[7369] Remove ReqSourceRef in quest_template.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
NoFantasy 2009-03-02 03:30:38 +03:00 committed by VladimirMangos
parent 2f02dc7642
commit 94de4437f8
8 changed files with 59 additions and 114 deletions

View file

@ -22,7 +22,7 @@
DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`required_7349_01_mangos_spell_area` bit(1) default NULL
`required_7369_01_mangos_quest_template` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -13047,10 +13047,6 @@ CREATE TABLE `quest_template` (
`ReqSourceCount2` smallint(5) unsigned NOT NULL default '0',
`ReqSourceCount3` smallint(5) unsigned NOT NULL default '0',
`ReqSourceCount4` smallint(5) unsigned NOT NULL default '0',
`ReqSourceRef1` tinyint(3) unsigned NOT NULL default '0',
`ReqSourceRef2` tinyint(3) unsigned NOT NULL default '0',
`ReqSourceRef3` tinyint(3) unsigned NOT NULL default '0',
`ReqSourceRef4` tinyint(3) unsigned NOT NULL default '0',
`ReqCreatureOrGOId1` mediumint(9) NOT NULL default '0',
`ReqCreatureOrGOId2` mediumint(9) NOT NULL default '0',
`ReqCreatureOrGOId3` mediumint(9) NOT NULL default '0',

View file

@ -0,0 +1,7 @@
ALTER TABLE db_version CHANGE COLUMN required_7349_01_mangos_spell_area required_7369_01_mangos_quest_template bit;
ALTER TABLE quest_template
DROP COLUMN ReqSourceRef1,
DROP COLUMN ReqSourceRef2,
DROP COLUMN ReqSourceRef3,
DROP COLUMN ReqSourceRef4;

View file

@ -188,6 +188,7 @@ pkgdata_DATA = \
7331_01_mangos_command.sql \
7332_01_mangos_command.sql \
7349_01_mangos_spell_area.sql \
7369_01_mangos_quest_template.sql \
README
## Additional files to include when running 'make dist'
@ -356,4 +357,5 @@ EXTRA_DIST = \
7331_01_mangos_command.sql \
7332_01_mangos_command.sql \
7349_01_mangos_spell_area.sql \
7369_01_mangos_quest_template.sql \
README

View file

@ -2731,25 +2731,25 @@ void ObjectMgr::LoadQuests()
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
// 39 40 41 42 43 44 45 46
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4,"
// 47 48 49 50 51 52 53 54 55 56 57 58
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4, ReqSourceRef1, ReqSourceRef2, ReqSourceRef3, ReqSourceRef4,"
// 59 60 61 62 63 64 65 66
// 47 48 49 50 51 52 53 54
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4,"
// 55 56 57 58 59 60 61 62
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
// 67 68 69 70
// 63 64 65 66
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4,"
// 71 72 73 74 75 76
// 67 68 69 70 71 72
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
// 77 78 79 80 81 82
// 73 74 75 76 77 78
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
// 83 84 85 86 87 88 89 90
// 79 80 81 82 83 84 85 86
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
// 91 92 93 94 95 96 97 98 99 100
// 87 88 89 90 91 92 93 94 95 96
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5, RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
// 101 102 103 104 105 106 107 108 109 110 111
// 97 98 99 100 101 102 103 104 105 106 107
"RewHonorableKills, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast, RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
// 112 113 114 115 116 117 118 119 120 121
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4,IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 122 123
// 108 109 110 111 112 113 114 115 116 117
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
// 118 119
"StartScript, CompleteScript"
" FROM quest_template");
if(result == NULL)
@ -3043,20 +3043,6 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(),j+1,id,id);
// no changes, quest can't be done for this requirement
}
if(!qinfo->ReqSourceCount[j])
{
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = %u but `ReqSourceCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1);
qinfo->ReqSourceId[j] = 0; // prevent incorrect work of quest
}
if(!qinfo->ReqSourceRef[j])
{
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = %u but `ReqSourceRef%d` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,id,j+1);
qinfo->ReqSourceId[j] = 0; // prevent incorrect work of quest
}
}
else
{
@ -3066,41 +3052,6 @@ void ObjectMgr::LoadQuests()
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqSourceCount[j]);
// no changes, quest ignore this data
}
if(qinfo->ReqSourceRef[j]>0)
{
sLog.outErrorDb("Quest %u has `ReqSourceId%d` = 0 but `ReqSourceRef%d` = %u.",
qinfo->GetQuestId(),j+1,j+1,qinfo->ReqSourceRef[j]);
// no changes, quest ignore this data
}
}
}
for(int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j )
{
uint32 ref = qinfo->ReqSourceRef[j];
if(ref)
{
if(ref > QUEST_OBJECTIVES_COUNT)
{
sLog.outErrorDb("Quest %u has `ReqSourceRef%d` = %u but max value in `ReqSourceRef%d` is %u, quest can't be done.",
qinfo->GetQuestId(),j+1,ref,j+1,QUEST_OBJECTIVES_COUNT);
// no changes, quest can't be done for this requirement
}
else
if(!qinfo->ReqItemId[ref-1] && !qinfo->ReqSpell[ref-1])
{
sLog.outErrorDb("Quest %u has `ReqSourceRef%d` = %u but `ReqItemId%u` = 0 and `ReqSpellCast%u` = 0, quest can't be done.",
qinfo->GetQuestId(),j+1,ref,ref,ref);
// no changes, quest can't be done for this requirement
}
else if(qinfo->ReqItemId[ref-1] && qinfo->ReqSpell[ref-1])
{
sLog.outErrorDb("Quest %u has `ReqItemId%u` = %u and `ReqSpellCast%u` = %u, quest can't have both fields <> 0, then can't be done.",
qinfo->GetQuestId(),ref,qinfo->ReqItemId[ref-1],ref,qinfo->ReqSpell[ref-1]);
// no changes, quest can't be done for this requirement
qinfo->ReqSourceId[j] = 0; // prevent incorrect work of quest
}
}
}

View file

@ -13818,28 +13818,21 @@ bool Player::HasQuestForItem( uint32 itemid ) const
for (int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; j++)
{
// examined item is a source item
if (qinfo->ReqSourceId[j] == itemid && qinfo->ReqSourceRef[j] > 0 && qinfo->ReqSourceRef[j] <= QUEST_OBJECTIVES_COUNT)
if (qinfo->ReqSourceId[j] == itemid)
{
uint32 idx = qinfo->ReqSourceRef[j]-1;
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
// total count of created ReqItems and SourceItems is less than ReqItemCount
if(qinfo->ReqItemId[idx] != 0 &&
q_status.m_itemcount[idx] * qinfo->ReqSourceCount[j] + GetItemCount(itemid,true) < qinfo->ReqItemCount[idx] * qinfo->ReqSourceCount[j])
// 'unique' item
if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount)
return true;
// total count of casted ReqCreatureOrGOs and SourceItems is less than ReqCreatureOrGOCount
if (qinfo->ReqCreatureOrGOId[idx] != 0)
// allows custom amount drop when not 0
if (qinfo->ReqSourceCount[j])
{
if(q_status.m_creatureOrGOcount[idx] * qinfo->ReqSourceCount[j] + GetItemCount(itemid,true) < qinfo->ReqCreatureOrGOCount[idx] * qinfo->ReqSourceCount[j])
if (GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
return true;
}
// spell with SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT (with script) case
else if(qinfo->ReqSpell[idx] != 0)
{
// not casted and need more reagents/item for use.
if(!q_status.m_explored && GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
return true;
}
} else if (GetItemCount(itemid,true) < pProto->Stackable)
return true;
}
}
}

View file

@ -73,59 +73,56 @@ Quest::Quest(Field * questRecord)
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceCount[i] = questRecord[51+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
ReqSourceRef[i] = questRecord[55+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOId[i] = questRecord[55+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOId[i] = questRecord[59+i].GetInt32();
ReqCreatureOrGOCount[i] = questRecord[59+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqCreatureOrGOCount[i] = questRecord[63+i].GetUInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ReqSpell[i] = questRecord[67+i].GetUInt32();
ReqSpell[i] = questRecord[63+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemId[i] = questRecord[71+i].GetUInt32();
RewChoiceItemId[i] = questRecord[67+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
RewChoiceItemCount[i] = questRecord[77+i].GetUInt32();
RewChoiceItemCount[i] = questRecord[73+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemId[i] = questRecord[83+i].GetUInt32();
RewItemId[i] = questRecord[79+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
RewItemCount[i] = questRecord[87+i].GetUInt32();
RewItemCount[i] = questRecord[83+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepFaction[i] = questRecord[91+i].GetUInt32();
RewRepFaction[i] = questRecord[87+i].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
RewRepValue[i] = questRecord[96+i].GetInt32();
RewRepValue[i] = questRecord[92+i].GetInt32();
RewHonorableKills = questRecord[101].GetUInt32();
RewOrReqMoney = questRecord[102].GetInt32();
RewMoneyMaxLevel = questRecord[103].GetUInt32();
RewSpell = questRecord[104].GetUInt32();
RewSpellCast = questRecord[105].GetUInt32();
RewMailTemplateId = questRecord[106].GetUInt32();
RewMailDelaySecs = questRecord[107].GetUInt32();
PointMapId = questRecord[108].GetUInt32();
PointX = questRecord[109].GetFloat();
PointY = questRecord[110].GetFloat();
PointOpt = questRecord[111].GetUInt32();
RewHonorableKills = questRecord[97].GetUInt32();
RewOrReqMoney = questRecord[98].GetInt32();
RewMoneyMaxLevel = questRecord[99].GetUInt32();
RewSpell = questRecord[100].GetUInt32();
RewSpellCast = questRecord[101].GetUInt32();
RewMailTemplateId = questRecord[102].GetUInt32();
RewMailDelaySecs = questRecord[103].GetUInt32();
PointMapId = questRecord[104].GetUInt32();
PointX = questRecord[105].GetFloat();
PointY = questRecord[106].GetFloat();
PointOpt = questRecord[107].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
DetailsEmote[i] = questRecord[112+i].GetUInt32();
DetailsEmote[i] = questRecord[108+i].GetUInt32();
IncompleteEmote = questRecord[116].GetUInt32();
CompleteEmote = questRecord[117].GetUInt32();
IncompleteEmote = questRecord[112].GetUInt32();
CompleteEmote = questRecord[113].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmote[i] = questRecord[118+i].GetInt32();
OfferRewardEmote[i] = questRecord[114+i].GetInt32();
QuestStartScript = questRecord[122].GetUInt32();
QuestCompleteScript = questRecord[123].GetUInt32();
QuestStartScript = questRecord[118].GetUInt32();
QuestCompleteScript = questRecord[119].GetUInt32();
QuestFlags |= SpecialFlags << 16;

View file

@ -229,7 +229,6 @@ class Quest
uint32 ReqItemCount[QUEST_OBJECTIVES_COUNT];
uint32 ReqSourceId[QUEST_SOURCE_ITEM_IDS_COUNT];
uint32 ReqSourceCount[QUEST_SOURCE_ITEM_IDS_COUNT];
uint32 ReqSourceRef[QUEST_SOURCE_ITEM_IDS_COUNT];
int32 ReqCreatureOrGOId[QUEST_OBJECTIVES_COUNT]; // >0 Creature <0 Gameobject
uint32 ReqCreatureOrGOCount[QUEST_OBJECTIVES_COUNT];
uint32 ReqSpell[QUEST_OBJECTIVES_COUNT];

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7368"
#define REVISION_NR "7369"
#endif // __REVISION_NR_H__