aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-05-22 17:43:14 +0200
committerKudlaty <none@none>2009-05-22 17:43:14 +0200
commit3bd98584170536d16cc7e09ee5e8921b9a3de9fb (patch)
tree9051beafbaeb1ade49a64cc8a05bbfa89fe022bc
parentab5b273d3cc02f9db39864b39c55a619dc0a88e6 (diff)
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
-rw-r--r--sql/mangos.sql1
-rw-r--r--sql/updates/3467_world_spellclick_spell.sql7
-rw-r--r--src/game/ObjectMgr.cpp7
-rw-r--r--src/game/ObjectMgr.h4
-rw-r--r--src/game/Player.cpp2
-rw-r--r--src/game/SpellHandler.cpp2
6 files changed, 17 insertions, 6 deletions
diff --git a/sql/mangos.sql b/sql/mangos.sql
index 96da5218048..1561438c0a3 100644
--- a/sql/mangos.sql
+++ b/sql/mangos.sql
@@ -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;
diff --git a/sql/updates/3467_world_spellclick_spell.sql b/sql/updates/3467_world_spellclick_spell.sql
new file mode 100644
index 00000000000..41f93f190d4
--- /dev/null
+++ b/sql/updates/3467_world_spellclick_spell.sql
@@ -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');
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 02da82cb5fb..ca3b35a1cf3 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -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;
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index 136429a41d5..000e95623f4 100644
--- a/src/game/ObjectMgr.h
+++ b/src/game/ObjectMgr.h
@@ -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
-
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index db91a9abb95..8647afd2f69 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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;
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 644d8bc919b..ca675dcd931 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -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;