Add a column to npc_spellclick_spells table to check if quest is completed/rewarded or incompleted
1: completed or rewarded; 3: incompleted; default 3 --HG-- branch : trunk
This commit is contained in:
@@ -3168,6 +3168,7 @@ CREATE TABLE `npc_spellclick_spells` (
|
||||
`npc_entry` INT UNSIGNED NOT NULL COMMENT 'reference to creature_template',
|
||||
`spell_id` INT UNSIGNED NOT NULL COMMENT 'spell which should be casted ',
|
||||
`quest_id` INT UNSIGNED NOT NULL COMMENT 'reference to quest_template',
|
||||
`quest_status` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Quest status: 3 incompleted, 1 completed/rewarded',
|
||||
`cast_flags` TINYINT UNSIGNED NOT NULL COMMENT 'first bit defines caster: 1=player, 0=creature; second bit defines target, same mapping as caster bit'
|
||||
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
ALTER TABLE `npc_spellclick_spells`
|
||||
ADD COLUMN `quest_status` int(11) UNSIGNED NOT NULL DEFAULT 3 COMMENT 'Quest status: 3 incompleted, 1 completed/rewarded' AFTER `quest_id`;
|
||||
|
||||
DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN ('29501', '29488');
|
||||
INSERT INTO `npc_spellclick_spells` VALUES ('29488', '54568', '12670', '1', '3');
|
||||
INSERT INTO `npc_spellclick_spells` VALUES ('29501', '54575', '12670', '1', '3');
|
||||
UPDATE `creature_template` SET `npcflag` = 16777216 WHERE `entry` IN ('29501', '29488');
|
||||
@@ -6253,7 +6253,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
|
||||
|
||||
mSpellClickInfoMap.clear();
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_id, cast_flags FROM npc_spellclick_spells");
|
||||
QueryResult *result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_id, quest_status, cast_flags FROM npc_spellclick_spells");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -6302,10 +6302,13 @@ void ObjectMgr::LoadNPCSpellClickSpells()
|
||||
|
||||
}
|
||||
|
||||
uint8 castFlags = fields[3].GetUInt8();
|
||||
uint32 queststatus = fields[3].GetUInt32();
|
||||
|
||||
uint8 castFlags = fields[4].GetUInt8();
|
||||
SpellClickInfo info;
|
||||
info.spellId = spellid;
|
||||
info.questId = quest;
|
||||
info.questStatus = queststatus;
|
||||
info.castFlags = castFlags;
|
||||
mSpellClickInfoMap.insert(SpellClickInfoMap::value_type(npc_entry, info));
|
||||
++count;
|
||||
|
||||
@@ -103,6 +103,7 @@ struct SpellClickInfo
|
||||
{
|
||||
uint32 spellId;
|
||||
uint32 questId;
|
||||
uint32 questStatus;
|
||||
uint8 castFlags;
|
||||
};
|
||||
|
||||
@@ -231,7 +232,7 @@ enum ConditionType
|
||||
CONDITION_SKILL = 7, // skill_id skill_value
|
||||
CONDITION_QUESTREWARDED = 8, // quest_id 0
|
||||
CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active.
|
||||
CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ñommission aura active
|
||||
CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ńommission aura active
|
||||
CONDITION_NO_AURA = 11, // spell_id effindex
|
||||
CONDITION_ACTIVE_EVENT = 12, // event_id
|
||||
CONDITION_INSTANCE_DATA = 13, // entry data
|
||||
@@ -954,4 +955,3 @@ TRINITY_DLL_SPEC CreatureInfo const* GetCreatureTemplateStore(uint32 entry);
|
||||
TRINITY_DLL_SPEC Quest const* GetQuestTemplateStore(uint32 entry);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -20683,7 +20683,7 @@ bool Player::canSeeSpellClickOn(Creature const *c) const
|
||||
|
||||
for(SpellClickInfoMap::const_iterator itr = lower; itr != upper; ++itr)
|
||||
{
|
||||
if(itr->second.questId == 0 || GetQuestStatus(itr->second.questId) == QUEST_STATUS_INCOMPLETE)
|
||||
if(itr->second.questId == 0 || GetQuestStatus(itr->second.questId) == itr->second.questStatus)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -499,7 +499,7 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
|
||||
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
|
||||
for(SpellClickInfoMap::const_iterator itr = map.lower_bound(unit->GetEntry()); itr != map.upper_bound(unit->GetEntry()); ++itr)
|
||||
{
|
||||
if(itr->second.questId == 0 || _player->GetQuestStatus(itr->second.questId) == QUEST_STATUS_INCOMPLETE)
|
||||
if(itr->second.questId == 0 || _player->GetQuestStatus(itr->second.questId) == itr->second.questStatus)
|
||||
{
|
||||
Unit *caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit;
|
||||
Unit *target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit;
|
||||
|
||||
Reference in New Issue
Block a user