mirror of
https://github.com/araxiaonline/RandomScriptsforAzerothCore.git
synced 2026-06-13 02:22:19 -04:00
Add files via upload
This commit is contained in:
@@ -595,70 +595,3 @@ RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
|
||||
|
||||
------------------
|
||||
|
||||
local NPC_ENTRY11 = 381
|
||||
local REQUIRED_QUEST_ID = 30011
|
||||
local GAME_EVENT_ID = 17
|
||||
|
||||
local function ShowGossipMenu(player, creature)
|
||||
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
|
||||
player:GossipSendMenu(1, creature)
|
||||
end
|
||||
|
||||
local function OnGossipHello(event, player, creature)
|
||||
if IsGameEventActive(GAME_EVENT_ID) then
|
||||
if not player:HasQuest(REQUIRED_QUEST_ID) then
|
||||
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
|
||||
if questStatus == 4 then
|
||||
player:SendBroadcastMessage("Your time ran out, and you have failed this quest...")
|
||||
else
|
||||
player:SendBroadcastMessage("You must be on a certain quest to interact with this person.")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
ShowGossipMenu(player, creature)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnGossipSelect(event, player, creature, sender, intid, code)
|
||||
if (intid == 1) then
|
||||
player:GossipComplete()
|
||||
player:KilledMonsterCredit(NPC_ENTRY1)
|
||||
local random = math.random(0, 4)
|
||||
if random == 0 then
|
||||
creature:SendUnitSay("Mommmmy!!!!", 0)
|
||||
elseif random == 1 then
|
||||
creature:SendUnitSay("But I wanted to go play with Sally...", 0)
|
||||
elseif random == 2 then
|
||||
creature:SendUnitSay("Really? Stay indoors? How boring...", 0)
|
||||
elseif random == 3 then
|
||||
creature:SendUnitSay("Darn those yucky Scourge...", 0)
|
||||
else
|
||||
creature:SendUnitSay("Awww, no fun!", 0)
|
||||
end
|
||||
creature:DespawnOrUnsummon(1000) -- Despawn after 1 second (1000 milliseconds)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnGameEventStart(event, gameEventId)
|
||||
if gameEventId == GAME_EVENT_ID then
|
||||
local creatures = GetWorld():GetCreaturesByEntry(NPC_ENTRY11)
|
||||
for _, creature in ipairs(creatures) do
|
||||
creature:SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function OnGameEventStop(event, gameEventId)
|
||||
if gameEventId == GAME_EVENT_ID then
|
||||
local creatures = GetWorld():GetCreaturesByEntry(NPC_ENTRY11)
|
||||
for _, creature in ipairs(creatures) do
|
||||
creature:RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCreatureGossipEvent(NPC_ENTRY11, 1, OnGossipHello)
|
||||
RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
|
||||
RegisterServerEvent(34, OnGameEventStart)
|
||||
RegisterServerEvent(35, OnGameEventStop)
|
||||
|
||||
Reference in New Issue
Block a user