From d8ffeed4767a42071ca075b23e3989069f91e4ab Mon Sep 17 00:00:00 2001 From: Stalker_Riddick Date: Fri, 25 Nov 2011 13:11:53 +0000 Subject: Core/Quests: Add new field RequiredClasses for quest_template Credits to NoFantasy. * SkillOrClass is converted to RequiredSkill (and then field can contain skill id only) * Field ZoneOrSort has no longer a function in quest requirement, and RequiredClasses must be used instead where class limits are expected. To restrict a quest to one class or more, use bitmask of class in RequiredClasses. RequiredSkill works like before. Signed-off-by: NoFantasy Signed-off-by: Stalker_Riddick --- src/server/game/Globals/ObjectMgr.cpp | 91 ++++++++++++++++------------------- 1 file changed, 41 insertions(+), 50 deletions(-) (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1047ff90174..c1af7bcfed4 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3691,41 +3691,41 @@ void ObjectMgr::LoadQuests() mExclusiveQuestGroups.clear(); - // 0 1 2 3 4 5 6 7 8 9 - QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClassMask, MinLevel, MaxLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue, " - // 10 11 12 13 14 15 16 17 18 19 + // 0 1 2 3 4 5 6 7 8 9 10 + QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, MinLevel, MaxLevel, QuestLevel, Type, RequiredClasses, RequiredRaces, RequiredSkill, RequiredSkillValue, " + // 11 12 13 14 15 16 17 18 19 20 "RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime, " - // 20 21 22 23 24 25 26 27 28 29 30 31 32 33 + // 21 22 23 24 25 26 27 28 29 30 31 32 33 34 "QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, RewardArenaPoints, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, RewXPId, SrcItemId, SrcItemCount, SrcSpell, " - // 34 35 36 37 38 39 40 41 42 43 44 + // 35 36 37 38 39 40 41 42 43 44 45 "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, " - // 45 46 47 48 49 50 51 52 53 54 55 56 + // 46 47 48 49 50 51 52 53 54 55 56 57 "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6, " - // 57 58 59 60 61 62 63 64 + // 58 59 60 61 62 63 64 65 "ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, " - // 65 66 67 68 69 70 71 72 + // 66 67 68 69 70 71 72 73 "ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4, " - // 73 74 75 76 + // 74 75 76 77 "ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, " - // 77 78 79 80 81 82 + // 78 79 80 81 82 83 "RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, " - // 83 84 85 86 87 88 + // 84 85 86 87 88 89 "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6, " - // 89 90 91 92 93 94 95 96 + // 90 91 92 93 94 95 96 97 "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4, " - // 97 98 99 100 101 102 103 104 105 106 + // 98 99 100 101 102 103 104 105 106 107 "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValueId1, RewRepValueId2, RewRepValueId3, RewRepValueId4, RewRepValueId5, " - // 107 108 109 110 111 + // 108 109 110 111 112 "RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5, " - // 112 113 114 115 116 117 118 119 120 121 122 123 + // 113 114 115 116 117 118 119 120 121 122 123 124 "RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt, " - // 124 125 126 127 128 129 130 131 + // 125 126 127 128 129 130 131 132 "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, " - // 132 133 134 135 136 137 + // 133 134 135 136 137 138 "IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, " - // 138 139 140 141 + // 139 140 141 142 "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, " - // 142 143 + // 143 144 "StartScript, CompleteScript" " FROM quest_template"); if (!result) @@ -3829,45 +3829,43 @@ void ObjectMgr::LoadQuests() qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } - //check SkillOrClass value (class case). - if (ClassByQuestSort(-int32(qinfo->ZoneOrSort))) - { - // SkillOrClass should not have class case when class case already set in ZoneOrSort. - if (qinfo->SkillOrClassMask < 0) - { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (class sort case) and `SkillOrClassMask` = %i (class case), redundant.", - qinfo->GetQuestId(), qinfo->ZoneOrSort, qinfo->SkillOrClassMask); - } - } - //check for proper SkillOrClass value (skill case) + //check for proper RequiredSkill value (skill case) if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) { - // skill is positive value in SkillOrClass - if (qinfo->SkillOrClassMask != skill_id) + if (qinfo->RequiredSkill != skill_id) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (skill sort case) but `SkillOrClassMask` does not have a corresponding value (%i).", + sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkill` does not have a corresponding value (%i).", qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } } } - // SkillOrClassMask (class case) - if (qinfo->SkillOrClassMask < 0) + // RequiredClasses, can be 0/CLASSMASK_ALL_PLAYABLE to allow any class + if (qinfo->RequiredClasses) { - if (!(-int32(qinfo->SkillOrClassMask) & CLASSMASK_ALL_PLAYABLE)) + if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Quest %u has `SkillOrClassMask` = %i (class case) but classmask does not have valid class", - qinfo->GetQuestId(), qinfo->SkillOrClassMask); + sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); + qinfo->RequiredClasses = 0; } } - // SkillOrClassMask (skill case) - if (qinfo->SkillOrClassMask > 0) + // RequiredRaces, can be 0/RACEMASK_ALL_PLAYABLE to allow any race + if (qinfo->RequiredRaces) + { + if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE)) + { + sLog->outErrorDb("Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces); + qinfo->RequiredRaces = 0; + } + } + // RequiredSkill, can be 0 + if (qinfo->RequiredSkill) { - if (!sSkillLineStore.LookupEntry(qinfo->SkillOrClassMask)) + if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkill)) { - sLog->outErrorDb("Quest %u has `SkillOrClass` = %u (skill case) but skill (%i) does not exist", - qinfo->GetQuestId(), qinfo->SkillOrClassMask, qinfo->SkillOrClassMask); + sLog->outErrorDb("Quest %u has `RequiredSkill` = %u but this skill does not exist", + qinfo->GetQuestId(), qinfo->RequiredSkill); } } @@ -3879,13 +3877,6 @@ void ObjectMgr::LoadQuests() qinfo->GetQuestId(), qinfo->RequiredSkillValue, sWorld->GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } - - if (qinfo->SkillOrClassMask <= 0) - { - sLog->outErrorDb("Quest %u has `RequiredSkillValue` = %u but `SkillOrClass` = %i (class case), value ignored.", - qinfo->GetQuestId(), qinfo->RequiredSkillValue, qinfo->SkillOrClassMask); - // no changes, quest can't be done for this requirement (fail at wrong skill id) - } } // else Skill quests can have 0 skill level, this is ok -- cgit v1.2.3 From ec54bb48952fb0f766c61976f736ad727f9aadd0 Mon Sep 17 00:00:00 2001 From: kaelima Date: Fri, 25 Nov 2011 18:54:59 +0100 Subject: Core/Misc: Clearing compile errors since UpdateFields were changed: - Completely remove ammo (Cataclysm change) - Revert some changes with power/maxpower and only store the 5 needed powers in db (the rest is useless) - Remove GuildId from corpse - Move PLAYER_GUILDID to character db (removed updatefield) Note: Compile is still not working as we need to change currency handling --- .../2011_11_25_03_characters_character_stats.sql | 7 + .../2011_11_25_03_characters_characters.sql | 9 + .../characters/2011_11_25_03_characters_corpse.sql | 1 + src/server/game/AI/EventAI/CreatureEventAI.cpp | 2 +- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 2 +- src/server/game/DataStores/DB2Stores.cpp | 2 +- src/server/game/Entities/Corpse/Corpse.cpp | 56 +++--- .../game/Entities/Object/Updates/UpdateFields.h | 12 -- src/server/game/Entities/Player/Player.cpp | 199 +++------------------ src/server/game/Entities/Player/Player.h | 29 ++- src/server/game/Entities/Unit/StatSystem.cpp | 10 -- src/server/game/Entities/Unit/Unit.cpp | 4 +- src/server/game/Globals/ObjectMgr.cpp | 2 +- src/server/game/Miscellaneous/SharedDefines.h | 2 + src/server/game/Spells/Auras/SpellAuraEffects.cpp | 10 +- src/server/game/Spells/Spell.cpp | 124 ------------- src/server/game/Spells/Spell.h | 3 +- src/server/game/Spells/SpellEffects.cpp | 2 +- src/server/game/World/World.cpp | 2 +- .../IcecrownCitadel/boss_lady_deathwhisper.cpp | 2 +- .../Database/Implementation/CharacterDatabase.cpp | 17 +- .../Database/Implementation/CharacterDatabase.h | 2 + 22 files changed, 116 insertions(+), 383 deletions(-) create mode 100644 sql/updates/characters/2011_11_25_03_characters_character_stats.sql create mode 100644 sql/updates/characters/2011_11_25_03_characters_characters.sql create mode 100644 sql/updates/characters/2011_11_25_03_characters_corpse.sql (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/sql/updates/characters/2011_11_25_03_characters_character_stats.sql b/sql/updates/characters/2011_11_25_03_characters_character_stats.sql new file mode 100644 index 00000000000..5f41b6e40db --- /dev/null +++ b/sql/updates/characters/2011_11_25_03_characters_character_stats.sql @@ -0,0 +1,7 @@ +ALTER TABLE `character_stats` +DROP COLUMN `maxpower6`, +DROP COLUMN `maxpower7`, +DROP COLUMN `maxpower8`, +DROP COLUMN `maxpower9`, +DROP COLUMN `maxpower10`, +DROP COLUMN `maxpower11`; diff --git a/sql/updates/characters/2011_11_25_03_characters_characters.sql b/sql/updates/characters/2011_11_25_03_characters_characters.sql new file mode 100644 index 00000000000..cede344b6bf --- /dev/null +++ b/sql/updates/characters/2011_11_25_03_characters_characters.sql @@ -0,0 +1,9 @@ +ALTER TABLE `characters` +DROP COLUMN `power6`, +DROP COLUMN `power7`, +DROP COLUMN `power8`, +DROP COLUMN `power9`, +DROP COLUMN `power10`, +DROP COLUMN `power11`, +DROP COLUMN `ammoId`, +ADD COLUMN `guildId` int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `grantableLevels`; diff --git a/sql/updates/characters/2011_11_25_03_characters_corpse.sql b/sql/updates/characters/2011_11_25_03_characters_corpse.sql new file mode 100644 index 00000000000..e1823602b65 --- /dev/null +++ b/sql/updates/characters/2011_11_25_03_characters_corpse.sql @@ -0,0 +1 @@ +ALTER TABLE `corpse` DROP COLUMN `guildId`; diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index be0dd8c3679..08f8d7a3d77 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1312,7 +1312,7 @@ bool CreatureEventAI::CanCast(Unit* target, SpellInfo const* spell, bool trigger return false; //Check for power - if (!triggered && me->GetPower((Powers)spell->PowerType) < spell->CalcPowerCost(me, spell->GetSchoolMask())) + if (!triggered && (uint32)me->GetPower((Powers)spell->PowerType) < spell->CalcPowerCost(me, spell->GetSchoolMask())) return false; //Unit is out of range of this spell diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 953bbf7521a..e9a9c1fdcf2 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -237,7 +237,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec continue; //Continue if we don't have the mana to actually cast this spell - if (tempSpell->ManaCost > me->GetPower(Powers(tempSpell->PowerType))) + if (tempSpell->ManaCost > (uint32)me->GetPower(Powers(tempSpell->PowerType))) continue; //Check if the spell meets our range requirements diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 7919a3fba16..77d16501415 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -87,7 +87,7 @@ void LoadDB2Stores(const std::string& dataPath) LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2"); LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2"); - LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2"); // error checks if (bad_db2_files.size() >= DB2FilesCount) { diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 31cc21659c9..ff8c93ec404 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -106,25 +106,25 @@ void Corpse::SaveToDB() SQLTransaction trans = CharacterDatabase.BeginTransaction(); DeleteFromDB(trans); + uint16 index = 0; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CORPSE); - stmt->setUInt32(0, GetGUIDLow()); // corpseGuid - stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid - stmt->setFloat (2, GetPositionX()); // posX - stmt->setFloat (3, GetPositionY()); // posY - stmt->setFloat (4, GetPositionZ()); // posZ - stmt->setFloat (5, GetOrientation()); // orientation - stmt->setUInt16(6, GetMapId()); // mapId - stmt->setUInt32(7, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId - stmt->setString(8, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache - stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1 - stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2 - stmt->setUInt32(11, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId - stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags - stmt->setUInt8 (13, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags - stmt->setUInt32(14, uint32(m_time)); // time - stmt->setUInt8 (15, GetType()); // corpseType - stmt->setUInt32(16, GetInstanceId()); // instanceId - stmt->setUInt16(17, GetPhaseMask()); // phaseMask + stmt->setUInt32(index, GetGUIDLow()); // corpseGuid + stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid + stmt->setFloat (index++, GetPositionX()); // posX + stmt->setFloat (index++, GetPositionY()); // posY + stmt->setFloat (index++, GetPositionZ()); // posZ + stmt->setFloat (index++, GetOrientation()); // orientation + stmt->setUInt16(index++, GetMapId()); // mapId + stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId + stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache + stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1 + stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2 + stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags + stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags + stmt->setUInt32(index++, uint32(m_time)); // time + stmt->setUInt8 (index++, GetType()); // corpseType + stmt->setUInt32(index++, GetInstanceId()); // instanceId + stmt->setUInt16(index++, GetPhaseMask()); // phaseMask trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); @@ -164,10 +164,11 @@ void Corpse::DeleteFromDB(SQLTransaction& trans) bool Corpse::LoadFromDB(uint32 guid, Field* fields) { - uint32 ownerGuid = fields[17].GetUInt32(); - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0 - m_type = CorpseType(fields[13].GetUInt8()); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 + // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0 + + uint32 ownerGuid = fields[16].GetUInt32(); + m_type = CorpseType(fields[12].GetUInt8()); if (m_type >= MAX_CORPSE_TYPE) { sLog->outError("Corpse (guid: %u, owner: %u) have wrong corpse type (%u), not loading.", guid, ownerGuid, m_type); @@ -188,15 +189,14 @@ bool Corpse::LoadFromDB(uint32 guid, Field* fields) _LoadIntoDataField(fields[6].GetCString(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END); SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].GetUInt32()); SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].GetUInt32()); - SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32()); - SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].GetUInt8()); - SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].GetUInt8()); + SetUInt32Value(CORPSE_FIELD_FLAGS, fields[9].GetUInt8()); + SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[10].GetUInt8()); SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(ownerGuid, 0, HIGHGUID_PLAYER)); - m_time = time_t(fields[12].GetUInt32()); + m_time = time_t(fields[11].GetUInt32()); - uint32 instanceId = fields[14].GetUInt32(); - uint32 phaseMask = fields[15].GetUInt16(); + uint32 instanceId = fields[13].GetUInt32(); + uint32 phaseMask = fields[14].GetUInt16(); // place SetLocationInstanceId(instanceId); diff --git a/src/server/game/Entities/Object/Updates/UpdateFields.h b/src/server/game/Entities/Object/Updates/UpdateFields.h index 03e83496297..ce063f4f2f1 100755 --- a/src/server/game/Entities/Object/Updates/UpdateFields.h +++ b/src/server/game/Entities/Object/Updates/UpdateFields.h @@ -105,24 +105,12 @@ enum EUnitFields UNIT_FIELD_POWER3 = OBJECT_END + 0x0015, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER4 = OBJECT_END + 0x0016, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER5 = OBJECT_END + 0x0017, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_POWER6 = OBJECT_END + 0x0018, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_POWER7 = OBJECT_END + 0x0019, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_POWER8 = OBJECT_END + 0x001A, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_POWER9 = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_POWER10 = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_POWER11 = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXHEALTH = OBJECT_END + 0x0018, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER1 = OBJECT_END + 0x0019, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER2 = OBJECT_END + 0x001A, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER3 = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER4 = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_MAXPOWER5 = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_MAXPOWER6 = OBJECT_END + 0x0024, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_MAXPOWER7 = OBJECT_END + 0x0025, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_MAXPOWER8 = OBJECT_END + 0x0026, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_MAXPOWER9 = OBJECT_END + 0x0027, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_MAXPOWER10 = OBJECT_END + 0x0028, // Size: 1, Type: INT, Flags: PUBLIC - UNIT_FIELD_MAXPOWER11 = OBJECT_END + 0x0029, // Size: 1, Type: INT, Flags: PUBLIC UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER = OBJECT_END + 0x001E, // Size: 5, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_MEMBER UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER = OBJECT_END + 0x0023, // Size: 5, Type: FLOAT, Flags: PRIVATE, OWNER, PARTY_MEMBER UNIT_FIELD_LEVEL = OBJECT_END + 0x0028, // Size: 1, Type: INT, Flags: PUBLIC diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f3dc392f569..b75f3f07d55 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -787,6 +787,8 @@ Player::Player (WorldSession* session): Unit(), m_achievementMgr(this), m_reputa m_activeSpec = 0; m_specsCount = 1; + m_freeTalentPoints = 0; + for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i) { for (uint8 g = 0; g < MAX_GLYPH_SLOT_INDEX; ++g) @@ -978,7 +980,6 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) SetByteValue(PLAYER_BYTES_3, 0, createInfo->Gender); SetByteValue(PLAYER_BYTES_3, 3, 0); // BattlefieldArenaFaction (0 or 1) - SetUInt32Value(PLAYER_GUILDID, 0); SetUInt32Value(PLAYER_GUILDRANK, 0); SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0); @@ -1165,7 +1166,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) RemoveItem(INVENTORY_SLOT_BAG_0, i, true); EquipItem(eDest, pItem, true); } - // move other items to more appropriate slots (ammo not equipped in special bag) + // move other items to more appropriate slots else { ItemPosCountVec sDest; @@ -1175,11 +1176,6 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) RemoveItem(INVENTORY_SLOT_BAG_0, i, true); pItem = StoreItem(sDest, pItem, true); } - - // if this is ammo then use it - msg = CanUseAmmo(pItem->GetEntry()); - if (msg == EQUIP_ERR_OK) - SetAmmo(pItem->GetEntry()); } } } @@ -3111,7 +3107,7 @@ void Player::GiveLevel(uint8 level) SetFullHealth(); SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); - if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE)) + if ((uint32)GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE)) SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE)); SetPower(POWER_FOCUS, 0); @@ -3250,10 +3246,8 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, 0.0f); SetInt32Value(UNIT_FIELD_ATTACK_POWER, 0); - SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, 0); SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, 0.0f); SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER, 0); - SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS, 0); SetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, 0.0f); // Base crit values (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset @@ -3334,7 +3328,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFullHealth(); SetPower(POWER_MANA, GetMaxPower(POWER_MANA)); SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); - if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE)) + if ((uint32)GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE)) SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE)); SetPower(POWER_FOCUS, GetMaxPower(POWER_FOCUS)); SetPower(POWER_RUNIC_POWER, 0); @@ -4502,12 +4496,6 @@ bool Player::resetTalents(bool no_cost) return true; } -void Player::SetFreeTalentPoints(uint32 points) -{ - sScriptMgr->OnPlayerFreeTalentPointsChanged(this, points); - SetUInt32Value(PLAYER_CHARACTER_POINTS1, points); -} - Mail* Player::GetMail(uint32 id) { for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) @@ -4565,16 +4553,12 @@ void Player::InitVisibleBits() updateVisualBits.SetBit(UNIT_FIELD_POWER3); updateVisualBits.SetBit(UNIT_FIELD_POWER4); updateVisualBits.SetBit(UNIT_FIELD_POWER5); - updateVisualBits.SetBit(UNIT_FIELD_POWER6); - updateVisualBits.SetBit(UNIT_FIELD_POWER7); updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH); updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1); updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2); updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER3); updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER4); updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6); - updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7); updateVisualBits.SetBit(UNIT_FIELD_LEVEL); updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE); updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0); @@ -4603,7 +4587,6 @@ void Player::InitVisibleBits() updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 0); updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 1); updateVisualBits.SetBit(PLAYER_FLAGS); - updateVisualBits.SetBit(PLAYER_GUILDID); updateVisualBits.SetBit(PLAYER_GUILDRANK); updateVisualBits.SetBit(PLAYER_BYTES); updateVisualBits.SetBit(PLAYER_BYTES_2); @@ -5290,12 +5273,10 @@ void Player::CreateCorpse() flags |= CORPSE_FLAG_HIDE_CLOAK; if (InBattleground() && !InArena()) flags |= CORPSE_FLAG_LOOTABLE; // to be able to remove insignia - corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags); + corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags); corpse->SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, GetNativeDisplayId()); - corpse->SetUInt32Value(CORPSE_FIELD_GUILD, GetGuildId()); - uint32 iDisplayID; uint32 iIventoryType; uint32 _cfi; @@ -7856,10 +7837,6 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) _ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), apply); _ApplyItemBonuses(proto, slot, apply); - - if (slot == EQUIPMENT_SLOT_RANGED) - _ApplyAmmoBonuses(); - ApplyItemEquipSpell(item, apply); ApplyEnchantment(item, apply); @@ -8649,9 +8626,6 @@ void Player::_RemoveAllItemMods() _ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), false); _ApplyItemBonuses(proto, i, false); - - if (i == EQUIPMENT_SLOT_RANGED) - _ApplyAmmoBonuses(); } } @@ -8678,9 +8652,6 @@ void Player::_ApplyAllItemMods() _ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), true); _ApplyItemBonuses(proto, i, true); - - if (i == EQUIPMENT_SLOT_RANGED) - _ApplyAmmoBonuses(); } } @@ -8725,63 +8696,6 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply) } } -void Player::_ApplyAmmoBonuses() -{ - // check ammo - uint32 ammo_id = GetUInt32Value(PLAYER_AMMO_ID); - if (!ammo_id) - return; - - float currentAmmoDPS; - - ItemTemplate const* ammo_proto = sObjectMgr->GetItemTemplate(ammo_id); - if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto)) - currentAmmoDPS = 0.0f; - else - currentAmmoDPS = (ammo_proto->Damage[0].DamageMin + ammo_proto->Damage[0].DamageMax) / 2; - - if (currentAmmoDPS == GetAmmoDPS()) - return; - - m_ammoDPS = currentAmmoDPS; - - if (CanModifyStats()) - UpdateDamagePhysical(RANGED_ATTACK); -} - -bool Player::CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const -{ - if (!ammo_proto) - return false; - - // check ranged weapon - Item* weapon = GetWeaponForAttack(RANGED_ATTACK); - if (!weapon || weapon->IsBroken()) - return false; - - ItemTemplate const* weapon_proto = weapon->GetTemplate(); - if (!weapon_proto || weapon_proto->Class != ITEM_CLASS_WEAPON) - return false; - - // check ammo ws. weapon compatibility - switch (weapon_proto->SubClass) - { - case ITEM_SUBCLASS_WEAPON_BOW: - case ITEM_SUBCLASS_WEAPON_CROSSBOW: - if (ammo_proto->SubClass != ITEM_SUBCLASS_ARROW) - return false; - break; - case ITEM_SUBCLASS_WEAPON_GUN: - if (ammo_proto->SubClass != ITEM_SUBCLASS_BULLET) - return false; - break; - default: - return false; - } - - return true; -} - /* If in a battleground a player dies, and an enemy removes the insignia, the player's bones is lootable Called by remove insignia spell effect */ void Player::RemovedInsignia(Player* looterPlr) @@ -11999,71 +11913,6 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const return EQUIP_ERR_ITEM_NOT_FOUND; } -InventoryResult Player::CanUseAmmo(uint32 item) const -{ - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item); - if (!isAlive()) - return EQUIP_ERR_YOU_ARE_DEAD; - //if (isStunned()) - // return EQUIP_ERR_YOU_ARE_STUNNED; - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); - if (pProto) - { - if (pProto->InventoryType!= INVTYPE_AMMO) - return EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE; - - InventoryResult res = CanUseItem(pProto); - if (res != EQUIP_ERR_OK) - return res; - - /*if (GetReputationMgr().GetReputation() < pProto->RequiredReputation) - return EQUIP_ERR_CANT_EQUIP_REPUTATION; - */ - - // Requires No Ammo - if (HasAura(46699)) - return EQUIP_ERR_BAG_FULL6; - - return EQUIP_ERR_OK; - } - return EQUIP_ERR_ITEM_NOT_FOUND; -} - -void Player::SetAmmo(uint32 item) -{ - if (!item) - return; - - // already set - if (GetUInt32Value(PLAYER_AMMO_ID) == item) - return; - - // check ammo - if (item) - { - InventoryResult msg = CanUseAmmo(item); - if (msg != EQUIP_ERR_OK) - { - SendEquipError(msg, NULL, NULL, item); - return; - } - } - - SetUInt32Value(PLAYER_AMMO_ID, item); - - _ApplyAmmoBonuses(); -} - -void Player::RemoveAmmo() -{ - SetUInt32Value(PLAYER_AMMO_ID, 0); - - m_ammoDPS = 0.0f; - - if (CanModifyStats()) - UpdateDamagePhysical(RANGED_ATTACK); -} - Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId) { AllowedLooterSet allowedLooters; @@ -16645,10 +16494,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) //"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, " // 39 40 41 42 43 44 45 46 47 48 49 //"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, " - // 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 - //"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, power11, instance_id, speccount, activespec, exploredZones, equipmentCache, " - // 67 68 69 70 - //"ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid); + // 50 51 52 53 54 55 56 57 58 59 60 + //"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, " + // 61 62 63 64 + //"knownTitles, actionBars, grantableLevels, guildId FROM characters WHERE guid = '%u'", guid); PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADFROM); if (!result) @@ -16707,8 +16556,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8()); SetUInt32Value(PLAYER_XP, fields[7].GetUInt32()); - _LoadIntoDataField(fields[65].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE); - _LoadIntoDataField(fields[68].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2); + _LoadIntoDataField(fields[59].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE); + _LoadIntoDataField(fields[61].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2); SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f); @@ -16730,10 +16579,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64()); - SetUInt32Value(PLAYER_AMMO_ID, fields[67].GetUInt32()); - // set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise) - SetByteValue(PLAYER_FIELD_BYTES, 2, fields[69].GetUInt8()); + SetByteValue(PLAYER_FIELD_BYTES, 2, fields[62].GetUInt8()); InitDisplayIds(); @@ -16764,7 +16611,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint32 transGUID = uint32(fields[30].GetUInt64()); // field type is uint64 but lowguid is saved Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat()); uint32 mapId = fields[15].GetUInt16(); - uint32 instanceId = fields[62].GetUInt8(); + uint32 instanceId = fields[56].GetUInt8(); uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F; if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY) @@ -17126,8 +16973,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) //mails are loaded only when needed ;-) - when player in game click on mailbox. //_LoadMail(); - m_specsCount = fields[63].GetUInt8(); - m_activeSpec = fields[64].GetUInt8(); + m_specsCount = fields[57].GetUInt8(); + m_activeSpec = fields[58].GetUInt8(); // sanity check if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS) @@ -17199,7 +17046,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // restore remembered power/health values (but not more max values) uint32 savedHealth = fields[50].GetUInt32(); SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth); - for (uint8 i = 0; i < MAX_POWERS; ++i) + for (uint8 i = 0; i < MAX_STORED_POWERS; ++i) { uint32 savedPower = fields[51+i].GetUInt32(); SetPower(Powers(i), savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower); @@ -17257,7 +17104,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } // RaF stuff. - m_grantableLevels = fields[70].GetUInt32(); + m_grantableLevels = fields[63].GetUInt32(); if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0)) SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND); @@ -18524,7 +18371,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); stmt->setUInt32(index++, GetHealth()); - for (uint32 i = 0; i < MAX_POWERS; ++i) + for (uint32 i = 0; i < MAX_STORED_POWERS; ++i) stmt->setUInt32(index++, GetPower(Powers(i))); stmt->setUInt32(index++, GetSession()->GetLatency()); @@ -18555,7 +18402,6 @@ void Player::SaveToDB(bool create /*=false*/) } stmt->setString(index++, ss.str()); - stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID)); ss.str().clear(); for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i) @@ -18637,7 +18483,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE)); stmt->setUInt32(index++, GetHealth()); - for (uint32 i = 0; i < MAX_POWERS; ++i) + for (uint32 i = 0; i < MAX_STORED_POWERS; ++i) stmt->setUInt32(index++, GetPower(Powers(i))); stmt->setUInt32(index++, GetSession()->GetLatency()); @@ -18668,7 +18514,6 @@ void Player::SaveToDB(bool create /*=false*/) } stmt->setString(index++, ss.str()); - stmt->setUInt32(index++, GetUInt32Value(PLAYER_AMMO_ID)); ss.str().clear(); for (uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i) @@ -19142,12 +18987,12 @@ void Player::_SaveStats(SQLTransaction& trans) trans->PAppend("DELETE FROM character_stats WHERE guid = '%u'", GetGUIDLow()); std::ostringstream ss; - ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, maxpower10, maxpower11, " + ss << "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, " "strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, " "blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower, resilience) VALUES (" << GetGUIDLow() << ',' << GetMaxHealth() << ','; - for (uint8 i = 0; i < MAX_POWERS; ++i) + for (uint8 i = 0; i < MAX_STORED_POWERS; ++i) ss << GetMaxPower(Powers(i)) << ','; for (uint8 i = 0; i < MAX_STATS; ++i) ss << GetStat(Stats(i)) << ','; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index abbbe31b3ff..b2457a87e82 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1689,8 +1689,8 @@ class Player : public Unit, public GridObject void SetReputation(uint32 factionentry, uint32 value); uint32 GetReputation(uint32 factionentry); std::string GetGuildName(); - uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); } - void SetFreeTalentPoints(uint32 points); + uint32 GetFreeTalentPoints() const { return m_freeTalentPoints; } + void SetFreeTalentPoints(uint32 points) { m_freeTalentPoints = points; } bool resetTalents(bool no_cost = false); uint32 resetTalentsCost() const; void InitTalentForLevel(); @@ -1723,8 +1723,8 @@ class Player : public Unit, public GridObject } uint32 GetGlyph(uint8 slot) { return m_Glyphs[m_activeSpec][slot]; } - uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); } - void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); } + uint32 GetFreePrimaryProfessionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS); } + void SetFreePrimaryProfessions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS, profs); } void InitPrimaryProfessions(); PlayerSpellMap const& GetSpellMap() const { return m_spells; } @@ -1844,11 +1844,24 @@ class Player : public Unit, public GridObject void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); } void SendUpdateToOutOfRangeGroupMembers(); - void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); } + void SetInGuild(uint32 GuildId) + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_GUILD_ID); + stmt->setUInt32(0, GuildId); + stmt->setUInt64(1, GetGUID()); + CharacterDatabase.Execute(stmt); + } + + uint32 GetGuildId() + { + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_GUILD_ID); + stmt->setUInt64(0, GetGUIDLow()); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + return result ? (*result)[0].GetUInt32() : 0; + } void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); } uint8 GetRank() { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } - uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); } static uint32 GetGuildIdFromDB(uint64 guid); static uint8 GetRankFromDB(uint64 guid); int GetGuildIdInvited() { return m_GuildIdInvited; } @@ -2075,6 +2088,7 @@ class Player : public Unit, public GridObject /*********************************************************/ /*** PVP SYSTEM ***/ /*********************************************************/ + // TODO: Properly implement correncies as of Cataclysm void UpdateHonorFields(); bool RewardHonor(Unit* pVictim, uint32 groupsize, int32 honor = -1, bool pvptoken = false); uint32 GetHonorPoints() const { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); } @@ -2128,7 +2142,6 @@ class Player : public Unit, public GridObject void _ApplyAllLevelScaleItemMods(bool apply); void _ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply, bool only_level_scale = false); void _ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply); - void _ApplyAmmoBonuses(); bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot); void ToggleMetaGemsActive(uint8 exceptslot, bool apply); void CorrectMetaGemEnchants(uint8 slot, bool apply); @@ -2705,6 +2718,8 @@ class Player : public Unit, public GridObject uint8 m_activeSpec; uint8 m_specsCount; + uint32 m_freeTalentPoints; + uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX]; ActionButtonList m_actionButtons; diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 459379ac11a..aa5d783323a 100755 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -287,13 +287,11 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER; uint16 index = UNIT_FIELD_ATTACK_POWER; - uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS; uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER; if (ranged) { index = UNIT_FIELD_RANGED_ATTACK_POWER; - index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS; index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER; switch (getClass()) @@ -437,10 +435,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) } float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f; - SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field - SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field - SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field Pet* pet = GetPet(); //update pet's AP //automatically update weapon damage after attack power modification @@ -968,13 +963,11 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged) UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER; uint16 index = UNIT_FIELD_ATTACK_POWER; - uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS; uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER; if (ranged) { index = UNIT_FIELD_RANGED_ATTACK_POWER; - index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS; index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER; } @@ -983,7 +976,6 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged) float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f; SetInt32Value(index, (uint32)base_attPower); //UNIT_FIELD_(RANGED)_ATTACK_POWER field - SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field //automatically update weapon damage after attack power modification @@ -1336,8 +1328,6 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) //UNIT_FIELD_(RANGED)_ATTACK_POWER field SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower); - //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field - SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 00471c420ce..545ba676091 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13524,14 +13524,14 @@ float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const { if (attType == RANGED_ATTACK) { - int32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS); + int32 ap = GetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER); if (ap < 0) return 0.0f; return ap * (1.0f + GetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER)); } else { - int32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER) + GetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS); + int32 ap = GetInt32Value(UNIT_FIELD_ATTACK_POWER); if (ap < 0) return 0.0f; return ap * (1.0f + GetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER)); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 93f58003f6d..f2553b3ace5 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2184,7 +2184,7 @@ void ObjectMgr::LoadItemTemplates() } itemTemplate.ScalingStatDistribution = uint32(fields[48].GetUInt16()); - itemTemplate.ScalingStatValue = fields[49].GetInt32(); + //itemTemplate.ScalingStatValue = fields[49].GetInt32(); for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) { diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 9bca1c15423..197c12ac519 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -186,6 +186,8 @@ enum Powers POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value) }; +#define MAX_STORED_POWERS 5 + enum SpellSchools { SPELL_SCHOOL_NORMAL = 0, diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b7cc673962c..20ee5ce39e4 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1984,7 +1984,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo case FORM_DIREBEAR: { // get furor proc chance - uint32 FurorChance = 0; + int32 FurorChance = 0; if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0)) FurorChance = std::max(dummy->GetAmount(), 0); @@ -2003,7 +2003,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo target->CastSpell(target, 17057, true); default: { - uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance); + int32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance); target->SetPower(POWER_ENERGY, newEnergy); } break; @@ -2056,7 +2056,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo case FORM_DEFENSIVESTANCE: case FORM_BERSERKERSTANCE: { - uint32 Rage_val = 0; + int32 Rage_val = 0; // Defensive Tactics if (form == FORM_DEFENSIVESTANCE) { @@ -4757,10 +4757,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool target->GetMotionMaster()->MoveFall(currentGroundLevel); } break; - case 46699: // Requires No Ammo - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use - break; case 49028: if (caster) if (AuraEffect* aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 4003f2f3b36..c1749867945 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3738,8 +3738,6 @@ void Spell::SendSpellStart() if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) castFlags |= CAST_FLAG_PENDING; - if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO) - castFlags |= CAST_FLAG_AMMO; if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) && m_spellInfo->PowerType != POWER_HEALTH) @@ -3765,9 +3763,6 @@ void Spell::SendSpellStart() if (castFlags & CAST_FLAG_POWER_LEFT_SELF) data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType)); - if (castFlags & CAST_FLAG_AMMO) - WriteAmmoToPacket(&data); - if (castFlags & CAST_FLAG_UNKNOWN_23) { data << uint32(0); @@ -3791,8 +3786,6 @@ void Spell::SendSpellGo() if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) castFlags |= CAST_FLAG_PENDING; - if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO) - castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) && m_spellInfo->PowerType != POWER_HEALTH) @@ -3863,9 +3856,6 @@ void Spell::SendSpellGo() data << uint32(0); } - if (castFlags & CAST_FLAG_AMMO) - WriteAmmoToPacket(&data); - if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk { data << uint32(0); @@ -3880,78 +3870,6 @@ void Spell::SendSpellGo() m_caster->SendMessageToSet(&data, true); } -void Spell::WriteAmmoToPacket(WorldPacket* data) -{ - uint32 ammoInventoryType = 0; - uint32 ammoDisplayID = 0; - - if (m_caster->GetTypeId() == TYPEID_PLAYER) - { - Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); - if (pItem) - { - ammoInventoryType = pItem->GetTemplate()->InventoryType; - if (ammoInventoryType == INVTYPE_THROWN) - ammoDisplayID = pItem->GetTemplate()->DisplayInfoID; - else - { - uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID); - if (ammoID) - { - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ammoID); - if (pProto) - { - ammoDisplayID = pProto->DisplayInfoID; - ammoInventoryType = pProto->InventoryType; - } - } - else if (m_caster->HasAura(46699)) // Requires No Ammo - { - ammoDisplayID = 5996; // normal arrow - ammoInventoryType = INVTYPE_AMMO; - } - } - } - } - else - { - for (uint8 i = 0; i < 3; ++i) - { - if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i)) - { - if (ItemEntry const* itemEntry = sItemStore.LookupEntry(item_id)) - { - if (itemEntry->Class == ITEM_CLASS_WEAPON) - { - switch (itemEntry->SubClass) - { - case ITEM_SUBCLASS_WEAPON_THROWN: - ammoDisplayID = itemEntry->DisplayId; - ammoInventoryType = itemEntry->InventoryType; - break; - case ITEM_SUBCLASS_WEAPON_BOW: - case ITEM_SUBCLASS_WEAPON_CROSSBOW: - ammoDisplayID = 5996; // is this need fixing? - ammoInventoryType = INVTYPE_AMMO; - break; - case ITEM_SUBCLASS_WEAPON_GUN: - ammoDisplayID = 5998; // is this need fixing? - ammoInventoryType = INVTYPE_AMMO; - break; - } - - if (ammoDisplayID) - break; - } - } - } - } - } - - *data << uint32(ammoDisplayID); - *data << uint32(ammoInventoryType); -} - void Spell::WriteSpellGoTargets(WorldPacket* data) { // This function also fill data for channeled spells: @@ -4319,8 +4237,6 @@ void Spell::TakeAmmo() m_caster->ToPlayer()->DestroyItemCount(pItem, count, true); } } - else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID)) - m_caster->ToPlayer()->DestroyItemCount(ammo, 1, true); } } @@ -6136,46 +6052,6 @@ SpellCastResult Spell::CheckItems() case ITEM_SUBCLASS_WEAPON_GUN: case ITEM_SUBCLASS_WEAPON_BOW: case ITEM_SUBCLASS_WEAPON_CROSSBOW: - { - uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID); - if (!ammo) - { - // Requires No Ammo - if (m_caster->HasAura(46699)) - break; // skip other checks - - return SPELL_FAILED_NO_AMMO; - } - - ItemTemplate const* ammoProto = sObjectMgr->GetItemTemplate(ammo); - if (!ammoProto) - return SPELL_FAILED_NO_AMMO; - - if (ammoProto->Class != ITEM_CLASS_PROJECTILE) - return SPELL_FAILED_NO_AMMO; - - // check ammo ws. weapon compatibility - switch (pItem->GetTemplate()->SubClass) - { - case ITEM_SUBCLASS_WEAPON_BOW: - case ITEM_SUBCLASS_WEAPON_CROSSBOW: - if (ammoProto->SubClass != ITEM_SUBCLASS_ARROW) - return SPELL_FAILED_NO_AMMO; - break; - case ITEM_SUBCLASS_WEAPON_GUN: - if (ammoProto->SubClass != ITEM_SUBCLASS_BULLET) - return SPELL_FAILED_NO_AMMO; - break; - default: - return SPELL_FAILED_NO_AMMO; - } - - if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) - { - m_caster->ToPlayer()->SetUInt32Value(PLAYER_AMMO_ID, 0); - return SPELL_FAILED_NO_AMMO; - } - }; break; case ITEM_SUBCLASS_WEAPON_WAND: break; default: diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 624c3b9b9b3..02f415e88c3 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -43,7 +43,7 @@ enum SpellCastFlags CAST_FLAG_UNKNOWN_3 = 0x00000004, CAST_FLAG_UNKNOWN_4 = 0x00000008, // ignore AOE visual CAST_FLAG_UNKNOWN_5 = 0x00000010, - CAST_FLAG_AMMO = 0x00000020, // Projectiles visual + CAST_FLAG_UNKNOWN_6 = 0x00000020, CAST_FLAG_UNKNOWN_7 = 0x00000040, CAST_FLAG_UNKNOWN_8 = 0x00000080, CAST_FLAG_UNKNOWN_9 = 0x00000100, @@ -402,7 +402,6 @@ class Spell void DoCreateItem(uint32 i, uint32 itemtype); void WriteSpellGoTargets(WorldPacket* data); - void WriteAmmoToPacket(WorldPacket* data); void InitExplicitTargets(SpellCastTargets const& targets); void SelectSpellTargets(); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 8cb001ed0ac..a3ff66f7b5b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -7344,7 +7344,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex) if (!(spellInfo->AttributesEx7 & SPELL_ATTR7_SUMMON_PLAYER_TOTEM)) continue; - uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask()); + int32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask()); if (m_caster->GetPower(POWER_MANA) < cost) continue; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 9a5a8d6f5fe..e4ee17e324d 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1258,7 +1258,7 @@ void World::SetInitialWorldSettings() ///- Load the DBC files sLog->outString("Initialize data stores..."); LoadDBCStores(m_dataPath); - LoadDB2Stores(m_dataPath); + LoadDB2Stores(m_dataPath); DetectDBCLang(); sLog->outString("Loading spell dbc data corrections..."); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index ae6f3feb57f..fe307932988 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -357,7 +357,7 @@ class boss_lady_deathwhisper : public CreatureScript void DamageTaken(Unit* /*damageDealer*/, uint32& damage) { // phase transition - if (events.GetPhaseMask() & PHASE_ONE_MASK && damage > me->GetPower(POWER_MANA)) + if (events.GetPhaseMask() & PHASE_ONE_MASK && damage > (uint32)me->GetPower(POWER_MANA)) { Talk(SAY_PHASE_2); Talk(EMOTE_PHASE_2); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 94b4ca16d7f..536db9dcd30 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -42,7 +42,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() "position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, " "resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, " "arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, " - "health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, power11, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = ?", CONNECTION_ASYNC) + "health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, guildId FROM characters WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_GROUP, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_BOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_AURAS, "SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, " @@ -116,6 +116,9 @@ void CharacterDatabaseConnection::DoPrepareStatements() // 0: uint32, 1: string, 2: uint32, 3: string, 4: string, 5: uint64, 6-10: uint32, 11: uint64 PREPARE_STATEMENT(CHAR_ADD_GUILD, "INSERT INTO guild (guildid, name, leaderguid, info, motd, createdate, EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, BankMoney) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_GUILD, "DELETE FROM guild WHERE guildid = ?", CONNECTION_ASYNC) // 0: uint32 + // 0: uint32 + PREPARE_STATEMENT(CHAR_SET_GUILD_ID, "UPDATE characters SET guildId = ? WHERE guid = ?", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_GET_GUILD_ID, "SELECT guildId FROM characters WHERE guid = ?", CONNECTION_SYNCH) // 0: uint32, 1: uint32, 2: uint8, 4: string, 5: string PREPARE_STATEMENT(CHAR_ADD_GUILD_MEMBER, "INSERT INTO guild_member (guildid, guid, rank, pnote, offnote) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_GUILD_MEMBER, "DELETE FROM guild_member WHERE guid = ?", CONNECTION_ASYNC) // 0: uint32 @@ -262,8 +265,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(CHAR_DEL_PLAYER_HOMEBIND, "DELETE FROM character_homebind WHERE guid = ?", CONNECTION_ASYNC) // Corpse - PREPARE_STATEMENT(CHAR_LOAD_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_ADD_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_LOAD_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH) + PREPARE_STATEMENT(CHAR_ADD_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC) @@ -308,12 +311,12 @@ void CharacterDatabaseConnection::DoPrepareStatements() "extra_flags, stable_slots, at_login, zone, " "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, " "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, " - "power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels) VALUES " - "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); + "power4, power5, latency, speccount, activespec, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, guildId) VALUES " + "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); PREPARE_STATEMENT(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?," "map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?," "logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?," "arenaPoints=?,totalHonorPoints=?,todayHonorPoints=?,yesterdayHonorPoints=?,totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,knownCurrencies=?," - "watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,power7=?,latency=?,speccount=?,activespec=?,exploredZones=?," - "equipmentCache=?,ammoId=?,knownTitles=?,actionBars=?,grantableLevels=?,online=? WHERE guid=?", CONNECTION_ASYNC); + "watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,latency=?,speccount=?,activespec=?,exploredZones=?," + "equipmentCache=?,knownTitles=?,actionBars=?,grantableLevels=?,guildId=?,online=? WHERE guid=?", CONNECTION_ASYNC); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index f06a17aa924..c84ea5544fa 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -123,6 +123,8 @@ enum CharacterDatabaseStatements CHAR_ADD_GUILD, CHAR_DEL_GUILD, + CHAR_SET_GUILD_ID, + CHAR_GET_GUILD_ID, CHAR_ADD_GUILD_MEMBER, CHAR_DEL_GUILD_MEMBER, CHAR_DEL_GUILD_MEMBERS, -- cgit v1.2.3 From e8c3a3ac9c032cf56ec11620ba7dd33efed487c5 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 25 Nov 2011 23:24:40 +0100 Subject: Core/Items * Updated ItemTemplate structure to 4.x * Calculate armor, damage and disenchant loot from dbc files TODO: Use dbc disenchant ids in disenchant_loot_template --- .../2011_11_25_02_world_item_script_names.sql | 17 + .../world/2011_11_25_02_world_item_template.sql | 48 + .../2011_11_25_02_world_item_template_addon.sql | 38 + src/server/game/DataStores/DBCStores.cpp | 22 +- src/server/game/DataStores/DBCStores.h | 1 + src/server/game/DataStores/DBCStructure.h | 14 +- src/server/game/DataStores/DBCfmt.h | 1 + src/server/game/Entities/Item/ItemPrototype.h | 54 +- src/server/game/Entities/Player/Player.cpp | 55 +- src/server/game/Entities/Player/Player.h | 4 +- src/server/game/Entities/Unit/Unit.cpp | 4 +- src/server/game/Globals/ObjectMgr.cpp | 971 +++++++++------------ src/server/game/Globals/ObjectMgr.h | 3 +- src/server/game/Guilds/GuildMgr.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 21 +- .../game/Server/Protocol/Handlers/ItemHandler.cpp | 294 +++---- src/server/game/Server/Protocol/Opcodes.cpp | 8 +- src/server/game/Server/WorldSession.h | 4 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/Spell.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 4 +- src/server/game/World/World.cpp | 14 +- .../Database/Implementation/CharacterDatabase.cpp | 2 +- src/server/shared/Packets/ByteBuffer.h | 2 +- 24 files changed, 784 insertions(+), 803 deletions(-) create mode 100644 sql/updates/world/2011_11_25_02_world_item_script_names.sql create mode 100644 sql/updates/world/2011_11_25_02_world_item_template.sql create mode 100644 sql/updates/world/2011_11_25_02_world_item_template_addon.sql (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/sql/updates/world/2011_11_25_02_world_item_script_names.sql b/sql/updates/world/2011_11_25_02_world_item_script_names.sql new file mode 100644 index 00000000000..aaf843b91ae --- /dev/null +++ b/sql/updates/world/2011_11_25_02_world_item_script_names.sql @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS `item_script_names`; +CREATE TABLE `item_script_names` ( +`Id` int(10) unsigned not null, +`ScriptName` varchar(64) not null, +PRIMARY KEY(`Id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +INSERT INTO `item_script_names` +SELECT +`item_template`.`entry` AS `Id`, +`item_template`.`ScriptName` AS `ScriptName` +FROM +`item_template` +WHERE +length(`item_template`.`ScriptName`)>0; + +ALTER TABLE `item_template` DROP `ScriptName`; diff --git a/sql/updates/world/2011_11_25_02_world_item_template.sql b/sql/updates/world/2011_11_25_02_world_item_template.sql new file mode 100644 index 00000000000..8a047ed9d11 --- /dev/null +++ b/sql/updates/world/2011_11_25_02_world_item_template.sql @@ -0,0 +1,48 @@ +ALTER TABLE `item_template` + ADD `stat_unk1_1` int(11) not null default 0 AFTER `stat_value1`, + ADD `stat_unk2_1` int(11) not null default 0 AFTER `stat_unk1_1`, + ADD `stat_unk1_2` int(11) not null default 0 AFTER `stat_value2`, + ADD `stat_unk2_2` int(11) not null default 0 AFTER `stat_unk1_2`, + ADD `stat_unk1_3` int(11) not null default 0 AFTER `stat_value3`, + ADD `stat_unk2_3` int(11) not null default 0 AFTER `stat_unk1_3`, + ADD `stat_unk1_4` int(11) not null default 0 AFTER `stat_value4`, + ADD `stat_unk2_4` int(11) not null default 0 AFTER `stat_unk1_4`, + ADD `stat_unk1_5` int(11) not null default 0 AFTER `stat_value5`, + ADD `stat_unk2_5` int(11) not null default 0 AFTER `stat_unk1_5`, + ADD `stat_unk1_6` int(11) not null default 0 AFTER `stat_value6`, + ADD `stat_unk2_6` int(11) not null default 0 AFTER `stat_unk1_6`, + ADD `stat_unk1_7` int(11) not null default 0 AFTER `stat_value7`, + ADD `stat_unk2_7` int(11) not null default 0 AFTER `stat_unk1_7`, + ADD `stat_unk1_8` int(11) not null default 0 AFTER `stat_value8`, + ADD `stat_unk2_8` int(11) not null default 0 AFTER `stat_unk1_8`, + ADD `stat_unk1_9` int(11) not null default 0 AFTER `stat_value9`, + ADD `stat_unk2_9` int(11) not null default 0 AFTER `stat_unk1_9`, + ADD `stat_unk1_10` int(11) not null default 0 AFTER `stat_value10`, + ADD `stat_unk2_10` int(11) not null default 0 AFTER `stat_unk1_10`, + DROP `StatsCount`, + DROP `ScalingStatValue`, + CHANGE `dmg_type1` `DamageType` tinyint(3) unsigned not null default 0 AFTER `ScalingStatDistribution`, + DROP `dmg_min1`, + DROP `dmg_max1`, + DROP `dmg_min2`, + DROP `dmg_max2`, + DROP `dmg_type2`, + DROP `armor`, + DROP `holy_res`, + DROP `fire_res`, + DROP `nature_res`, + DROP `frost_res`, + DROP `shadow_res`, + DROP `arcane_res`, + DROP `ammo_type`, + DROP `spellppmRate_1`, + DROP `spellppmRate_2`, + DROP `spellppmRate_3`, + DROP `spellppmRate_4`, + DROP `spellppmRate_5`, + DROP `block`, + DROP `RequiredDisenchantSkill`, + DROP `DisenchantId`, + ADD `StatScalingFactor` float not null default 0 AFTER `HolidayId`, + ADD `Field130` int(11) not null default 0 AFTER `StatScalingFactor`, + ADD `Field131` int(11) not null default 0 AFTER `Field130`; diff --git a/sql/updates/world/2011_11_25_02_world_item_template_addon.sql b/sql/updates/world/2011_11_25_02_world_item_template_addon.sql new file mode 100644 index 00000000000..2d99d9fc610 --- /dev/null +++ b/sql/updates/world/2011_11_25_02_world_item_template_addon.sql @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS `item_template_addon`; +CREATE TABLE `item_template_addon` ( +`Id` int(10) unsigned not null, +`BuyCount` tinyint(3) unsigned not null default 1, +`FoodType` tinyint(3) unsigned not null default 0, +`MinMoneyLoot` int(10) unsigned not null default 0, +`MaxMoneyLoot` int(10) unsigned not null default 0, +`SpellPPMChance` float unsigned not null default 0, +PRIMARY KEY(`Id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +INSERT INTO `item_template_addon` +SELECT +`item_template`.`entry` AS `Id`, +`item_template`.`BuyCount` AS `BuyCount`, +`item_template`.`FoodType` AS `FoodType`, +`item_template`.`minMoneyLoot` AS `MinMoneyLoot`, +`item_template`.`maxMoneyLoot` AS `MaxMoneyLoot`, +ABS(IF(`item_template`.`spelltrigger_1`=2, `item_template`.`spellppmRate_1`, + IF (`item_template`.`spelltrigger_2`=2, `item_template`.`spellppmRate_2`, + IF (`item_template`.`spelltrigger_3`=2, `item_template`.`spellppmRate_3`, + IF (`item_template`.`spelltrigger_4`=2, `item_template`.`spellppmRate_4`, + IF (`item_template`.`spelltrigger_5`=2, `item_template`.`spellppmRate_5`, 0)))))) + AS `SpellPPMChance` +FROM +`item_template` +HAVING -- need to use having due to `SpellPPMChance` usage which is not an actual field in table +`item_template`.`BuyCount`!=1 OR +`item_template`.`FoodType`!=0 OR +(`item_template`.`minMoneyLoot`!=0 AND +`item_template`.`maxMoneyLoot`!=0) OR +`SpellPPMChance`!=0; + +ALTER TABLE `item_template` + DROP `BuyCount`, + DROP `FoodType`, + DROP `minMoneyLoot`, + DROP `maxMoneyLoot`; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index ceba8d178cf..9bdbce70acc 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -111,20 +111,12 @@ DBCStorage sGtRegenMPPerSptStore(GtRegenMPPerSptf DBCStorage sHolidaysStore(Holidaysfmt); -DBCStorage sItemClassStore(ItemClassfmt); -//DBCStorage sItemStore(Itemfmt); -DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); -//DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); -//DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently -//DBCStorage sItemExtendedCostStore(ItemExtendedCostEntryfmt); -DBCStorage sItemLimitCategoryStore(ItemLimitCategoryEntryfmt); -DBCStorage sItemRandomPropertiesStore(ItemRandomPropertiesfmt); -DBCStorage sItemRandomSuffixStore(ItemRandomSuffixfmt); -DBCStorage sItemSetStore(ItemSetEntryfmt); - DBCStorage sItemArmorQualityStore(ItemArmorQualityfmt); DBCStorage sItemArmorShieldStore(ItemArmorShieldfmt); DBCStorage sItemArmorTotalStore(ItemArmorTotalfmt); +DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); +DBCStorage sItemClassStore(ItemClassfmt); +//DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); DBCStorage sItemDamageAmmoStore(ItemDamagefmt); DBCStorage sItemDamageOneHandStore(ItemDamagefmt); DBCStorage sItemDamageOneHandCasterStore(ItemDamagefmt); @@ -133,6 +125,13 @@ DBCStorage sItemDamageThrownStore(ItemDamagefmt); DBCStorage sItemDamageTwoHandStore(ItemDamagefmt); DBCStorage sItemDamageTwoHandCasterStore(ItemDamagefmt); DBCStorage sItemDamageWandStore(ItemDamagefmt); +DBCStorage sItemDisenchantLootStore(ItemDisenchantLootfmt); +//DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently +//DBCStorage sItemExtendedCostStore(ItemExtendedCostEntryfmt); +DBCStorage sItemLimitCategoryStore(ItemLimitCategoryEntryfmt); +DBCStorage sItemRandomPropertiesStore(ItemRandomPropertiesfmt); +DBCStorage sItemRandomSuffixStore(ItemRandomSuffixfmt); +DBCStorage sItemSetStore(ItemSetEntryfmt); DBCStorage sLFGDungeonStore(LFGDungeonEntryfmt); //DBCStorage sLiquidTypeStore(LiquidTypeEntryfmt); @@ -409,6 +408,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sItemDamageTwoHandStore, dbcPath, "ItemDamageTwoHand.dbc");//14545 LoadDBC(availableDbcLocales, bad_dbc_files, sItemDamageTwoHandCasterStore,dbcPath, "ItemDamageTwoHandCaster.dbc");//14545 LoadDBC(availableDbcLocales, bad_dbc_files, sItemDamageWandStore, dbcPath, "ItemDamageWand.dbc");//14545 + LoadDBC(availableDbcLocales, bad_dbc_files, sItemDisenchantLootStore, dbcPath, "ItemDisenchantLoot.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sItemClassStore, dbcPath,"ItemClass.dbc");//14545 LoadDBC(availableDbcLocales, bad_dbc_files, sLFGDungeonStore, dbcPath, "LFGDungeons.dbc");//14545 diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index fc20d61982f..aee179af3b2 100755 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -128,6 +128,7 @@ extern DBCStorage sItemDamageTwoHandStore; extern DBCStorage sItemDamageTwoHandCasterStore; extern DBCStorage sItemDamageWandStore; //extern DBCStorage sItemDisplayInfoStore; -- not used currently +extern DBCStorage sItemDisenchantLootStore; extern DBCStorage sItemLimitCategoryStore; extern DBCStorage sItemRandomPropertiesStore; extern DBCStorage sItemRandomSuffixStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 7dbb8a200aa..ae71b24bdcb 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1169,7 +1169,7 @@ struct ItemClassEntry struct ItemDamageEntry { uint32 Id; // 0 item level - float Value[7]; // 1-7 multiplier for item quality + float DPS[7]; // 1-7 multiplier for item quality uint32 Id2; // 8 item level }; @@ -1216,6 +1216,17 @@ struct ItemDisplayInfoEntry // 11 m_particleColorID }; +struct ItemDisenchantLootEntry +{ + uint32 Id; + uint32 ItemClass; + int32 Unk; + uint32 ItemQuality; + uint32 MinItemLevel; + uint32 MaxItemLevel; + uint32 RequiredDisenchantSkill; +}; + //struct ItemCondExtCostsEntry //{ // uint32 ID; @@ -2317,4 +2328,3 @@ typedef std::vector TaxiPathNodesByPath; #define TaxiMaskSize 14 typedef uint32 TaxiMask[TaxiMaskSize]; #endif - diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index be2fe6916e4..28df75f185b 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -82,6 +82,7 @@ const char ItemArmorQualityfmt[]="nfffffffi"; const char ItemArmorShieldfmt[]="nifffffff"; const char ItemArmorTotalfmt[]="niffff"; const char ItemDamagefmt[]="nfffffffi"; +const char ItemDisenchantLootfmt[]="niiiiii"; const char ItemClassfmt[]="dixxx"; //const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx"; //const char ItemCondExtCostsEntryfmt[]="xiii"; diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h index c15189dfb5f..0234b90e7f5 100755 --- a/src/server/game/Entities/Item/ItemPrototype.h +++ b/src/server/game/Entities/Item/ItemPrototype.h @@ -67,7 +67,15 @@ enum ItemModType ITEM_MOD_SPELL_POWER = 45, ITEM_MOD_HEALTH_REGEN = 46, ITEM_MOD_SPELL_PENETRATION = 47, - ITEM_MOD_BLOCK_VALUE = 48 + ITEM_MOD_BLOCK_VALUE = 48, + ITEM_MOD_MASTERY_RATING = 49, + ITEM_MOD_EXTRA_ARMOR = 50, + ITEM_MOD_FIRE_RESISTANCE = 51, + ITEM_MOD_FROST_RESISTANCE = 52, + ITEM_MOD_HOLY_RESISTANCE = 53, + ITEM_MOD_SHADOW_RESISTANCE = 54, + ITEM_MOD_NATURE_RESISTANCE = 55, + ITEM_MOD_ARCANE_RESISTANCE = 56, }; #define MAX_ITEM_MOD 49 @@ -543,24 +551,19 @@ inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemS #pragma pack(push, 1) #endif -struct _Damage -{ - float DamageMin; - float DamageMax; - uint32 DamageType; // id from Resistances.dbc -}; - struct _ItemStat { uint32 ItemStatType; int32 ItemStatValue; + int32 ItemStatUnk1; + int32 ItemStatUnk2; }; + struct _Spell { int32 SpellId; // id from Spell.dbc uint32 SpellTrigger; int32 SpellCharges; - float SpellPPMRate; int32 SpellCooldown; uint32 SpellCategory; // id from SpellCategory.dbc int32 SpellCategoryCooldown; @@ -583,7 +586,7 @@ struct ItemTemplate uint32 Class; // id from ItemClass.dbc uint32 SubClass; // id from ItemSubClass.dbc int32 Unk0; - std::string Name1; + std::string Name1; uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc uint32 Quality; uint32 Flags; @@ -609,18 +612,15 @@ struct ItemTemplate uint32 StatsCount; _ItemStat ItemStat[MAX_ITEM_PROTO_STATS]; uint32 ScalingStatDistribution; // id from ScalingStatDistribution.dbc - _Damage Damage[MAX_ITEM_PROTO_DAMAGES]; + float DamageMin; + float DamageMax; + uint32 DamageType; // id from Resistances.dbc + float DPS; uint32 Armor; - uint32 HolyRes; - uint32 FireRes; - uint32 NatureRes; - uint32 FrostRes; - uint32 ShadowRes; - uint32 ArcaneRes; uint32 Delay; - uint32 AmmoType; float RangedModRange; _Spell Spells[MAX_ITEM_PROTO_SPELLS]; + float SpellPPMRate; uint32 Bonding; std::string Description; uint32 PageText; @@ -632,7 +632,6 @@ struct ItemTemplate uint32 Sheath; int32 RandomProperty; // id from ItemRandomProperties.dbc int32 RandomSuffix; // id from ItemRandomSuffix.dbc - uint32 Block; uint32 ItemSet; // id from ItemSet.dbc uint32 MaxDurability; uint32 Area; // id from AreaTable.dbc @@ -647,6 +646,9 @@ struct ItemTemplate int32 Duration; // negative = realtime, positive = ingame time uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc uint32 HolidayId; // id from Holidays.dbc + float StatScalingFactor; + int32 Field130; + int32 Field131; uint32 ScriptId; uint32 DisenchantID; uint32 FoodType; @@ -679,22 +681,12 @@ struct ItemTemplate return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable); } - float getDPS() const - { - if (Delay == 0) - return 0; - float temp = 0; - for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) - temp+=Damage[i].DamageMin + Damage[i].DamageMax; - return temp*500/Delay; - } - int32 getFeralBonus(int32 extraDPS = 0) const { // 0x02A5F3 - is mask for Melee weapon from ItemSubClassMask.dbc - if (Class == ITEM_CLASS_WEAPON && (1<ArmorDamageModifier > 0) HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(proto->ArmorDamageModifier), apply); - if (proto->Block) - HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(proto->Block), apply); - - if (proto->HolyRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(proto->HolyRes), apply); - - if (proto->FireRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, float(proto->FireRes), apply); - - if (proto->NatureRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, float(proto->NatureRes), apply); - - if (proto->FrostRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, float(proto->FrostRes), apply); - - if (proto->ShadowRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, float(proto->ShadowRes), apply); - - if (proto->ArcaneRes) - HandleStatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, float(proto->ArcaneRes), apply); - WeaponAttackType attType = BASE_ATTACK; if (slot == EQUIPMENT_SLOT_RANGED && ( @@ -8123,8 +8120,8 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt attType = OFF_ATTACK; } - float minDamage = proto->Damage[0].DamageMin; - float maxDamage = proto->Damage[0].DamageMax; + float minDamage = proto->DamageMin; + float maxDamage = proto->DamageMax; // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage int32 extraDPS = 0; @@ -8410,7 +8407,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 float chance = (float)spellInfo->ProcChance; - if (spellData.SpellPPMRate) + if (proto->SpellPPMRate) { if (spellData.SpellId == 52781) // Persuasive Strike { @@ -8425,7 +8422,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 } } uint32 WeaponSpeed = GetAttackTime(attType); - chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo); + chance = GetPPMProcChance(WeaponSpeed, proto->SpellPPMRate, spellInfo); } else if (chance > 100.0f) { @@ -18334,7 +18331,7 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setFloat(index++, finiteAlways(GetPositionY())); stmt->setFloat(index++, finiteAlways(GetPositionZ())); stmt->setFloat(index++, finiteAlways(GetOrientation())); - + std::ostringstream ss; ss << m_taxi; stmt->setString(index++, ss.str()); @@ -18356,7 +18353,7 @@ void Player::SaveToDB(bool create /*=false*/) ss.str().clear(); ss << m_taxi.SaveTaxiDestinationsToString(); - + stmt->setString(index++, ss.str()); stmt->setUInt32(index++, GetArenaPoints()); stmt->setUInt32(index++, GetHonorPoints()); @@ -18389,7 +18386,7 @@ void Player::SaveToDB(bool create /*=false*/) for (uint32 i = 0; i < EQUIPMENT_SLOT_END * 2; ++i) ss << GetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + i) << ' '; stmt->setString(index++, ss.str()); - + ss.str().clear(); // ...and bags for enum opcode for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) @@ -24825,4 +24822,4 @@ bool Player::IsInWhisperWhiteList(uint64 guid) return true; } return false; -} +} \ No newline at end of file diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b2457a87e82..efe9dd487d5 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1844,7 +1844,7 @@ class Player : public Unit, public GridObject void RemoveFromGroup(RemoveMethod method = GROUP_REMOVEMETHOD_DEFAULT) { RemoveFromGroup(GetGroup(), GetGUID(), method); } void SendUpdateToOutOfRangeGroupMembers(); - void SetInGuild(uint32 GuildId) + void SetInGuild(uint32 GuildId) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SET_GUILD_ID); stmt->setUInt32(0, GuildId); @@ -2538,7 +2538,7 @@ class Player : public Unit, public GridObject CreatureDisplayInfoEntry const* mountDisplayInfo = sCreatureDisplayInfoStore.LookupEntry(GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID)); if (!mountDisplayInfo) return GetCollisionHeight(false); - + CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId); if (!mountModelData) return GetCollisionHeight(false); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 545ba676091..87834d27f34 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2715,7 +2715,7 @@ float Unit::GetUnitBlockChance() const if (player->CanBlock()) { Item* tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); - if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block) + if (tmpitem && !tmpitem->IsBroken()) return GetFloatValue(PLAYER_BLOCK_PERCENTAGE); } // is player but has no block ability or no not broken shield equipped @@ -8674,7 +8674,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg ItemTemplate const* weapon = item->GetTemplate(); - float weaponDPS = weapon->getDPS(); + float weaponDPS = weapon->DPS; float attackPower = GetTotalAttackPowerValue(BASE_ATTACK) / 14.0f; float weaponSpeed = float(weapon->Delay) / 1000.0f; basepoints0 = int32((weaponDPS + attackPower) * weaponSpeed); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index f2553b3ace5..3218f954078 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2093,600 +2093,493 @@ void ObjectMgr::LoadItemLocales() sLog->outString(); } -void ObjectMgr::LoadItemTemplates() +void FillItemDamageFields(float* minDamage, float* maxDamage, float* dps, uint32 itemLevel, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32 delay, float statScalingFactor, uint32 inventoryType, uint32 flags2) { - uint32 oldMSTime = getMSTime(); - - // 0 1 2 3 4 5 6 7 8 9 10 11 12 - QueryResult result = WorldDatabase.Query("SELECT entry, class, subclass, unk0, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, " - // 13 14 15 16 17 18 19 20 - "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, " - // 21 22 23 24 25 26 27 28 - "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, StatsCount, stat_type1, " - // 29 30 31 32 33 34 35 36 37 38 - "stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, " - // 39 40 41 42 43 44 45 46 47 - "stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9, stat_value9, stat_type10, stat_value10, " - // 48 49 50 51 52 53 54 55 56 57 58 - "ScalingStatDistribution, ScalingStatValue, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, " - // 59 60 61 62 63 64 65 66 67 68 - "nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type, RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, " - // 69 70 71 72 73 74 75 - "spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, spellid_2, spelltrigger_2, spellcharges_2, " - // 76 77 78 79 80 81 82 - "spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, " - // 83 84 85 86 87 88 89 - "spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, spellid_4, spelltrigger_4, spellcharges_4, " - // 90 91 92 93 94 95 96 - "spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, " - // 97 98 99 100 101 102 103 104 105 - "spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, description, PageText, LanguageID, PageMaterial, " - // 106 107 108 109 110 111 112 113 114 115 116 117 - "startquest, lockid, Material, sheath, RandomProperty, RandomSuffix, block, itemset, MaxDurability, area, Map, BagFamily, " - // 118 119 120 121 122 123 124 125 - "TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, " - // 126 127 128 129 130 131 132 133 - "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, " - // 134 135 136 - "FoodType, minMoneyLoot, maxMoneyLoot FROM item_template"); - - if (!result) - { - sLog->outString(">> Loaded 0 item templates. DB table `item_template` is empty."); - sLog->outString(); + *minDamage = *maxDamage = *dps = 0.0f; + if (itemClass != ITEM_CLASS_WEAPON || quality > ITEM_QUALITY_ARTIFACT) return; - } - uint32 count = 0; - bool enforceDBCAttributes = sWorld->getBoolConfig(CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES); + DBCStorage* store = NULL; + // get the right store here + if (inventoryType > 0xD + 13) + return; - do + switch (inventoryType) { - Field* fields = result->Fetch(); - - uint32 entry = fields[0].GetUInt32(); - - ItemTemplate& itemTemplate = ItemTemplateStore[entry]; - - itemTemplate.ItemId = entry; - itemTemplate.Class = uint32(fields[1].GetUInt8()); - itemTemplate.SubClass = uint32(fields[2].GetUInt8()); - itemTemplate.Unk0 = fields[3].GetInt32(); - itemTemplate.Name1 = fields[4].GetString(); - itemTemplate.DisplayInfoID = fields[5].GetUInt32(); - itemTemplate.Quality = uint32(fields[6].GetUInt8()); - itemTemplate.Flags = uint32(fields[7].GetInt64()); - itemTemplate.Flags2 = fields[8].GetUInt32(); - itemTemplate.BuyCount = uint32(fields[9].GetUInt8()); - itemTemplate.BuyPrice = int32(fields[10].GetInt64()); - itemTemplate.SellPrice = fields[11].GetUInt32(); - itemTemplate.InventoryType = uint32(fields[12].GetUInt8()); - itemTemplate.AllowableClass = fields[13].GetInt32(); - itemTemplate.AllowableRace = fields[14].GetInt32(); - itemTemplate.ItemLevel = uint32(fields[15].GetUInt16()); - itemTemplate.RequiredLevel = uint32(fields[16].GetUInt8()); - itemTemplate.RequiredSkill = uint32(fields[17].GetUInt16()); - itemTemplate.RequiredSkillRank = uint32(fields[18].GetUInt16()); - itemTemplate.RequiredSpell = fields[19].GetUInt32(); - itemTemplate.RequiredHonorRank = fields[20].GetUInt32(); - itemTemplate.RequiredCityRank = fields[21].GetUInt32(); - itemTemplate.RequiredReputationFaction = uint32(fields[22].GetUInt16()); - itemTemplate.RequiredReputationRank = uint32(fields[23].GetUInt16()); - itemTemplate.MaxCount = fields[24].GetInt32(); - itemTemplate.Stackable = fields[25].GetInt32(); - itemTemplate.ContainerSlots = uint32(fields[26].GetUInt8()); - itemTemplate.StatsCount = uint32(fields[27].GetUInt8()); - - for (uint8 i = 0; i < itemTemplate.StatsCount; ++i) - { - itemTemplate.ItemStat[i].ItemStatType = uint32(fields[28 + i*2].GetUInt8()); - itemTemplate.ItemStat[i].ItemStatValue = int32(fields[29 + i*2].GetInt16()); - } - - itemTemplate.ScalingStatDistribution = uint32(fields[48].GetUInt16()); - //itemTemplate.ScalingStatValue = fields[49].GetInt32(); - - for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) - { - itemTemplate.Damage[i].DamageMin = fields[50 + i*3].GetFloat(); - itemTemplate.Damage[i].DamageMax = fields[51 + i*3].GetFloat(); - itemTemplate.Damage[i].DamageType = uint32(fields[52 + i*3].GetUInt8()); - } - - itemTemplate.Armor = uint32(fields[56].GetUInt16()); - itemTemplate.HolyRes = uint32(fields[57].GetUInt8()); - itemTemplate.FireRes = uint32(fields[58].GetUInt8()); - itemTemplate.NatureRes = uint32(fields[59].GetUInt8()); - itemTemplate.FrostRes = uint32(fields[60].GetUInt8()); - itemTemplate.ShadowRes = uint32(fields[61].GetUInt8()); - itemTemplate.ArcaneRes = uint32(fields[62].GetUInt8()); - itemTemplate.Delay = uint32(fields[63].GetUInt16()); - itemTemplate.AmmoType = uint32(fields[64].GetUInt8()); - itemTemplate.RangedModRange = fields[65].GetFloat(); - - for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) - { - itemTemplate.Spells[i].SpellId = fields[66 + i*7 ].GetInt32(); - itemTemplate.Spells[i].SpellTrigger = uint32(fields[67 + i*7].GetUInt8()); - itemTemplate.Spells[i].SpellCharges = int32(fields[68 + i*7].GetInt16()); - itemTemplate.Spells[i].SpellPPMRate = fields[69 + i*7].GetFloat(); - itemTemplate.Spells[i].SpellCooldown = fields[70 + i*7].GetInt32(); - itemTemplate.Spells[i].SpellCategory = uint32(fields[71 + i*7].GetUInt16()); - itemTemplate.Spells[i].SpellCategoryCooldown = fields[72 + i*7].GetInt32(); - } - - itemTemplate.Bonding = uint32(fields[101].GetUInt8()); - itemTemplate.Description = fields[102].GetString(); - itemTemplate.PageText = fields[103].GetUInt32(); - itemTemplate.LanguageID = uint32(fields[104].GetUInt8()); - itemTemplate.PageMaterial = uint32(fields[105].GetUInt8()); - itemTemplate.StartQuest = fields[106].GetUInt32(); - itemTemplate.LockID = fields[107].GetUInt32(); - itemTemplate.Material = int32(fields[108].GetInt8()); - itemTemplate.Sheath = uint32(fields[109].GetUInt8()); - itemTemplate.RandomProperty = fields[110].GetUInt32(); - itemTemplate.RandomSuffix = fields[111].GetInt32(); - itemTemplate.Block = fields[112].GetUInt32(); - itemTemplate.ItemSet = fields[113].GetUInt32(); - itemTemplate.MaxDurability = uint32(fields[114].GetUInt16()); - itemTemplate.Area = fields[115].GetUInt32(); - itemTemplate.Map = uint32(fields[116].GetUInt16()); - itemTemplate.BagFamily = fields[117].GetUInt32(); - itemTemplate.TotemCategory = fields[118].GetUInt32(); - - for (uint8 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i) - { - itemTemplate.Socket[i].Color = uint32(fields[119 + i*2].GetUInt8()); - itemTemplate.Socket[i].Content = fields[120 + i*2].GetUInt32(); - } - - itemTemplate.socketBonus = fields[125].GetUInt32(); - itemTemplate.GemProperties = fields[126].GetUInt32(); - itemTemplate.RequiredDisenchantSkill = uint32(fields[127].GetInt16()); - itemTemplate.ArmorDamageModifier = fields[128].GetFloat(); - itemTemplate.Duration = fields[129].GetInt32(); - itemTemplate.ItemLimitCategory = uint32(fields[130].GetInt16()); - itemTemplate.HolidayId = fields[131].GetUInt32(); - itemTemplate.ScriptId = sObjectMgr->GetScriptId(fields[132].GetCString()); - itemTemplate.DisenchantID = fields[133].GetUInt32(); - itemTemplate.FoodType = uint32(fields[134].GetUInt8()); - itemTemplate.MinMoneyLoot = fields[135].GetUInt32(); - itemTemplate.MaxMoneyLoot = fields[136].GetUInt32(); - - // Checks - - /*ItemEntry const* dbcitem = sItemStore.LookupEntry(entry); - - if (dbcitem) - { - if (itemTemplate.Class != dbcitem->Class) - { - sLog->outErrorDb("Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class); - if (enforceDBCAttributes) - itemTemplate.Class = dbcitem->Class; - } - - if (itemTemplate.Unk0 != dbcitem->Unk0) - { - sLog->outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0); - if (enforceDBCAttributes) - itemTemplate.Unk0 = dbcitem->Unk0; - } - if (itemTemplate.Material != dbcitem->Material) - { - sLog->outErrorDb("Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material); - if (enforceDBCAttributes) - itemTemplate.Material = dbcitem->Material; - } - if (itemTemplate.InventoryType != dbcitem->InventoryType) - { - sLog->outErrorDb("Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType); - if (enforceDBCAttributes) - itemTemplate.InventoryType = dbcitem->InventoryType; - } - if (itemTemplate.DisplayInfoID != dbcitem->DisplayId) - { - sLog->outErrorDb("Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId); - if (enforceDBCAttributes) - itemTemplate.DisplayInfoID = dbcitem->DisplayId; - } - if (itemTemplate.Sheath != dbcitem->Sheath) + case INVTYPE_AMMO: + store = &sItemDamageAmmoStore; + break; + case INVTYPE_2HWEAPON: + if (flags2 & ITEM_FLAGS_EXTRA_CASTER_WEAPON) + store = &sItemDamageTwoHandCasterStore; + else + store = &sItemDamageTwoHandStore; + break; + case INVTYPE_RANGED: + case INVTYPE_THROWN: + case INVTYPE_RANGEDRIGHT: + switch (itemSubClass) { - sLog->outErrorDb("Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath); - if (enforceDBCAttributes) - itemTemplate.Sheath = dbcitem->Sheath; + case ITEM_SUBCLASS_WEAPON_WAND: + store = &sItemDamageWandStore; + break; + case ITEM_SUBCLASS_WEAPON_THROWN: + store = &sItemDamageThrownStore; + break; + case ITEM_SUBCLASS_WEAPON_BOW: + case ITEM_SUBCLASS_WEAPON_GUN: + case ITEM_SUBCLASS_WEAPON_CROSSBOW: + store = &sItemDamageRangedStore; + break; + default: + return; } + break; + case INVTYPE_WEAPON: + case INVTYPE_WEAPONMAINHAND: + case INVTYPE_WEAPONOFFHAND: + if (flags2 & ITEM_FLAGS_EXTRA_CASTER_WEAPON) + store = &sItemDamageOneHandCasterStore; + else + store = &sItemDamageOneHandStore; + break; + default: + return; + } - } - else - sLog->outErrorDb("Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry);*/ - - if (itemTemplate.Class >= MAX_ITEM_CLASS) - { - sLog->outErrorDb("Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); - itemTemplate.Class = ITEM_CLASS_MISC; - } - - if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class]) - { - sLog->outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); - itemTemplate.SubClass = 0;// exist for all item classes - } + if (!store) + return; - if (itemTemplate.Quality >= MAX_ITEM_QUALITY) - { - sLog->outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); - itemTemplate.Quality = ITEM_QUALITY_NORMAL; - } + ItemDamageEntry const* damageInfo = store->LookupEntry(itemLevel); + if (!damageInfo) + return; - if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) - { - if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE)) - if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", - entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); + *dps = damageInfo->DPS[quality]; + float avgDamage = *dps * delay * 0.001f; + *minDamage = (statScalingFactor * -0.5f + 1.0f) * avgDamage; + *maxDamage = floor(float(avgDamage * (statScalingFactor * 0.5f + 1.0f) + 0.5f)); +} - if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", - entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); - } - else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) - { - if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE)) - if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", - entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); - } +uint32 FillItemArmor(uint32 itemlevel, uint32 itemClass, uint32 itemSubclass, uint32 quality, uint32 inventoryType) +{ + if (quality > ITEM_QUALITY_ARTIFACT) + return 0; - if (itemTemplate.BuyCount <= 0) - { - sLog->outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); - itemTemplate.BuyCount = 1; - } + // all items but shields + if (itemClass != ITEM_CLASS_ARMOR || itemSubclass != ITEM_SUBCLASS_ARMOR_SHIELD) + { + ItemArmorQualityEntry const* armorQuality = sItemArmorQualityStore.LookupEntry(itemlevel); + ItemArmorTotalEntry const* armorToral = sItemArmorTotalStore.LookupEntry(itemlevel); + if (!armorQuality || !armorToral) + return 0; - if (itemTemplate.InventoryType >= MAX_INVTYPE) - { - sLog->outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); - itemTemplate.InventoryType = INVTYPE_NON_EQUIP; - } + if (inventoryType == INVTYPE_ROBE) + inventoryType = INVTYPE_CHEST; - if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE) - { - sLog->outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); - itemTemplate.RequiredSkill = 0; - } + ArmorLocationEntry const* location = sArmorLocationStore.LookupEntry(inventoryType); + if (!location) + return 0; - { - // can be used in equip slot, as page read use in inventory, or spell casting at use - bool req = itemTemplate.InventoryType != INVTYPE_NON_EQUIP || itemTemplate.PageText; - if (!req) - for (uint8 j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j) - { - if (itemTemplate.Spells[j].SpellId) - { - req = true; - break; - } - } + if (itemSubclass < ITEM_SUBCLASS_ARMOR_CLOTH) + return 0; - if (req) - { - if (!(itemTemplate.AllowableClass & CLASSMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); + return uint32(armorQuality->Value[quality] * armorToral->Value[quality] * location->Value[itemSubclass - 1] + 0.5f); + } - if (!(itemTemplate.AllowableRace & RACEMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); - } - } + // shields + ItemArmorShieldEntry const* shield = sItemArmorShieldStore.LookupEntry(itemlevel); + if (!shield) + return 0; - if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell)) - { - sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); - itemTemplate.RequiredSpell = 0; - } + return uint32(shield->Value[quality] + 0.5f); +} - if (itemTemplate.RequiredReputationRank >= MAX_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); +void FillDisenchantFields(uint32* disenchantID, uint32* requiredDisenchantSkill, uint32 itemClass, uint32 quality, uint32 itemLevel) +{ + for (uint32 i = 0; i < sItemDisenchantLootStore.GetNumRows(); ++i) + { + ItemDisenchantLootEntry const* disenchant = sItemDisenchantLootStore.LookupEntry(i); + if (!disenchant) + continue; - if (itemTemplate.RequiredReputationFaction) + if (disenchant->ItemClass == itemClass && + disenchant->ItemQuality == quality && + disenchant->MinItemLevel <= itemLevel && + disenchant->MaxItemLevel >= itemLevel) { - if (!sFactionStore.LookupEntry(itemTemplate.RequiredReputationFaction)) - { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); - itemTemplate.RequiredReputationFaction = 0; - } - - if (itemTemplate.RequiredReputationRank == MIN_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); + *disenchantID = disenchant->Id; + *requiredDisenchantSkill = disenchant->RequiredDisenchantSkill; + return; } + } - if (itemTemplate.MaxCount < -1) - { - sLog->outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); - itemTemplate.MaxCount = -1; - } + *disenchantID = 0; + *(int32*)requiredDisenchantSkill = -1; +} - if (itemTemplate.Stackable == 0) - { - sLog->outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); - itemTemplate.Stackable = 1; - } - else if (itemTemplate.Stackable < -1) - { - sLog->outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); - itemTemplate.Stackable = -1; - } +void ObjectMgr::LoadItemTemplates() +{ + uint32 oldMSTime = getMSTime(); + uint32 sparseCount = 0; + uint32 dbCount = 0; - if (itemTemplate.ContainerSlots > MAX_BAG_SIZE) - { - sLog->outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); - itemTemplate.ContainerSlots = MAX_BAG_SIZE; - } + for (uint32 itemId = 0; itemId < sItemSparseStore.GetNumRows(); ++itemId) + { + ItemSparseEntry const* sparse = sItemSparseStore.LookupEntry(itemId); + ItemEntry const* db2Data = sItemStore.LookupEntry(itemId); + if (!sparse || !db2Data) + continue; - if (itemTemplate.StatsCount > MAX_ITEM_PROTO_STATS) - { - sLog->outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); - itemTemplate.StatsCount = MAX_ITEM_PROTO_STATS; - } + ItemTemplate& itemTemplate = ItemTemplateStore[itemId]; + + itemTemplate.ItemId = itemId; + itemTemplate.Class = db2Data->Class; + itemTemplate.SubClass = db2Data->SubClass; + itemTemplate.Unk0 = db2Data->Unk0; + itemTemplate.Name1 = sparse->Name; + itemTemplate.DisplayInfoID = db2Data->DisplayId; + itemTemplate.Quality = sparse->Quality; + itemTemplate.Flags = sparse->Flags; + itemTemplate.Flags2 = sparse->Flags2; + itemTemplate.BuyCount = 1; + itemTemplate.BuyPrice = sparse->BuyPrice; + itemTemplate.SellPrice = sparse->SellPrice; + itemTemplate.InventoryType = db2Data->InventoryType; + itemTemplate.AllowableClass = sparse->AllowableClass; + itemTemplate.AllowableRace = sparse->AllowableRace; + itemTemplate.ItemLevel = sparse->ItemLevel; + itemTemplate.RequiredLevel = sparse->RequiredLevel; + itemTemplate.RequiredSkill = sparse->RequiredSkill; + itemTemplate.RequiredSkillRank = sparse->RequiredSkillRank; + itemTemplate.RequiredSpell = sparse->RequiredSpell; + itemTemplate.RequiredHonorRank = sparse->RequiredHonorRank; + itemTemplate.RequiredCityRank = sparse->RequiredCityRank; + itemTemplate.RequiredReputationFaction = sparse->RequiredReputationFaction; + itemTemplate.RequiredReputationRank = sparse->RequiredReputationRank; + itemTemplate.MaxCount = sparse->MaxCount; + itemTemplate.Stackable = sparse->Stackable; + itemTemplate.ContainerSlots = sparse->ContainerSlots; + for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) + { + itemTemplate.ItemStat[i].ItemStatType = sparse->ItemStatType[i]; + itemTemplate.ItemStat[i].ItemStatValue = sparse->ItemStatValue[i]; + itemTemplate.ItemStat[i].ItemStatUnk1 = sparse->ItemStatUnk1[i]; + itemTemplate.ItemStat[i].ItemStatUnk2 = sparse->ItemStatUnk2[i]; + } + + itemTemplate.ScalingStatDistribution = sparse->ScalingStatDistribution; + + // cache item damage + FillItemDamageFields(&itemTemplate.DamageMin, &itemTemplate.DamageMax, &itemTemplate.DPS, sparse->ItemLevel, + db2Data->Class, db2Data->SubClass, sparse->Quality, sparse->Delay, sparse->StatScalingFactor, + sparse->InventoryType, sparse->Flags2); + + itemTemplate.DamageType = sparse->DamageType; + itemTemplate.Armor = FillItemArmor(sparse->ItemLevel, db2Data->Class, db2Data->SubClass, sparse->Quality, sparse->InventoryType); + itemTemplate.Delay = sparse->Delay; + itemTemplate.RangedModRange = sparse->RangedModRange; + for (uint32 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + itemTemplate.Spells[i].SpellId = sparse->SpellId[i]; + itemTemplate.Spells[i].SpellTrigger = sparse->SpellTrigger[i]; + itemTemplate.Spells[i].SpellCharges = sparse->SpellCharges[i]; + itemTemplate.Spells[i].SpellCooldown = sparse->SpellCooldown[i]; + itemTemplate.Spells[i].SpellCategory = sparse->SpellCategory[i]; + itemTemplate.Spells[i].SpellCategoryCooldown = sparse->SpellCategoryCooldown[i]; + } + + itemTemplate.SpellPPMRate = 0.0f; + itemTemplate.Bonding = sparse->Bonding; + itemTemplate.Description = sparse->Description; + itemTemplate.PageText = sparse->PageText; + itemTemplate.LanguageID = sparse->LanguageID; + itemTemplate.PageMaterial = sparse->PageMaterial; + itemTemplate.StartQuest = sparse->StartQuest; + itemTemplate.LockID = sparse->LockID; + itemTemplate.Material = sparse->Material; + itemTemplate.Sheath = sparse->Sheath; + itemTemplate.RandomProperty = sparse->RandomProperty; + itemTemplate.RandomSuffix = sparse->RandomSuffix; + itemTemplate.ItemSet = sparse->ItemSet; + itemTemplate.MaxDurability = sparse->MaxDurability; + itemTemplate.Area = sparse->Area; + itemTemplate.Map = sparse->Map; + itemTemplate.BagFamily = sparse->BagFamily; + itemTemplate.TotemCategory = sparse->TotemCategory; + for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i) + { + itemTemplate.Socket[i].Color = sparse->Color[i]; + itemTemplate.Socket[i].Content = sparse->Content[i]; + } + + itemTemplate.socketBonus = sparse->SocketBonus; + itemTemplate.GemProperties = sparse->GemProperties; + FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, + db2Data->Class, sparse->Quality, sparse->ItemLevel); + + itemTemplate.ArmorDamageModifier = sparse->ArmorDamageModifier; + itemTemplate.Duration = sparse->Duration; + itemTemplate.ItemLimitCategory = sparse->ItemLimitCategory; + itemTemplate.HolidayId = sparse->HolidayId; + itemTemplate.StatScalingFactor = sparse->StatScalingFactor; + itemTemplate.Field130 = sparse->Field130; + itemTemplate.Field131 = sparse->Field131; + itemTemplate.ScriptId = 0; + itemTemplate.FoodType = 0; + itemTemplate.MinMoneyLoot = 0; + itemTemplate.MaxMoneyLoot = 0; + ++sparseCount; + } + + // Load missing items from item_template AND overwrite data from Item-sparse.db2 (item_template is supposed to contain Item-sparse.adb data) + // 0 1 2 3 4 5 6 7 8 9 10 11 + QueryResult result = WorldDatabase.Query("SELECT entry, Class, SubClass, Unk0, Name, DisplayId, Quality, Flags, FlagsExtra, BuyPrice, SellPrice, InventoryType, " + // 12 13 14 15 16 17 18 19 + "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, RequiredHonorRank, " + // 20 21 22 23 24 25 + "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, " + // 26 27 28 29 30 31 32 33 + "stat_type1, stat_value1, stat_unk1_1, stat_unk2_1, stat_type2, stat_value2, stat_unk1_2, stat_unk2_2, " + // 34 35 36 37 38 39 40 41 + "stat_type3, stat_value3, stat_unk1_3, stat_unk2_3, stat_type4, stat_value4, stat_unk1_4, stat_unk2_4, " + // 42 43 44 45 46 47 48 49 + "stat_type5, stat_value5, stat_unk1_5, stat_unk2_5, stat_type6, stat_value6, stat_unk1_6, stat_unk2_6, " + // 50 51 52 53 54 55 56 57 + "stat_type7, stat_value7, stat_unk1_7, stat_unk2_7, stat_type8, stat_value8, stat_unk1_8, stat_unk2_8, " + // 58 59 60 61 62 63 64 65 + "stat_type9, stat_value9, stat_unk1_9, stat_unk2_9, stat_type10, stat_value10, stat_unk1_10, stat_unk2_10, " + // 66 67 68 69 + "ScalingStatDistribution, DamageType, Delay, RangedModRange, " + // 70 71 72 73 74 75 + "spellid_1, spelltrigger_1, spellcharges_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, " + // 76 77 78 79 80 81 + "spellid_2, spelltrigger_2, spellcharges_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, " + // 82 83 84 85 86 87 + "spellid_3, spelltrigger_3, spellcharges_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, " + // 88 89 90 91 92 93 + "spellid_4, spelltrigger_4, spellcharges_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, " + // 94 95 96 97 98 99 + "spellid_5, spelltrigger_5, spellcharges_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, " + // 100 101 102 103 104 105 106 107 + "Bonding, Description, PageText, LanguageID, PageMaterial, StartQuest, LockID, Material, " + // 108 109 110 111 112 113 114 115 116 + "Sheath, RandomProperty, RandomSuffix, ItemSet, MaxDurability, Area, Map, BagFamily, TotemCategory, " + // 117 118 119 120 121 122 123 + "SocketColor_1, SocketContent_1, SocketColor_2, SocketContent_2, SocketColor_3, SocketContent_3, SocketBonus, " + // 124 125 126 127 128 129 130 131 + "GemProperties, ArmorDamageModifier, Duration, ItemLimitCategory, HolidayId, StatScalingFactor, Field130, Field131 " + "FROM item_template"); - for (uint8 j = 0; j < itemTemplate.StatsCount; ++j) + if (result) + { + do { - // for ItemStatValue != 0 - if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD) - { - sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); - itemTemplate.ItemStat[j].ItemStatType = 0; - } - - switch (itemTemplate.ItemStat[j].ItemStatType) - { - case ITEM_MOD_SPELL_HEALING_DONE: - case ITEM_MOD_SPELL_DAMAGE_DONE: - sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); - break; - default: - break; - } - } + Field* fields = result->Fetch(); + uint32 itemId = fields[0].GetUInt32(); + if (ItemTemplateStore.find(itemId) != ItemTemplateStore.end()) + --sparseCount; + + ItemTemplate& itemTemplate = ItemTemplateStore[itemId]; + + itemTemplate.ItemId = itemId; + itemTemplate.Class = fields[1].GetUInt32(); + itemTemplate.SubClass = fields[2].GetUInt32(); + itemTemplate.Unk0 = fields[3].GetInt32(); + itemTemplate.Name1 = fields[4].GetString(); + itemTemplate.DisplayInfoID = fields[5].GetUInt32(); + itemTemplate.Quality = fields[6].GetUInt32(); + itemTemplate.Flags = fields[7].GetUInt32(); + itemTemplate.Flags2 = fields[8].GetUInt32(); + itemTemplate.BuyCount = 1; + itemTemplate.BuyPrice = fields[9].GetInt32(); + itemTemplate.SellPrice = fields[10].GetUInt32(); + itemTemplate.InventoryType = fields[11].GetUInt32(); + itemTemplate.AllowableClass = fields[12].GetUInt32(); + itemTemplate.AllowableRace = fields[13].GetUInt32(); + itemTemplate.ItemLevel = fields[14].GetUInt32(); + itemTemplate.RequiredLevel = fields[15].GetUInt32(); + itemTemplate.RequiredSkill = fields[16].GetUInt32(); + itemTemplate.RequiredSkillRank = fields[17].GetUInt32(); + itemTemplate.RequiredSpell = fields[18].GetUInt32(); + itemTemplate.RequiredHonorRank = fields[19].GetUInt32(); + itemTemplate.RequiredCityRank = fields[20].GetUInt32(); + itemTemplate.RequiredReputationFaction = fields[21].GetUInt32(); + itemTemplate.RequiredReputationRank = fields[22].GetUInt32(); + itemTemplate.MaxCount = fields[23].GetInt32(); + itemTemplate.Stackable = fields[24].GetInt32(); + itemTemplate.ContainerSlots = fields[25].GetUInt32(); + for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) + { + itemTemplate.ItemStat[i].ItemStatType = fields[26 + i * 4].GetUInt32(); + itemTemplate.ItemStat[i].ItemStatValue = fields[26 + i * 4 + 1].GetInt32(); + itemTemplate.ItemStat[i].ItemStatUnk1 = fields[26 + i * 4 + 2].GetInt32(); + itemTemplate.ItemStat[i].ItemStatUnk2 = fields[26 + i * 4 + 3].GetInt32(); + } + + itemTemplate.ScalingStatDistribution = fields[66].GetUInt32(); + + // cache item damage + FillItemDamageFields(&itemTemplate.DamageMin, &itemTemplate.DamageMax, &itemTemplate.DPS, itemTemplate.ItemLevel, + itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, fields[68].GetUInt32(), + fields[129].GetFloat(), itemTemplate.InventoryType, itemTemplate.Flags2); + + itemTemplate.DamageType = fields[67].GetUInt32(); + itemTemplate.Armor = FillItemArmor(itemTemplate.ItemLevel, itemTemplate.Class, itemTemplate.SubClass, itemTemplate.Quality, itemTemplate.InventoryType); + itemTemplate.Delay = fields[68].GetUInt32(); + itemTemplate.RangedModRange = fields[69].GetFloat(); + for (uint32 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + itemTemplate.Spells[i].SpellId = fields[70 + 6 * i].GetInt32(); + itemTemplate.Spells[i].SpellTrigger = fields[70 + 6 * i + 1].GetUInt32(); + itemTemplate.Spells[i].SpellCharges = fields[70 + 6 * i + 2].GetInt32(); + itemTemplate.Spells[i].SpellCooldown = fields[70 + 6 * i + 3].GetInt32(); + itemTemplate.Spells[i].SpellCategory = fields[70 + 6 * i + 4].GetUInt32(); + itemTemplate.Spells[i].SpellCategoryCooldown = fields[70 + 6 * i + 5].GetInt32(); + } + + itemTemplate.SpellPPMRate = 0.0f; + itemTemplate.Bonding = fields[100].GetUInt32(); + itemTemplate.Description = fields[101].GetString(); + itemTemplate.PageText = fields[102].GetUInt32(); + itemTemplate.LanguageID = fields[103].GetUInt32(); + itemTemplate.PageMaterial = fields[104].GetUInt32(); + itemTemplate.StartQuest = fields[105].GetUInt32(); + itemTemplate.LockID = fields[106].GetUInt32(); + itemTemplate.Material = fields[107].GetInt32(); + itemTemplate.Sheath = fields[108].GetUInt32(); + itemTemplate.RandomProperty = fields[109].GetInt32(); + itemTemplate.RandomSuffix = fields[110].GetInt32(); + itemTemplate.ItemSet = fields[111].GetUInt32(); + itemTemplate.MaxDurability = fields[112].GetUInt32(); + itemTemplate.Area = fields[113].GetUInt32(); + itemTemplate.Map = fields[114].GetUInt32(); + itemTemplate.BagFamily = fields[115].GetUInt32(); + itemTemplate.TotemCategory = fields[116].GetUInt32(); + for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i) + { + itemTemplate.Socket[i].Color = fields[117 + i * 2].GetUInt32(); + itemTemplate.Socket[i].Content = fields[117 + i * 2 + 1].GetUInt32(); + } + + itemTemplate.socketBonus = fields[123].GetUInt32(); + itemTemplate.GemProperties = fields[124].GetUInt32(); + FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, + itemTemplate.Class, itemTemplate.Quality, itemTemplate.ItemLevel); + + itemTemplate.ArmorDamageModifier = fields[125].GetFloat(); + itemTemplate.Duration = fields[126].GetUInt32(); + itemTemplate.ItemLimitCategory = fields[127].GetUInt32(); + itemTemplate.HolidayId = fields[128].GetUInt32(); + itemTemplate.StatScalingFactor = fields[129].GetFloat(); + itemTemplate.Field130 = fields[130].GetInt32(); + itemTemplate.Field131 = fields[131].GetInt32(); + itemTemplate.ScriptId = 0; + itemTemplate.FoodType = 0; + itemTemplate.MinMoneyLoot = 0; + itemTemplate.MaxMoneyLoot = 0; + ++dbCount; + } while (result->NextRow()); + } - for (uint8 j = 0; j < MAX_ITEM_PROTO_DAMAGES; ++j) - { - if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL) - { - sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType); - itemTemplate.Damage[j].DamageType = 0; - } - } + // Check if item templates for DBC referenced character start outfit are present + std::set notFoundOutfit; + for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i) + { + CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i); + if (!entry) + continue; - // special format - if ((itemTemplate.Spells[0].SpellId == 483) || (itemTemplate.Spells[0].SpellId == 55884)) + for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j) { - // spell_1 - if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) - { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger); - itemTemplate.Spells[0].SpellId = 0; - itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - itemTemplate.Spells[1].SpellId = 0; - itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } - - // spell_2 have learning spell - if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) - { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger); - itemTemplate.Spells[0].SpellId = 0; - itemTemplate.Spells[1].SpellId = 0; - itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } - else if (!itemTemplate.Spells[1].SpellId) - { - sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1); - itemTemplate.Spells[0].SpellId = 0; - itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } - else if (itemTemplate.Spells[1].SpellId != -1) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); - if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) - { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); - itemTemplate.Spells[0].SpellId = 0; - itemTemplate.Spells[1].SpellId = 0; - itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } - // allowed only in special format - else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884)) - { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); - itemTemplate.Spells[0].SpellId = 0; - itemTemplate.Spells[1].SpellId = 0; - itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } - } + if (entry->ItemId[j] <= 0) + continue; - // spell_3*, spell_4*, spell_5* is empty - for (uint8 j = 2; j < MAX_ITEM_PROTO_SPELLS; ++j) - { - if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) - { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); - itemTemplate.Spells[j].SpellId = 0; - itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } - else if (itemTemplate.Spells[j].SpellId != 0) - { - sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId); - itemTemplate.Spells[j].SpellId = 0; - } - } - } - // normal spell list - else - { - for (uint8 j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j) - { - if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) - { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); - itemTemplate.Spells[j].SpellId = 0; - itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; - } + uint32 item_id = entry->ItemId[j]; - if (itemTemplate.Spells[j].SpellId && itemTemplate.Spells[j].SpellId != -1) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); - if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) - { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); - itemTemplate.Spells[j].SpellId = 0; - } - // allowed only in special format - else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884)) - { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); - itemTemplate.Spells[j].SpellId = 0; - } - } - } + if (!GetItemTemplate(item_id)) + notFoundOutfit.insert(item_id); } + } - if (itemTemplate.Bonding >= MAX_BIND_TYPE) - sLog->outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); - - if (itemTemplate.PageText && !GetPageText(itemTemplate.PageText)) - sLog->outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); + for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) + sLog->outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID)) - sLog->outErrorDb("Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); + sLog->outString(">> Loaded %u item templates from Item-sparse.db2 and %u from database in %u ms", sparseCount, dbCount, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); +} - if (itemTemplate.Sheath >= MAX_SHEATHETYPE) - { - sLog->outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); - itemTemplate.Sheath = SHEATHETYPE_NONE; - } +void ObjectMgr::LoadItemTemplateAddon() +{ + uint32 oldMSTime = getMSTime(); + uint32 count = 0; - if (itemTemplate.RandomProperty) + QueryResult result = WorldDatabase.Query("SELECT Id, BuyCount, FoodType, MinMoneyLoot, MaxMoneyLoot, SpellPPMChance FROM item_template_addon"); + if (result) + { + do { - // To be implemented later - if (itemTemplate.RandomProperty == -1) - itemTemplate.RandomProperty = 0; - - else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomProperty))) + Field* fields = result->Fetch(); + uint32 itemId = fields[0].GetUInt32(); + if (!GetItemTemplate(itemId)) { - sLog->outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); - itemTemplate.RandomProperty = 0; + sLog->outErrorDb("Item %u specified in `item_template_addon` does not exist, skipped.", itemId); + continue; } - } - - if (itemTemplate.RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomSuffix))) - { - sLog->outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); - itemTemplate.RandomSuffix = 0; - } - - if (itemTemplate.ItemSet && !sItemSetStore.LookupEntry(itemTemplate.ItemSet)) - { - sLog->outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); - itemTemplate.ItemSet = 0; - } - - if (itemTemplate.Area && !GetAreaEntryByAreaID(itemTemplate.Area)) - sLog->outErrorDb("Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); - if (itemTemplate.Map && !sMapStore.LookupEntry(itemTemplate.Map)) - sLog->outErrorDb("Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); - - if (itemTemplate.BagFamily) - { - // check bits - for (uint32 j = 0; j < sizeof(itemTemplate.BagFamily)*8; ++j) + uint8 buyCount = fields[1].GetUInt8(); + if (!buyCount) { - uint32 mask = 1 << j; - if ((itemTemplate.BagFamily & mask) == 0) - continue; - - ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1); - if (!bf) - { - sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); - itemTemplate.BagFamily &= ~mask; - continue; - } - - if (BAG_FAMILY_MASK_CURRENCY_TOKENS & mask) - { - CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate.ItemId); - if (!ctEntry) - { - sLog->outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); - itemTemplate.BagFamily &= ~mask; - } - } + sLog->outErrorDb("Item %u has BuyCount set to 0, corrected to 1.", itemId); + buyCount = 1; } - } - - if (itemTemplate.TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate.TotemCategory)) - sLog->outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); - for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) - { - if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color) + uint8 foodType = fields[2].GetUInt8(); + uint32 minMoneyLoot = fields[3].GetUInt32(); + uint32 maxMoneyLoot = fields[4].GetUInt32(); + if (minMoneyLoot > maxMoneyLoot) { - sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color); - itemTemplate.Socket[j].Color = 0; + sLog->outErrorDb("Minimum money loot specified in `item_template_addon` for item %u was greater than maximum amount, swapping.", itemId); + std::swap(minMoneyLoot, maxMoneyLoot); } - } - - if (itemTemplate.GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate.GemProperties)) - sLog->outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); - - if (itemTemplate.FoodType >= MAX_PET_DIET) - { - sLog->outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); - itemTemplate.FoodType = 0; - } - if (itemTemplate.ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate.ItemLimitCategory)) - { - sLog->outErrorDb("Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); - itemTemplate.ItemLimitCategory = 0; - } + ItemTemplate& itemTemplate = ItemTemplateStore[itemId]; + itemTemplate.BuyCount = buyCount; + itemTemplate.FoodType = foodType; + itemTemplate.MinMoneyLoot = minMoneyLoot; + itemTemplate.MaxMoneyLoot = maxMoneyLoot; + itemTemplate.SpellPPMRate = fields[5].GetFloat(); + ++count; + } while (result->NextRow()); + } - if (itemTemplate.HolidayId && !sHolidaysStore.LookupEntry(itemTemplate.HolidayId)) - { - sLog->outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); - itemTemplate.HolidayId = 0; - } + sLog->outString(">> Loaded %u item addon templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(); +} - ++count; - } - while (result->NextRow()); +void ObjectMgr::LoadItemScriptNames() +{ + uint32 oldMSTime = getMSTime(); + uint32 count = 0; - // Check if item templates for DBC referenced character start outfit are present - std::set notFoundOutfit; - for (uint32 i = 1; i < sCharStartOutfitStore.GetNumRows(); ++i) + QueryResult result = WorldDatabase.Query("SELECT Id, ScriptName FROM item_script_names"); + if (result) { - CharStartOutfitEntry const* entry = sCharStartOutfitStore.LookupEntry(i); - if (!entry) - continue; - - for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j) + do { - if (entry->ItemId[j] <= 0) + Field* fields = result->Fetch(); + uint32 itemId = fields[0].GetUInt32(); + if (!GetItemTemplate(itemId)) + { + sLog->outErrorDb("Item %u specified in `item_script_names` does not exist, skipped.", itemId); continue; + } - uint32 item_id = entry->ItemId[j]; - - if (!sObjectMgr->GetItemTemplate(item_id)) - notFoundOutfit.insert(item_id); - } + ItemTemplateStore[itemId].ScriptId = GetScriptId(fields[1].GetCString()); + ++count; + } while (result->NextRow()); } - for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) - sLog->outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - - sLog->outString(">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(">> Loaded %u item script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } @@ -8584,7 +8477,7 @@ void ObjectMgr::LoadScriptNames() "UNION " "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' " "UNION " - "SELECT DISTINCT(ScriptName) FROM item_template WHERE ScriptName <> '' " + "SELECT DISTINCT(ScriptName) FROM item_script_names WHERE ScriptName <> '' " "UNION " "SELECT DISTINCT(ScriptName) FROM areatrigger_scripts WHERE ScriptName <> '' " "UNION " @@ -8951,4 +8844,4 @@ VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) con if (itr != m_VehicleTemplateAccessoryMap.end()) return &itr->second; return NULL; -} +} \ No newline at end of file diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 88c593a009d..e6ac7036d48 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -865,6 +865,8 @@ class ObjectMgr void LoadGameobjects(); void LoadGameobjectRespawnTimes(); void LoadItemTemplates(); + void LoadItemTemplateAddon(); + void LoadItemScriptNames(); void LoadItemLocales(); void LoadItemSetNames(); void LoadItemSetNameLocales(); @@ -1285,7 +1287,6 @@ class ObjectMgr PlayerClassInfo playerClassInfo[MAX_CLASSES]; void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo* plinfo) const; - PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES]; typedef std::vector PlayerXPperLevel; // [level] diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 8eac07918de..dd1ae020a51 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -178,7 +178,7 @@ void GuildMgr::LoadGuilds() CharacterDatabase.DirectExecute("DELETE gm FROM guild_member gm LEFT JOIN guild g ON gm.guildId = g.guildId WHERE g.guildId IS NULL"); // 0 1 2 3 4 5 6 - QueryResult result = CharacterDatabase.Query("SELECT guildid, gm.guid, rank, pnote, offnote, BankResetTimeMoney, BankRemMoney, " + QueryResult result = CharacterDatabase.Query("SELECT gm.guildid, gm.guid, rank, pnote, offnote, BankResetTimeMoney, BankRemMoney, " // 7 8 9 10 11 12 "BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2, " // 13 14 15 16 17 18 diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index dd17e8277d6..acfb01ecc44 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -232,7 +232,7 @@ void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const void LootStore::ReportNotExistedId(uint32 id) const { - sLog->outErrorDb("Table '%s' entry %d (%s) not exist but used as loot id in DB.", GetName(), id, GetEntryName()); + sLog->outErrorDb("Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName()); } // @@ -1461,16 +1461,17 @@ void LoadLootTemplates_Disenchant() LootIdSet lootIdSet, loodIdSetUsed; uint32 count = LootTemplates_Disenchant.LoadAndCollectLootIds(lootIdSet); - ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); - for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) + for (uint32 i = 0; i < sItemDisenchantLootStore.GetNumRows(); ++i) { - if (uint32 lootid = itr->second.DisenchantID) - { - if (lootIdSet.find(lootid) == lootIdSet.end()) - LootTemplates_Disenchant.ReportNotExistedId(lootid); - else - loodIdSetUsed.insert(lootid); - } + ItemDisenchantLootEntry const* disenchant = sItemDisenchantLootStore.LookupEntry(i); + if (!disenchant) + continue; + + uint32 lootid = disenchant->Id; + if (lootIdSet.find(lootid) == lootIdSet.end()) + LootTemplates_Disenchant.ReportNotExistedId(lootid); + else + loodIdSetUsed.insert(lootid); } for (LootIdSet::const_iterator itr = loodIdSetUsed.begin(); itr != loodIdSetUsed.end(); ++itr) diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index 53b864b4d90..3f301a7aba8 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -280,160 +280,153 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data) // Only _static_ data send in this packet !!! void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_ITEM_QUERY_SINGLE"); - uint32 item; - recv_data >> item; + uint32 count, type; + recv_data >> count >> type; - sLog->outDetail("STORAGE: Item Query = %u", item); + if (type != DB2_REPLY_SPARSE && type != DB2_REPLY_ITEM) + return; - ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); - if (pProto) + for (uint32 i = 0; i < count; ++i) { - std::string Name = pProto->Name1; - std::string Description = pProto->Description; - - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + uint32 item; + recv_data >> item; + recv_data.read_skip(); + WorldPacket data2(SMSG_DB_REPLY, 700); + ByteBuffer data; + data2 << uint32(type); + data2 << uint32(item); + + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item); + if (proto) { - if (ItemLocale const* il = sObjectMgr->GetItemLocale(pProto->ItemId)) + data << uint32(item); + if (type == DB2_REPLY_ITEM) { - ObjectMgr::GetLocaleString(il->Name, loc_idx, Name); - ObjectMgr::GetLocaleString(il->Description, loc_idx, Description); + data << uint32(proto->Class); + data << uint32(proto->SubClass); + data << int32(proto->Unk0); + data << uint32(proto->Material); + data << uint32(proto->DisplayInfoID); + data << uint32(proto->InventoryType); + data << uint32(proto->Sheath); } - } - // guess size - WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); - data << pProto->ItemId; - data << pProto->Class; - data << pProto->SubClass; - data << int32(pProto->Unk0); // new 2.0.3, not exist in wdb cache? - data << Name; - data << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name... - data << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00); - data << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00); - data << pProto->DisplayInfoID; - data << pProto->Quality; - data << pProto->Flags; - data << pProto->Flags2; - data << pProto->BuyPrice; - data << pProto->SellPrice; - data << pProto->InventoryType; - data << pProto->AllowableClass; - data << pProto->AllowableRace; - data << pProto->ItemLevel; - data << pProto->RequiredLevel; - data << pProto->RequiredSkill; - data << pProto->RequiredSkillRank; - data << pProto->RequiredSpell; - data << pProto->RequiredHonorRank; - data << pProto->RequiredCityRank; - data << pProto->RequiredReputationFaction; - data << pProto->RequiredReputationRank; - data << int32(pProto->MaxCount); - data << int32(pProto->Stackable); - data << pProto->ContainerSlots; - data << pProto->StatsCount; // item stats count - for (uint32 i = 0; i < pProto->StatsCount; ++i) - { - data << pProto->ItemStat[i].ItemStatType; - data << pProto->ItemStat[i].ItemStatValue; - } - data << pProto->ScalingStatDistribution; // scaling stats distribution - data << uint32(0); - for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) - { - data << pProto->Damage[i].DamageMin; - data << pProto->Damage[i].DamageMax; - data << pProto->Damage[i].DamageType; - } - - // resistances (7) - data << pProto->Armor; - data << pProto->HolyRes; - data << pProto->FireRes; - data << pProto->NatureRes; - data << pProto->FrostRes; - data << pProto->ShadowRes; - data << pProto->ArcaneRes; - - data << pProto->Delay; - data << pProto->AmmoType; - data << pProto->RangedModRange; - - for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) - { - // send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown - // use `item_template` or if not set then only use spell cooldowns - SpellInfo const* spell = sSpellMgr->GetSpellInfo(pProto->Spells[s].SpellId); - if (spell) + else if (type == DB2_REPLY_SPARSE) { - bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0; - - data << pProto->Spells[s].SpellId; - data << pProto->Spells[s].SpellTrigger; - data << uint32(-abs(pProto->Spells[s].SpellCharges)); - - if (db_data) - { - data << uint32(pProto->Spells[s].SpellCooldown); - data << uint32(pProto->Spells[s].SpellCategory); - data << uint32(pProto->Spells[s].SpellCategoryCooldown); - } - else - { - data << uint32(spell->RecoveryTime); - data << uint32(spell->Category); - data << uint32(spell->CategoryRecoveryTime); - } + data << uint32(proto->Quality); + data << uint32(proto->Flags); + data << uint32(proto->Flags2); + data << int32(proto->BuyPrice); + data << uint32(proto->SellPrice); + data << uint32(proto->InventoryType); + data << int32(proto->AllowableClass); + data << int32(proto->AllowableRace); + data << uint32(proto->ItemLevel); + data << uint32(proto->RequiredLevel); + data << uint32(proto->RequiredSkill); + data << uint32(proto->RequiredSkillRank); + data << uint32(proto->RequiredSpell); + data << uint32(proto->RequiredHonorRank); + data << uint32(proto->RequiredCityRank); + data << uint32(proto->RequiredReputationFaction); + data << uint32(proto->RequiredReputationRank); + data << int32(proto->MaxCount); + data << int32(proto->Stackable); + data << uint32(proto->ContainerSlots); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) + data << uint32(proto->ItemStat[x].ItemStatType); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) + data << int32(proto->ItemStat[x].ItemStatValue); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) + data << int32(proto->ItemStat[x].ItemStatUnk1); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x) + data << int32(proto->ItemStat[x].ItemStatUnk2); + + data << uint32(proto->ScalingStatDistribution); + data << uint32(proto->DamageType); + data << uint32(proto->Delay); + data << float(proto->RangedModRange); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) + data << int32(proto->Spells[x].SpellId); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) + data << uint32(proto->Spells[x].SpellTrigger); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) + data << int32(proto->Spells[x].SpellCharges); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) + data << int32(proto->Spells[x].SpellCooldown); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) + data << uint32(proto->Spells[x].SpellCategory); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x) + data << int32(proto->Spells[x].SpellCategoryCooldown); + + data << uint32(proto->Bonding); + + // item name + std::string name = proto->Name1; + data << uint16(name.length() + 1); + data << name; + + for (uint32 i = 0; i < 3; ++i) // other 3 names + data << uint16(0); + + std::string desc = proto->Description; + data << uint16(desc.length() + 1); + data << desc; + + data << uint32(proto->PageText); + data << uint32(proto->LanguageID); + data << uint32(proto->PageMaterial); + data << uint32(proto->StartQuest); + data << uint32(proto->LockID); + data << int32(proto->Material); + data << uint32(proto->Sheath); + data << int32(proto->RandomProperty); + data << int32(proto->RandomSuffix); + data << uint32(proto->ItemSet); + data << uint32(proto->MaxDurability); + + data << uint32(proto->Area); + data << uint32(proto->Map); + data << uint32(proto->BagFamily); + data << uint32(proto->TotemCategory); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x) + data << uint32(proto->Socket[x].Color); + + for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x) + data << uint32(proto->Socket[x].Content); + + data << uint32(proto->socketBonus); + data << uint32(proto->GemProperties); + data << float(proto->ArmorDamageModifier); + data << int32(proto->Duration); + data << uint32(proto->ItemLimitCategory); + data << uint32(proto->HolidayId); + data << float(proto->StatScalingFactor); // StatScalingFactor + data << uint32(proto->Field130); // archaeology unk + data << uint32(proto->Field131); // archaeology findinds count } else { + data << uint32(item | 0x80000000); // sometimes with | 0x80000000 data << uint32(0); - data << uint32(0); - data << uint32(0); - data << uint32(-1); - data << uint32(0); - data << uint32(-1); } + + data2 << uint32(data.size()); + data2.append(data); } - data << pProto->Bonding; - data << Description; - data << pProto->PageText; - data << pProto->LanguageID; - data << pProto->PageMaterial; - data << pProto->StartQuest; - data << pProto->LockID; - data << int32(pProto->Material); - data << pProto->Sheath; - data << pProto->RandomProperty; - data << pProto->RandomSuffix; - data << pProto->Block; - data << pProto->ItemSet; - data << pProto->MaxDurability; - data << pProto->Area; - data << pProto->Map; // Added in 1.12.x & 2.0.1 client branch - data << pProto->BagFamily; - data << pProto->TotemCategory; - for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s) - { - data << pProto->Socket[s].Color; - data << pProto->Socket[s].Content; - } - data << pProto->socketBonus; - data << pProto->GemProperties; - data << pProto->RequiredDisenchantSkill; - data << pProto->ArmorDamageModifier; - data << uint32(abs(pProto->Duration)); // added in 2.4.2.8209, duration (seconds) - data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory - data << pProto->HolidayId; // Holiday.dbc? - SendPacket(&data); - } - else - { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); - WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); - data << uint32(item | 0x80000000); - SendPacket(&data); + + data2 << uint32(type); + _player->GetSession()->SendPacket(&data2); } } @@ -981,25 +974,6 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) } } -void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data) -{ - if (!GetPlayer()->isAlive()) - { - GetPlayer()->SendEquipError(EQUIP_ERR_YOU_ARE_DEAD, NULL, NULL); - return; - } - - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_AMMO"); - uint32 item; - - recv_data >> item; - - if (!item) - GetPlayer()->RemoveAmmo(); - else - GetPlayer()->SetAmmo(item); -} - void WorldSession::SendEnchantmentLog(uint64 Target, uint64 Caster, uint32 ItemID, uint32 SpellID) { WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4+1)); // last check 2.0.10 diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 8f0487d563f..ad182b4120a 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -40,7 +40,7 @@ void InitOpcodes() } memset(opcodeTable, 0, sizeof(opcodeTable)); - + //DEFINE_OPCODE_HANDLER(MSG_NULL_ACTION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //DEFINE_OPCODE_HANDLER(CMSG_BOOTME, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //DEFINE_OPCODE_HANDLER(CMSG_DBLOOKUP, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); @@ -658,7 +658,7 @@ void InitOpcodes() //DEFINE_OPCODE_HANDLER(SMSG_AUCTION_BIDDER_LIST_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(SMSG_SET_FLAT_SPELL_MODIFIER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(SMSG_SET_PCT_SPELL_MODIFIER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); - //DEFINE_OPCODE_HANDLER(CMSG_SET_AMMO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetAmmoOpcode ); + //DEFINE_OPCODE_HANDLER(CMSG_SET_AMMO, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //DEFINE_OPCODE_HANDLER(SMSG_CORPSE_RECLAIM_DELAY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(CMSG_SET_ACTIVE_MOVER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetActiveMoverOpcode ); //DEFINE_OPCODE_HANDLER(CMSG_PET_CANCEL_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandlePetCancelAuraOpcode ); @@ -707,7 +707,7 @@ void InitOpcodes() //DEFINE_OPCODE_HANDLER(CMSG_LFG_GET_STATUS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //DEFINE_OPCODE_HANDLER(SMSG_SHOW_MAILBOX, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(SMSG_RESET_RANGED_COMBAT_TIMER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); - ////DEFINE_OPCODE_HANDLER(SMSG_MEETINGSTONE_MEMBER_ADDED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); + //DEFINE_OPCODE_HANDLER(SMSG_MEETINGSTONE_MEMBER_ADDED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(SMSG_CHAT_NOT_IN_PARTY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(CMSG_CANCEL_GROWTH_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelGrowthAuraOpcode ); //DEFINE_OPCODE_HANDLER(SMSG_CANCEL_AUTO_REPEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); @@ -919,7 +919,7 @@ void InitOpcodes() //DEFINE_OPCODE_HANDLER(CMSG_LFG_SET_ROLES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfgSetRolesOpcode ); //DEFINE_OPCODE_HANDLER(CMSG_LFG_SET_NEEDS, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL ); //DEFINE_OPCODE_HANDLER(CMSG_LFG_SET_BOOT_VOTE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfgSetBootVoteOpcode ); - ////DEFINE_OPCODE_HANDLER(SMSG_LFG_BOOT_PROPOSAL_UPDATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); + //DEFINE_OPCODE_HANDLER(SMSG_LFG_BOOT_PROPOSAL_UPDATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(CMSG_LFD_PLAYER_LOCK_INFO_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfgPlayerLockInfoRequestOpcode); //DEFINE_OPCODE_HANDLER(SMSG_LFG_PLAYER_INFO, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide ); //DEFINE_OPCODE_HANDLER(CMSG_LFG_TELEPORT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfgTeleportOpcode ); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 6421edaa7c6..db71fe0941b 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -137,6 +137,9 @@ enum CharterTypes ARENA_TEAM_CHARTER_5v5_TYPE = 5 }; +#define DB2_REPLY_SPARSE 2442913102 +#define DB2_REPLY_ITEM 1344507586 + //class to deal with packet processing //allows to determine if next packet is safe to be processed class PacketFilter @@ -478,7 +481,6 @@ class WorldSession void HandleDelIgnoreOpcode(WorldPacket& recvPacket); void HandleSetContactNotesOpcode(WorldPacket& recvPacket); void HandleBugOpcode(WorldPacket& recvPacket); - void HandleSetAmmoOpcode(WorldPacket& recvPacket); void HandleItemNameQueryOpcode(WorldPacket& recvPacket); void HandleAreaTriggerOpcode(WorldPacket& recvPacket); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 20ee5ce39e4..867ae80319f 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1992,7 +1992,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo { case FORM_CAT: { - int32 basePoints = int32(std::min(oldPower, FurorChance)); + int32 basePoints = std::min(oldPower, FurorChance); target->SetPower(POWER_ENERGY, 0); target->CastCustomSpell(target, 17099, &basePoints, NULL, NULL, true, NULL, this); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index c1749867945..c47d6d08990 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -513,7 +513,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme // wand case if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK)) - m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType); + m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->DamageType); if (originalCasterGUID) m_originalCasterGUID = originalCasterGUID; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a3ff66f7b5b..f98d0ab3e46 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -694,8 +694,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex) Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); if (item) { - float dmg_min = item->GetTemplate()->Damage->DamageMin; - float dmg_max = item->GetTemplate()->Damage->DamageMax; + float dmg_min = item->GetTemplate()->DamageMin; + float dmg_max = item->GetTemplate()->DamageMax; if (dmg_max == 0.0f && dmg_min > dmg_max) damage += int32(dmg_min); else diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index e4ee17e324d..64f4e40c32b 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1344,13 +1344,19 @@ void World::SetInitialWorldSettings() sLog->outString("Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); - sLog->outString("Loading Disables"); - DisableMgr::LoadDisables(); // must be before loading quests and items + sLog->outString("Loading Disables..."); + DisableMgr::LoadDisables(); // must be before loading quests and items - sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts + sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); - sLog->outString("Loading Item set names..."); // must be after LoadItemPrototypes + sLog->outString("Loading Item Extra Data..."); // must be after LoadItemPrototypes + sObjectMgr->LoadItemTemplateAddon(); + + sLog->outString("Loading Item Scripts..."); // must be after LoadItemPrototypes + sObjectMgr->LoadItemScriptNames(); + + sLog->outString("Loading Item set names..."); // must be after LoadItemPrototypes sObjectMgr->LoadItemSetNames(); sLog->outString("Loading Creature Model Based Info Data..."); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 536db9dcd30..41e9a1c8220 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -266,7 +266,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() // Corpse PREPARE_STATEMENT(CHAR_LOAD_CORPSES, "SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0", CONNECTION_SYNCH) - PREPARE_STATEMENT(CHAR_ADD_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) + PREPARE_STATEMENT(CHAR_ADD_CORPSE, "INSERT INTO corpse (corpseGuid, guid, posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, phaseMask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_CORPSE, "DELETE FROM corpse WHERE corpseGuid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_PLAYER_CORPSES, "DELETE FROM corpse WHERE guid = ? AND corpseType <> 0", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_DEL_OLD_CORPSES, "DELETE FROM corpse WHERE corpseType = 0 OR time < (UNIX_TIMESTAMP(NOW()) - ?)", CONNECTION_ASYNC) diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 93a9aaa6d80..a4a996b299a 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -108,7 +108,7 @@ class ByteBuffer { ++_bitpos; if (_bitpos > 7) - { + { _bitpos = 0; _curbitval = read(); } -- cgit v1.2.3 From 5a4636c145cc5e2eaab9ea8a105f61a5fef34dcd Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 26 Nov 2011 03:00:06 +0000 Subject: Core|DB/Quests: Rename and re-order fields in `quest_template` table, for the sake of consistency Order should match SMSG_QUEST_QUERY_RESPONSE --- src/server/game/Entities/Creature/GossipDef.cpp | 76 ++-- src/server/game/Entities/Player/Player.cpp | 136 +++---- src/server/game/Globals/ObjectMgr.cpp | 393 ++++++++++----------- src/server/game/Quests/QuestDef.cpp | 206 +++++------ src/server/game/Quests/QuestDef.h | 172 ++++----- .../game/Server/Protocol/Handlers/LFGHandler.cpp | 16 +- .../game/Server/Protocol/Handlers/QuestHandler.cpp | 2 +- src/server/scripts/Commands/cs_quest.cpp | 10 +- src/server/scripts/Northrend/borean_tundra.cpp | 2 +- src/server/scripts/World/go_scripts.cpp | 2 +- 10 files changed, 509 insertions(+), 506 deletions(-) (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 90011dbae22..5bf7910466c 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -337,13 +337,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, data << uint32(quest->GetRewChoiceItemsCount()); for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { - if (!quest->RewChoiceItemId[i]) + if (!quest->RewardChoiceItemId[i]) continue; - data << uint32(quest->RewChoiceItemId[i]); - data << uint32(quest->RewChoiceItemCount[i]); + data << uint32(quest->RewardChoiceItemId[i]); + data << uint32(quest->RewardChoiceItemCount[i]); - if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewChoiceItemId[i])) + if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i])) data << uint32(itemTemplate->DisplayInfoID); else data << uint32(0x00); @@ -353,13 +353,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, for (uint32 i=0; i < QUEST_REWARDS_COUNT; ++i) { - if (!quest->RewItemId[i]) + if (!quest->RewardItemId[i]) continue; - data << uint32(quest->RewItemId[i]); - data << uint32(quest->RewItemCount[i]); + data << uint32(quest->RewardItemId[i]); + data << uint32(quest->RewardItemIdCount[i]); - if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewItemId[i])) + if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i])) data << uint32(itemTemplate->DisplayInfoID); else data << uint32(0); @@ -380,13 +380,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, data << uint32(0); // unk for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - data << uint32(quest->RewRepFaction[i]); + data << uint32(quest->RewardFactionId[i]); for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - data << int32(quest->RewRepValueId[i]); + data << int32(quest->RewardFactionValueId[i]); for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - data << int32(quest->RewRepValue[i]); + data << int32(quest->RewardFactionValueIdOverride[i]); data << uint32(QUEST_EMOTE_COUNT); for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i) @@ -478,24 +478,24 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const { for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) { - data << uint32(quest->RewItemId[i]); - data << uint32(quest->RewItemCount[i]); + data << uint32(quest->RewardItemId[i]); + data << uint32(quest->RewardItemIdCount[i]); } for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { - data << uint32(quest->RewChoiceItemId[i]); - data << uint32(quest->RewChoiceItemCount[i]); + data << uint32(quest->RewardChoiceItemId[i]); + data << uint32(quest->RewardChoiceItemCount[i]); } } for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids - data << uint32(quest->RewRepFaction[i]); + data << uint32(quest->RewardFactionId[i]); for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc? - data << int32(quest->RewRepValueId[i]); + data << int32(quest->RewardFactionValueId[i]); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0) - data << int32(quest->RewRepValue[i]); + data << int32(quest->RewardFactionValueIdOverride[i]); data << quest->GetPointMapId(); data << quest->GetPointX(); @@ -510,20 +510,20 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - if (quest->ReqCreatureOrGOId[i] < 0) - data << uint32((quest->ReqCreatureOrGOId[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000) + if (quest->RequiredNpcOrGo[i] < 0) + data << uint32((quest->RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000) else - data << uint32(quest->ReqCreatureOrGOId[i]); + data << uint32(quest->RequiredNpcOrGo[i]); - data << uint32(quest->ReqCreatureOrGOCount[i]); - data << uint32(quest->ReqSourceId[i]); + data << uint32(quest->RequiredNpcOrGoCount[i]); + data << uint32(quest->RequiredSourceItemid[i]); data << uint32(0); // req source count? } for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - data << uint32(quest->ReqItemId[i]); - data << uint32(quest->ReqItemCount[i]); + data << uint32(quest->RequiredItemId[i]); + data << uint32(quest->RequiredItemCount[i]); } for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) @@ -576,10 +576,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(quest->GetRewChoiceItemsCount()); for (uint32 i=0; i < quest->GetRewChoiceItemsCount(); ++i) { - data << uint32(quest->RewChoiceItemId[i]); - data << uint32(quest->RewChoiceItemCount[i]); + data << uint32(quest->RewardChoiceItemId[i]); + data << uint32(quest->RewardChoiceItemCount[i]); - if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewChoiceItemId[i])) + if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i])) data << uint32(itemTemplate->DisplayInfoID); else data << uint32(0); @@ -588,10 +588,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(quest->GetRewItemsCount()); for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i) { - data << uint32(quest->RewItemId[i]); - data << uint32(quest->RewItemCount[i]); + data << uint32(quest->RewardItemId[i]); + data << uint32(quest->RewardItemIdCount[i]); - if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewItemId[i])) + if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i])) data << uint32(itemTemplate->DisplayInfoID); else data << uint32(0); @@ -612,13 +612,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(0); for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids - data << uint32(quest->RewRepFaction[i]); + data << uint32(quest->RewardFactionId[i]); for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)? - data << int32(quest->RewRepValueId[i]); + data << int32(quest->RewardFactionValueId[i]); for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override? - data << uint32(quest->RewRepValue[i]); + data << uint32(quest->RewardFactionValueIdOverride[i]); _session->SendPacket(&data); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); @@ -676,13 +676,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, data << uint32(quest->GetReqItemsCount()); for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - if (!quest->ReqItemId[i]) + if (!quest->RequiredItemId[i]) continue; - data << uint32(quest->ReqItemId[i]); - data << uint32(quest->ReqItemCount[i]); + data << uint32(quest->RequiredItemId[i]); + data << uint32(quest->RequiredItemCount[i]); - if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->ReqItemId[i])) + if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i])) data << uint32(itemTemplate->DisplayInfoID); else data << uint32(0); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 39a9264922f..9dacd76fffc 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7016,22 +7016,22 @@ void Player::RewardReputation(Quest const* quest) // quest reputation reward/loss for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) { - if (!quest->RewRepFaction[i]) + if (!quest->RewardFactionId[i]) continue; - if (quest->RewRepValue[i]) + if (quest->RewardFactionValueIdOverride[i]) { - int32 rep = CalculateReputationGain(GetQuestLevel(quest), quest->RewRepValue[i]/100, quest->RewRepFaction[i], true, true); + int32 rep = CalculateReputationGain(GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true, true); if (recruitAFriend) rep = int32(rep * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewRepFaction[i])) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i])) GetReputationMgr().ModifyReputation(factionEntry, rep); } else { - uint32 row = ((quest->RewRepValueId[i] < 0) ? 1 : 0) + 1; - uint32 field = abs(quest->RewRepValueId[i]); + uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1; + uint32 field = abs(quest->RewardFactionValueId[i]); if (const QuestFactionRewEntry* pRow = sQuestFactionRewardStore.LookupEntry(row)) { @@ -7040,12 +7040,12 @@ void Player::RewardReputation(Quest const* quest) if (!repPoints) continue; - repPoints = CalculateReputationGain(GetQuestLevel(quest), repPoints, quest->RewRepFaction[i], true); + repPoints = CalculateReputationGain(GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true); if (recruitAFriend) repPoints = int32(repPoints * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(quest->RewRepFaction[i])) + if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i])) GetReputationMgr().ModifyReputation(factionEntry, repPoints); } } @@ -14589,7 +14589,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) { - if (qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i]) + if (qInfo->RequiredItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->RequiredItemCount[i]) return false; } } @@ -14598,10 +14598,10 @@ bool Player::CanCompleteQuest(uint32 quest_id) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { - if (qInfo->ReqCreatureOrGOId[i] == 0) + if (qInfo->RequiredNpcOrGo[i] == 0) continue; - if (qInfo->ReqCreatureOrGOCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->ReqCreatureOrGOCount[i]) + if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->RequiredNpcOrGoCount[i]) return false; } } @@ -14642,7 +14642,7 @@ bool Player::CanCompleteRepeatableQuest(Quest const* quest) if (quest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) - if (quest->ReqItemId[i] && quest->ReqItemCount[i] && !HasItemCount(quest->ReqItemId[i], quest->ReqItemCount[i])) + if (quest->RequiredItemId[i] && quest->RequiredItemCount[i] && !HasItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i])) return false; if (!CanRewardQuest(quest, false)) @@ -14670,11 +14670,11 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) { - if (quest->ReqItemCount[i]!= 0 && - GetItemCount(quest->ReqItemId[i]) < quest->ReqItemCount[i]) + if (quest->RequiredItemCount[i]!= 0 && + GetItemCount(quest->RequiredItemId[i]) < quest->RequiredItemCount[i]) { if (msg) - SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, quest->ReqItemId[i]); + SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, quest->RequiredItemId[i]); return false; } } @@ -14695,13 +14695,13 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) if (quest->GetRewChoiceItemsCount() > 0) { - if (quest->RewChoiceItemId[reward]) + if (quest->RewardChoiceItemId[reward]) { ItemPosCountVec dest; - InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewChoiceItemId[reward], quest->RewChoiceItemCount[reward]); + InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardChoiceItemId[reward], quest->RewardChoiceItemCount[reward]); if (res != EQUIP_ERR_OK) { - SendEquipError(res, NULL, NULL, quest->RewChoiceItemId[reward]); + SendEquipError(res, NULL, NULL, quest->RewardChoiceItemId[reward]); return false; } } @@ -14711,13 +14711,13 @@ bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) { for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i) { - if (quest->RewItemId[i]) + if (quest->RewardItemId[i]) { ItemPosCountVec dest; - InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewItemId[i], quest->RewItemCount[i]); + InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, quest->RewardItemId[i], quest->RewardItemIdCount[i]); if (res != EQUIP_ERR_OK) { - SendEquipError(res, NULL, NULL, quest->RewItemId[i]); + SendEquipError(res, NULL, NULL, quest->RewardItemId[i]); return false; } } @@ -14850,15 +14850,15 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, uint32 quest_id = quest->GetQuestId(); for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - if (quest->ReqItemId[i]) - DestroyItemCount(quest->ReqItemId[i], quest->ReqItemCount[i], true); + if (quest->RequiredItemId[i]) + DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true); for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) { - if (quest->ReqSourceId[i]) + if (quest->RequiredSourceItemid[i]) { - uint32 count = quest->ReqSourceCount[i]; - DestroyItemCount(quest->ReqSourceId[i], count ? count : 9999, true); + uint32 count = quest->RequiredSourceItemId[i]; + DestroyItemCount(quest->RequiredSourceItemid[i], count ? count : 9999, true); } } @@ -14866,13 +14866,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (quest->GetRewChoiceItemsCount() > 0) { - if (uint32 itemId = quest->RewChoiceItemId[reward]) + if (uint32 itemId = quest->RewardChoiceItemId[reward]) { ItemPosCountVec dest; - if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewChoiceItemCount[reward]) == EQUIP_ERR_OK) + if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardChoiceItemCount[reward]) == EQUIP_ERR_OK) { Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); - SendNewItem(item, quest->RewChoiceItemCount[reward], true, false); + SendNewItem(item, quest->RewardChoiceItemCount[reward], true, false); } } } @@ -14881,13 +14881,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, { for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i) { - if (uint32 itemId = quest->RewItemId[i]) + if (uint32 itemId = quest->RewardItemId[i]) { ItemPosCountVec dest; - if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewItemCount[i]) == EQUIP_ERR_OK) + if (CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, quest->RewardItemIdCount[i]) == EQUIP_ERR_OK) { Item* item = StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); - SendNewItem(item, quest->RewItemCount[i], true, false); + SendNewItem(item, quest->RewardItemIdCount[i], true, false); } } } @@ -15051,13 +15051,13 @@ void Player::FailQuest(uint32 questId) // Destroy quest items on quest failure. for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - if (quest->ReqItemId[i] > 0 && quest->ReqItemCount[i] > 0) + if (quest->RequiredItemId[i] > 0 && quest->RequiredItemCount[i] > 0) // Destroy items recieved on starting the quest. - DestroyItemCount(quest->ReqItemId[i], quest->ReqItemCount[i], true, true); + DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true, true); for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - if (quest->ReqSourceId[i] > 0 && quest->ReqSourceCount[i] > 0) + if (quest->RequiredSourceItemid[i] > 0 && quest->RequiredSourceItemId[i] > 0) // Destroy items recieved during the quest. - DestroyItemCount(quest->ReqSourceId[i], quest->ReqSourceCount[i], true, true); + DestroyItemCount(quest->RequiredSourceItemid[i], quest->RequiredSourceItemId[i], true, true); } } @@ -15478,7 +15478,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg) // exist two cases when destroy source quest item not possible: // a) non un-equippable item (equipped non-empty bag, for example) // b) when quest is started from an item and item also is needed in - // the end as ReqItemId + // the end as RequiredItemId InventoryResult res = CanUnequipItems(srcItemId, count); if (res != EQUIP_ERR_OK) { @@ -15488,7 +15488,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg) } for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n) - if (item->StartQuest == questId && srcItemId == quest->ReqItemId[n]) + if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n]) destroyItem = false; if (destroyItem) @@ -15580,7 +15580,7 @@ uint16 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) return 0; for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) - if (qInfo->ReqCreatureOrGOId[j] == entry) + if (qInfo->RequiredNpcOrGo[j] == entry) return m_QuestStatus[quest_id].m_creatureOrGOcount[j]; return 0; @@ -15592,10 +15592,10 @@ void Player::AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questS { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - uint32 reqitemcount = quest->ReqItemCount[i]; + uint32 reqitemcount = quest->RequiredItemCount[i]; if (reqitemcount != 0) { - uint32 curitemcount = GetItemCount(quest->ReqItemId[i], true); + uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true); questStatusData.m_itemcount[i] = std::min(curitemcount, reqitemcount); m_QuestStatusSave[quest->GetQuestId()] = true; @@ -15670,10 +15670,10 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) { - uint32 reqitem = qInfo->ReqItemId[j]; + uint32 reqitem = qInfo->RequiredItemId[j]; if (reqitem == entry) { - uint32 reqitemcount = qInfo->ReqItemCount[j]; + uint32 reqitemcount = qInfo->RequiredItemCount[j]; uint16 curitemcount = q_status.m_itemcount[j]; if (curitemcount < reqitemcount) { @@ -15708,12 +15708,12 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) { - uint32 reqitem = qInfo->ReqItemId[j]; + uint32 reqitem = qInfo->RequiredItemId[j]; if (reqitem == entry) { QuestStatusData& q_status = m_QuestStatus[questid]; - uint32 reqitemcount = qInfo->ReqItemCount[j]; + uint32 reqitemcount = qInfo->RequiredItemCount[j]; uint16 curitemcount; if (q_status.m_status != QUEST_STATUS_COMPLETE) curitemcount = q_status.m_itemcount[j]; @@ -15777,18 +15777,18 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip GO activate objective or none - if (qInfo->ReqCreatureOrGOId[j] <= 0) + if (qInfo->RequiredNpcOrGo[j] <= 0) continue; // skip Cast at creature objective - if (qInfo->ReqSpell[j] != 0) + if (qInfo->RequiredSpellCast[j] != 0) continue; - uint32 reqkill = qInfo->ReqCreatureOrGOId[j]; + uint32 reqkill = qInfo->RequiredNpcOrGo[j]; if (reqkill == real_entry) { - uint32 reqkillcount = qInfo->ReqCreatureOrGOCount[j]; + uint32 reqkillcount = qInfo->RequiredNpcOrGoCount[j]; uint16 curkillcount = q_status.m_creatureOrGOcount[j]; if (curkillcount < reqkillcount) { @@ -15874,7 +15874,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip kill creature objective (0) or wrong spell casts - if (qInfo->ReqSpell[j] != spell_id) + if (qInfo->RequiredSpellCast[j] != spell_id) continue; uint32 reqTarget = 0; @@ -15882,10 +15882,10 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) if (isCreature) { // creature activate objectives - if (qInfo->ReqCreatureOrGOId[j] > 0) + if (qInfo->RequiredNpcOrGo[j] > 0) { // checked at quest_template loading - reqTarget = qInfo->ReqCreatureOrGOId[j]; + reqTarget = qInfo->RequiredNpcOrGo[j]; if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template { CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); @@ -15898,16 +15898,16 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) else { // GO activate objective - if (qInfo->ReqCreatureOrGOId[j] < 0) + if (qInfo->RequiredNpcOrGo[j] < 0) // checked at quest_template loading - reqTarget = - qInfo->ReqCreatureOrGOId[j]; + reqTarget = - qInfo->RequiredNpcOrGo[j]; } // other not this creature/GO related objectives if (reqTarget != entry) continue; - uint32 reqCastCount = qInfo->ReqCreatureOrGOCount[j]; + uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j]; uint16 curCastCount = q_status.m_creatureOrGOcount[j]; if (curCastCount < reqCastCount) { @@ -15951,20 +15951,20 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid) for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip spell casts and Gameobject objectives - if (qInfo->ReqSpell[j] > 0 || qInfo->ReqCreatureOrGOId[j] < 0) + if (qInfo->RequiredSpellCast[j] > 0 || qInfo->RequiredNpcOrGo[j] < 0) continue; uint32 reqTarget = 0; - if (qInfo->ReqCreatureOrGOId[j] > 0) // creature activate objectives + if (qInfo->RequiredNpcOrGo[j] > 0) // creature activate objectives // checked at quest_template loading - reqTarget = qInfo->ReqCreatureOrGOId[j]; + reqTarget = qInfo->RequiredNpcOrGo[j]; else continue; if (reqTarget == entry) { - uint32 reqTalkCount = qInfo->ReqCreatureOrGOCount[j]; + uint32 reqTalkCount = qInfo->RequiredNpcOrGoCount[j]; uint16 curTalkCount = q_status.m_creatureOrGOcount[j]; if (curTalkCount < reqTalkCount) { @@ -16101,14 +16101,14 @@ bool Player::HasQuestForItem(uint32 itemid) const // This part for ReqItem drop for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) { - if (itemid == qinfo->ReqItemId[j] && q_status.m_itemcount[j] < qinfo->ReqItemCount[j]) + if (itemid == qinfo->RequiredItemId[j] && q_status.m_itemcount[j] < qinfo->RequiredItemCount[j]) return true; } // This part - for ReqSource for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j) { // examined item is a source item - if (qinfo->ReqSourceId[j] == itemid) + if (qinfo->RequiredSourceItemid[j] == itemid) { ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid); @@ -16117,9 +16117,9 @@ bool Player::HasQuestForItem(uint32 itemid) const return true; // allows custom amount drop when not 0 - if (qinfo->ReqSourceCount[j]) + if (qinfo->RequiredSourceItemId[j]) { - if (GetItemCount(itemid, true) < qinfo->ReqSourceCount[j]) + if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemId[j]) return true; } else if (GetItemCount(itemid, true) < pProto->GetMaxStackSize()) return true; @@ -16237,7 +16237,7 @@ void Player::SendQuestUpdateAddItem(Quest const* /*quest*/, uint32 /*item_idx*/, { WorldPacket data(SMSG_QUESTUPDATE_ADD_ITEM, 0); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); - //data << quest->ReqItemId[item_idx]; + //data << quest->RequiredItemId[item_idx]; //data << count; GetSession()->SendPacket(&data); } @@ -16246,7 +16246,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin { ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)"); - int32 entry = quest->ReqCreatureOrGOId[ creatureOrGO_idx ]; + int32 entry = quest->RequiredNpcOrGo[ creatureOrGO_idx ]; if (entry < 0) // client expected gameobject template id in form (id|0x80000000) entry = (-entry) | 0x80000000; @@ -16256,7 +16256,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin data << uint32(quest->GetQuestId()); data << uint32(entry); data << uint32(old_count + add_count); - data << uint32(quest->ReqCreatureOrGOCount[ creatureOrGO_idx ]); + data << uint32(quest->RequiredNpcOrGoCount[ creatureOrGO_idx ]); data << uint64(guid); GetSession()->SendPacket(&data); @@ -22064,10 +22064,10 @@ bool Player::HasQuestForGO(int32 GOId) const for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { - if (qinfo->ReqCreatureOrGOId[j] >= 0) //skip non GO case + if (qinfo->RequiredNpcOrGo[j] >= 0) //skip non GO case continue; - if ((-1)*GOId == qinfo->ReqCreatureOrGOId[j] && qs.m_creatureOrGOcount[j] < qinfo->ReqCreatureOrGOCount[j]) + if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.m_creatureOrGOcount[j] < qinfo->RequiredNpcOrGoCount[j]) return true; } } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c1af7bcfed4..6b0601d9663 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3691,42 +3691,41 @@ void ObjectMgr::LoadQuests() mExclusiveQuestGroups.clear(); - // 0 1 2 3 4 5 6 7 8 9 10 - QueryResult result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, MinLevel, MaxLevel, QuestLevel, Type, RequiredClasses, RequiredRaces, RequiredSkill, RequiredSkillValue, " - // 11 12 13 14 15 16 17 18 19 20 - "RepObjectiveFaction, RepObjectiveValue, RepObjectiveFaction2, RepObjectiveValue2, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime, " - // 21 22 23 24 25 26 27 28 29 30 31 32 33 34 - "QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, RewardArenaPoints, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain, RewXPId, SrcItemId, SrcItemCount, SrcSpell, " - // 35 36 37 38 39 40 41 42 43 44 45 - "Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, " - // 46 47 48 49 50 51 52 53 54 55 56 57 - "ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6, " - // 58 59 60 61 62 63 64 65 - "ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, " - // 66 67 68 69 70 71 72 73 - "ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4, " - // 74 75 76 77 - "ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, " - // 78 79 80 81 82 83 - "RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, " - // 84 85 86 87 88 89 - "RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6, " - // 90 91 92 93 94 95 96 97 - "RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4, " - // 98 99 100 101 102 103 104 105 106 107 - "RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValueId1, RewRepValueId2, RewRepValueId3, RewRepValueId4, RewRepValueId5, " - // 108 109 110 111 112 - "RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5, " - // 113 114 115 116 117 118 119 120 121 122 123 124 - "RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt, " - // 125 126 127 128 129 130 131 132 - "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, " - // 133 134 135 136 137 138 - "IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, " - // 139 140 141 142 - "OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, " - // 143 144 - "StartScript, CompleteScript" + QueryResult result = WorldDatabase.Query("SELECT " + //0 1 2 3 4 5 6 7 8 9 10 11 12 + "Id, Method, Level, MinLevel, MaxLevel, ZoneOrSort, Type, SuggestedPlayers, LimitTime, RequiredClasses, RequiredRaces, RequiredSkillId, RequiredSkillPoints, " + // 13 14 15 16 17 18 19 20 + "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, " + // 21 22 23 24 25 26 27 28 29 30 31 + "PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestIdChain, RewardXPId, RewardOrRequiredMoney, RewardMoneyMaxLevel, RewardSpell, RewardSpellCast, RewardHonor, RewardHonorMultiplier, " + // 32 33 34 35 36 37 38 39 40 41 42 + "RewardMailTemplateId, RewardMailDelay, SourceItemId, SourceItemCount, SourceSpellId, Flags, SpecialFlags, RewardTitleId, RequiredPlayerKills, RewardTalents, RewardArenaPoints, " + // 43 44 45 46 47 48 49 50 + "RewardItemId1, RewardItemId2, RewardItemId3, RewardItemId4, RewardItemCount1, RewardItemCount2, RewardItemCount3, RewardItemCount4, " + // 51 52 53 54 55 56 57 58 59 60 61 62 + "RewardChoiceItemId1, RewardChoiceItemId2, RewardChoiceItemId3, RewardChoiceItemId4, RewardChoiceItemId5, RewardChoiceItemId6, RewardChoiceItemCount1, RewardChoiceItemCount2, RewardChoiceItemCount3, RewardChoiceItemCount4, RewardChoiceItemCount5, RewardChoiceItemCount6, " + // 63 64 65 66 67 68 69 70 71 72 + "RewardFactionId1, RewardFactionId2, RewardFactionId3, RewardFactionId4, RewardFactionId5, RewardFactionValueId1, RewardFactionValueId2, RewardFactionValueId3, RewardFactionValueId4, RewardFactionValueId5, " + // 73 74 75 76 77 + "RewardFactionValueIdOverride1, RewardFactionValueIdOverride2, RewardFactionValueIdOverride3, RewardFactionValueIdOverride4, RewardFactionValueIdOverride5, " + // 78 79 80 81 + "PointMapId, PointX, PointY, PointOption, " + // 82 83 84 85 86 87 88 + "Title, Objectives, Details, EndText, OfferRewardText, RequestItemsText, CompletedText, " + // 89 90 91 92 93 94 95 96 + "RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, " + // 97 98 99 100 101 102 103 104 + "RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4, RequiredSourceItemCount1, RequiredSourceItemCount2, RequiredSourceItemCount3, RequiredSourceItemCount4, " + // 105 106 107 108 109 110 111 112 113 114 115 116 + "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, " + // 117 118 119 120 121 122 123 124 125 + "RequiredSpellCast1, RequiredSpellCast2, RequiredSpellCast3, RequiredSpellCast4, Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, " + // 126 127 128 129 130 131 132 133 134 135 + "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, EmoteOnIncomplete, EmoteOnComplete, " + // 136 137 138 139 140 141 142 143 + "OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, " + // 144 145 146 + "StartScript, CompleteScript, WDBVerified" " FROM quest_template"); if (!result) { @@ -3764,45 +3763,45 @@ void ObjectMgr::LoadQuests() sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); } - if (qinfo->QuestFlags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED) + if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED) { sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", - qinfo->GetQuestId(), qinfo->QuestFlags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20); - qinfo->QuestFlags &= QUEST_TRINITY_FLAGS_DB_ALLOWED; + qinfo->GetQuestId(), qinfo->Flags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20); + qinfo->Flags &= QUEST_TRINITY_FLAGS_DB_ALLOWED; } - if (qinfo->QuestFlags & QUEST_FLAGS_DAILY && qinfo->QuestFlags & QUEST_FLAGS_WEEKLY) + if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY) { - sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `QuestFlags`, removed daily flag.", qinfo->GetQuestId()); - qinfo->QuestFlags &= ~QUEST_FLAGS_DAILY; + sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); + qinfo->Flags &= ~QUEST_FLAGS_DAILY; } - if (qinfo->QuestFlags & QUEST_FLAGS_DAILY) + if (qinfo->Flags & QUEST_FLAGS_DAILY) { - if (!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE)) + if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE)) { sLog->outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); - qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE; + qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE; } } - if (qinfo->QuestFlags & QUEST_FLAGS_WEEKLY) + if (qinfo->Flags & QUEST_FLAGS_WEEKLY) { - if (!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE)) + if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE)) { sLog->outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); - qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE; + qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE; } } - if (qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED) + if (qinfo->Flags & QUEST_FLAGS_AUTO_REWARDED) { - // at auto-reward can be rewarded only RewChoiceItemId[0] + // at auto-reward can be rewarded only RewardChoiceItemId[0] for (int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j ) { - if (uint32 id = qinfo->RewChoiceItemId[j]) + if (uint32 id = qinfo->RewardChoiceItemId[j]) { - sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item from `RewChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.", + sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest ignore this data } @@ -3829,12 +3828,12 @@ void ObjectMgr::LoadQuests() qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } - //check for proper RequiredSkill value (skill case) + //check for proper RequiredSkillId value (skill case) if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) { - if (qinfo->RequiredSkill != skill_id) + if (qinfo->RequiredSkillId != skill_id) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkill` does not have a corresponding value (%i).", + sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%i).", qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } @@ -3859,38 +3858,38 @@ void ObjectMgr::LoadQuests() qinfo->RequiredRaces = 0; } } - // RequiredSkill, can be 0 - if (qinfo->RequiredSkill) + // RequiredSkillId, can be 0 + if (qinfo->RequiredSkillId) { - if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkill)) + if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId)) { - sLog->outErrorDb("Quest %u has `RequiredSkill` = %u but this skill does not exist", - qinfo->GetQuestId(), qinfo->RequiredSkill); + sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist", + qinfo->GetQuestId(), qinfo->RequiredSkillId); } } - if (qinfo->RequiredSkillValue) + if (qinfo->RequiredSkillPoints) { - if (qinfo->RequiredSkillValue > sWorld->GetConfigMaxSkillValue()) + if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue()) { - sLog->outErrorDb("Quest %u has `RequiredSkillValue` = %u but max possible skill is %u, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredSkillValue, sWorld->GetConfigMaxSkillValue()); + sLog->outErrorDb("Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", + qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } } // else Skill quests can have 0 skill level, this is ok - if (qinfo->RepObjectiveFaction2 && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction2)) + if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2)) { - sLog->outErrorDb("Quest %u has `RepObjectiveFaction2` = %u but faction template %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->RepObjectiveFaction2, qinfo->RepObjectiveFaction2); + sLog->outErrorDb("Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", + qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2); // no changes, quest can't be done for this requirement } - if (qinfo->RepObjectiveFaction && !sFactionStore.LookupEntry(qinfo->RepObjectiveFaction)) + if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1)) { - sLog->outErrorDb("Quest %u has `RepObjectiveFaction` = %u but faction template %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->RepObjectiveFaction, qinfo->RepObjectiveFaction); + sLog->outErrorDb("Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", + qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1); // no changes, quest can't be done for this requirement } @@ -3922,17 +3921,17 @@ void ObjectMgr::LoadQuests() // no changes, quest can't be done for this requirement } - if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue != 0) + if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0) { - sLog->outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect", - qinfo->GetQuestId(), qinfo->RepObjectiveValue); + sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", + qinfo->GetQuestId(), qinfo->RequiredFactionValue1); // warning } - if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 != 0) + if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0) { - sLog->outErrorDb("Quest %u has `RepObjectiveValue2` = %d but `RepObjectiveFaction2` is 0, value has no effect", - qinfo->GetQuestId(), qinfo->RepObjectiveValue2); + sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", + qinfo->GetQuestId(), qinfo->RequiredFactionValue2); // warning } @@ -3950,61 +3949,61 @@ void ObjectMgr::LoadQuests() // warning } - if (qinfo->CharTitleId && !sCharTitlesStore.LookupEntry(qinfo->CharTitleId)) + if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId)) { - sLog->outErrorDb("Quest %u has `CharTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", + sLog->outErrorDb("Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); - qinfo->CharTitleId = 0; + qinfo->RewardTitleId = 0; // quest can't reward this title } - if (qinfo->SrcItemId) + if (qinfo->SourceItemId) { - if (!sObjectMgr->GetItemTemplate(qinfo->SrcItemId)) + if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId)) { - sLog->outErrorDb("Quest %u has `SrcItemId` = %u but item with entry %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->SrcItemId, qinfo->SrcItemId); - qinfo->SrcItemId = 0; // quest can't be done for this requirement + sLog->outErrorDb("Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.", + qinfo->GetQuestId(), qinfo->SourceItemId, qinfo->SourceItemId); + qinfo->SourceItemId = 0; // quest can't be done for this requirement } - else if (qinfo->SrcItemCount == 0) + else if (qinfo->SourceItemIdCount == 0) { - sLog->outErrorDb("Quest %u has `SrcItemId` = %u but `SrcItemCount` = 0, set to 1 but need fix in DB.", - qinfo->GetQuestId(), qinfo->SrcItemId); - qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB + sLog->outErrorDb("Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.", + qinfo->GetQuestId(), qinfo->SourceItemId); + qinfo->SourceItemIdCount = 1; // update to 1 for allow quest work for backward compatibility with DB } } - else if (qinfo->SrcItemCount>0) + else if (qinfo->SourceItemIdCount>0) { - sLog->outErrorDb("Quest %u has `SrcItemId` = 0 but `SrcItemCount` = %u, useless value.", - qinfo->GetQuestId(), qinfo->SrcItemCount); - qinfo->SrcItemCount=0; // no quest work changes in fact + sLog->outErrorDb("Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.", + qinfo->GetQuestId(), qinfo->SourceItemIdCount); + qinfo->SourceItemIdCount=0; // no quest work changes in fact } - if (qinfo->SrcSpell) + if (qinfo->SourceSpellid) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SrcSpell); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid); if (!spellInfo) { - sLog->outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->SrcSpell, qinfo->SrcSpell); - qinfo->SrcSpell = 0; // quest can't be done for this requirement + sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", + qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); + qinfo->SourceSpellid = 0; // quest can't be done for this requirement } else if (!SpellMgr::IsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `SrcSpell` = %u but spell %u is broken, quest can't be done.", - qinfo->GetQuestId(), qinfo->SrcSpell, qinfo->SrcSpell); - qinfo->SrcSpell = 0; // quest can't be done for this requirement + sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", + qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); + qinfo->SourceSpellid = 0; // quest can't be done for this requirement } } for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) { - uint32 id = qinfo->ReqItemId[j]; + uint32 id = qinfo->RequiredItemId[j]; if (id) { - if (qinfo->ReqItemCount[j] == 0) + if (qinfo->RequiredItemCount[j] == 0) { - sLog->outErrorDb("Quest %u has `ReqItemId%d` = %u but `ReqItemCount%d` = 0, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can't be done for this requirement } @@ -4013,37 +4012,37 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `ReqItemId%d` = %u but item with entry %u does not exist, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); - qinfo->ReqItemCount[j] = 0; // prevent incorrect work of quest + qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } - else if (qinfo->ReqItemCount[j]>0) + else if (qinfo->RequiredItemCount[j]>0) { - sLog->outErrorDb("Quest %u has `ReqItemId%d` = 0 but `ReqItemCount%d` = %u, quest can't be done.", - qinfo->GetQuestId(), j+1, j+1, qinfo->ReqItemCount[j]); - qinfo->ReqItemCount[j] = 0; // prevent incorrect work of quest + sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]); + qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j) { - uint32 id = qinfo->ReqSourceId[j]; + uint32 id = qinfo->RequiredSourceItemid[j]; if (id) { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `ReqSourceId%d` = %u but item with entry %u does not exist, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); // no changes, quest can't be done for this requirement } } else { - if (qinfo->ReqSourceCount[j]>0) + if (qinfo->RequiredSourceItemId[j]>0) { - sLog->outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->ReqSourceCount[j]); + sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = 0 but `RequiredSourceItemId%d` = %u.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemId[j]); // no changes, quest ignore this data } } @@ -4051,7 +4050,7 @@ void ObjectMgr::LoadQuests() for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { - uint32 id = qinfo->ReqSpell[j]; + uint32 id = qinfo->RequiredSpellCast[j]; if (id) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); @@ -4062,12 +4061,12 @@ void ObjectMgr::LoadQuests() continue; } - if (!qinfo->ReqCreatureOrGOId[j]) + if (!qinfo->RequiredNpcOrGo[j]) { bool found = false; for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k) { - if ((spellInfo->Effects[k].Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->Effects[k].MiscValue) == qinfo->QuestId) || + if ((spellInfo->Effects[k].Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->Effects[k].MiscValue) == qinfo->Id) || spellInfo->Effects[k].Effect == SPELL_EFFECT_SEND_EVENT) { found = true; @@ -4079,7 +4078,7 @@ void ObjectMgr::LoadQuests() { if (!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->QuestId, j+1, j+1); + sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1); // this will prevent quest completing without objective const_cast(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); @@ -4087,7 +4086,7 @@ void ObjectMgr::LoadQuests() } else { - sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u and ReqCreatureOrGOId%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.", + sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1, id); // no changes, quest can't be done for this requirement } @@ -4097,19 +4096,19 @@ void ObjectMgr::LoadQuests() for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { - int32 id = qinfo->ReqCreatureOrGOId[j]; + int32 id = qinfo->RequiredNpcOrGo[j]; if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id)) { - sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but gameobject %u does not exist, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, uint32(-id)); - qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement + qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } if (id > 0 && !sObjectMgr->GetCreatureTemplate(id)) { - sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %i but creature with entry %u does not exist, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, uint32(id)); - qinfo->ReqCreatureOrGOId[j] = 0; // quest can't be done for this requirement + qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } if (id) @@ -4118,179 +4117,179 @@ void ObjectMgr::LoadQuests() qinfo->SetFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO); - if (!qinfo->ReqCreatureOrGOCount[j]) + if (!qinfo->RequiredNpcOrGoCount[j]) { - sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = %u but `ReqCreatureOrGOCount%d` = 0, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can be incorrectly done, but we already report this } } - else if (qinfo->ReqCreatureOrGOCount[j]>0) + else if (qinfo->RequiredNpcOrGoCount[j]>0) { - sLog->outErrorDb("Quest %u has `ReqCreatureOrGOId%d` = 0 but `ReqCreatureOrGOCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->ReqCreatureOrGOCount[j]); + sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredNpcOrGoCount[j]); // no changes, quest ignore this data } } for (uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j) { - uint32 id = qinfo->RewChoiceItemId[j]; + uint32 id = qinfo->RewardChoiceItemId[j]; if (id) { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, id); - qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this + qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this } - if (!qinfo->RewChoiceItemCount[j]) + if (!qinfo->RewardChoiceItemCount[j]) { - sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = %u but `RewChoiceItemCount%d` = 0, quest can't be done.", + sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can't be done } } - else if (qinfo->RewChoiceItemCount[j]>0) + else if (qinfo->RewardChoiceItemCount[j]>0) { - sLog->outErrorDb("Quest %u has `RewChoiceItemId%d` = 0 but `RewChoiceItemCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RewChoiceItemCount[j]); + sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]); // no changes, quest ignore this data } } for (uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j) { - uint32 id = qinfo->RewItemId[j]; + uint32 id = qinfo->RewardItemId[j]; if (id) { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RewItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, id); - qinfo->RewItemId[j] = 0; // no changes, quest will not reward this item + qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item } - if (!qinfo->RewItemCount[j]) + if (!qinfo->RewardItemIdCount[j]) { - sLog->outErrorDb("Quest %u has `RewItemId%d` = %u but `RewItemCount%d` = 0, quest will not reward this item.", + sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, j+1); // no changes } } - else if (qinfo->RewItemCount[j]>0) + else if (qinfo->RewardItemIdCount[j]>0) { - sLog->outErrorDb("Quest %u has `RewItemId%d` = 0 but `RewItemCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RewItemCount[j]); + sLog->outErrorDb("Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemIdCount[j]); // no changes, quest ignore this data } } for (uint8 j = 0; j < QUEST_REPUTATIONS_COUNT; ++j) { - if (qinfo->RewRepFaction[j]) + if (qinfo->RewardFactionId[j]) { - if (abs(qinfo->RewRepValueId[j]) > 9) + if (abs(qinfo->RewardFactionValueId[j]) > 9) { - sLog->outErrorDb("Quest %u has RewRepValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewRepValueId[j]); + sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]); } - if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j])) + if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j])) { - sLog->outErrorDb("Quest %u has `RewRepFaction%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewRepFaction[j], qinfo->RewRepFaction[j]); - qinfo->RewRepFaction[j] = 0; // quest will not reward this + sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); + qinfo->RewardFactionId[j] = 0; // quest will not reward this } } - else if (qinfo->RewRepValue[j] != 0) + else if (qinfo->RewardFactionValueIdOverride[j] != 0) { - sLog->outErrorDb("Quest %u has `RewRepFaction%d` = 0 but `RewRepValue%d` = %i.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RewRepValue[j]); + sLog->outErrorDb("Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionValueIdOverride[j]); // no changes, quest ignore this data } } - if (qinfo->RewSpell) + if (qinfo->RewardSpell) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpell); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardSpell); if (!spellInfo) { - sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u does not exist, spell removed as display reward.", - qinfo->GetQuestId(), qinfo->RewSpell, qinfo->RewSpell); - qinfo->RewSpell = 0; // no spell reward will display for this quest + sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.", + qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); + qinfo->RewardSpell = 0; // no spell reward will display for this quest } else if (!SpellMgr::IsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u is broken, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewSpell, qinfo->RewSpell); - qinfo->RewSpell = 0; // no spell reward will display for this quest + sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", + qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); + qinfo->RewardSpell = 0; // no spell reward will display for this quest } - else if (GetTalentSpellCost(qinfo->RewSpell)) + else if (GetTalentSpellCost(qinfo->RewardSpell)) { - sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewSpell, qinfo->RewSpell); - qinfo->RewSpell = 0; // no spell reward will display for this quest + sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); + qinfo->RewardSpell = 0; // no spell reward will display for this quest } } - if (qinfo->RewSpellCast > 0) + if (qinfo->RewardSpellCast > 0) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpellCast); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardSpellCast); if (!spellInfo) { - sLog->outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewSpellCast, qinfo->RewSpellCast); - qinfo->RewSpellCast = 0; // no spell will be casted on player + sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", + qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); + qinfo->RewardSpellCast = 0; // no spell will be casted on player } else if (!SpellMgr::IsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `RewSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewSpellCast, qinfo->RewSpellCast); - qinfo->RewSpellCast = 0; // no spell will be casted on player + sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", + qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); + qinfo->RewardSpellCast = 0; // no spell will be casted on player } - else if (GetTalentSpellCost(qinfo->RewSpellCast)) + else if (GetTalentSpellCost(qinfo->RewardSpellCast)) { - sLog->outErrorDb("Quest %u has `RewSpell` = %u but spell %u is talent, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewSpellCast, qinfo->RewSpellCast); - qinfo->RewSpellCast = 0; // no spell will be casted on player + sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); + qinfo->RewardSpellCast = 0; // no spell will be casted on player } } - if (qinfo->RewMailTemplateId) + if (qinfo->RewardMailTemplateId) { - if (!sMailTemplateStore.LookupEntry(qinfo->RewMailTemplateId)) + if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId)) { - sLog->outErrorDb("Quest %u has `RewMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", - qinfo->GetQuestId(), qinfo->RewMailTemplateId, qinfo->RewMailTemplateId); - qinfo->RewMailTemplateId = 0; // no mail will send to player - qinfo->RewMailDelaySecs = 0; // no mail will send to player + sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", + qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); + qinfo->RewardMailTemplateId = 0; // no mail will send to player + qinfo->RewardMailDelay = 0; // no mail will send to player } - else if (usedMailTemplates.find(qinfo->RewMailTemplateId) != usedMailTemplates.end()) + else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end()) { - std::map::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewMailTemplateId); - sLog->outErrorDb("Quest %u has `RewMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", - qinfo->GetQuestId(), qinfo->RewMailTemplateId, qinfo->RewMailTemplateId, used_mt_itr->second); - qinfo->RewMailTemplateId = 0; // no mail will send to player - qinfo->RewMailDelaySecs = 0; // no mail will send to player + std::map::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId); + sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", + qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); + qinfo->RewardMailTemplateId = 0; // no mail will send to player + qinfo->RewardMailDelay = 0; // no mail will send to player } else - usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); + usedMailTemplates[qinfo->RewardMailTemplateId] = qinfo->GetQuestId(); } - if (qinfo->NextQuestInChain) + if (qinfo->NextQuestIdChain) { - QuestMap::iterator qNextItr = mQuestTemplates.find(qinfo->NextQuestInChain); + QuestMap::iterator qNextItr = mQuestTemplates.find(qinfo->NextQuestIdChain); if (qNextItr == mQuestTemplates.end()) { - sLog->outErrorDb("Quest %u has `NextQuestInChain` = %u but quest %u does not exist, quest chain will not work.", - qinfo->GetQuestId(), qinfo->NextQuestInChain, qinfo->NextQuestInChain); - qinfo->NextQuestInChain = 0; + sLog->outErrorDb("Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.", + qinfo->GetQuestId(), qinfo->NextQuestIdChain, qinfo->NextQuestIdChain); + qinfo->NextQuestIdChain = 0; } else qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); @@ -4327,7 +4326,7 @@ void ObjectMgr::LoadQuests() mExclusiveQuestGroups.insert(std::pair(qinfo->ExclusiveGroup, qinfo->GetQuestId())); if (qinfo->LimitTime) qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED); - if (qinfo->PlayersSlain) + if (qinfo->RequiredPlayerKills) qinfo->SetFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL); } diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 7cd442cd9f9..29bd95a73a3 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -22,128 +22,132 @@ Quest::Quest(Field* questRecord) { - QuestId = questRecord[0].GetUInt32(); - QuestMethod = questRecord[1].GetUInt32(); - ZoneOrSort = questRecord[2].GetInt32(); + Id = questRecord[0].GetUInt32(); + Method = questRecord[1].GetUInt32(); + Level = questRecord[2].GetInt32(); MinLevel = questRecord[3].GetUInt32(); MaxLevel = questRecord[4].GetUInt32(); - QuestLevel = questRecord[5].GetInt32(); + ZoneOrSort = questRecord[5].GetInt32(); Type = questRecord[6].GetUInt32(); - RequiredClasses = questRecord[7].GetUInt32(); - RequiredRaces = questRecord[8].GetUInt32(); - RequiredSkill = questRecord[9].GetUInt32(); - RequiredSkillValue = questRecord[10].GetUInt32(); - RepObjectiveFaction = questRecord[11].GetUInt32(); - RepObjectiveValue = questRecord[12].GetInt32(); - RepObjectiveFaction2 = questRecord[13].GetUInt32(); - RepObjectiveValue2 = questRecord[14].GetInt32(); - RequiredMinRepFaction = questRecord[15].GetUInt32(); - RequiredMinRepValue = questRecord[16].GetInt32(); - RequiredMaxRepFaction = questRecord[17].GetUInt32(); - RequiredMaxRepValue = questRecord[18].GetInt32(); - SuggestedPlayers = questRecord[19].GetUInt32(); - LimitTime = questRecord[20].GetUInt32(); - QuestFlags = questRecord[21].GetUInt32(); - uint32 SpecialFlags = questRecord[22].GetUInt16(); - CharTitleId = questRecord[23].GetUInt32(); - PlayersSlain = questRecord[24].GetUInt32(); - BonusTalents = questRecord[25].GetUInt32(); - RewArenaPoints = questRecord[26].GetInt32(); - PrevQuestId = questRecord[27].GetInt32(); - NextQuestId = questRecord[28].GetInt32(); - ExclusiveGroup = questRecord[29].GetInt32(); - NextQuestInChain = questRecord[30].GetUInt32(); - XPId = questRecord[31].GetUInt32(); - SrcItemId = questRecord[32].GetUInt32(); - SrcItemCount = questRecord[33].GetUInt32(); - SrcSpell = questRecord[34].GetUInt32(); - Title = questRecord[35].GetString(); - Details = questRecord[36].GetString(); - Objectives = questRecord[37].GetString(); - OfferRewardText = questRecord[38].GetString(); - RequestItemsText = questRecord[39].GetString(); - EndText = questRecord[40].GetString(); - CompletedText = questRecord[41].GetString(); + SuggestedPlayers = questRecord[7].GetUInt32(); + LimitTime = questRecord[8].GetUInt32(); + RequiredClasses = questRecord[9].GetUInt32(); + RequiredRaces = questRecord[10].GetUInt32(); + RequiredSkillId = questRecord[11].GetUInt32(); + RequiredSkillPoints = questRecord[12].GetUInt32(); + RequiredFactionId1 = questRecord[13].GetUInt32(); + RequiredFactionId2 = questRecord[14].GetUInt32(); + RequiredFactionValue1 = questRecord[15].GetInt32(); + RequiredFactionValue2 = questRecord[16].GetInt32(); + RequiredMinRepFaction = questRecord[17].GetUInt32(); + RequiredMaxRepFaction = questRecord[18].GetUInt32(); + RequiredMinRepValue = questRecord[19].GetInt32(); + RequiredMaxRepValue = questRecord[20].GetInt32(); + PrevQuestId = questRecord[21].GetInt32(); + NextQuestId = questRecord[22].GetInt32(); + ExclusiveGroup = questRecord[23].GetInt32(); + NextQuestIdChain = questRecord[24].GetUInt32(); + RewardXPId = questRecord[25].GetUInt32(); + RewardOrRequiredMoney = questRecord[26].GetInt32(); + RewardMoneyMaxLevel = questRecord[27].GetUInt32(); + RewardSpell = questRecord[28].GetUInt32(); + RewardSpellCast = questRecord[29].GetInt32(); + RewardHonor = questRecord[30].GetUInt32(); + RewardHonorMultiplier = questRecord[31].GetFloat(); + RewardMailTemplateId = questRecord[32].GetUInt32(); + RewardMailDelay = questRecord[33].GetUInt32(); + SourceItemId = questRecord[34].GetUInt32(); + SourceItemIdCount = questRecord[35].GetUInt32(); + SourceSpellid = questRecord[36].GetUInt32(); + Flags = questRecord[37].GetUInt32(); + uint32 SpecialFlags = questRecord[38].GetUInt16(); + RewardTitleId = questRecord[39].GetUInt32(); + RequiredPlayerKills = questRecord[40].GetUInt32(); + RewardTalents = questRecord[41].GetUInt32(); + RewardArenaPoints = questRecord[42].GetInt32(); - for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ObjectiveText[i] = questRecord[42+i].GetString(); + for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) + RewardItemId[i] = questRecord[43+i].GetUInt32(); - for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - ReqItemId[i] = questRecord[46+i].GetUInt32(); + for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) + RewardItemIdCount[i] = questRecord[47+i].GetUInt32(); - for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - ReqItemCount[i] = questRecord[52+i].GetUInt32(); + for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) + RewardChoiceItemId[i] = questRecord[51+i].GetUInt32(); - for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - ReqSourceId[i] = questRecord[58+i].GetUInt32(); + for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) + RewardChoiceItemCount[i] = questRecord[57+i].GetUInt32(); + + for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + RewardFactionId[i] = questRecord[63+i].GetUInt32(); - for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - ReqSourceCount[i] = questRecord[62+i].GetUInt32(); + for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + RewardFactionValueId[i] = questRecord[68+i].GetInt32(); - for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqCreatureOrGOId[i] = questRecord[66+i].GetInt32(); + for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32(); + + PointMapId = questRecord[78].GetUInt32(); + PointX = questRecord[79].GetFloat(); + PointY = questRecord[80].GetFloat(); + PointOption = questRecord[81].GetUInt32(); + Title = questRecord[82].GetString(); + Objectives = questRecord[83].GetString(); + Details = questRecord[84].GetString(); + EndText = questRecord[85].GetString(); + OfferRewardText = questRecord[86].GetString(); + RequestItemsText = questRecord[87].GetString(); + CompletedText = questRecord[88].GetString(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqCreatureOrGOCount[i] = questRecord[70+i].GetUInt32(); + RequiredNpcOrGo[i] = questRecord[89+i].GetInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ReqSpell[i] = questRecord[74+i].GetUInt32(); + RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt32(); - for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewChoiceItemId[i] = questRecord[78+i].GetUInt32(); + for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) + RequiredSourceItemid[i] = questRecord[97+i].GetUInt32(); - for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewChoiceItemCount[i] = questRecord[84+i].GetUInt32(); + for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) + RequiredSourceItemId[i] = questRecord[101+i].GetUInt32(); - for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewItemId[i] = questRecord[90+i].GetUInt32(); + for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + RequiredItemId[i] = questRecord[105+i].GetUInt32(); - for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewItemCount[i] = questRecord[94+i].GetUInt32(); + for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + RequiredItemCount[i] = questRecord[111+i].GetUInt32(); - for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewRepFaction[i] = questRecord[98+i].GetUInt32(); + for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + RequiredSpellCast[i] = questRecord[117+i].GetUInt32(); - for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewRepValueId[i] = questRecord[103+i].GetInt32(); + // int8 Unknown0 = questRecord[121].GetUInt32(); - for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewRepValue[i] = questRecord[108+i].GetInt32(); - - RewHonorAddition = questRecord[113].GetUInt32(); - RewHonorMultiplier = questRecord[114].GetFloat(); - RewOrReqMoney = questRecord[115].GetInt32(); - RewMoneyMaxLevel = questRecord[116].GetUInt32(); - RewSpell = questRecord[117].GetUInt32(); - RewSpellCast = questRecord[118].GetInt32(); - RewMailTemplateId = questRecord[119].GetUInt32(); - RewMailDelaySecs = questRecord[120].GetUInt32(); - PointMapId = questRecord[121].GetUInt32(); - PointX = questRecord[122].GetFloat(); - PointY = questRecord[123].GetFloat(); - PointOpt = questRecord[124].GetUInt32(); + for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + ObjectiveText[i] = questRecord[122+i].GetString(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - DetailsEmote[i] = questRecord[125+i].GetUInt32(); + DetailsEmote[i] = questRecord[126+i].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - DetailsEmoteDelay[i] = questRecord[129+i].GetUInt32(); + DetailsEmoteDelay[i] = questRecord[130+i].GetUInt32(); - IncompleteEmote = questRecord[133].GetUInt32(); - CompleteEmote = questRecord[134].GetUInt32(); + EmoteOnIncomplete = questRecord[134].GetUInt32(); + EmoteOnComplete = questRecord[135].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmote[i] = questRecord[135+i].GetInt32(); + OfferRewardEmote[i] = questRecord[136+i].GetInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmoteDelay[i] = questRecord[139+i].GetInt32(); + OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32(); + + StartScript = questRecord[144].GetUInt32(); + CompleteScript = questRecord[145].GetUInt32(); - QuestStartScript = questRecord[143].GetUInt32(); - QuestCompleteScript = questRecord[144].GetUInt32(); + // int32 WDBVerified = questRecord[146].GetInt32(); - QuestFlags |= SpecialFlags << 20; - if (QuestFlags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT) - QuestFlags |= QUEST_FLAGS_AUTO_ACCEPT; + Flags |= SpecialFlags << 20; + if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT) + Flags |= QUEST_FLAGS_AUTO_ACCEPT; m_reqitemscount = 0; m_reqCreatureOrGOcount = 0; @@ -151,19 +155,19 @@ Quest::Quest(Field* questRecord) m_rewchoiceitemscount = 0; for (int i=0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - if (ReqItemId[i]) + if (RequiredItemId[i]) ++m_reqitemscount; for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i) - if (ReqCreatureOrGOId[i]) + if (RequiredNpcOrGo[i]) ++m_reqCreatureOrGOcount; for (int i=0; i < QUEST_REWARDS_COUNT; ++i) - if (RewItemId[i]) + if (RewardItemId[i]) ++m_rewitemscount; for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - if (RewChoiceItemId[i]) + if (RewardChoiceItemId[i]) ++m_rewchoiceitemscount; } @@ -171,7 +175,7 @@ uint32 Quest::XPValue(Player* player) const { if (player) { - int32 quest_level = (QuestLevel == -1 ? player->getLevel() : QuestLevel); + int32 quest_level = (Level == -1 ? player->getLevel() : Level); const QuestXPEntry* xpentry = sQuestXPStore.LookupEntry(quest_level); if (!xpentry) return 0; @@ -182,7 +186,7 @@ uint32 Quest::XPValue(Player* player) const else if (diffFactor > 10) diffFactor = 10; - uint32 xp = diffFactor * xpentry->Exp[XPId] / 10; + uint32 xp = diffFactor * xpentry->Exp[RewardXPId] / 10; if (xp <= 100) xp = 5 * ((xp + 2) / 5); else if (xp <= 500) @@ -200,15 +204,15 @@ uint32 Quest::XPValue(Player* player) const int32 Quest::GetRewOrReqMoney() const { - if (RewOrReqMoney <= 0) - return RewOrReqMoney; + if (RewardOrRequiredMoney <= 0) + return RewardOrRequiredMoney; - return int32(RewOrReqMoney * sWorld->getRate(RATE_DROP_MONEY)); + return int32(RewardOrRequiredMoney * sWorld->getRate(RATE_DROP_MONEY)); } bool Quest::IsAutoComplete() const { - return QuestMethod == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE); + return Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE); } bool Quest::IsAllowedInRaid() const diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 895b87f4465..fc9a432a11b 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -141,7 +141,7 @@ enum __QuestFlags QUEST_FLAGS_UNAVAILABLE = 0x00004000, // Used on quests that are not generically available QUEST_FLAGS_WEEKLY = 0x00008000, QUEST_FLAGS_AUTOCOMPLETE = 0x00010000, // auto complete - QUEST_FLAGS_SPECIAL_ITEM = 0x00020000, // has something to do with ReqItemId and SrcItemId + QUEST_FLAGS_SPECIAL_ITEM = 0x00020000, // has something to do with RequiredItemId and SourceItemId QUEST_FLAGS_OBJ_TEXT = 0x00040000, // use Objective text as Complete text QUEST_FLAGS_AUTO_ACCEPT = 0x00080000, // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future. @@ -185,25 +185,25 @@ class Quest Quest(Field* questRecord); uint32 XPValue(Player* player) const; - bool HasFlag(uint32 flag) const { return (QuestFlags & flag) != 0; } - void SetFlag(uint32 flag) { QuestFlags |= flag; } + bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; } + void SetFlag(uint32 flag) { Flags |= flag; } // table data accessors: - uint32 GetQuestId() const { return QuestId; } - uint32 GetQuestMethod() const { return QuestMethod; } + uint32 GetQuestId() const { return Id; } + uint32 GetQuestMethod() const { return Method; } int32 GetZoneOrSort() const { return ZoneOrSort; } uint32 GetMinLevel() const { return MinLevel; } uint32 GetMaxLevel() const { return MaxLevel; } - uint32 GetQuestLevel() const { return QuestLevel; } + uint32 GetQuestLevel() const { return Level; } uint32 GetType() const { return Type; } uint32 GetRequiredClasses() const { return RequiredClasses; } uint32 GetRequiredRaces() const { return RequiredRaces; } - uint32 GetRequiredSkill() const { return RequiredSkill; } - uint32 GetRequiredSkillValue() const { return RequiredSkillValue; } - uint32 GetRepObjectiveFaction() const { return RepObjectiveFaction; } - int32 GetRepObjectiveValue() const { return RepObjectiveValue; } - uint32 GetRepObjectiveFaction2() const { return RepObjectiveFaction2; } - int32 GetRepObjectiveValue2() const { return RepObjectiveValue2; } + uint32 GetRequiredSkill() const { return RequiredSkillId; } + uint32 GetRequiredSkillValue() const { return RequiredSkillPoints; } + uint32 GetRepObjectiveFaction() const { return RequiredFactionId1; } + int32 GetRepObjectiveValue() const { return RequiredFactionValue1; } + uint32 GetRepObjectiveFaction2() const { return RequiredFactionId2; } + int32 GetRepObjectiveValue2() const { return RequiredFactionValue2; } uint32 GetRequiredMinRepFaction() const { return RequiredMinRepFaction; } int32 GetRequiredMinRepValue() const { return RequiredMinRepValue; } uint32 GetRequiredMaxRepFaction() const { return RequiredMaxRepFaction; } @@ -213,15 +213,15 @@ class Quest int32 GetPrevQuestId() const { return PrevQuestId; } int32 GetNextQuestId() const { return NextQuestId; } int32 GetExclusiveGroup() const { return ExclusiveGroup; } - uint32 GetNextQuestInChain() const { return NextQuestInChain; } - uint32 GetCharTitleId() const { return CharTitleId; } - uint32 GetPlayersSlain() const { return PlayersSlain; } - uint32 GetBonusTalents() const { return BonusTalents; } - int32 GetRewArenaPoints() const {return RewArenaPoints; } - uint32 GetXPId() const { return XPId; } - uint32 GetSrcItemId() const { return SrcItemId; } - uint32 GetSrcItemCount() const { return SrcItemCount; } - uint32 GetSrcSpell() const { return SrcSpell; } + uint32 GetNextQuestInChain() const { return NextQuestIdChain; } + uint32 GetCharTitleId() const { return RewardTitleId; } + uint32 GetPlayersSlain() const { return RequiredPlayerKills; } + uint32 GetBonusTalents() const { return RewardTalents; } + int32 GetRewArenaPoints() const {return RewardArenaPoints; } + uint32 GetXPId() const { return RewardXPId; } + uint32 GetSrcItemId() const { return SourceItemId; } + uint32 GetSrcItemCount() const { return SourceItemIdCount; } + uint32 GetSrcSpell() const { return SourceSpellid; } std::string GetTitle() const { return Title; } std::string GetDetails() const { return Details; } std::string GetObjectives() const { return Objectives; } @@ -230,50 +230,50 @@ class Quest std::string GetEndText() const { return EndText; } std::string GetCompletedText() const { return CompletedText; } int32 GetRewOrReqMoney() const; - uint32 GetRewHonorAddition() const { return RewHonorAddition; } - float GetRewHonorMultiplier() const { return RewHonorMultiplier; } - uint32 GetRewMoneyMaxLevel() const { return RewMoneyMaxLevel; } + uint32 GetRewHonorAddition() const { return RewardHonor; } + float GetRewHonorMultiplier() const { return RewardHonorMultiplier; } + uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } // use in XP calculation at client - uint32 GetRewSpell() const { return RewSpell; } - int32 GetRewSpellCast() const { return RewSpellCast; } - uint32 GetRewMailTemplateId() const { return RewMailTemplateId; } - uint32 GetRewMailDelaySecs() const { return RewMailDelaySecs; } + uint32 GetRewSpell() const { return RewardSpell; } + int32 GetRewSpellCast() const { return RewardSpellCast; } + uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; } + uint32 GetRewMailDelaySecs() const { return RewardMailDelay; } uint32 GetPointMapId() const { return PointMapId; } float GetPointX() const { return PointX; } float GetPointY() const { return PointY; } - uint32 GetPointOpt() const { return PointOpt; } - uint32 GetIncompleteEmote() const { return IncompleteEmote; } - uint32 GetCompleteEmote() const { return CompleteEmote; } - uint32 GetQuestStartScript() const { return QuestStartScript; } - uint32 GetQuestCompleteScript() const { return QuestCompleteScript; } - bool IsRepeatable() const { return QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE; } + uint32 GetPointOpt() const { return PointOption; } + uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; } + uint32 GetCompleteEmote() const { return EmoteOnComplete; } + uint32 GetQuestStartScript() const { return StartScript; } + uint32 GetQuestCompleteScript() const { return CompleteScript; } + bool IsRepeatable() const { return Flags & QUEST_TRINITY_FLAGS_REPEATABLE; } bool IsAutoComplete() const; - uint32 GetFlags() const { return QuestFlags; } - bool IsDaily() const { return QuestFlags & QUEST_FLAGS_DAILY; } - bool IsWeekly() const { return QuestFlags & QUEST_FLAGS_WEEKLY; } - bool IsDailyOrWeekly() const { return QuestFlags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); } - bool IsAutoAccept() const { return QuestFlags & QUEST_FLAGS_AUTO_ACCEPT; } + uint32 GetFlags() const { return Flags; } + bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; } + bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; } + bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); } + bool IsAutoAccept() const { return Flags & QUEST_FLAGS_AUTO_ACCEPT; } bool IsRaidQuest() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25; } bool IsAllowedInRaid() const; - bool IsDFQuest() const { return QuestFlags & QUEST_TRINITY_FLAGS_DF_QUEST; } + bool IsDFQuest() const { return Flags & QUEST_TRINITY_FLAGS_DF_QUEST; } uint32 CalculateHonorGain(uint8 level) const; // multiple values std::string ObjectiveText[QUEST_OBJECTIVES_COUNT]; - uint32 ReqItemId[QUEST_ITEM_OBJECTIVES_COUNT]; - uint32 ReqItemCount[QUEST_ITEM_OBJECTIVES_COUNT]; - uint32 ReqSourceId[QUEST_SOURCE_ITEM_IDS_COUNT]; - uint32 ReqSourceCount[QUEST_SOURCE_ITEM_IDS_COUNT]; - int32 ReqCreatureOrGOId[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject - uint32 ReqCreatureOrGOCount[QUEST_OBJECTIVES_COUNT]; - uint32 ReqSpell[QUEST_OBJECTIVES_COUNT]; - uint32 RewChoiceItemId[QUEST_REWARD_CHOICES_COUNT]; - uint32 RewChoiceItemCount[QUEST_REWARD_CHOICES_COUNT]; - uint32 RewItemId[QUEST_REWARDS_COUNT]; - uint32 RewItemCount[QUEST_REWARDS_COUNT]; - uint32 RewRepFaction[QUEST_REPUTATIONS_COUNT]; - int32 RewRepValueId[QUEST_REPUTATIONS_COUNT]; - int32 RewRepValue[QUEST_REPUTATIONS_COUNT]; + uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT]; + uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT]; + uint32 RequiredSourceItemid[QUEST_SOURCE_ITEM_IDS_COUNT]; + uint32 RequiredSourceItemId[QUEST_SOURCE_ITEM_IDS_COUNT]; + int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject + uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT]; + uint32 RequiredSpellCast[QUEST_OBJECTIVES_COUNT]; + uint32 RewardChoiceItemId[QUEST_REWARD_CHOICES_COUNT]; + uint32 RewardChoiceItemCount[QUEST_REWARD_CHOICES_COUNT]; + uint32 RewardItemId[QUEST_REWARDS_COUNT]; + uint32 RewardItemIdCount[QUEST_REWARDS_COUNT]; + uint32 RewardFactionId[QUEST_REPUTATIONS_COUNT]; + int32 RewardFactionValueId[QUEST_REPUTATIONS_COUNT]; + int32 RewardFactionValueIdOverride[QUEST_REPUTATIONS_COUNT]; uint32 DetailsEmote[QUEST_EMOTE_COUNT]; uint32 DetailsEmoteDelay[QUEST_EMOTE_COUNT]; uint32 OfferRewardEmote[QUEST_EMOTE_COUNT]; @@ -298,40 +298,40 @@ class Quest // table data protected: - uint32 QuestId; - uint32 QuestMethod; + uint32 Id; + uint32 Method; int32 ZoneOrSort; uint32 MinLevel; uint32 MaxLevel; - int32 QuestLevel; + int32 Level; uint32 Type; uint32 RequiredClasses; uint32 RequiredRaces; - uint32 RequiredSkill; - uint32 RequiredSkillValue; - uint32 RepObjectiveFaction; - int32 RepObjectiveValue; - uint32 RepObjectiveFaction2; - int32 RepObjectiveValue2; + uint32 RequiredSkillId; + uint32 RequiredSkillPoints; + uint32 RequiredFactionId1; + int32 RequiredFactionValue1; + uint32 RequiredFactionId2; + int32 RequiredFactionValue2; uint32 RequiredMinRepFaction; int32 RequiredMinRepValue; uint32 RequiredMaxRepFaction; int32 RequiredMaxRepValue; uint32 SuggestedPlayers; uint32 LimitTime; - uint32 QuestFlags; - uint32 CharTitleId; - uint32 PlayersSlain; - uint32 BonusTalents; - int32 RewArenaPoints; + uint32 Flags; + uint32 RewardTitleId; + uint32 RequiredPlayerKills; + uint32 RewardTalents; + int32 RewardArenaPoints; int32 PrevQuestId; int32 NextQuestId; int32 ExclusiveGroup; - uint32 NextQuestInChain; - uint32 XPId; - uint32 SrcItemId; - uint32 SrcItemCount; - uint32 SrcSpell; + uint32 NextQuestIdChain; + uint32 RewardXPId; + uint32 SourceItemId; + uint32 SourceItemIdCount; + uint32 SourceSpellid; std::string Title; std::string Details; std::string Objectives; @@ -339,22 +339,22 @@ class Quest std::string RequestItemsText; std::string EndText; std::string CompletedText; - uint32 RewHonorAddition; - float RewHonorMultiplier; - int32 RewOrReqMoney; - uint32 RewMoneyMaxLevel; - uint32 RewSpell; - int32 RewSpellCast; - uint32 RewMailTemplateId; - uint32 RewMailDelaySecs; + uint32 RewardHonor; + float RewardHonorMultiplier; + int32 RewardOrRequiredMoney; + uint32 RewardMoneyMaxLevel; + uint32 RewardSpell; + int32 RewardSpellCast; + uint32 RewardMailTemplateId; + uint32 RewardMailDelay; uint32 PointMapId; float PointX; float PointY; - uint32 PointOpt; - uint32 IncompleteEmote; - uint32 CompleteEmote; - uint32 QuestStartScript; - uint32 QuestCompleteScript; + uint32 PointOption; + uint32 EmoteOnIncomplete; + uint32 EmoteOnComplete; + uint32 StartScript; + uint32 CompleteScript; }; struct QuestStatusData diff --git a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp index 1ff1181bc6a..3df59b9bba1 100755 --- a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp @@ -205,14 +205,14 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data ItemTemplate const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { - if (!qRew->RewItemId[i]) + if (!qRew->RewardItemId[i]) continue; - iProto = sObjectMgr->GetItemTemplate(qRew->RewItemId[i]); + iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]); - data << uint32(qRew->RewItemId[i]); + data << uint32(qRew->RewardItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); - data << uint32(qRew->RewItemCount[i]); + data << uint32(qRew->RewardItemIdCount[i]); } } } @@ -495,14 +495,14 @@ void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntr ItemTemplate const* iProto = NULL; for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { - if (!qRew->RewItemId[i]) + if (!qRew->RewardItemId[i]) continue; - iProto = sObjectMgr->GetItemTemplate(qRew->RewItemId[i]); + iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]); - data << uint32(qRew->RewItemId[i]); + data << uint32(qRew->RewardItemId[i]); data << uint32(iProto ? iProto->DisplayInfoID : 0); - data << uint32(qRew->RewItemCount[i]); + data << uint32(qRew->RewardItemIdCount[i]); } } SendPacket(&data); diff --git a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp index fbd6c23d20f..e0bcadc89e9 100755 --- a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp @@ -200,7 +200,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) bool destroyItem = true; for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { - if ((qInfo->ReqItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetTemplate()->MaxCount > 0)) + if ((qInfo->RequiredItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetTemplate()->MaxCount > 0)) { destroyItem = false; break; diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index b1a3f55314c..3d437e473f7 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -176,8 +176,8 @@ public: // Add quest items for quests that require items for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x) { - uint32 id = quest->ReqItemId[x]; - uint32 count = quest->ReqItemCount[x]; + uint32 id = quest->RequiredItemId[x]; + uint32 count = quest->RequiredItemCount[x]; if (!id || !count) continue; @@ -195,10 +195,10 @@ public: // All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10") for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { - int32 creature = quest->ReqCreatureOrGOId[i]; - uint32 creaturecount = quest->ReqCreatureOrGOCount[i]; + int32 creature = quest->RequiredNpcOrGo[i]; + uint32 creaturecount = quest->RequiredNpcOrGoCount[i]; - if (uint32 spell_id = quest->ReqSpell[i]) + if (uint32 spell_id = quest->RequiredSpellCast[i]) { for (uint16 z = 0; z < creaturecount; ++z) player->CastedCreatureOrGO(creature, 0, spell_id); diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index 9c40fbb3f82..96f1cb49b84 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -2125,7 +2125,7 @@ public: { Quest const* qInfo = sObjectMgr->GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); if (qInfo) - CAST_PLR(killer)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0], 0); + CAST_PLR(killer)->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); } } }; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index f83b728ee01..3bb969977b6 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1009,7 +1009,7 @@ public: if (qInfo) { //TODO: prisoner should help player for a short period of time - player->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0], 0); + player->KilledMonsterCredit(qInfo->RequiredNpcOrGo[0], 0); pPrisoner->DisappearAndDie(); } return true; -- cgit v1.2.3 From 711858c43bdf58fe309a2a23cfc674bb1bbf894f Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 26 Nov 2011 14:49:15 +0000 Subject: Core/Quests: Update `quest_template` and SMSG_QUEST_QUERY_RESPONSE TODO: - Validate SkillId and reward it - Validate Currency, add it to the requires and reward it (after being able to read currency dbc) - Update other quest related opcodes --- sql/updates/world/2011_11_24_01_world_command.sql | 2 - .../2011_11_24_02_world_player_xp_for_level.sql | 7 - .../2011_11_25_02_world_item_script_names.sql | 17 -- .../world/2011_11_25_02_world_item_template.sql | 48 ----- .../2011_11_25_02_world_item_template_addon.sql | 38 ---- .../world/4.x/2011_11_24_01_world_command.sql | 2 + .../2011_11_24_02_world_player_xp_for_level.sql | 7 + .../4.x/2011_11_25_02_world_item_script_names.sql | 17 ++ .../4.x/2011_11_25_02_world_item_template.sql | 48 +++++ .../2011_11_25_02_world_item_template_addon.sql | 38 ++++ .../4.x/2011_12_26_02_world_quest_template.sql | 31 +++ src/server/game/Entities/Creature/GossipDef.cpp | 46 ++++- src/server/game/Entities/Player/Player.cpp | 16 +- src/server/game/Globals/ObjectMgr.cpp | 209 ++++++++++++++++++--- src/server/game/Quests/QuestDef.cpp | 134 ++++++++----- src/server/game/Quests/QuestDef.h | 62 ++++-- 16 files changed, 512 insertions(+), 210 deletions(-) delete mode 100644 sql/updates/world/2011_11_24_01_world_command.sql delete mode 100644 sql/updates/world/2011_11_24_02_world_player_xp_for_level.sql delete mode 100644 sql/updates/world/2011_11_25_02_world_item_script_names.sql delete mode 100644 sql/updates/world/2011_11_25_02_world_item_template.sql delete mode 100644 sql/updates/world/2011_11_25_02_world_item_template_addon.sql create mode 100644 sql/updates/world/4.x/2011_11_24_01_world_command.sql create mode 100644 sql/updates/world/4.x/2011_11_24_02_world_player_xp_for_level.sql create mode 100644 sql/updates/world/4.x/2011_11_25_02_world_item_script_names.sql create mode 100644 sql/updates/world/4.x/2011_11_25_02_world_item_template.sql create mode 100644 sql/updates/world/4.x/2011_11_25_02_world_item_template_addon.sql create mode 100644 sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/sql/updates/world/2011_11_24_01_world_command.sql b/sql/updates/world/2011_11_24_01_world_command.sql deleted file mode 100644 index 849a7538621..00000000000 --- a/sql/updates/world/2011_11_24_01_world_command.sql +++ /dev/null @@ -1,2 +0,0 @@ -UPDATE `command` SET `help`='Syntax: .account set addon [$account] #addon\n\nSet user (possible targeted) expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk, 3 - cata.' WHERE `name`='account set addon'; -UPDATE `command` SET `help`='Syntax: .account addon #addon\nSet expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk, 3 - cata.' WHERE `name`='account addon'; diff --git a/sql/updates/world/2011_11_24_02_world_player_xp_for_level.sql b/sql/updates/world/2011_11_24_02_world_player_xp_for_level.sql deleted file mode 100644 index d108b01824d..00000000000 --- a/sql/updates/world/2011_11_24_02_world_player_xp_for_level.sql +++ /dev/null @@ -1,7 +0,0 @@ -DELETE FROM `player_xp_for_level` WHERE `lvl` BETWEEN 80 AND 84; -INSERT INTO `player_xp_for_level` (`lvl`, `xp_for_next_level`) VALUES -(80, 1686300), -(81, 2121500), -(82, 4004000), -(83, 5203400), -(84, 9165100); diff --git a/sql/updates/world/2011_11_25_02_world_item_script_names.sql b/sql/updates/world/2011_11_25_02_world_item_script_names.sql deleted file mode 100644 index aaf843b91ae..00000000000 --- a/sql/updates/world/2011_11_25_02_world_item_script_names.sql +++ /dev/null @@ -1,17 +0,0 @@ -DROP TABLE IF EXISTS `item_script_names`; -CREATE TABLE `item_script_names` ( -`Id` int(10) unsigned not null, -`ScriptName` varchar(64) not null, -PRIMARY KEY(`Id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -INSERT INTO `item_script_names` -SELECT -`item_template`.`entry` AS `Id`, -`item_template`.`ScriptName` AS `ScriptName` -FROM -`item_template` -WHERE -length(`item_template`.`ScriptName`)>0; - -ALTER TABLE `item_template` DROP `ScriptName`; diff --git a/sql/updates/world/2011_11_25_02_world_item_template.sql b/sql/updates/world/2011_11_25_02_world_item_template.sql deleted file mode 100644 index 8a047ed9d11..00000000000 --- a/sql/updates/world/2011_11_25_02_world_item_template.sql +++ /dev/null @@ -1,48 +0,0 @@ -ALTER TABLE `item_template` - ADD `stat_unk1_1` int(11) not null default 0 AFTER `stat_value1`, - ADD `stat_unk2_1` int(11) not null default 0 AFTER `stat_unk1_1`, - ADD `stat_unk1_2` int(11) not null default 0 AFTER `stat_value2`, - ADD `stat_unk2_2` int(11) not null default 0 AFTER `stat_unk1_2`, - ADD `stat_unk1_3` int(11) not null default 0 AFTER `stat_value3`, - ADD `stat_unk2_3` int(11) not null default 0 AFTER `stat_unk1_3`, - ADD `stat_unk1_4` int(11) not null default 0 AFTER `stat_value4`, - ADD `stat_unk2_4` int(11) not null default 0 AFTER `stat_unk1_4`, - ADD `stat_unk1_5` int(11) not null default 0 AFTER `stat_value5`, - ADD `stat_unk2_5` int(11) not null default 0 AFTER `stat_unk1_5`, - ADD `stat_unk1_6` int(11) not null default 0 AFTER `stat_value6`, - ADD `stat_unk2_6` int(11) not null default 0 AFTER `stat_unk1_6`, - ADD `stat_unk1_7` int(11) not null default 0 AFTER `stat_value7`, - ADD `stat_unk2_7` int(11) not null default 0 AFTER `stat_unk1_7`, - ADD `stat_unk1_8` int(11) not null default 0 AFTER `stat_value8`, - ADD `stat_unk2_8` int(11) not null default 0 AFTER `stat_unk1_8`, - ADD `stat_unk1_9` int(11) not null default 0 AFTER `stat_value9`, - ADD `stat_unk2_9` int(11) not null default 0 AFTER `stat_unk1_9`, - ADD `stat_unk1_10` int(11) not null default 0 AFTER `stat_value10`, - ADD `stat_unk2_10` int(11) not null default 0 AFTER `stat_unk1_10`, - DROP `StatsCount`, - DROP `ScalingStatValue`, - CHANGE `dmg_type1` `DamageType` tinyint(3) unsigned not null default 0 AFTER `ScalingStatDistribution`, - DROP `dmg_min1`, - DROP `dmg_max1`, - DROP `dmg_min2`, - DROP `dmg_max2`, - DROP `dmg_type2`, - DROP `armor`, - DROP `holy_res`, - DROP `fire_res`, - DROP `nature_res`, - DROP `frost_res`, - DROP `shadow_res`, - DROP `arcane_res`, - DROP `ammo_type`, - DROP `spellppmRate_1`, - DROP `spellppmRate_2`, - DROP `spellppmRate_3`, - DROP `spellppmRate_4`, - DROP `spellppmRate_5`, - DROP `block`, - DROP `RequiredDisenchantSkill`, - DROP `DisenchantId`, - ADD `StatScalingFactor` float not null default 0 AFTER `HolidayId`, - ADD `Field130` int(11) not null default 0 AFTER `StatScalingFactor`, - ADD `Field131` int(11) not null default 0 AFTER `Field130`; diff --git a/sql/updates/world/2011_11_25_02_world_item_template_addon.sql b/sql/updates/world/2011_11_25_02_world_item_template_addon.sql deleted file mode 100644 index 2d99d9fc610..00000000000 --- a/sql/updates/world/2011_11_25_02_world_item_template_addon.sql +++ /dev/null @@ -1,38 +0,0 @@ -DROP TABLE IF EXISTS `item_template_addon`; -CREATE TABLE `item_template_addon` ( -`Id` int(10) unsigned not null, -`BuyCount` tinyint(3) unsigned not null default 1, -`FoodType` tinyint(3) unsigned not null default 0, -`MinMoneyLoot` int(10) unsigned not null default 0, -`MaxMoneyLoot` int(10) unsigned not null default 0, -`SpellPPMChance` float unsigned not null default 0, -PRIMARY KEY(`Id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -INSERT INTO `item_template_addon` -SELECT -`item_template`.`entry` AS `Id`, -`item_template`.`BuyCount` AS `BuyCount`, -`item_template`.`FoodType` AS `FoodType`, -`item_template`.`minMoneyLoot` AS `MinMoneyLoot`, -`item_template`.`maxMoneyLoot` AS `MaxMoneyLoot`, -ABS(IF(`item_template`.`spelltrigger_1`=2, `item_template`.`spellppmRate_1`, - IF (`item_template`.`spelltrigger_2`=2, `item_template`.`spellppmRate_2`, - IF (`item_template`.`spelltrigger_3`=2, `item_template`.`spellppmRate_3`, - IF (`item_template`.`spelltrigger_4`=2, `item_template`.`spellppmRate_4`, - IF (`item_template`.`spelltrigger_5`=2, `item_template`.`spellppmRate_5`, 0)))))) - AS `SpellPPMChance` -FROM -`item_template` -HAVING -- need to use having due to `SpellPPMChance` usage which is not an actual field in table -`item_template`.`BuyCount`!=1 OR -`item_template`.`FoodType`!=0 OR -(`item_template`.`minMoneyLoot`!=0 AND -`item_template`.`maxMoneyLoot`!=0) OR -`SpellPPMChance`!=0; - -ALTER TABLE `item_template` - DROP `BuyCount`, - DROP `FoodType`, - DROP `minMoneyLoot`, - DROP `maxMoneyLoot`; diff --git a/sql/updates/world/4.x/2011_11_24_01_world_command.sql b/sql/updates/world/4.x/2011_11_24_01_world_command.sql new file mode 100644 index 00000000000..849a7538621 --- /dev/null +++ b/sql/updates/world/4.x/2011_11_24_01_world_command.sql @@ -0,0 +1,2 @@ +UPDATE `command` SET `help`='Syntax: .account set addon [$account] #addon\n\nSet user (possible targeted) expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk, 3 - cata.' WHERE `name`='account set addon'; +UPDATE `command` SET `help`='Syntax: .account addon #addon\nSet expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk, 3 - cata.' WHERE `name`='account addon'; diff --git a/sql/updates/world/4.x/2011_11_24_02_world_player_xp_for_level.sql b/sql/updates/world/4.x/2011_11_24_02_world_player_xp_for_level.sql new file mode 100644 index 00000000000..d108b01824d --- /dev/null +++ b/sql/updates/world/4.x/2011_11_24_02_world_player_xp_for_level.sql @@ -0,0 +1,7 @@ +DELETE FROM `player_xp_for_level` WHERE `lvl` BETWEEN 80 AND 84; +INSERT INTO `player_xp_for_level` (`lvl`, `xp_for_next_level`) VALUES +(80, 1686300), +(81, 2121500), +(82, 4004000), +(83, 5203400), +(84, 9165100); diff --git a/sql/updates/world/4.x/2011_11_25_02_world_item_script_names.sql b/sql/updates/world/4.x/2011_11_25_02_world_item_script_names.sql new file mode 100644 index 00000000000..aaf843b91ae --- /dev/null +++ b/sql/updates/world/4.x/2011_11_25_02_world_item_script_names.sql @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS `item_script_names`; +CREATE TABLE `item_script_names` ( +`Id` int(10) unsigned not null, +`ScriptName` varchar(64) not null, +PRIMARY KEY(`Id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +INSERT INTO `item_script_names` +SELECT +`item_template`.`entry` AS `Id`, +`item_template`.`ScriptName` AS `ScriptName` +FROM +`item_template` +WHERE +length(`item_template`.`ScriptName`)>0; + +ALTER TABLE `item_template` DROP `ScriptName`; diff --git a/sql/updates/world/4.x/2011_11_25_02_world_item_template.sql b/sql/updates/world/4.x/2011_11_25_02_world_item_template.sql new file mode 100644 index 00000000000..8a047ed9d11 --- /dev/null +++ b/sql/updates/world/4.x/2011_11_25_02_world_item_template.sql @@ -0,0 +1,48 @@ +ALTER TABLE `item_template` + ADD `stat_unk1_1` int(11) not null default 0 AFTER `stat_value1`, + ADD `stat_unk2_1` int(11) not null default 0 AFTER `stat_unk1_1`, + ADD `stat_unk1_2` int(11) not null default 0 AFTER `stat_value2`, + ADD `stat_unk2_2` int(11) not null default 0 AFTER `stat_unk1_2`, + ADD `stat_unk1_3` int(11) not null default 0 AFTER `stat_value3`, + ADD `stat_unk2_3` int(11) not null default 0 AFTER `stat_unk1_3`, + ADD `stat_unk1_4` int(11) not null default 0 AFTER `stat_value4`, + ADD `stat_unk2_4` int(11) not null default 0 AFTER `stat_unk1_4`, + ADD `stat_unk1_5` int(11) not null default 0 AFTER `stat_value5`, + ADD `stat_unk2_5` int(11) not null default 0 AFTER `stat_unk1_5`, + ADD `stat_unk1_6` int(11) not null default 0 AFTER `stat_value6`, + ADD `stat_unk2_6` int(11) not null default 0 AFTER `stat_unk1_6`, + ADD `stat_unk1_7` int(11) not null default 0 AFTER `stat_value7`, + ADD `stat_unk2_7` int(11) not null default 0 AFTER `stat_unk1_7`, + ADD `stat_unk1_8` int(11) not null default 0 AFTER `stat_value8`, + ADD `stat_unk2_8` int(11) not null default 0 AFTER `stat_unk1_8`, + ADD `stat_unk1_9` int(11) not null default 0 AFTER `stat_value9`, + ADD `stat_unk2_9` int(11) not null default 0 AFTER `stat_unk1_9`, + ADD `stat_unk1_10` int(11) not null default 0 AFTER `stat_value10`, + ADD `stat_unk2_10` int(11) not null default 0 AFTER `stat_unk1_10`, + DROP `StatsCount`, + DROP `ScalingStatValue`, + CHANGE `dmg_type1` `DamageType` tinyint(3) unsigned not null default 0 AFTER `ScalingStatDistribution`, + DROP `dmg_min1`, + DROP `dmg_max1`, + DROP `dmg_min2`, + DROP `dmg_max2`, + DROP `dmg_type2`, + DROP `armor`, + DROP `holy_res`, + DROP `fire_res`, + DROP `nature_res`, + DROP `frost_res`, + DROP `shadow_res`, + DROP `arcane_res`, + DROP `ammo_type`, + DROP `spellppmRate_1`, + DROP `spellppmRate_2`, + DROP `spellppmRate_3`, + DROP `spellppmRate_4`, + DROP `spellppmRate_5`, + DROP `block`, + DROP `RequiredDisenchantSkill`, + DROP `DisenchantId`, + ADD `StatScalingFactor` float not null default 0 AFTER `HolidayId`, + ADD `Field130` int(11) not null default 0 AFTER `StatScalingFactor`, + ADD `Field131` int(11) not null default 0 AFTER `Field130`; diff --git a/sql/updates/world/4.x/2011_11_25_02_world_item_template_addon.sql b/sql/updates/world/4.x/2011_11_25_02_world_item_template_addon.sql new file mode 100644 index 00000000000..2d99d9fc610 --- /dev/null +++ b/sql/updates/world/4.x/2011_11_25_02_world_item_template_addon.sql @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS `item_template_addon`; +CREATE TABLE `item_template_addon` ( +`Id` int(10) unsigned not null, +`BuyCount` tinyint(3) unsigned not null default 1, +`FoodType` tinyint(3) unsigned not null default 0, +`MinMoneyLoot` int(10) unsigned not null default 0, +`MaxMoneyLoot` int(10) unsigned not null default 0, +`SpellPPMChance` float unsigned not null default 0, +PRIMARY KEY(`Id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +INSERT INTO `item_template_addon` +SELECT +`item_template`.`entry` AS `Id`, +`item_template`.`BuyCount` AS `BuyCount`, +`item_template`.`FoodType` AS `FoodType`, +`item_template`.`minMoneyLoot` AS `MinMoneyLoot`, +`item_template`.`maxMoneyLoot` AS `MaxMoneyLoot`, +ABS(IF(`item_template`.`spelltrigger_1`=2, `item_template`.`spellppmRate_1`, + IF (`item_template`.`spelltrigger_2`=2, `item_template`.`spellppmRate_2`, + IF (`item_template`.`spelltrigger_3`=2, `item_template`.`spellppmRate_3`, + IF (`item_template`.`spelltrigger_4`=2, `item_template`.`spellppmRate_4`, + IF (`item_template`.`spelltrigger_5`=2, `item_template`.`spellppmRate_5`, 0)))))) + AS `SpellPPMChance` +FROM +`item_template` +HAVING -- need to use having due to `SpellPPMChance` usage which is not an actual field in table +`item_template`.`BuyCount`!=1 OR +`item_template`.`FoodType`!=0 OR +(`item_template`.`minMoneyLoot`!=0 AND +`item_template`.`maxMoneyLoot`!=0) OR +`SpellPPMChance`!=0; + +ALTER TABLE `item_template` + DROP `BuyCount`, + DROP `FoodType`, + DROP `minMoneyLoot`, + DROP `maxMoneyLoot`; diff --git a/sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql b/sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql new file mode 100644 index 00000000000..b43abd6f85d --- /dev/null +++ b/sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql @@ -0,0 +1,31 @@ +ALTER TABLE `quest_template` ADD COLUMN `MinimapTargetMark` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `SpecialFlags`, + ADD COLUMN `RewardSkillId` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardArenaPoints`, + ADD COLUMN `RewardSkillPoints` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardSkillId`, + ADD COLUMN `RewardReputationMask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardSkillPoints`, + ADD COLUMN `QuestGiverPortrait` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardReputationMask`, + ADD COLUMN `QuestTurnInPortrait` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `QuestGiverPortrait`, + ADD COLUMN `RequiredSpell` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredItemCount6`, + ADD COLUMN `RewardCurrencyId1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `ObjectiveText4`, + ADD COLUMN `RewardCurrencyId2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId1`, + ADD COLUMN `RewardCurrencyId3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId2`, + ADD COLUMN `RewardCurrencyId4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId3`, + ADD COLUMN `RewardCurrencyCount1` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId4`, + ADD COLUMN `RewardCurrencyCount2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount1`, + ADD COLUMN `RewardCurrencyCount3` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount2`, + ADD COLUMN `RewardCurrencyCount4` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount3`, + ADD COLUMN `RequiredCurrencyId1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount4`, + ADD COLUMN `RequiredCurrencyId2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId1`, + ADD COLUMN `RequiredCurrencyId3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId2`, + ADD COLUMN `RequiredCurrencyId4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId3`, + ADD COLUMN `RequiredCurrencyCount1` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId4`, + ADD COLUMN `RequiredCurrencyCount2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount1`, + ADD COLUMN `RequiredCurrencyCount3` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount2`, + ADD COLUMN `RequiredCurrencyCount4` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount3`, + ADD COLUMN `QuestGiverTextWindow` TEXT NULL DEFAULT NULL AFTER `RequiredCurrencyCount4`, + ADD COLUMN `QuestGiverTargetName` TEXT NULL DEFAULT NULL AFTER `QuestGiverTextWindow`, + ADD COLUMN `QuestTurnTextWindow` TEXT NULL DEFAULT NULL AFTER `QuestGiverTargetName`, + ADD COLUMN `QuestTurnTargetName` TEXT NULL DEFAULT NULL AFTER `QuestTurnTextWindow`, + ADD COLUMN `SoundAccept` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '890' AFTER `QuestTurnTargetName`, + ADD COLUMN `SoundTurnIn` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '878' AFTER `SoundAccept`; + +ALTER TABLE `quest_template` DROP COLUMN `Unknown0`; -- Not found on 422 diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 5bf7910466c..1b1c86fe00d 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -401,11 +401,17 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const { + // SMSG_QUEST_QUERY_RESPONSE - Updated to 422 + std::string questTitle = quest->GetTitle(); std::string questDetails = quest->GetDetails(); std::string questObjectives = quest->GetObjectives(); std::string questEndText = quest->GetEndText(); std::string questCompletedText = quest->GetCompletedText(); + std::string questGiverTextWindow = quest->GetQuestGiverTextWindow(); + std::string questGiverTargetName = quest->GetQuestGiverTargetName(); + std::string questTurnTextWindow = quest->GetQuestTurnTextWindow(); + std::string questTurnTargetName = quest->GetQuestTurnTargetName(); std::string questObjectiveText[QUEST_OBJECTIVES_COUNT]; for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) @@ -421,6 +427,10 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); ObjectMgr::GetLocaleString(localeData->EndText, locale, questEndText); ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText); + ObjectMgr::GetLocaleString(localeData->QuestGiverTextWindow, locale, questGiverTextWindow); + ObjectMgr::GetLocaleString(localeData->QuestGiverTargetName, locale, questGiverTargetName); + ObjectMgr::GetLocaleString(localeData->QuestTurnTextWindow, locale, questTurnTextWindow); + ObjectMgr::GetLocaleString(localeData->QuestTurnTargetName, locale, questTurnTargetName); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); @@ -461,11 +471,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << float(0); // new reward honor (multipled by ~62 at client side) data << uint32(quest->GetSrcItemId()); // source item id data << uint32(quest->GetFlags() & 0xFFFF); // quest flags + data << uint32(quest->GetMinimapTargetMark()); // minimap target mark (skull, etc. missing enum) data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(quest->GetPlayersSlain()); // players slain data << uint32(quest->GetBonusTalents()); // bonus talents data << uint32(quest->GetRewArenaPoints()); // bonus arena points - data << uint32(0); // review rep show mask + data << uint32(quest->GetRewardSkillId()); // reward skill id + data << uint32(quest->GetRewardSkillPoints()); // reward skill points + data << uint32(quest->GetRewardReputationMask()); // rep mask (unsure on what it does) + data << uint32(quest->GetQuestGiverPortrait()); // quest giver entry ? + data << uint32(quest->GetQuestTurnInPortrait()); // quest turnin entry ? if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) { @@ -494,7 +509,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc? data << int32(quest->RewardFactionValueId[i]); - for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0) + for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unknown usage data << int32(quest->RewardFactionValueIdOverride[i]); data << quest->GetPointMapId(); @@ -506,7 +521,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << questObjectives; data << questDetails; data << questEndText; - data << questCompletedText; // display in quest objectives window once all objectives are completed + data << questCompletedText; for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { @@ -516,8 +531,8 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << uint32(quest->RequiredNpcOrGo[i]); data << uint32(quest->RequiredNpcOrGoCount[i]); - data << uint32(quest->RequiredSourceItemid[i]); - data << uint32(0); // req source count? + data << uint32(quest->RequiredSourceItemId[i]); + data << uint32(quest->RequiredSourceItemCount[i]); } for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) @@ -526,9 +541,30 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << uint32(quest->RequiredItemCount[i]); } + data << uint32(quest->GetRequiredSpell()); // Is it required to be cast, learned or what? + for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) data << questObjectiveText[i]; + for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) + { + data << uint32(quest->RewardCurrencyId[i]); + data << uint32(quest->RewardCurrencyCount[i]); + } + + for (uint32 i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) + { + data << uint32(quest->RequiredCurrencyId[i]); + data << uint32(quest->RequiredCurrencyCount[i]); + } + + data << questGiverTextWindow; + data << questGiverTargetName; + data << questTurnTextWindow; + data << questTurnTargetName; + data << uint32(quest->GetSoundAccept()); + data << uint32(quest->GetSoundTurnIn()); + _session->SendPacket(&data); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId()); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 524a5943c7f..5565aacc0e1 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14834,10 +14834,10 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) { - if (quest->RequiredSourceItemid[i]) + if (quest->RequiredSourceItemId[i]) { - uint32 count = quest->RequiredSourceItemId[i]; - DestroyItemCount(quest->RequiredSourceItemid[i], count ? count : 9999, true); + uint32 count = quest->RequiredSourceItemCount[i]; + DestroyItemCount(quest->RequiredSourceItemId[i], count ? count : 9999, true); } } @@ -15031,9 +15031,9 @@ void Player::FailQuest(uint32 questId) // Destroy items recieved on starting the quest. DestroyItemCount(quest->RequiredItemId[i], quest->RequiredItemCount[i], true, true); for (uint8 i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - if (quest->RequiredSourceItemid[i] > 0 && quest->RequiredSourceItemId[i] > 0) + if (quest->RequiredSourceItemId[i] > 0 && quest->RequiredSourceItemCount[i] > 0) // Destroy items recieved during the quest. - DestroyItemCount(quest->RequiredSourceItemid[i], quest->RequiredSourceItemId[i], true, true); + DestroyItemCount(quest->RequiredSourceItemId[i], quest->RequiredSourceItemCount[i], true, true); } } @@ -16084,7 +16084,7 @@ bool Player::HasQuestForItem(uint32 itemid) const for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j) { // examined item is a source item - if (qinfo->RequiredSourceItemid[j] == itemid) + if (qinfo->RequiredSourceItemId[j] == itemid) { ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid); @@ -16093,9 +16093,9 @@ bool Player::HasQuestForItem(uint32 itemid) const return true; // allows custom amount drop when not 0 - if (qinfo->RequiredSourceItemId[j]) + if (qinfo->RequiredSourceItemCount[j]) { - if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemId[j]) + if (GetItemCount(itemid, true) < qinfo->RequiredSourceItemCount[j]) return true; } else if (GetItemCount(itemid, true) < pProto->GetMaxStackSize()) return true; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 2057180b81b..8a47e91b32b 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3593,33 +3593,37 @@ void ObjectMgr::LoadQuests() "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, " // 21 22 23 24 25 26 27 28 29 30 31 "PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestIdChain, RewardXPId, RewardOrRequiredMoney, RewardMoneyMaxLevel, RewardSpell, RewardSpellCast, RewardHonor, RewardHonorMultiplier, " - // 32 33 34 35 36 37 38 39 40 41 42 - "RewardMailTemplateId, RewardMailDelay, SourceItemId, SourceItemCount, SourceSpellId, Flags, SpecialFlags, RewardTitleId, RequiredPlayerKills, RewardTalents, RewardArenaPoints, " - // 43 44 45 46 47 48 49 50 - "RewardItemId1, RewardItemId2, RewardItemId3, RewardItemId4, RewardItemCount1, RewardItemCount2, RewardItemCount3, RewardItemCount4, " - // 51 52 53 54 55 56 57 58 59 60 61 62 + // 32 33 34 35 36 37 38 39 40 41 42 43 + "RewardMailTemplateId, RewardMailDelay, SourceItemId, SourceItemCount, SourceSpellId, Flags, SpecialFlags, MinimapTargetMark, RewardTitleId, RequiredPlayerKills, RewardTalents, RewardArenaPoints, " + // 44 45 46 47 48 49 50 51 52 53 54 55 56 + "RewardSkillId, RewardSkillPoints, RewardReputationMask, QuestGiverPortrait, QuestTurnInPortrait, RewardItemId1, RewardItemId2, RewardItemId3, RewardItemId4, RewardItemCount1, RewardItemCount2, RewardItemCount3, RewardItemCount4, " + // 57 58 59 60 61 62 63 64 65 66 67 68 "RewardChoiceItemId1, RewardChoiceItemId2, RewardChoiceItemId3, RewardChoiceItemId4, RewardChoiceItemId5, RewardChoiceItemId6, RewardChoiceItemCount1, RewardChoiceItemCount2, RewardChoiceItemCount3, RewardChoiceItemCount4, RewardChoiceItemCount5, RewardChoiceItemCount6, " - // 63 64 65 66 67 68 69 70 71 72 + // 69 70 71 72 73 74 75 76 77 78 "RewardFactionId1, RewardFactionId2, RewardFactionId3, RewardFactionId4, RewardFactionId5, RewardFactionValueId1, RewardFactionValueId2, RewardFactionValueId3, RewardFactionValueId4, RewardFactionValueId5, " - // 73 74 75 76 77 + // 79 80 81 82 83 "RewardFactionValueIdOverride1, RewardFactionValueIdOverride2, RewardFactionValueIdOverride3, RewardFactionValueIdOverride4, RewardFactionValueIdOverride5, " - // 78 79 80 81 - "PointMapId, PointX, PointY, PointOption, " - // 82 83 84 85 86 87 88 - "Title, Objectives, Details, EndText, OfferRewardText, RequestItemsText, CompletedText, " - // 89 90 91 92 93 94 95 96 + // 84 85 86 87 88 89 90 91 92 93 94 + "PointMapId, PointX, PointY, PointOption, Title, Objectives, Details, EndText, CompletedText, OfferRewardText, RequestItemsText, " + // 95 96 97 98 99 100 101 102 "RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, " - // 97 98 99 100 101 102 103 104 + // 103 104 105 106 107 108 109 110 "RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4, RequiredSourceItemCount1, RequiredSourceItemCount2, RequiredSourceItemCount3, RequiredSourceItemCount4, " - // 105 106 107 108 109 110 111 112 113 114 115 116 + // 111 112 113 114 115 116 117 118 119 120 121 122 "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, " - // 117 118 119 120 121 122 123 124 125 - "RequiredSpellCast1, RequiredSpellCast2, RequiredSpellCast3, RequiredSpellCast4, Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, " - // 126 127 128 129 130 131 132 133 134 135 + // 123 124 125 126 127 128 129 130 131 + "RequiredSpell, RequiredSpellCast1, RequiredSpellCast2, RequiredSpellCast3, RequiredSpellCast4, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, " + // 132 133 134 135 136 137 138 139 + "RewardCurrencyId1, RewardCurrencyId2, RewardCurrencyId3, RewardCurrencyId4, RewardCurrencyCount1, RewardCurrencyCount2, RewardCurrencyCount3, RewardCurrencyCount4, " + // 140 141 142 143 144 145 146 147 + "RequiredCurrencyId1, RequiredCurrencyId2, RequiredCurrencyId3, RequiredCurrencyId4, RequiredCurrencyCount1, RequiredCurrencyCount2, RequiredCurrencyCount3, RequiredCurrencyCount4, " + // 148 149 150 151 152 153 + "QuestGiverTextWindow, QuestGiverTargetName, QuestTurnTextWindow, QuestTurnTargetName, SoundAccept, SoundTurnIn, " + // 154 155 156 157 158 159 160 161 162 163 "DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, EmoteOnIncomplete, EmoteOnComplete, " - // 136 137 138 139 140 141 142 143 + // 164 165 166 167 168 169 170 171 "OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, " - // 144 145 146 + // 172 173 174 "StartScript, CompleteScript, WDBVerified" " FROM quest_template"); if (!result) @@ -3912,7 +3916,7 @@ void ObjectMgr::LoadQuests() qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } - else if (qinfo->RequiredItemCount[j]>0) + else if (qinfo->RequiredItemCount[j] > 0) { sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]); @@ -3922,22 +3926,22 @@ void ObjectMgr::LoadQuests() for (uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j) { - uint32 id = qinfo->RequiredSourceItemid[j]; + uint32 id = qinfo->RequiredSourceItemId[j]; if (id) { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = %u but item with entry %u does not exist, quest can't be done.", + sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); // no changes, quest can't be done for this requirement } } else { - if (qinfo->RequiredSourceItemId[j]>0) + if (qinfo->RequiredSourceItemCount[j] > 0) { - sLog->outErrorDb("Quest %u has `RequiredSourceItemid%d` = 0 but `RequiredSourceItemId%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemId[j]); + sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemCount[j]); // no changes, quest ignore this data } } @@ -4190,6 +4194,161 @@ void ObjectMgr::LoadQuests() qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); } + for (uint8 j = 0; j < QUEST_REWARD_CURRENCY_COUNT; ++j) + { + uint32 currency = qinfo->RewardCurrencyId[j]; + if (currency) + { + if (qinfo->RewardCurrencyCount[j] == 0) + { + sLog->outErrorDb("Quest %u has `RewardCurrencyId%d` = %u but `RewardCurrencyCount%d` = 0, quest can't be done.", + qinfo->GetQuestId(), j+1, currency, j+1); + // no changes, quest can't be done for this requirement + } + + /* TODO: Re-enable once currency dbc getters are implemented + if (!sObjectMgr->GetCurrency(currency)) + { + sLog->outErrorDb("Quest %u has `RewardCurrencyId%d` = %u but currency with entry %u does not exist, quest can't be done.", + qinfo->GetQuestId(), j+1, currency, currency); + qinfo->RewardCurrencyCount[j] = 0; // prevent incorrect work of quest + }*/ + } + else if (qinfo->RewardCurrencyCount[j] > 0) + { + sLog->outErrorDb("Quest %u has `RewardCurrencyId%d` = 0 but `RewardCurrencyCount%d` = %u, quest can't be done.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RewardCurrencyCount[j]); + qinfo->RewardCurrencyCount[j] = 0; // prevent incorrect work of quest + } + } + + for (uint8 j = 0; j < QUEST_REQUIRED_CURRENCY_COUNT; ++j) + { + uint32 currency = qinfo->RequiredCurrencyId[j]; + if (currency) + { + if (qinfo->RequiredCurrencyCount[j] == 0) + { + sLog->outErrorDb("Quest %u has `RequiredCurrencyId%d` = %u but `RequiredCurrencyCount%d` = 0, quest can't be done.", + qinfo->GetQuestId(), j+1, currency, j+1); + // no changes, quest can't be done for this requirement + } + + /* TODO: Re-enable once currency dbc getters are implemented + if (!sObjectMgr->GetCurrency(currency)) + { + sLog->outErrorDb("Quest %u has `RequiredCurrencyId%d` = %u but currency with entry %u does not exist, quest can't be done.", + qinfo->GetQuestId(), j+1, currency, currency); + qinfo->RequiredCurrencyCount[j] = 0; // prevent incorrect work of quest + }*/ + } + else if (qinfo->RequiredCurrencyCount[j] > 0) + { + sLog->outErrorDb("Quest %u has `RequiredCurrencyId%d` = 0 but `RequiredCurrencyCount%d` = %u, quest can't be done.", + qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredCurrencyCount[j]); + qinfo->RequiredCurrencyCount[j] = 0; // prevent incorrect work of quest + } + } + + if (qinfo->SoundAccept) + { + if (!sSoundEntriesStore.LookupEntry(qinfo->SoundAccept)) + { + sLog->outErrorDb("Quest %u has `SoundAccept` = %u but sound %u does not exist, set to 0.", + qinfo->GetQuestId(), qinfo->SoundAccept, qinfo->SoundAccept); + qinfo->SoundAccept = 0; // no sound will be played + } + } + + if (qinfo->SoundTurnIn) + { + if (!sSoundEntriesStore.LookupEntry(qinfo->SoundTurnIn)) + { + sLog->outErrorDb("Quest %u has `SoundTurnIn` = %u but sound %u does not exist, set to 0.", + qinfo->GetQuestId(), qinfo->SoundTurnIn, qinfo->SoundTurnIn); + qinfo->SoundTurnIn = 0; // no sound will be played + } + } + + if (qinfo->RequiredSpell > 0) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RequiredSpell); + + if (!spellInfo) + { + sLog->outErrorDb("Quest %u has `RequiredSpell` = %u but spell %u does not exist, quest will not require a spell.", + qinfo->GetQuestId(), qinfo->RequiredSpell, qinfo->RequiredSpell); + qinfo->RequiredSpell = 0; // no spell will be required + } + + else if (!SpellMgr::IsSpellValid(spellInfo)) + { + sLog->outErrorDb("Quest %u has `RequiredSpell` = %u but spell %u is broken, quest will not require a spell.", + qinfo->GetQuestId(), qinfo->RequiredSpell, qinfo->RequiredSpell); + qinfo->RequiredSpell = 0; // no spell will be required + } + + /* Can we require talents? + else if (GetTalentSpellCost(qinfo->RewardSpellCast)) + { + sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); + qinfo->RewardSpellCast = 0; // no spell will be casted on player + } + }*/ + } + + if (qinfo->RewardSkillId) + { + if (!sSkillLineStore.LookupEntry(qinfo->RewardSkillId)) + { + sLog->outErrorDb("Quest %u has `RewardSkillId` = %u but this skill does not exist", + qinfo->GetQuestId(), qinfo->RewardSkillId); + } + if (!qinfo->RewardSkillPoints) + { + sLog->outErrorDb("Quest %u has `RewardSkillId` = %u but `RewardSkillPoints` is 0", + qinfo->GetQuestId(), qinfo->RewardSkillId); + } + } + + if (qinfo->RewardSkillPoints) + { + if (qinfo->RewardSkillPoints > sWorld->GetConfigMaxSkillValue()) + { + sLog->outErrorDb("Quest %u has `RewardSkillPoints` = %u but max possible skill is %u, quest can't be done.", + qinfo->GetQuestId(), qinfo->RewardSkillPoints, sWorld->GetConfigMaxSkillValue()); + // no changes, quest can't be done for this requirement + } + if (!qinfo->RewardSkillId) + { + sLog->outErrorDb("Quest %u has `RewardSkillPoints` = %u but `RewardSkillId` is 0", + qinfo->GetQuestId(), qinfo->RewardSkillPoints); + } + } + + if (qinfo->QuestGiverPortrait) + { + if (!sObjectMgr->GetCreatureTemplate(qinfo->QuestGiverPortrait)) + { + sLog->outErrorDb("Quest %u has `QuestGiverPortrait` = %u but creature with entry %u does not exist, quest can't be done.", + qinfo->GetQuestId(), qinfo->QuestGiverPortrait, qinfo->QuestGiverPortrait); + qinfo->QuestGiverPortrait = 0; + } + } + + if (qinfo->QuestTurnInPortrait) + { + if (!sObjectMgr->GetCreatureTemplate(qinfo->QuestTurnInPortrait)) + { + sLog->outErrorDb("Quest %u has `QuestTurnInPortrait` = %u but creature with entry %u does not exist, quest can't be done.", + qinfo->GetQuestId(), qinfo->QuestTurnInPortrait, qinfo->QuestTurnInPortrait); + qinfo->QuestTurnInPortrait = 0; + } + } + + + // fill additional data stores if (qinfo->PrevQuestId) { diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 873b6c29fea..f0c67e3ac4d 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -61,114 +61,150 @@ Quest::Quest(Field* questRecord) SourceSpellid = questRecord[36].GetUInt32(); Flags = questRecord[37].GetUInt32(); uint32 SpecialFlags = questRecord[38].GetUInt16(); - RewardTitleId = questRecord[39].GetUInt32(); - RequiredPlayerKills = questRecord[40].GetUInt32(); - RewardTalents = questRecord[41].GetUInt32(); - RewardArenaPoints = questRecord[42].GetInt32(); + MinimapTargetMark = questRecord[39].GetUInt32(); + RewardTitleId = questRecord[40].GetUInt32(); + RequiredPlayerKills = questRecord[41].GetUInt32(); + RewardTalents = questRecord[42].GetUInt32(); + RewardArenaPoints = questRecord[43].GetInt32(); + RewardSkillId = questRecord[44].GetUInt32(); + RewardSkillPoints = questRecord[45].GetUInt32(); + RewardReputationMask = questRecord[46].GetUInt32(); + QuestGiverPortrait = questRecord[47].GetUInt32(); + QuestTurnInPortrait = questRecord[48].GetUInt32(); for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewardItemId[i] = questRecord[43+i].GetUInt32(); + RewardItemId[i] = questRecord[49+i].GetUInt32(); for (int i = 0; i < QUEST_REWARDS_COUNT; ++i) - RewardItemIdCount[i] = questRecord[47+i].GetUInt32(); + RewardItemIdCount[i] = questRecord[53+i].GetUInt32(); for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewardChoiceItemId[i] = questRecord[51+i].GetUInt32(); + RewardChoiceItemId[i] = questRecord[57+i].GetUInt32(); for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) - RewardChoiceItemCount[i] = questRecord[57+i].GetUInt32(); + RewardChoiceItemCount[i] = questRecord[63+i].GetUInt32(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewardFactionId[i] = questRecord[63+i].GetUInt32(); + RewardFactionId[i] = questRecord[69+i].GetUInt32(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewardFactionValueId[i] = questRecord[68+i].GetInt32(); + RewardFactionValueId[i] = questRecord[74+i].GetInt32(); for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) - RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32(); + RewardFactionValueIdOverride[i] = questRecord[79+i].GetInt32(); - PointMapId = questRecord[78].GetUInt32(); - PointX = questRecord[79].GetFloat(); - PointY = questRecord[80].GetFloat(); - PointOption = questRecord[81].GetUInt32(); - Title = questRecord[82].GetString(); - Objectives = questRecord[83].GetString(); - Details = questRecord[84].GetString(); - EndText = questRecord[85].GetString(); - OfferRewardText = questRecord[86].GetString(); - RequestItemsText = questRecord[87].GetString(); - CompletedText = questRecord[88].GetString(); + PointMapId = questRecord[84].GetUInt32(); + PointX = questRecord[85].GetFloat(); + PointY = questRecord[86].GetFloat(); + PointOption = questRecord[87].GetUInt32(); + Title = questRecord[88].GetString(); + Objectives = questRecord[89].GetString(); + Details = questRecord[90].GetString(); + EndText = questRecord[91].GetString(); + CompletedText = questRecord[92].GetString(); + OfferRewardText = questRecord[93].GetString(); + RequestItemsText = questRecord[94].GetString(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - RequiredNpcOrGo[i] = questRecord[89+i].GetInt32(); + RequiredNpcOrGo[i] = questRecord[95+i].GetInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt32(); + RequiredNpcOrGoCount[i] = questRecord[99+i].GetUInt32(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - RequiredSourceItemid[i] = questRecord[97+i].GetUInt32(); + RequiredSourceItemId[i] = questRecord[103+i].GetUInt32(); for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i) - RequiredSourceItemId[i] = questRecord[101+i].GetUInt32(); + RequiredSourceItemCount[i] = questRecord[107+i].GetUInt32(); for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - RequiredItemId[i] = questRecord[105+i].GetUInt32(); + RequiredItemId[i] = questRecord[111+i].GetUInt32(); for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - RequiredItemCount[i] = questRecord[111+i].GetUInt32(); + RequiredItemCount[i] = questRecord[117+i].GetUInt32(); - for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - RequiredSpellCast[i] = questRecord[117+i].GetUInt32(); + RequiredSpell = questRecord[123].GetUInt32(); - // int8 Unknown0 = questRecord[121].GetUInt32(); + for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) // To be removed + RequiredSpellCast[i] = questRecord[124+i].GetUInt32(); for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ObjectiveText[i] = questRecord[122+i].GetString(); + ObjectiveText[i] = questRecord[128+i].GetString(); + + for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) + RewardCurrencyId[i] = questRecord[132].GetUInt32(); + + for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) + RewardCurrencyCount[i] = questRecord[136].GetUInt32(); + + for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) + RequiredCurrencyId[i] = questRecord[140].GetUInt32(); + + for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) + RequiredCurrencyCount[i] = questRecord[144].GetUInt32(); + + QuestGiverTextWindow = questRecord[148].GetString(); + QuestGiverTargetName = questRecord[149].GetString(); + QuestTurnTextWindow = questRecord[150].GetString(); + QuestTurnTargetName = questRecord[151].GetString(); + SoundAccept = questRecord[152].GetUInt32(); + SoundTurnIn = questRecord[153].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - DetailsEmote[i] = questRecord[126+i].GetUInt32(); + DetailsEmote[i] = questRecord[154+i].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - DetailsEmoteDelay[i] = questRecord[130+i].GetUInt32(); + DetailsEmoteDelay[i] = questRecord[158+i].GetUInt32(); - EmoteOnIncomplete = questRecord[134].GetUInt32(); - EmoteOnComplete = questRecord[135].GetUInt32(); + EmoteOnIncomplete = questRecord[162].GetUInt32(); + EmoteOnComplete = questRecord[163].GetUInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmote[i] = questRecord[136+i].GetInt32(); + OfferRewardEmote[i] = questRecord[164+i].GetInt32(); for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) - OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32(); + OfferRewardEmoteDelay[i] = questRecord[168+i].GetInt32(); - StartScript = questRecord[144].GetUInt32(); - CompleteScript = questRecord[145].GetUInt32(); + StartScript = questRecord[172].GetUInt32(); + CompleteScript = questRecord[173].GetUInt32(); - // int32 WDBVerified = questRecord[146].GetInt32(); + // int32 WDBVerified = questRecord[174].GetInt32(); Flags |= SpecialFlags << 20; if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT) Flags |= QUEST_FLAGS_AUTO_ACCEPT; - m_reqitemscount = 0; - m_reqCreatureOrGOcount = 0; - m_rewitemscount = 0; - m_rewchoiceitemscount = 0; + m_reqItemsCount = 0; + m_reqNpcOrGoCount = 0; + m_rewItemsCount = 0; + m_rewChoiceItemsCount = 0; + m_rewCurrencyCount = 0; + m_reqCurrencyCount = 0; for (int i=0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) if (RequiredItemId[i]) - ++m_reqitemscount; + ++m_reqItemsCount; for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i) if (RequiredNpcOrGo[i]) - ++m_reqCreatureOrGOcount; + ++m_reqNpcOrGoCount; for (int i=0; i < QUEST_REWARDS_COUNT; ++i) if (RewardItemId[i]) - ++m_rewitemscount; + ++m_rewItemsCount; for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i) if (RewardChoiceItemId[i]) - ++m_rewchoiceitemscount; + ++m_rewChoiceItemsCount; + + for (int i=0; i < QUEST_REWARD_CURRENCY_COUNT; ++i) + if (RewardCurrencyId[i]) + ++m_rewCurrencyCount; + + for (int i=0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i) + if (RequiredCurrencyId[i]) + ++m_reqCurrencyCount; + } uint32 Quest::XPValue(Player* player) const diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index fc9a432a11b..4601154feab 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -41,6 +41,8 @@ class ObjectMgr; #define QUEST_REPUTATIONS_COUNT 5 #define QUEST_EMOTE_COUNT 4 #define QUEST_PVP_KILL_SLOT 0 +#define QUEST_REWARD_CURRENCY_COUNT 4 +#define QUEST_REQUIRED_CURRENCY_COUNT 4 enum QuestFailedReasons { @@ -173,6 +175,11 @@ struct QuestLocale StringVector EndText; StringVector CompletedText; std::vector< StringVector > ObjectiveText; + // new on 4.x + StringVector QuestGiverTextWindow; + StringVector QuestGiverTargetName; + StringVector QuestTurnTextWindow; + StringVector QuestTurnTargetName; }; // This Quest class provides a convenient way to access a few pretotaled (cached) quest details, @@ -229,11 +236,14 @@ class Quest std::string GetRequestItemsText() const { return RequestItemsText; } std::string GetEndText() const { return EndText; } std::string GetCompletedText() const { return CompletedText; } + std::string GetQuestGiverTextWindow() const { return QuestGiverTextWindow; } + std::string GetQuestGiverTargetName() const { return QuestGiverTargetName; } + std::string GetQuestTurnTextWindow() const { return QuestTurnTextWindow; } + std::string GetQuestTurnTargetName() const { return QuestTurnTargetName; } int32 GetRewOrReqMoney() const; uint32 GetRewHonorAddition() const { return RewardHonor; } float GetRewHonorMultiplier() const { return RewardHonorMultiplier; } - uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } - // use in XP calculation at client + uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } // use in XP calculation at client uint32 GetRewSpell() const { return RewardSpell; } int32 GetRewSpellCast() const { return RewardSpellCast; } uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; } @@ -242,6 +252,9 @@ class Quest float GetPointX() const { return PointX; } float GetPointY() const { return PointY; } uint32 GetPointOpt() const { return PointOption; } + uint32 GetRequiredSpell() const { return RequiredSpell; } + uint32 GetSoundAccept() const { return SoundAccept; } + uint32 GetSoundTurnIn() const { return SoundTurnIn; } uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; } uint32 GetCompleteEmote() const { return EmoteOnComplete; } uint32 GetQuestStartScript() const { return StartScript; } @@ -249,6 +262,12 @@ class Quest bool IsRepeatable() const { return Flags & QUEST_TRINITY_FLAGS_REPEATABLE; } bool IsAutoComplete() const; uint32 GetFlags() const { return Flags; } + uint32 GetMinimapTargetMark() const { return MinimapTargetMark; } + uint32 GetRewardSkillId() const { return RewardSkillId; } + uint32 GetRewardSkillPoints() const { return RewardSkillPoints; } + uint32 GetRewardReputationMask() const { return RewardReputationMask; } + uint32 GetQuestGiverPortrait() const { return QuestGiverPortrait; } + uint32 GetQuestTurnInPortrait() const { return QuestTurnInPortrait; } bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; } bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; } bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); } @@ -262,8 +281,8 @@ class Quest std::string ObjectiveText[QUEST_OBJECTIVES_COUNT]; uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT]; uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT]; - uint32 RequiredSourceItemid[QUEST_SOURCE_ITEM_IDS_COUNT]; uint32 RequiredSourceItemId[QUEST_SOURCE_ITEM_IDS_COUNT]; + uint32 RequiredSourceItemCount[QUEST_SOURCE_ITEM_IDS_COUNT]; int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT]; uint32 RequiredSpellCast[QUEST_OBJECTIVES_COUNT]; @@ -278,11 +297,16 @@ class Quest uint32 DetailsEmoteDelay[QUEST_EMOTE_COUNT]; uint32 OfferRewardEmote[QUEST_EMOTE_COUNT]; uint32 OfferRewardEmoteDelay[QUEST_EMOTE_COUNT]; + // 4.x + uint32 RewardCurrencyId[QUEST_REWARD_CURRENCY_COUNT]; + uint32 RewardCurrencyCount[QUEST_REWARD_CURRENCY_COUNT]; + uint32 RequiredCurrencyId[QUEST_REQUIRED_CURRENCY_COUNT]; + uint32 RequiredCurrencyCount[QUEST_REQUIRED_CURRENCY_COUNT]; - uint32 GetReqItemsCount() const { return m_reqitemscount; } - uint32 GetReqCreatureOrGOcount() const { return m_reqCreatureOrGOcount; } - uint32 GetRewChoiceItemsCount() const { return m_rewchoiceitemscount; } - uint32 GetRewItemsCount() const { return m_rewitemscount; } + uint32 GetReqItemsCount() const { return m_reqItemsCount; } + uint32 GetReqCreatureOrGOcount() const { return m_reqNpcOrGoCount; } + uint32 GetRewChoiceItemsCount() const { return m_rewChoiceItemsCount; } + uint32 GetRewItemsCount() const { return m_rewItemsCount; } typedef std::vector PrevQuests; PrevQuests prevQuests; @@ -291,10 +315,12 @@ class Quest // cached data private: - uint32 m_reqitemscount; - uint32 m_reqCreatureOrGOcount; - uint32 m_rewchoiceitemscount; - uint32 m_rewitemscount; + uint32 m_reqItemsCount; + uint32 m_reqNpcOrGoCount; + uint32 m_rewChoiceItemsCount; + uint32 m_rewItemsCount; + uint32 m_rewCurrencyCount; + uint32 m_reqCurrencyCount; // table data protected: @@ -355,6 +381,20 @@ class Quest uint32 EmoteOnComplete; uint32 StartScript; uint32 CompleteScript; + // new in 4.x + uint32 MinimapTargetMark; + uint32 RewardSkillId; + uint32 RewardSkillPoints; + uint32 RewardReputationMask; + uint32 QuestGiverPortrait; + uint32 QuestTurnInPortrait; + uint32 RequiredSpell; + std::string QuestGiverTextWindow; + std::string QuestGiverTargetName; + std::string QuestTurnTextWindow; + std::string QuestTurnTargetName; + uint32 SoundAccept; + uint32 SoundTurnIn; }; struct QuestStatusData -- cgit v1.2.3 From bbf9703b73416917c9c6fae063354658a483926f Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 26 Nov 2011 16:36:01 +0100 Subject: Core/Items: Added more checks determining item disenchanting loot DB/Loot: Added all disenchant templates --- .../4.x/2011_11_26_02_world_quest_template.sql | 31 +++ ...011_11_26_03_world_disenchant_loot_template.sql | 225 +++++++++++++++++++++ .../4.x/2011_12_26_02_world_quest_template.sql | 31 --- src/server/game/DataStores/DB2Stores.cpp | 6 +- src/server/game/DataStores/DB2Stores.h | 3 +- src/server/game/DataStores/DB2Structure.h | 22 +- src/server/game/DataStores/DB2fmt.h | 1 + src/server/game/Globals/ObjectMgr.cpp | 41 ++-- 8 files changed, 305 insertions(+), 55 deletions(-) create mode 100644 sql/updates/world/4.x/2011_11_26_02_world_quest_template.sql create mode 100644 sql/updates/world/4.x/2011_11_26_03_world_disenchant_loot_template.sql delete mode 100644 sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/sql/updates/world/4.x/2011_11_26_02_world_quest_template.sql b/sql/updates/world/4.x/2011_11_26_02_world_quest_template.sql new file mode 100644 index 00000000000..b43abd6f85d --- /dev/null +++ b/sql/updates/world/4.x/2011_11_26_02_world_quest_template.sql @@ -0,0 +1,31 @@ +ALTER TABLE `quest_template` ADD COLUMN `MinimapTargetMark` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `SpecialFlags`, + ADD COLUMN `RewardSkillId` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardArenaPoints`, + ADD COLUMN `RewardSkillPoints` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardSkillId`, + ADD COLUMN `RewardReputationMask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardSkillPoints`, + ADD COLUMN `QuestGiverPortrait` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardReputationMask`, + ADD COLUMN `QuestTurnInPortrait` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `QuestGiverPortrait`, + ADD COLUMN `RequiredSpell` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredItemCount6`, + ADD COLUMN `RewardCurrencyId1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `ObjectiveText4`, + ADD COLUMN `RewardCurrencyId2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId1`, + ADD COLUMN `RewardCurrencyId3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId2`, + ADD COLUMN `RewardCurrencyId4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId3`, + ADD COLUMN `RewardCurrencyCount1` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId4`, + ADD COLUMN `RewardCurrencyCount2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount1`, + ADD COLUMN `RewardCurrencyCount3` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount2`, + ADD COLUMN `RewardCurrencyCount4` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount3`, + ADD COLUMN `RequiredCurrencyId1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount4`, + ADD COLUMN `RequiredCurrencyId2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId1`, + ADD COLUMN `RequiredCurrencyId3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId2`, + ADD COLUMN `RequiredCurrencyId4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId3`, + ADD COLUMN `RequiredCurrencyCount1` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId4`, + ADD COLUMN `RequiredCurrencyCount2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount1`, + ADD COLUMN `RequiredCurrencyCount3` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount2`, + ADD COLUMN `RequiredCurrencyCount4` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount3`, + ADD COLUMN `QuestGiverTextWindow` TEXT NULL DEFAULT NULL AFTER `RequiredCurrencyCount4`, + ADD COLUMN `QuestGiverTargetName` TEXT NULL DEFAULT NULL AFTER `QuestGiverTextWindow`, + ADD COLUMN `QuestTurnTextWindow` TEXT NULL DEFAULT NULL AFTER `QuestGiverTargetName`, + ADD COLUMN `QuestTurnTargetName` TEXT NULL DEFAULT NULL AFTER `QuestTurnTextWindow`, + ADD COLUMN `SoundAccept` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '890' AFTER `QuestTurnTargetName`, + ADD COLUMN `SoundTurnIn` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '878' AFTER `SoundAccept`; + +ALTER TABLE `quest_template` DROP COLUMN `Unknown0`; -- Not found on 422 diff --git a/sql/updates/world/4.x/2011_11_26_03_world_disenchant_loot_template.sql b/sql/updates/world/4.x/2011_11_26_03_world_disenchant_loot_template.sql new file mode 100644 index 00000000000..48f5d712533 --- /dev/null +++ b/sql/updates/world/4.x/2011_11_26_03_world_disenchant_loot_template.sql @@ -0,0 +1,225 @@ +SET @LESSER_MAGIC = 10938; +SET @GREATER_MAGIC = 10939; +SET @STRANGE_DUST = 10940; +SET @SMALL_GLIMMERING = 10978; +SET @LESSER_ASTRAL = 10998; +SET @GREATER_ASTRAL = 11082; +SET @SOUL_DUST = 11083; +SET @LARGE_GLIMMERING = 11084; +SET @LESSER_MYSTIC = 11134; +SET @GREATER_MYSTIC = 11135; +SET @VISION_DUST = 11137; +SET @SMALL_GLOWING = 11138; +SET @LARGE_GLOWING = 11139; +SET @LESSER_NETHER = 11174; +SET @GREATER_NETHER = 11175; +SET @DREAM_DUST = 11176; +SET @SMALL_RADIANT = 11177; +SET @LARGE_RADIANT = 11178; +SET @SMALL_BRILLIANT = 14343; +SET @LARGE_BRILLIANT = 14344; +SET @LESSER_ETERNAL = 16202; +SET @GREATER_ETERNAL = 16203; +SET @ILLUSION_DUST = 16204; +SET @NEXUS_CRYSTAL = 20725; +SET @ARCANE_DUST = 22445; +SET @GREATER_PLANAR = 22446; +SET @LESSER_PLANAR = 22447; +SET @SMALL_PRISMATIC = 22448; +SET @LARGE_PRISMATIC = 22449; +SET @VOID_CRYSTAL = 22450; +SET @DREAM_SHARD = 34052; +SET @SMALL_DREAM = 34053; +SET @INFINITE_DUST = 34054; +SET @GREATER_COSMIC = 34055; +SET @LESSER_COSMIC = 34056; +SET @ABYSS_CRYSTAL = 34057; +SET @HEAVENLY_SHARD = 52721; +SET @SMALL_HEAVENLY = 52720; +SET @HYPN_DUST = 52555; +SET @GREATER_CEL = 52719; +SET @LESSER_CEL = 52718; +SET @MAELSTROM_CRYSTAL = 52722; + +TRUNCATE `disenchant_loot_template`; +INSERT INTO `disenchant_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES +(3,@STRANGE_DUST,20,1,1,1,2), +(4,@STRANGE_DUST,80,1,1,1,2), +(5,@STRANGE_DUST,75,1,1,2,3), +(6,@STRANGE_DUST,20,1,1,2,3), +(7,@STRANGE_DUST,15,1,1,4,6), +(8,@STRANGE_DUST,75,1,1,4,6), +(13,@SOUL_DUST,75,1,1,1,2), +(14,@SOUL_DUST,20,1,1,1,2), +(17,@SOUL_DUST,75,1,1,2,5), +(18,@SOUL_DUST,20,1,1,2,5), +(21,@VISION_DUST,75,1,1,1,2), +(22,@VISION_DUST,20,1,1,1,2), +(25,@VISION_DUST,75,1,1,2,5), +(26,@VISION_DUST,20,1,1,2,5), +(29,@DREAM_DUST,75,1,1,1,2), +(30,@DREAM_DUST,20,1,1,1,2), +(31,@DREAM_DUST,22,1,1,2,5), +(32,@DREAM_DUST,75,1,1,2,5), +(46,@ILLUSION_DUST,75,1,1,1,2), +(47,@ILLUSION_DUST,22,1,1,1,2), +(52,@ILLUSION_DUST,75,1,1,2,5), +(53,@ILLUSION_DUST,22,1,1,2,5), +(56,@ARCANE_DUST,75,1,1,1,3), +(57,@ARCANE_DUST,22,1,1,1,2), +(62,@ARCANE_DUST,22,1,1,2,5), +(63,@ARCANE_DUST,75,1,1,2,5), +(70,@ARCANE_DUST,75,1,1,2,3), +(71,@ARCANE_DUST,22,1,1,2,3), +(82,@INFINITE_DUST,75,1,1,1,3), +(83,@INFINITE_DUST,22,1,1,1,3), +(88,@INFINITE_DUST,75,1,1,4,7), +(89,@INFINITE_DUST,22,1,1,4,7), +(94,@HYPN_DUST,75,1,1,1,2), +(95,@HYPN_DUST,75,1,1,1,3), +(96,@HYPN_DUST,60,1,1,1,4), +(97,@HYPN_DUST,80,1,1,2,4), +(98,@HYPN_DUST,50,1,1,2,5), +(99,@HYPN_DUST,25,1,1,1,2), +(100,@HYPN_DUST,25,1,1,1,3), +(101,@HYPN_DUST,35,1,1,1,4), +(102,@HYPN_DUST,30,1,1,2,4), +(103,@HYPN_DUST,30,1,1,2,5), +(3,@LESSER_MAGIC,80,1,1,1,2), +(4,@LESSER_MAGIC,20,1,1,1,2), +(5,@GREATER_MAGIC,20,1,1,1,2), +(6,@GREATER_MAGIC,75,1,1,1,2), +(7,@LESSER_ASTRAL,75,1,1,1,2), +(8,@LESSER_ASTRAL,15,1,1,1,2), +(13,@GREATER_ASTRAL,20,1,1,1,2), +(14,@GREATER_ASTRAL,75,1,1,1,2), +(17,@LESSER_MYSTIC,20,1,1,1,2), +(18,@LESSER_MYSTIC,75,1,1,1,2), +(21,@GREATER_MYSTIC,20,1,1,1,2), +(22,@GREATER_MYSTIC,75,1,1,1,2), +(25,@LESSER_NETHER,20,1,1,1,2), +(26,@LESSER_NETHER,75,1,1,1,2), +(29,@GREATER_NETHER,20,1,1,1,2), +(30,@GREATER_NETHER,75,1,1,1,2), +(31,@LESSER_ETERNAL,75,1,1,1,2), +(32,@LESSER_ETERNAL,20,1,1,1,2), +(46,@GREATER_ETERNAL,20,1,1,1,2), +(47,@GREATER_ETERNAL,75,1,1,1,2), +(52,@GREATER_ETERNAL,20,1,1,2,3), +(53,@GREATER_ETERNAL,75,1,1,2,3), +(56,@LESSER_PLANAR,22,1,1,1,3), +(57,@LESSER_PLANAR,75,1,1,1,2), +(62,@GREATER_PLANAR,75,1,1,1,2), +(63,@GREATER_PLANAR,22,1,1,1,2), +(70,@LESSER_PLANAR,22,1,1,2,3), +(71,@LESSER_PLANAR,75,1,1,2,3), +(82,@LESSER_COSMIC,22,1,1,1,2), +(83,@LESSER_COSMIC,75,1,1,1,2), +(88,@GREATER_COSMIC,22,1,1,1,2), +(89,@GREATER_COSMIC,75,1,1,1,2), +(94,@LESSER_CEL,25,1,1,1,2), +(95,@LESSER_CEL,25,1,1,1,3), +(96,@LESSER_CEL,40,1,1,2,4), +(97,@GREATER_CEL,20,1,1,1,2), +(98,@GREATER_CEL,50,1,1,2,3), +(99,@LESSER_CEL,75,1,1,1,2), +(100,@LESSER_CEL,75,1,1,1,3), +(101,@LESSER_CEL,65,1,1,2,4), +(102,@GREATER_CEL,70,1,1,1,2), +(103,@GREATER_CEL,70,1,1,2,3), +(5,@SMALL_GLIMMERING,5,1,1,1,1), +(6,@SMALL_GLIMMERING,5,1,1,1,1), +(7,@SMALL_GLIMMERING,10,1,1,1,1), +(8,@SMALL_GLIMMERING,10,1,1,1,1), +(9,@SMALL_GLIMMERING,100,1,1,1,1), +(10,@SMALL_GLIMMERING,100,1,1,1,1), +(11,@LARGE_GLIMMERING,100,1,1,1,1), +(12,@LARGE_GLIMMERING,100,1,1,1,1), +(13,@LARGE_GLIMMERING,5,1,1,1,1), +(14,@LARGE_GLIMMERING,5,1,1,1,1), +(15,@SMALL_GLOWING,100,1,1,1,1), +(16,@SMALL_GLOWING,100,1,1,1,1), +(17,@SMALL_GLOWING,5,1,1,1,1), +(18,@SMALL_GLOWING,5,1,1,1,1), +(19,@LARGE_GLOWING,100,1,1,1,1), +(20,@LARGE_GLOWING,100,1,1,1,1), +(21,@LARGE_GLOWING,5,1,1,1,1), +(22,@LARGE_GLOWING,5,1,1,1,1), +(23,@SMALL_RADIANT,100,1,1,1,1), +(24,@SMALL_RADIANT,100,1,1,1,1), +(25,@SMALL_RADIANT,5,1,1,1,1), +(26,@SMALL_RADIANT,5,1,1,1,1), +(27,@LARGE_RADIANT,100,1,1,1,1), +(28,@LARGE_RADIANT,100,1,1,1,1), +(29,@LARGE_RADIANT,5,1,1,1,1), +(30,@LARGE_RADIANT,5,1,1,1,1), +(31,@SMALL_BRILLIANT,3,1,1,1,1), +(32,@SMALL_BRILLIANT,5,1,1,1,1), +(34,@SMALL_BRILLIANT,100,1,1,1,1), +(35,@SMALL_BRILLIANT,100,1,1,1,1), +(38,@SMALL_RADIANT,100,1,1,2,4), +(39,@SMALL_RADIANT,100,1,1,2,4), +(40,@LARGE_RADIANT,100,1,1,2,4), +(41,@LARGE_RADIANT,100,1,1,2,4), +(42,@SMALL_BRILLIANT,100,1,1,2,4), +(43,@SMALL_BRILLIANT,100,1,1,2,4), +(44,@LARGE_BRILLIANT,99.5,1,1,1,1), +(45,@LARGE_BRILLIANT,99.5,1,1,1,1), +(46,@LARGE_BRILLIANT,5,1,1,1,1), +(47,@LARGE_BRILLIANT,3,1,1,1,1), +(50,@SMALL_PRISMATIC,99.5,1,1,1,1), +(51,@SMALL_PRISMATIC,99.5,1,1,1,1), +(52,@LARGE_BRILLIANT,5,1,1,1,1), +(53,@LARGE_BRILLIANT,3,1,1,1,1), +(56,@SMALL_PRISMATIC,3,1,1,1,1), +(57,@SMALL_PRISMATIC,3,1,1,1,1), +(58,@SMALL_PRISMATIC,100,1,1,1,1), +(59,@SMALL_PRISMATIC,100,1,1,1,1), +(62,@LARGE_PRISMATIC,3,1,1,1,1), +(63,@LARGE_PRISMATIC,3,1,1,1,1), +(64,@LARGE_PRISMATIC,99.5,1,1,1,1), +(65,@LARGE_PRISMATIC,99.5,1,1,1,1), +(68,@SMALL_PRISMATIC,100,1,1,1,2), +(69,@SMALL_PRISMATIC,100,1,1,1,2), +(70,@SMALL_PRISMATIC,3,1,1,1,1), +(71,@SMALL_PRISMATIC,3,1,1,1,1), +(72,@SMALL_GLIMMERING,100,1,1,2,4), +(73,@SMALL_GLIMMERING,100,1,1,2,4), +(74,@LARGE_GLIMMERING,100,1,1,2,4), +(75,@LARGE_GLIMMERING,100,1,1,2,4), +(76,@SMALL_GLOWING,100,1,1,2,4), +(77,@SMALL_GLOWING,100,1,1,2,4), +(78,@LARGE_GLOWING,100,1,1,2,4), +(79,@LARGE_GLOWING,100,1,1,2,4), +(82,@SMALL_DREAM,3,1,1,1,1), +(83,@SMALL_DREAM,3,1,1,1,1), +(84,@SMALL_DREAM,100,1,1,1,1), +(85,@SMALL_DREAM,100,1,1,1,1), +(86,@DREAM_SHARD,99.5,1,1,1,1), +(87,@DREAM_SHARD,99.5,1,1,1,1), +(88,@DREAM_SHARD,3,1,1,1,1), +(89,@DREAM_SHARD,3,1,1,1,1), +(104,@SMALL_HEAVENLY,100,1,1,1,1), +(105,@SMALL_HEAVENLY,100,1,1,1,2), +(106,@HEAVENLY_SHARD,100,1,1,1,1), +(107,@HEAVENLY_SHARD,100,1,1,1,1), +(44,@NEXUS_CRYSTAL,0.5,1,1,1,1), +(45,@NEXUS_CRYSTAL,0.5,1,1,1,1), +(48,@NEXUS_CRYSTAL,100,1,1,1,1), +(49,@NEXUS_CRYSTAL,100,1,1,1,1), +(50,@NEXUS_CRYSTAL,0.5,1,1,1,1), +(51,@NEXUS_CRYSTAL,0.5,1,1,1,1), +(54,@NEXUS_CRYSTAL,100,1,1,1,2), +(55,@NEXUS_CRYSTAL,100,1,1,1,2), +(60,@NEXUS_CRYSTAL,100,1,1,1,2), +(61,@NEXUS_CRYSTAL,100,1,1,1,2), +(64,@VOID_CRYSTAL,0.5,1,1,1,1), +(65,@VOID_CRYSTAL,0.5,1,1,1,1), +(66,@VOID_CRYSTAL,100,1,1,1,2), +(67,@VOID_CRYSTAL,100,1,1,1,2), +(80,@ABYSS_CRYSTAL,100,1,1,1,1), +(81,@ABYSS_CRYSTAL,100,1,1,1,1), +(86,@ABYSS_CRYSTAL,0.5,1,1,1,1), +(87,@ABYSS_CRYSTAL,0.5,1,1,1,1), +(108,@MAELSTROM_CRYSTAL,100,1,1,1,1), +(109,@MAELSTROM_CRYSTAL,100,1,1,1,1); diff --git a/sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql b/sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql deleted file mode 100644 index b43abd6f85d..00000000000 --- a/sql/updates/world/4.x/2011_12_26_02_world_quest_template.sql +++ /dev/null @@ -1,31 +0,0 @@ -ALTER TABLE `quest_template` ADD COLUMN `MinimapTargetMark` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `SpecialFlags`, - ADD COLUMN `RewardSkillId` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardArenaPoints`, - ADD COLUMN `RewardSkillPoints` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardSkillId`, - ADD COLUMN `RewardReputationMask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardSkillPoints`, - ADD COLUMN `QuestGiverPortrait` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardReputationMask`, - ADD COLUMN `QuestTurnInPortrait` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `QuestGiverPortrait`, - ADD COLUMN `RequiredSpell` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredItemCount6`, - ADD COLUMN `RewardCurrencyId1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `ObjectiveText4`, - ADD COLUMN `RewardCurrencyId2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId1`, - ADD COLUMN `RewardCurrencyId3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId2`, - ADD COLUMN `RewardCurrencyId4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId3`, - ADD COLUMN `RewardCurrencyCount1` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyId4`, - ADD COLUMN `RewardCurrencyCount2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount1`, - ADD COLUMN `RewardCurrencyCount3` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount2`, - ADD COLUMN `RewardCurrencyCount4` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount3`, - ADD COLUMN `RequiredCurrencyId1` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewardCurrencyCount4`, - ADD COLUMN `RequiredCurrencyId2` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId1`, - ADD COLUMN `RequiredCurrencyId3` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId2`, - ADD COLUMN `RequiredCurrencyId4` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId3`, - ADD COLUMN `RequiredCurrencyCount1` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyId4`, - ADD COLUMN `RequiredCurrencyCount2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount1`, - ADD COLUMN `RequiredCurrencyCount3` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount2`, - ADD COLUMN `RequiredCurrencyCount4` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `RequiredCurrencyCount3`, - ADD COLUMN `QuestGiverTextWindow` TEXT NULL DEFAULT NULL AFTER `RequiredCurrencyCount4`, - ADD COLUMN `QuestGiverTargetName` TEXT NULL DEFAULT NULL AFTER `QuestGiverTextWindow`, - ADD COLUMN `QuestTurnTextWindow` TEXT NULL DEFAULT NULL AFTER `QuestGiverTargetName`, - ADD COLUMN `QuestTurnTargetName` TEXT NULL DEFAULT NULL AFTER `QuestTurnTextWindow`, - ADD COLUMN `SoundAccept` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '890' AFTER `QuestTurnTargetName`, - ADD COLUMN `SoundTurnIn` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '878' AFTER `SoundAccept`; - -ALTER TABLE `quest_template` DROP COLUMN `Unknown0`; -- Not found on 422 diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 77d16501415..2db85542132 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -25,8 +25,9 @@ #include DB2Storage sItemStore(Itemfmt); -DB2Storage sItemSparseStore (ItemSparsefmt); +DB2Storage sItemCurrencyCostStore(ItemCurrencyCostfmt); DB2Storage sItemExtendedCostStore(ItemExtendedCostEntryfmt); +DB2Storage sItemSparseStore (ItemSparsefmt); typedef std::list StoreProblemList1; @@ -86,6 +87,7 @@ void LoadDB2Stores(const std::string& dataPath) uint32 availableDb2Locales = 0xFFFFFFFF; LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2"); + LoadDB2(availableDb2Locales, bad_db2_files, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2"); LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2"); LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2"); // error checks @@ -115,4 +117,4 @@ void LoadDB2Stores(const std::string& dataPath) sLog->outString(">> Initialized %d DB2 data stores.", DB2FilesCount); sLog->outString(); -} \ No newline at end of file +} diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index e60892e05eb..6cf719da70b 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -25,8 +25,9 @@ #include extern DB2Storage sItemStore; -extern DB2Storage sItemSparseStore; +extern DB2Storage sItemCurrencyCostStore; extern DB2Storage sItemExtendedCostStore; +extern DB2Storage sItemSparseStore; void LoadDB2Stores(const std::string& dataPath); diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h index 1f455eec0c2..23bf8339c0d 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -33,14 +33,20 @@ // Structures used to access raw DB2 data and required packing to portability struct ItemEntry { - uint32 ID; // 0 - uint32 Class; // 1 - uint32 SubClass; // 2 - int32 Unk0; // 3 - int32 Material; // 4 - uint32 DisplayId; // 5 - uint32 InventoryType; // 6 - uint32 Sheath; // 7 + uint32 ID; // 0 + uint32 Class; // 1 + uint32 SubClass; // 2 + int32 Unk0; // 3 + int32 Material; // 4 + uint32 DisplayId; // 5 + uint32 InventoryType; // 6 + uint32 Sheath; // 7 +}; + +struct ItemCurrencyCostEntry +{ + uint32 Id; + uint32 ItemId; }; struct ItemSparseEntry diff --git a/src/server/game/DataStores/DB2fmt.h b/src/server/game/DataStores/DB2fmt.h index 435309cbae4..ed48443d543 100644 --- a/src/server/game/DataStores/DB2fmt.h +++ b/src/server/game/DataStores/DB2fmt.h @@ -19,6 +19,7 @@ #define TRINITY_DB2SFRM_H const char Itemfmt[]="niiiiiii"; +const char ItemCurrencyCostfmt[]="xn"; const char ItemSparsefmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisssssiiiiiiiiiiiiiiiiiiiiiiifiiifii"; const char ItemExtendedCostEntryfmt[]="nxxiiiiiiiiiiiixiiiiiiiiiixxxxx"; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 8a47e91b32b..bac87dd1f25 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2194,27 +2194,44 @@ uint32 FillItemArmor(uint32 itemlevel, uint32 itemClass, uint32 itemSubclass, ui return uint32(shield->Value[quality] + 0.5f); } -void FillDisenchantFields(uint32* disenchantID, uint32* requiredDisenchantSkill, uint32 itemClass, uint32 quality, uint32 itemLevel) +void FillDisenchantFields(uint32* disenchantID, uint32* requiredDisenchantSkill, ItemTemplate const& itemTemplate) { + *disenchantID = 0; + *(int32*)requiredDisenchantSkill = -1; + if ((itemTemplate.Flags & (ITEM_PROTO_FLAG_CONJURED | ITEM_PROTO_FLAG_UNK6)) || + itemTemplate.Bonding == BIND_QUEST_ITEM || itemTemplate.Area || itemTemplate.Map || + itemTemplate.Stackable > 1 || + !(itemTemplate.SellPrice || sItemCurrencyCostStore.LookupEntry(itemTemplate.ItemId))) + return; + for (uint32 i = 0; i < sItemDisenchantLootStore.GetNumRows(); ++i) { ItemDisenchantLootEntry const* disenchant = sItemDisenchantLootStore.LookupEntry(i); if (!disenchant) continue; - if (disenchant->ItemClass == itemClass && - disenchant->ItemQuality == quality && - disenchant->MinItemLevel <= itemLevel && - disenchant->MaxItemLevel >= itemLevel) + if (disenchant->ItemClass == itemTemplate.Class && + disenchant->ItemQuality == itemTemplate.Quality && + disenchant->MinItemLevel <= itemTemplate.ItemLevel && + disenchant->MaxItemLevel >= itemTemplate.ItemLevel) { + // extra check for epics in range 90 - 99 + if (disenchant->MinItemLevel < 90) + { + if (itemTemplate.RequiredLevel > 60 || itemTemplate.RequiredSkillRank > 300) + continue; + } + else + { + if (itemTemplate.RequiredLevel <= 60 || itemTemplate.RequiredSkillRank <= 300) + continue; + } + *disenchantID = disenchant->Id; *requiredDisenchantSkill = disenchant->RequiredDisenchantSkill; return; } } - - *disenchantID = 0; - *(int32*)requiredDisenchantSkill = -1; } void ObjectMgr::LoadItemTemplates() @@ -2314,8 +2331,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.socketBonus = sparse->SocketBonus; itemTemplate.GemProperties = sparse->GemProperties; - FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, - db2Data->Class, sparse->Quality, sparse->ItemLevel); + FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate); itemTemplate.ArmorDamageModifier = sparse->ArmorDamageModifier; itemTemplate.Duration = sparse->Duration; @@ -2463,8 +2479,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.socketBonus = fields[123].GetUInt32(); itemTemplate.GemProperties = fields[124].GetUInt32(); - FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, - itemTemplate.Class, itemTemplate.Quality, itemTemplate.ItemLevel); + FillDisenchantFields(&itemTemplate.DisenchantID, &itemTemplate.RequiredDisenchantSkill, itemTemplate); itemTemplate.ArmorDamageModifier = fields[125].GetFloat(); itemTemplate.Duration = fields[126].GetUInt32(); @@ -3589,7 +3604,7 @@ void ObjectMgr::LoadQuests() QueryResult result = WorldDatabase.Query("SELECT " //0 1 2 3 4 5 6 7 8 9 10 11 12 "Id, Method, Level, MinLevel, MaxLevel, ZoneOrSort, Type, SuggestedPlayers, LimitTime, RequiredClasses, RequiredRaces, RequiredSkillId, RequiredSkillPoints, " - // 13 14 15 16 17 18 19 20 + // 13 14 15 16 17 18 19 20 "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, " // 21 22 23 24 25 26 27 28 29 30 31 "PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestIdChain, RewardXPId, RewardOrRequiredMoney, RewardMoneyMaxLevel, RewardSpell, RewardSpellCast, RewardHonor, RewardHonorMultiplier, " -- cgit v1.2.3