Created
June 25, 2022 21:29
-
-
Save Rastrian/ffbdb46db4f16ab0e4964bf18ac0853a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local QuestsBlockHeroic = {} | |
local QuestNameCache = {} | |
function populateQuestsBlockHeroic(quest, zone) | |
if (QuestsBlockHeroic[zone] == nil) then | |
QuestsBlockHeroic[zone] = {} | |
end | |
if (QuestsBlockHeroic[zone] ~= nil) then | |
table.insert(QuestsBlockHeroic[zone], quest) | |
print("[QuestBlockHeroic] Quest "..quest.." added to zone "..GetAreaName(zone)) | |
end | |
end | |
populateQuestsBlockHeroic(90016, 206) | |
populateQuestsBlockHeroic(90015, 4228) | |
populateQuestsBlockHeroic(90014, 4265) | |
populateQuestsBlockHeroic(90013, 4265) | |
populateQuestsBlockHeroic(90012, 4809) | |
populateQuestsBlockHeroic(90011, 1196) | |
populateQuestsBlockHeroic(90010, 4813) | |
populateQuestsBlockHeroic(90009, 4264) | |
populateQuestsBlockHeroic(90008, 4820) | |
populateQuestsBlockHeroic(90007, 4272) | |
populateQuestsBlockHeroic(90006, 4416) | |
populateQuestsBlockHeroic(90005, 4196) | |
populateQuestsBlockHeroic(90004, 4277) | |
populateQuestsBlockHeroic(90003, 4494) | |
populateQuestsBlockHeroic(90002, 4494) | |
local function GetQuestName(quest) | |
if (QuestNameCache[quest] == nil) then | |
local result = WorldDBQuery("SELECT LogTitle FROM quest_template WHERE id = "..quest) | |
if (result) then | |
local questName = result:GetString(0); | |
QuestNameCache[quest] = questName | |
return questName | |
end | |
return nil | |
else | |
return QuestNameCache[quest] | |
end | |
end | |
local function DGCheckHeroicQuest(event, player, newZone, newArea) | |
if (QuestsBlockHeroic[newZone]) then | |
local map = player:GetMap() | |
if (map:IsDungeon()) then | |
if (map:IsHeroic() == false) then | |
for _,v in pairs (QuestsBlockHeroic[newZone]) do | |
if (player:HasQuest(v) == true) then | |
player:RemoveQuest(v) | |
local msg = "Você acaba de perder a quest "..GetQuestName(v)..", ela só pode ser feita no modo Heroic dessa dungeon." | |
player:SendBroadcastMessage(msg) | |
player:SendTextPopup(msg) | |
end | |
end | |
end | |
end | |
end | |
end | |
RegisterPlayerEvent(27, DGCheckHeroicQuest) -- enter in zone | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment