diff --git a/Data/scripts/base/chara/npc/object/MarketEntrance.lua b/Data/scripts/base/chara/npc/object/MarketEntrance.lua index 23b45be6..86682561 100644 --- a/Data/scripts/base/chara/npc/object/MarketEntrance.lua +++ b/Data/scripts/base/chara/npc/object/MarketEntrance.lua @@ -82,13 +82,6 @@ city = { [1500394] = 3, -- Ul'dah : Edine } -ENTRANCE_LIMSA_DT = 1090238; -- Main Limsa Entrance -ENTRANCE_LIMSA_ALT = 1500392; -- M'septha Alternate -ENTRANCE_GRIDANIA_DT = 1090264; -- Main Grid Entrance -ENTRANCE_GRIDANIA_ALT = 1500393; -- Torsefers Alternate -ENTRANCE_ULDAH_DT = 1090265; -- Main Uldah Entrance -ENTRANCE_ULDAH_ALT = 1500394; -- Edine Alternate - function onEventStarted(player, npc, eventType, eventName) local npcCity = city[npc:GetActorClassId()] or 1; local marketPlaceName = CITY_INFO[npcCity][1]; -- Market Wards category name. Identical in all languages except Japanese diff --git a/Data/scripts/base/chara/npc/object/ObjectInnDoor.lua b/Data/scripts/base/chara/npc/object/ObjectInnDoor.lua index 24b7161b..e3c82af4 100644 --- a/Data/scripts/base/chara/npc/object/ObjectInnDoor.lua +++ b/Data/scripts/base/chara/npc/object/ObjectInnDoor.lua @@ -4,7 +4,7 @@ function init(npc) return false, false, 0, 0; end -function onEventStarted(player, npc, triggerName) +function onEventStarted(player, npc, eventType, eventName) defaultFst = GetStaticActor("DftFst"); choice = callClientFunction(player, "delegateEvent", player, defaultFst, "defaultTalkWithInn_ExitDoor", nil, nil, nil); diff --git a/Data/scripts/base/chara/npc/populace/PopulaceChocoboLender.lua b/Data/scripts/base/chara/npc/populace/PopulaceChocoboLender.lua index a4000a36..0ac4f0a9 100644 --- a/Data/scripts/base/chara/npc/populace/PopulaceChocoboLender.lua +++ b/Data/scripts/base/chara/npc/populace/PopulaceChocoboLender.lua @@ -41,7 +41,8 @@ local startAppearances = { local cityExits = { [1500006] = {133, -6.032, 46.356, 132.572, 3.034}, [1500061] = {150, 333.271, 5.889, -943.275, 0.794}, - [1000840] = {170, -26.088, 181.846, -79.438, 2.579} + [1000840] = {170, -26.088, 181.846, -79.438, 2.579}, + [1500059] = {172, -2133.028, 15.476, -421.471, 1.5} }; function init(npc) @@ -110,7 +111,7 @@ function onEventStarted(player, npc, triggerName) elseif(menuChoice == 3) then -- Change Barding callClientFunction(player, "eventTalkStepBreak", player); elseif(menuChoice == 5) then -- Rent Bird - mountChocobo(player, true, 1); + mountChocobo(player, true, 10); GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_CHOCOBO_RENTAL, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]); else callClientFunction(player, "eventTalkStepBreak", player); diff --git a/Data/scripts/base/chara/npc/populace/instanceraidguide/InstanceRaidGuide.lua b/Data/scripts/base/chara/npc/populace/instanceraidguide/InstanceRaidGuide.lua index 50801a26..b9238ec7 100644 --- a/Data/scripts/base/chara/npc/populace/instanceraidguide/InstanceRaidGuide.lua +++ b/Data/scripts/base/chara/npc/populace/instanceraidguide/InstanceRaidGuide.lua @@ -3,15 +3,54 @@ InstanceRaidGuide Script Functions; +askEnterInstanceRaid(arg1) -- Opens a widget asking to enter the given Raid id. --]] require ("global") function init(npc) - return false, false, 0, 0; + + if ((npc == 1002090) or (npc == 1002091)) then + -- This won't work due to how init() works, but old scripts had it, keeping it here for now + return false, false, 0, 0, 491, 2; + else + return false, false, 0, 0; + end end function onEventStarted(player, npc, eventType, eventName) + + npcId = npc:GetActorClassId() + + if (npcId == 1002090) then -- Serpent Private Hodder (Stewart) : Gcl107 + + callClientFunction(player, "delegateEvent", player, GetStaticActor("DftFst"), "defaultTalkWithStewart_001"); -- "defaultTalkWithStewart_002" -- Post-Raid dialog? + + --[[ + choice = callClientFunction(player, "delegateEvent", player, GetStaticActor("Gcl107"), "processEventStewart", 15); + + if (choice == 1) then + callClientFunction(player, "askEnterInstanceRaid", 15); -- Rivenroad + end + --]] + elseif (npcId == 1002091) then -- Serpent Private Dauremant (Trisselle) : Sum6w0 + + callClientFunction(player, "delegateEvent", player, GetStaticActor("DftFst"), "defaultTalkWithTrisselle_001"); -- "defaultTalkWithTrisselle_002" -- No idea for context. + + --[[ + choice = callClientFunction(player, "delegateEvent", player, GetStaticActor("Sum6w0"), "processEventTrisselle", 16) + + if (choice == 1) then + callClientFunction(player, "askEnterInstanceRaid", 16); -- Rivenroad (Hard) + end + --]] + elseif (npcId == 1060022) then -- Louisoix + callClientFunction(player, "delegateEvent", player, GetStaticActor("DftFst"), "defaultTalkLouisoix_001"); + end + + + + player:EndEvent(); end \ No newline at end of file diff --git a/Data/scripts/commands/ChangeJobCommand.lua b/Data/scripts/commands/ChangeJobCommand.lua index 930d8aa7..5cef1127 100644 --- a/Data/scripts/commands/ChangeJobCommand.lua +++ b/Data/scripts/commands/ChangeJobCommand.lua @@ -1,6 +1,90 @@ -function onEventStarted(player, caller, eventType, eventName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) +require("global"); +--[[ - player:SetCurrentJob(17); +ChangeJobCommand Script +Called when the player equips/unequips a job stone or uses the /job command. + +--]] + + +local classToJob = { -- [classId] = {jobId, jobAnim, jobKeyItem} + [2] = {15, 0x4000028, 2000202}, -- PGL -> MNK + [3] = {16, 0x4000029, 2000201}, -- GLD -> PLD + [4] = {17, 0x4000027, 2000203}, -- MRD -> WAR + [7] = {18, 0x400002D, 2000205}, -- ARC -> BRD + [8] = {19, 0x400002C, 2000204}, -- LNC -> DRG + [22] = {26, 0x400002B, 2000207}, -- THM -> BLM + [23] = {27, 0x400002A, 2000206}, -- CNJ -> WHM +} + +local jobToClass = { -- [jobId] = classId + [15] = 2, -- MNK -> PGL + [16] = 3, -- PLD -> GLD + [17] = 4, -- WAR -> MRD + [18] = 7, -- BRD -> ARC + [19] = 8, -- DRG -> LNC + [26] = 22, -- BLM -> THM + [27] = 23 -- WHM -> CNJ +} + + +function onEventStarted(player, command, eventType, eventName, jobState) + + local currentClass = player:GetCurrentClassOrJob(); + local jobCheck = isJob(currentClass); + local hasKeyItem = false; + + if (jobCheck == false) then + hasKeyItem = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(classToJob[currentClass][3]); + end + + if (jobCheck ~= nil) then -- Valid Class/Job ids only + if (jobState == 0) then -- Toggle current class/job state + if ((jobCheck == false) and (hasKeyItem == true)) then + setPlayerJob(player, classToJob[currentClass][1], classToJob[currentClass][2]); + elseif (jobCheck == true) then + setPlayerClass(player, jobToClass[currentClass]) + end + + elseif (jobState == 1 and (jobCheck == false) and (hasKeyItem == true)) then -- Equipping Job stone + setPlayerJob(player, classToJob[currentClass][1], classToJob[currentClass][2]); + elseif (jobState == 2 and (jobCheck == true)) then -- Removing Job stone + setPlayerClass(player, jobToClass[currentClass]); + end + end + player:EndEvent(); +end + + +function setPlayerClass(player, id) + player:SetCurrentJob(0); + player:PrepareClassChange(id); + player:DoClassChange(id); + player:PlayAnimation(0x4001030); + player:SendGameMessage(player, GetWorldMaster(), 30103, 0x20, 0, 0, player, id); +end + +function setPlayerJob(player, id, anim) + player:SetCurrentJob(id); + player:PrepareClassChange(id); + player:DoClassChange(jobToClass[id]); + player:PlayAnimation(anim); + player:SendGameMessage(player, GetWorldMaster(), 30103, 0x20, 0, 0, player, id); +end + +function isJob(id) + local validId = { + [2] = 0, [3] = 0, [4] = 0, [7] = 0, [8] = 0, [22] = 0, [23] = 0, + [15] = 1, [16] = 1, [17] = 1, [18] = 1, [19] = 1, [26] = 1, [27] = 1 + } + + if (validId[id] == 0) then + return false; + elseif (validId[id] == 1) then + return true; + else + return nil; + end end \ No newline at end of file diff --git a/Data/scripts/commands/ChocoboRideCommand.lua b/Data/scripts/commands/ChocoboRideCommand.lua index 24f56ffd..01c2fba3 100644 --- a/Data/scripts/commands/ChocoboRideCommand.lua +++ b/Data/scripts/commands/ChocoboRideCommand.lua @@ -26,7 +26,7 @@ function onEventStarted(player, actor, eventType, eventName, isGoobbue) player:ChangeSpeed(0.0, 3.6, 9.0, 9.0); player:ChangeState(15); else - player:ChangeMusic(player:GetZone().bgmDay, MUSIC_FADEIN); + player:ChangeMusic(player.currentArea.bgmDay, MUSIC_FADEIN); worldMaster = GetWorldMaster(); diff --git a/Data/scripts/commands/gm/anim.lua b/Data/scripts/commands/gm/anim.lua index 85fd2673..d0b092e7 100644 --- a/Data/scripts/commands/gm/anim.lua +++ b/Data/scripts/commands/gm/anim.lua @@ -2,29 +2,94 @@ require("global"); properties = { permissions = 0, - parameters = "ddd", + parameters = "dddd", description = [[ Sets anim id for current target !anim | +!anim ]], } function onTrigger(player, argc, aType, a1, a2) - npc = player;--GetWorldManager():GetActorInWorldByUniqueId("test"); - - aType = tonumber(aType); - a1 = tonumber(a1); - a2 = tonumber(a2); - - a1 = bit32.band(a1, 0xFFF); - a2 = bit32.band(a2, 0xFFF); - aType = bit32.band(aType, 0xFF); - - animId = bit32.bor(bit32.lshift(a2, 12), a1); - animId = bit32.bor(bit32.lshift(aType, 24), animId); - - print("AHHH"); - player:PlayAnimation(0x10005000); -end; + + local actor = player.CurrentArea.FindActorInArea(player.currentTarget) or nil; + + if (player and actor) then + a1 = bit32.band(a1, 0xFFF); + a2 = bit32.band(a2, 0xFFF); + aType = bit32.band(aType, 0xFF); + + animId = bit32.bor(bit32.lshift(a2, 12), a1); + animId = bit32.bor(bit32.lshift(aType, 24), animId); + -- player:SendMessage(0x20, "[anim] ", tostring(animId)); + actor:PlayAnimation(animId); + local output = string.format("%x", animId) + player:SendMessage(0x20, "[anim] ", "0x"..tostring(output).. " Target:"..tostring(actor)); + end +end + + +--[[ Categories: +1 MGK: 01 - Magic +2 SYS: 02 - System noises +3 ETC: 03 - ?? - Item sound? +4 LIB: 04 - Posing animations +5-9 ITM: 05-09 - Items +10 KAO: 0A - KAO = Face emotes? +11-12 GLI1/2/3: 0B/0C - Leve card things +13 CBI: 0D - Two small effects +14 ABL: 0E - Cooldown buffs +15 POP: 0F - Warp effects +16 CFT: 10 - Crafting? +17 BTL: 11 - More Crafting? +18 WSC: 12 - Weapon Skills Arg1 - Weapon Skill Arg2 - Player Animation +19 WSS: 13 - Mob animations +20 PIC: 14 - Gathering weapons? +21 LIU: 15 - Player Hand Emotes +22 LIN: 16 - Doesn't exist? +23 LIF: 17 - Doesn't exist? +24 LIL: 18 - Mouth +25 ATK: 19 - Autoattacks + +33 = ? +34 = Crash +120 = ??? + + +Notes: +------ +CATEGORY +Shift 18 bits right +CMP 0xB + +ANIMATION?????? +Shift 0xC bits right +AND 0x0FFF + +PARTICLE EFFECT +AND 0x0FFF +This number is in the subfolder (wsc, abi, etc) + + +That 12 is: + +CMP 7C +CMP 6f +CMP 70 +CMP 71 + +7C000062 +ec000000 +00FFFFFF + +19: Auto Attack? +6F: Casting +71: Seems to deal with signaling monster parts +7C: Sheath/Unsheath +7F: Cast failed + +--]] + + diff --git a/Data/scripts/commands/gm/music.lua b/Data/scripts/commands/gm/music.lua index 0a761b14..e2445f75 100644 --- a/Data/scripts/commands/gm/music.lua +++ b/Data/scripts/commands/gm/music.lua @@ -3,15 +3,15 @@ properties = { parameters = "ss", description = [[ -Plays music to player. +Plays music to player, otherwise resets to the zone's music. +!music !music !music ]], } function onTrigger(player, argc, music, transition) - music = tonumber(music) or 0; + music = tonumber(music) or player.currentArea.bgmDay or 0; transition = tonumber(transition) or nil; - player:SendMessage(0x20, "", tostring(argc).." "..tostring(music).." "..tostring(transition)); player:ChangeMusic(music, transition); end; \ No newline at end of file diff --git a/Data/scripts/commands/gm/nudgenpc.lua b/Data/scripts/commands/gm/nudgenpc.lua index 67e49c93..c832e5c7 100644 --- a/Data/scripts/commands/gm/nudgenpc.lua +++ b/Data/scripts/commands/gm/nudgenpc.lua @@ -38,7 +38,8 @@ horizontal = { rotation = { ["ROTATE"] = 3, ["ORIENTATION"] = 3, -["O"] = 3 +["O"] = 3, +["ROT"] = 3 } function onTrigger(player, argc, arg1, arg2) diff --git a/Data/scripts/commands/gm/quest.lua b/Data/scripts/commands/gm/quest.lua index eab846ef..569bf821 100644 --- a/Data/scripts/commands/gm/quest.lua +++ b/Data/scripts/commands/gm/quest.lua @@ -5,166 +5,207 @@ properties = { parameters = "ssss", description = [[ -Add/Remove Quests, modify and . -!quest add/remove | -!quest phase | -!quest flag true/false | +Add/Remove/Complete Quests, modify and . +!quest <#> | +!quest <#> | +!quest <#> true/false | ]], } -function onTrigger(player, argc, command, var1, var2, var3) +function onTrigger(player, argc, quest, command, var1, var2) local messageID = MESSAGE_TYPE_SYSTEM_ERROR; local sender = "[quest] "; local message = "Error"; + local questId = tonumber(quest); - print(tostring(argc)); - if player then - if argc == 2 then - if command == "add" or command == "give" or command == "+" then - if tonumber(var1) then - if player:HasQuest(tonumber(var1)) == false then - player:AddQuest(tonumber(var1)); - message = ("adding quest "..var1); - else - message = ("already have quest "..var1); - end - else - if player:HasQuest(var1) == false then - player:AddQuest(var1); - message = ("adding quest "..var1); - else - message = ("already have quest "..var1); - end - end - - elseif command == "remove" or command == "delete" or command == "-" then - if tonumber(var1) and player:HasQuest(tonumber(var1)) == true then - player:RemoveQuest(tonumber(var1)); - message = ("removing quest "..var1); - else - if player:HasQuest(var1) == true then - q2 = GetStaticActor(var1); - - if q2 ~= nil then - q3 = q2.Id; - message = ("removing quest "..var1); - printf(q3); - q4 = bit32.band(q3, 0xA0F00000); - printf(q4); - - player:RemoveQuest(quest.Name); - end - else - message = ("remove error: either incorrect ID or quest "..var1.." isn't active on character"); - end - end - elseif command == "info" then - if tonumber(var1) then - if player:HasQuest(tonumber(var1)) then - quest = player:GetQuest(tonumber(var1)); - - local flagStr = ""; - for i=0,31,1 do - if (quest:GetData():GetFlag(i)) then - flagStr = flagStr .. "O"; - else - flagStr = flagStr .. "X"; - end - if (i == 15) then - flagStr = flagStr .. "\n"; - end - end - - local data = quest:GetData(); - - message = string.format("\nInfo for quest %s [%d]\n", quest.Name, quest:GetQuestId()); - message = message .. string.format("Current Sequence: %d\n", quest:getSequence()); - message = message .. string.format("Flags: \n%s\n", flagStr) - message = message .. string.format("Counters: %d,%d,%d,%d", data:getCounter(0), data:getCounter(1), data:getCounter(2), data:getCounter(3)); - else - message = ("Quest not active: "..var1); - end - else - message = ("error: invalid parameters used"); - end + if (type(questId) == "number") then + if (questId < 110001 or questId > 110001 + 2048) and player then + player:SendMessage(messageID, sender, "Invalid questId entered"); + player:SendMessage(messageID, sender, argc); + return; + else + if (command == "add" or command == "give" or command == "+") then + message = addQuest(player, questId); + elseif (command == "remove" or command == "delete" or command == "-") then + message = removeQuest(player, questId); + elseif (command == "complete" or command == "completed" or command == "finish") then + message = setQuestCompletion(player, argc, questId, var1); + elseif (command == "info") then + message = getQuestInfo(player, questId); + elseif (command == "seq" or command == "sequence") then + message = setQuestSequence(player, questId, tonumber(var1)); + elseif (command == "flag") then + message = setQuestFlag(player, questId, var1, var2); + elseif (command == "counter" or command == "count") then + message = setQuestCounter(player, questId, var1, var2); else - message = ("error: command "..command.." not recognized"); - end - elseif argc == 3 then - if command == "seq" or command == "sequence" then - if (tonumber(var1) and tonumber(var2)) ~= nil then - if player:HasQuest(tonumber(var1)) == true then - player:GetQuest(tonumber(var1)):StartSequence(tonumber(var2)); - message = ("changing sequence of quest "..var1.." to "..var2); - else - message = ("sequence error: either incorrect ID or quest "..var1.." isn't active on character"); - end - else - message = ("error: invalid parameters used"); - end - else - message = ("error: command "..command.." not recognized"); - end; - - elseif argc == 4 then - if command == "flag" then - if tonumber(var1) and (tonumber(var2) >= 0 and tonumber(var2) <= 32) then - questvar = tonumber(var1); - flagvar = (tonumber(var2)); - boolvar = 0; - - if var3 == "true" or var3 == "1" or var3 == "on" or var3 == "O" then - boolvar = true; - elseif var3 == "false" or var3 == "0" or var3 == "off" or var3 == "X" then - boolvar = false; - elseif var3 == "flip" or var3 == "toggle" then - if player:HasQuest(questvar) == true then - boolvar = not player:GetQuest(questvar):GetData():GetFlag(flagvar); - end - else - message = ("error: flag: boolean not recognized"); - print(sender..message); - return; - end - - var4 = player:GetQuest(questvar):GetData():GetFlag(flagvar); - - if var4 ~= boolvar then - if (boolvar == true) then - player:GetQuest(questvar):GetData():SetFlag(flagvar); - else - player:GetQuest(questvar):GetData():ClearFlag(flagvar); - end - player:GetQuest(questvar):UpdateENPCs(); - player:GetQuest(questvar):GetData():Save(); - if boolvar == true then - message = ("changing flag "..tonumber(var2).." to true on quest "..questvar); - else - message = ("changing flag "..tonumber(var2).." to false on quest "..questvar); - end - else - message = ("error: flag "..flagvar.." is already set to that state on quest "..questvar); - end - else - message = ("error: command "..command.." not recognized"); - end - elseif command == "counter" then - if tonumber(var1) and (tonumber(var2) >= 0 and tonumber(var2) <= 4) then - questvar = tonumber(var1); - index = (tonumber(var2)); - - player:GetQuest(questvar):GetData():SetCounter(index, tonumber(var3)); - player:GetQuest(questvar):UpdateENPCs(); - player:GetQuest(questvar):GetData():Save(); - message = ("changing counter "..tonumber(var2).." to "..var3); - else - message = ("error: command "..command.." not recognized"); - end - end + message = ("Error: Command "..command.." not recognized"); + end end + else + message = ("Error: Quest id must be a valid number.") end player:SendMessage(messageID, sender, message); - print(sender..message); -end \ No newline at end of file +end + + + +function addQuest(player, questId) + if (not (player:HasQuest(questId))) then + player:AddQuest(questId); + return string.format("Adding quest "..player:GetQuest(questId).name.." ["..questId.."]"); + else + return string.format("Already have quest "..player:GetQuest(questId).name.." ["..questId.."]"); + end +end + +function removeQuest(player, questId) + if (player:HasQuest(questId)) then + local questName = player:GetQuest(questId).name; + player:RemoveQuest(questId); + return string.format("Removing quest "..questName.." ["..questId.."]"); + else + return string.format("Error: Either incorrect ID or quest "..questId.." isn't active on character."); + end +end + +function setQuestCompletion(player, argc, questId, flag) + + if (argc == 2) then -- No flag entered -> Return state of the quest's completion. + return string.format("Quest %d completion is set to: %s", questId, tostring(player:IsQuestCompleted(questId))); + else + local boolFlag = false; + + if (flag == "true" or flag == "1" or flag == "on" or flag == "O") then + boolFlag = true; + elseif (flag == "false" or flag == "0" or flag == "off" or flag == "X") then + boolFlag = false; + elseif flag == "flip" or flag == "toggle" then + boolFlag = not player:IsQuestCompleted(questId); + else -- A catch for bad inputs + return string.format("Error: Invalid flag entered"); + end + + player:SetQuestComplete(questId, boolFlag); + return string.format("Quest %d completion set to: %s", questId, tostring(player:IsQuestCompleted(questId))); + + end +end + +function setQuestSequence(player, questId, sequence) + if (type(sequence) == "number") then + if (player:HasQuest(questId)) then + local seq = math.floor(tonumber(sequence)); + if (seq >= 0 and seq <= 65535) then + player:GetQuest(questId):StartSequence(seq); + return string.format("Changing sequence of quest "..player:GetQuest(questId).name.." ["..questId.."] to "..seq); + else + return string.format("Error: Sequence value must be within 0-65535."); + end + else + return string.format("Sequence error: either incorrect ID or quest "..questId.." isn't active on character"); + end + else + return string.format("Error: Sequence value must be a valid number."); + end +end + +function setQuestFlag(player, questId, flagNum, flagCmd) + local questvar = questId; + local flagvar = tonumber(flagNum); + local boolvar = 0; + + if (player:HasQuest(questvar)) then + if (flagvar >= 0 and flagvar <= 31) then + + if flagCmd == "true" or flagCmd == "1" or flagCmd == "on" or flagCmd == "O" then + boolvar = true; + elseif flagCmd == "false" or flagCmd == "0" or flagCmd == "off" or flagCmd == "X" then + boolvar = false; + elseif flagCmd == "flip" or flagCmd == "toggle" then + boolvar = not player:GetQuest(questvar):GetData():GetFlag(flagvar); + else + return "Error: Flag: Boolean not recognized." + end + + currentFlagState = player:GetQuest(questvar):GetData():GetFlag(flagvar); + + if (currentFlagState ~= boolvar) then + + if (boolvar == true) then + player:GetQuest(questvar):GetData():SetFlag(flagvar); + else + player:GetQuest(questvar):GetData():ClearFlag(flagvar); + end + player:GetQuest(questvar):UpdateENPCs(); + player:GetQuest(questvar):GetData():Save(); + if boolvar == true then + return string.format("Changing flag "..tonumber(flagNum).." to true on quest "..questvar); + else + return string.format("Changing flag "..tonumber(flagNum).." to false on quest "..questvar); + end + else + return string.format("Error: Flag "..flagvar.." is already set to that state on quest "..questvar); + end + else + return string.format("Error: Flag "..flagNum.." is not within the valid range of 0-31."); + end + else + return string.format("Error: Either incorrect ID or quest "..tostring(questId).." isn't active on character."); + end + +end + +function setQuestCounter(player, questId, counterSlot, counterValue) + local cSlot = tonumber(counterSlot) or nil; + local cVal = tonumber(counterValue) or nil; + + if (cSlot ~= nil and cSlot >= 0 and cSlot <= 3) then + if (cVal ~= nil and cVal >= 0 and cVal <= 255) then + player:GetQuest(questId):GetData():SetCounter(cSlot, cVal); + player:GetQuest(questId):UpdateENPCs(); + player:GetQuest(questId):GetData():Save(); + + return string.format("Changing counter "..cSlot.." to "..cVal); + else + return string.format("Error: Invalid counter value. Must be between 0-255."); + end + else + return string.format("Error: Invalid counter index. Must be between 0-3."); + end +end + + +function getQuestInfo(player, questId) + if player:HasQuest(questId) then + quest = player:GetQuest(questId); + + local msg = ""; + local flagStr = ""; + + for i=0,31,1 do + if (quest:GetData():GetFlag(i)) then + flagStr = flagStr .. "O"; + else + flagStr = flagStr .. "X"; + end + if (i == 15) then + flagStr = flagStr .. "\n"; + end + end + + local data = quest:GetData(); + + msg = string.format("Info for quest %s [%d]\n", quest.Name, quest:GetQuestId()); + msg = msg .. string.format("Flags \\\\ Current Sequence: %d\n", quest:getSequence()); + msg = msg .. string.format("%s\n", flagStr) + msg = msg .. string.format("Counters: %d,%d,%d,%d", data:getCounter(0), data:getCounter(1), data:getCounter(2), data:getCounter(3)); + return msg; + else + return string.format("Quest not active: "..questId); + end +end + + diff --git a/Data/scripts/commands/gm/setstate.lua b/Data/scripts/commands/gm/setstate.lua index cfff2cb0..c6e1b091 100644 --- a/Data/scripts/commands/gm/setstate.lua +++ b/Data/scripts/commands/gm/setstate.lua @@ -15,10 +15,12 @@ function onTrigger(player, argc, state) local sender = "[setstate] "; local s = tonumber(state); - local actor = GetWorldManager():GetActorInWorld(player.currentTarget) or nil; + local actor = player.CurrentArea:FindActorInArea(player.currentTarget) or nil; if player and actor then actor:ChangeState(s); - wait(0.8); - player:SendMessage(0x20, "", "state: "..s); + wait(0.8); + player:SendMessage(0x20, "", "state: "..s); + else + player:SendMessage(0x20, "", "Error: No target selected."); end; end; \ No newline at end of file diff --git a/Data/scripts/commands/gm/testmapobj.lua b/Data/scripts/commands/gm/testmapobj.lua index feff9672..36d7b157 100644 --- a/Data/scripts/commands/gm/testmapobj.lua +++ b/Data/scripts/commands/gm/testmapobj.lua @@ -3,7 +3,12 @@ require("global"); properties = { permissions = 0, parameters = "sssss", - description = "" + description = +[[ + +Tests a layout/region id w/ an animation string +!testmapobj +]], } function onTrigger(player, argc, animation, layoutId, instanceId, maxInstanceId) diff --git a/Data/scripts/commands/gm/warp.lua b/Data/scripts/commands/gm/warp.lua index 4ebe9af6..eb421800 100644 --- a/Data/scripts/commands/gm/warp.lua +++ b/Data/scripts/commands/gm/warp.lua @@ -62,6 +62,27 @@ function onTrigger(player, argc, p1, p2, p3, p4, privateArea, privateAreaType, n worldManager:DoZoneChange(player, zone, privateArea, tonumber(privateAreaType), 0x02, x, y, z, 0.00); end + elseif (argc == 1) then -- Switch city zone + + local commands = { ["SWITCH"] = 1, ["S"] = 1, ["FLIP"] = 1, ["F"] = 1, ["TOWN"] = 1}; + + if (commands[string.upper(p1)]) then + local zones = { + [133] = {133, 230}, + [155] = {155, 206}, + [175] = {175, 209}, + [206] = {206, 155}, + [209] = {209, 175}, + [230] = {230, 133} + } + + if (player_zone == zones[player_zone][1]) then + worldManager:DoZoneChange(player, zones[player_zone][2], "", 0, 0x16, player_x, player_y, player_z, player_rot); + player:SendMessage(messageID, sender, string.format("setting coordinates X:%d Y:%d Z:%d to new zone (%d) private area:%s", player_x, player_y, player_z, zones[player_zone][2], privateArea or "unspecified")); + end + else + player:SendMessage(messageID, sender, "Unknown parameters! Usage: "..properties.description); + end else player:SendMessage(messageID, sender, "Unknown parameters! Usage: "..properties.description); end; diff --git a/Data/scripts/commands/gm/warpplayer.lua b/Data/scripts/commands/gm/warpplayer.lua index 297c9250..76970dd0 100644 --- a/Data/scripts/commands/gm/warpplayer.lua +++ b/Data/scripts/commands/gm/warpplayer.lua @@ -38,7 +38,7 @@ function onTrigger(player, argc, name, lastName, name2, lastName2) return; else local pos = p1:GetPos(); - worldManager:DoZoneChange(player, pos[4], nil, 0, 0x02, pos[0], pos[1], pos[2], pos[3]); + worldManager:DoZoneChange(player, pos[5], nil, 0, 0x02, pos[1], pos[2], pos[3], pos[4]); player:SendMessage(messageID, sender, string.format("Moving to %s %s 's coordinates.", name, lastName)); end; elseif argc == 4 then; @@ -50,7 +50,7 @@ function onTrigger(player, argc, name, lastName, name2, lastName2) local pos = p1:GetPos(); local pos2 = p2:GetPos(); - worldManager:DoZoneChange(p1, pos2[4], nil, 0, 0x02, pos2[0], pos2[1], pos2[2], pos2[3]); + worldManager:DoZoneChange(p1, pos2[5], nil, 0, 0x02, pos2[1], pos2[2], pos2[3], pos2[4]); player:SendMessage(messageID, sender, string.format("Moving %s %s to %s %s 's coordinates.", name, lastName, name2, lastName2)); p1:SendMessage(messageID, sender, string.format("You are being moved to %s %s 's coordinates.", name2, lastName2)); end; diff --git a/Data/scripts/commands/gm/weather.lua b/Data/scripts/commands/gm/weather.lua index 5bfae4da..adbfd16d 100644 --- a/Data/scripts/commands/gm/weather.lua +++ b/Data/scripts/commands/gm/weather.lua @@ -21,6 +21,12 @@ function onTrigger(player, argc, weather, updateTime, zonewide) weather = tonumber(weather) or 0; updateTime = tonumber(updateTime) or 0; zonewide = tonumber(zonewide) or 0; + + if (weather > 0 and weather < 82) then + weather = weather + 8000; + end + + message = string.format("changed weather to %u ", weather); if zonewide ~= 0 then diff --git a/Data/scripts/commands/gm/yolo.lua b/Data/scripts/commands/gm/yolo.lua index 24f9b2a4..98471443 100644 --- a/Data/scripts/commands/gm/yolo.lua +++ b/Data/scripts/commands/gm/yolo.lua @@ -144,11 +144,11 @@ function onTrigger(player, argc, width, height, blockCount) end; local pos = player:GetPos(); - local x = tonumber(pos[0]); - local y = tonumber(pos[1]); - local z = tonumber(pos[2]); - local rot = tonumber(pos[3]); - local zone = pos[4]; + local x = tonumber(pos[1]); + local y = tonumber(pos[2]); + local z = tonumber(pos[3]); + local rot = tonumber(pos[4]); + local zone = pos[5]; local w = tonumber(width) or 0; local h = tonumber(height) or 0; @@ -160,7 +160,7 @@ function onTrigger(player, argc, width, height, blockCount) for i = 0, w do for j = 0, h do local actor = player.CurrentArea.SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true); - --actor.ChangeNpcAppearance(2200905); + actor.ChangeNpcAppearance(2200905); actor.SetMaxHP(500); actor.SetHP(500); actor.SetMod(modifiersGlobal.CanBlock, 1); diff --git a/Data/scripts/content/SimpleContent30010.lua b/Data/scripts/content/SimpleContent30010.lua index 12cfc50b..6265f2bb 100644 --- a/Data/scripts/content/SimpleContent30010.lua +++ b/Data/scripts/content/SimpleContent30010.lua @@ -1,79 +1,34 @@ -require ("global") -require ("modifiers") function onCreate(starterPlayer, contentArea, director) - --papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); - --yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); - --mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); - --mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); - --mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); - yda = GetWorldManager().SpawnBattleNpcById(6, contentArea); - papalymo = GetWorldManager().SpawnBattleNpcById(7, contentArea); - --yda:ChangeState(2); - mob1 = GetWorldManager().SpawnBattleNpcById(3, contentArea); - mob2 = GetWorldManager().SpawnBattleNpcById(4, contentArea); - mob3 = GetWorldManager().SpawnBattleNpcById(5, contentArea); - starterPlayer.currentParty:AddMember(papalymo.Id); - starterPlayer.currentParty:AddMember(yda.Id); - starterPlayer:SetMod(modifiersGlobal.MinimumHpLock, 1); - - - openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); - - director:AddMember(starterPlayer); + papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); + yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); + + mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); + mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); + mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); + + openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); + + yda:ChangeState(2); + mob1:ChangeState(2); + mob2:ChangeState(2); + mob3:ChangeState(2); + + + + + director:AddMember(starterPlayer); director:AddMember(director); - director:AddMember(papalymo); - director:AddMember(yda); + director:AddMember(yda); + director:AddMember(papalymo); director:AddMember(mob1); director:AddMember(mob2); director:AddMember(mob3); - - --director:StartContentGroup(); - + director:StartContentGroup(); end function onDestroy() end -function onUpdate(tick, area) - if area then - local players = area:GetPlayers() - local mobs = area:GetMonsters() - local allies = area:GetAllies() - local resumeChecks = true - for player in players do - if player then - local exitLoop = false - - if allies then - for i = 0, #allies - 1 do - if allies[i] then - if not allies[i]:IsEngaged() then - if player:IsEngaged() and player.target then - - allies[i].neutral = false - allies[i].isAutoAttackEnabled = true - allies[i]:SetMod(modifiersGlobal.Speed, 8) - allyGlobal.EngageTarget(allies[i], player.target) - exitLoop = true - break - -- todo: support scripted paths - elseif allies[i]:GetSpeed() > 0 then - end - end - end - end - end - if exitLoop then - resumeChecks = false - break - end - end - end - if not resumeChecks then - return - end - end -end \ No newline at end of file diff --git a/Data/scripts/directors/AfterQuestWarpDirector.lua b/Data/scripts/directors/AfterQuestWarpDirector.lua index 923f0650..e90f1e5e 100644 --- a/Data/scripts/directors/AfterQuestWarpDirector.lua +++ b/Data/scripts/directors/AfterQuestWarpDirector.lua @@ -8,6 +8,9 @@ function onEventStarted(player, director, eventType, eventName) if (player:HasQuest(110002) == true) then quest = player:GetQuest("Man0l1"); quest:OnNotice(player); + elseif (player:HasQuest(110006) == true) then + quest = player:GetQuest("Man0g1"); + quest:OnNotice(player); end end diff --git a/Data/scripts/directors/Quest/QuestDirectorMan0g001.lua b/Data/scripts/directors/Quest/QuestDirectorMan0g001.lua index 79f765cb..17493af9 100644 --- a/Data/scripts/directors/Quest/QuestDirectorMan0g001.lua +++ b/Data/scripts/directors/Quest/QuestDirectorMan0g001.lua @@ -1,9 +1,8 @@ require ("global") require ("tutorial") -require ("modifiers") require ("quests/man/man0g0") ---processTtrBtl001: Active Mode Tutorial +--processTtrBtl001: Active Mode Tutorial - DoW only --processTtrBtl002: Targetting Tutorial (After active mode done) function init() @@ -11,90 +10,106 @@ function init() end function onCreateContentArea(players, director, contentArea, contentGroup) - director:StartContentGroup(); + + papalymo = contentArea:SpawnActor(2290005, "papalymo", 365.89, 4.0943, -706.72, -0.718); + yda = contentArea:SpawnActor(2290006, "yda", 365.266, 4.122, -700.73, 1.5659); + + mob1 = contentArea:SpawnActor(2201407, "mob1", 374.427, 4.4, -698.711, -1.942); + mob2 = contentArea:SpawnActor(2201407, "mob2", 375.377, 4.4, -700.247, -1.992); + mob3 = contentArea:SpawnActor(2201407, "mob3", 375.125, 4.4, -703.591, -1.54); + + openingStoper = contentArea:SpawnActor(1090384, "openingstoper", 356.09, 3.74, -701.62, -1.41); + + for _, player in pairs(players) do + contentGroup:AddMember(player); + end; + + + + contentGroup:AddMember(director); + contentGroup:AddMember(yda); + contentGroup:AddMember(papalymo); + contentGroup:AddMember(mob1); + contentGroup:AddMember(mob2); + contentGroup:AddMember(mob3); + end function onEventStarted(player, actor, triggerName) + man0g0Quest = player:GetQuest("Man0g0"); - player:SetMod(modifiersGlobal.MinimumHpLock, 1); - player:SendMessage(0x20, "", "Starting"); startTutorialMode(player); - callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtl001", nil, nil, nil); - player:EndEvent(); - player:SendMessage(0x20, "", "Waiting for player active"); - waitForSignal("playerActive"); - player:SendMessage(0x20, "", "player active"); - wait(1); --If this isn't here, the scripts bugs out. TODO: Find a better alternative. - kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); - callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtl002", nil, nil, nil); - player:SendMessage(0x20, "", "processTtrBtl002 called"); - player:EndEvent(); + --Combat portion of tutorial if player:IsDiscipleOfWar() then - player:SendMessage(0x20, "", "Is DoW"); - waitForSignal("playerAttack"); + + callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtl001"); + player:EndEvent(); + waitForSignal("playerActive"); + wait(1); --If this isn't here, the scripts bugs out. TODO: Find a better alternative. + kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); + + callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtl002", nil, nil, nil); + player:EndEvent(); + + --waitForSignal("playerAttack"); closeTutorialWidget(player); showTutorialSuccessWidget(player, 9055); --Open TutorialSuccessWidget for attacking enemy openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_TP); - waitForSignal("tpOver1000"); - player:SetMod(modifiersGlobal.MinimumTpLock, 1000); + + wait(3); closeTutorialWidget(player); openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_WEAPONSKILLS); - waitForSignal("weaponskillUsed"); - player:SetMod(modifiersGlobal.MinimumTpLock, 0); + --waitForSignal("weaponskillUsed"); + wait(3); + --player:SetMod(modifiersGlobal.MinimumTpLock, 0); closeTutorialWidget(player); showTutorialSuccessWidget(player, 9065); --Open TutorialSuccessWidget for weapon skill + elseif player:IsDiscipleOfMagic() then - player:SendMessage(0x20, "", "Is DoM"); - openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_CASTING); - waitForSignal("spellUsed"); - closeTutorialWidget(player); + + callClientFunction(player, "delegateEvent", player, man0g0Quest, "processTtrBtlMagic001"); + player:EndEvent(); + wait(1); + kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); + closeTutorialWidget(player); + player:SendMessage(0x20, "", "Sending success"); + showTutorialSuccessWidget(player, 9050); --Open TutorialSuccessWidget for magic skill + wait(1) + openTutorialWidget(player, CONTROLLER_KEYBOARD, TUTORIAL_DEFEATENEMY); + wait(3); + closeTutorialWidget(player); + + + --waitForSignal("spellUsed"); 9050 + elseif player:IsDiscipleOfHand() then - waitForSignal("abilityUsed"); + --waitForSignal("abilityUsed"); elseif player:IsDiscipleOfLand() then - waitForSignal("abilityUsed"); + --waitForSignal("abilityUsed"); end - player:SendMessage(0x20, "", "Waiting for mobkill1"); - waitForSignal("mobkill"); --Should be wait for mobkill - player:SendMessage(0x20, "", "Waiting for mobkill2"); - waitForSignal("mobkill"); - player:SendMessage(0x20, "", "Waiting for mobkill3"); - waitForSignal("mobkill"); + wait(3); worldMaster = GetWorldMaster(); - player:SetMod(modifiersGlobal.MinimumHpLock, 0); - player:SendMessage(0x20, "", "Sending data packet 'attention'"); player:SendDataPacket("attention", worldMaster, "", 51073, 2); - wait(5); - player:SendMessage(0x20, "", "Disengaging"); - player:Disengage(0x0000); - wait(5); - player:SendMessage(0x20, "", "NextPhase(10)"); - man0g0Quest:NextPhase(10); - wait(5); - player:SendMessage(0x20, "", "ProcessEvent020_1"); - callClientFunction(player, "delegateEvent", player, man0g0Quest, "processEvent020_1", nil, nil, nil); - - wait(5); - - player:SendMessage(0x20, "", "Changing music"); + wait(7); player:ChangeMusic(7); - wait(5); + player:ChangeState(0); + + --kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); + callClientFunction(player, "delegateEvent", player, man0g0Quest, "processEvent020_1"); + + man0g0Quest:StartSequence(10); - player:SendMessage(0x20, "", "Kick notice event"); - kickEventContinue(player, actor, "noticeEvent", "noticeEvent"); - wait(5); - - player:SendMessage(0x20, "", "ContentFinished"); - player.CurrentArea:ContentFinished(); - wait(5); - player:SendMessage(0x20, "", "Remove from party"); - player:RemoveFromCurrentPartyAndCleanup(); - --player:EndEvent(); - --GetWorldManager():DoZoneChange(player, 155, "PrivateAreaMasterPast", 1, 15, 175.38, -1.21, -1156.51, -2.1); - --[[ + player:EndEvent(); + player.CurrentArea:ContentFinished(); + GetWorldManager():DoZoneChange(player, 155, "PrivateAreaMasterPast", 1, 15, 175.38, -1.21, -1156.51, -2.1); + player:EndEvent(); +end + +--[[ IF DoW: OpenWidget (TP) IF TP REACHED: @@ -105,36 +120,4 @@ function onEventStarted(player, actor, triggerName) CloseWidget ELSE MAGIC: OpenWidget (DEFEAT ENEMY) - ]] - - player:EndEvent(); - - wait(5); - player:SendMessage(0x20, "", "Zone change"); - GetWorldManager():DoZoneChange(player, 155, "PrivateAreaMasterPast", 1, 15, 175.38, -1.21, -1156.51, -2.1); - -end - -function onUpdate(deltaTime, area) -end - -function onTalkEvent(player, npc) - -end - -function onPushEvent(player, npc) -end - -function onCommandEvent(player, command) - -end - -function onEventUpdate(player, npc) -end - -function onCommand(player, command) -end - -function main(director, contentGroup) - onCreateContentArea(director:GetPlayerMembers(), director, director.CurrentArea, contentGroup); -end; \ No newline at end of file + --]] \ No newline at end of file diff --git a/Data/scripts/quests/dft/DftSea.lua b/Data/scripts/quests/dft/DftSea.lua index d9956caf..80acbd19 100644 --- a/Data/scripts/quests/dft/DftSea.lua +++ b/Data/scripts/quests/dft/DftSea.lua @@ -59,7 +59,7 @@ local defaultTalkSea = { [1000164] = "defaultTalkWithFaucillien_001", -- Faucillien (Limsa Upper Decks: FSH Guild) - Will not fire, not PplStd [1000165] = "defaultTalkWithLouviaune_001", -- Louviaune (Limsa Upper Decks: FSH Guild) - Will not fire, not PplStd [1000166] = "defaultTalkWithUrsulie_001", -- Ursulie (Limsa Upper Decks: Adv. Guild) - Will not fire, not PplStd. Retainer NPC - [1000167] = "defaultTalkWithInn_Desk", -- Mytesyn (Limsa Upper Decks: Adv. Guild) defaultTalkWithMytesyn_001 (Pre-Inn dialog.) + [1000167] = "defaultTalkWithMytesyn_001", -- Mytesyn (Limsa Upper Decks: Adv. Guild) defaultTalkWithInn_Desk - used when Inn unlocked [1000168] = "defaultTalkWithPrudentia_001", -- Prudentia (Limsa Upper Decks: CUL Guild) [1000169] = "defaultTalkWithPulmia_001", -- Pulmia (Limsa Upper Decks: CUL Guild) [1000170] = "defaultTalkWithRsushmo_001", -- R'sushmo (Limsa Upper Decks: CUL Guild) @@ -260,7 +260,11 @@ function onTalk(player, quest, npc, eventName) local clientFunc = defaultTalkSea[npcId]; if (npcId == 1000167) then -- Mytesyn - Inn NPC - defaultTalkWithInn(player, quest, clientFunc); + if (player:IsQuestCompleted(110838)) then -- "The Ink Thief" completed. + defaultTalkWithInn(player, quest, "defaultTalkWithInn_Desk"); + else + callClientFunction(player, "delegateEvent", player, quest, clientFunc); + end else callClientFunction(player, "delegateEvent", player, quest, clientFunc); end diff --git a/Data/scripts/quests/dft/DftWil.lua b/Data/scripts/quests/dft/DftWil.lua index 3375c7d1..9eb2fcdd 100644 --- a/Data/scripts/quests/dft/DftWil.lua +++ b/Data/scripts/quests/dft/DftWil.lua @@ -14,7 +14,6 @@ Contains all default lines for talkable npcs in the Wilderness Region (aka Thana -- [ActorClassId] = "client_function_name" local defaultTalkWil = { - [1000046] = "defaultTalkWithGogofu_001", -- Gogofu [1000047] = "defaultTalkWithHahayo_001", -- Hahayo [1000070] = "defaultTalkWithKukumuko_001", -- Kukumuko @@ -66,7 +65,7 @@ local defaultTalkWil = { [1000861] = "defaultTalkWithLinette_001", -- Linette [1000862] = "defaultTalkWithGagaruna_001", -- Gagaruna [1000863] = "defaultTalkWithLulutsu_001", -- Lulutsu - [1000864] = "defaultTalkWithInn_Desk", -- Otopa Pottopa - defaultTalkWithOtopapottopa_001 (pre-Inn unlock?) + [1000864] = "defaultTalkWithOtopapottopa_001", -- Otopa Pottopa - defaultTalkWithInn_Desk - used when Inn unlocked [1000865] = "defaultTalkWithThaisie_001", -- Thaisie - Mentions retainers, but will not fire since she's not PplStd. [1000887] = "defaultTalkWithZssapa_001", -- <<>> - Z'ssapa (Central Thanalan: Black Brush: 92.779999 183.837 -1030.310059) alt actor ID: 1001217 (used in a quest presumably, different outfit from wiki image) [1000915] = "defaultTalkWithCahernaut_001", -- Cahernaut @@ -98,8 +97,8 @@ local defaultTalkWil = { [1001143] = "defaultTalkWithTotono_001", -- Totono [1001144] = "defaultTalkWithFyrilsunn_001", -- Fyrilsunn [1001145] = "defaultTalkWithSinette_001", -- Sinette - [1001146] = "defaultTalkWithZirnbyrt_001", -- <<>> - Zirnbyrt - Entry Denier Guard (East Thanalan: X:1831.565 Y:248.576 Z:448.872 Educated guess from wiki picture. Guards unused dun01) - [1001147] = "defaultTalkWithVhasotayuun_001", -- <<>> - Vhaso Tayuun - (Entry Denier? No wiki info) + [1001146] = "defaultTalkWithZirnbyrt_001", -- <<>> - Zirnbyrt - Entry Denier (East Thanalan: X:1831.565 Y:248.576 Z:448.872 Educated guess from wiki picture. Guards unused dun01) + [1001147] = "defaultTalkWithVhasotayuun_001", -- <<>> - Vhaso Tayuun - Entry Denier (East Thanalan: X:1818.940 Y:244.810 Z:-76.766 rough guess from vid. Guards unused dun03) [1001148] = "defaultTalkWithPulbeiyalbei_001", -- <<>> - Pulbei Yalbei - (Entry Denier? No wiki info) [1001149] = "defaultTalkWithGembert_001", -- <<>> - Gembert - Entry Denier Guard (South Thanalan: X:1707.143 Y:238.150 Z:1617.570 Rough estimate. Guards unused dun06) [1001165] = "defaultTalkWithMumukiya_001", -- Mumukiya @@ -200,9 +199,9 @@ local defaultTalkWil = { [1001600] = "defaultTalkWithBertouaint_001", -- <<>> - Bertouaint (Eastern Thanalan: Mythril Pit T-8) [1001601] = "defaultTalkWithAldebrand_001", -- <<>> - Aldebrand (Eastern Thanalan: Mythril Pit T-8) [1001602] = "defaultTalkWithPyhajawantal_001", -- <<>> - Pyha Jawantal (Eastern Thanalan: Mythril Pit T-8) - [1001624] = "talkIdayCap", -- <<>> - Flame Lieutenant Somber Meadow (Foundation Day 2011 Dialog) - OLD EVENT NPC: Replaced by 2012 version - [1001625] = "talkIday1", -- <<>> - Flame Sergeant Mimio Mio (Foundation Day 2011 Dialog) - OLD EVENT NPC: Replaced by 2012 version - [1001626] = "talkIday2", -- <<>> - Flame Private Sisimuza Tetemuza (Foundation Day 2011 Dialog) - OLD EVENT NPC: Replaced by 2012 version + --[1001624] = "talkIdayCap", -- <<>> - Flame Lieutenant Somber Meadow (Foundation Day 2011 Dialog) - OLD EVENT NPC: Replaced by 2012 version + --[1001625] = "talkIday1", -- <<>> - Flame Sergeant Mimio Mio (Foundation Day 2011 Dialog) - OLD EVENT NPC: Replaced by 2012 version + --[1001626] = "talkIday2", -- <<>> - Flame Private Sisimuza Tetemuza (Foundation Day 2011 Dialog) - OLD EVENT NPC: Replaced by 2012 version [1001630] = "defaultTalkWithChocobo_001", -- <<>> - Chocobo (Western Thanalan: The Coffer & Coffin) - Stands beside Haipo Eipo [1001685] = "defaultTalkWithAdalbert_001", -- <<>> - Flame Sergeant Cotter (Ul'dah: Merchant Strip: -0.92 196.100 126.32) - Double check caps. [1001699] = "defaultTalkWithJandonaut_001", -- <<>> - Flame Sergeant Fouillel (Southern Thanalan: Camp Broken Water: 1704 296.001 999) @@ -228,8 +227,11 @@ local defaultTalkWil = { [1001925] = "defaultTalkWithHortwann_001", -- <<>> - Flame Private Hanskalsyn - (North Thanalan: Camp Bluefog) [1001932] = "defaultTalkWithSIBOLD_001", -- Sibold [1001953] = "defaultTalkWithBerndan_001", -- Berndan - [1002047] = "defaultTalkWithInn_Desk_2", -- Kopuru Fupuru - Inn NPC. - defaultTalkWithKopuruFupuru_001 (pre-Inn unlock?) + [1002047] = "defaultTalkWithKopuruFupuru_001", -- Kopuru Fupuru - Inn NPC - defaultTalkWithInn_Desk_2 used when Inn unlocked [1002101] = "defaultTalkWithDuraltharal_001", -- Dural Tharal + [1002110] = "processEventSOMBER", -- Flame Lieutenant Somber Meadow (Foundation Day 2012 Dialog) Spl000 staticactor + [1002111] = "processEventMIMIO", -- Flame Sergeant Mimio Mio (Foundation Day 2012 Dialog) Spl000 staticactor + [1002112] = "processEventSISIMUZA", -- Flame Private Sisimuza Tetemuza (Foundation Day 2012 Dialog) Spl000 staticactor [1002116] = "defaultTalkWithHAVAK_ALVAK_001", -- <<>> - Havak Alvak (Ul'dah: Milvaneth Sacrarium) [1060028] = "defaultTalkWithCURIOUS_001", -- <<>> - Curious Gorge (Western Thanalan: -1116.040039, 53.2, 285.48999)? - defaultTalkWithCURIOUS_002 [1060029] = "defaultTalkWithSarra_001", -- <<>> - Sarra (Location unknown) defaultTalkWithSarra_002 / 003 @@ -240,16 +242,15 @@ local defaultTalkWil = { [1060037] = "defaultTalkWithHateli_001", -- <<>> - Dozol Meloc (Western Thanalan: -1513.660034, 10.617, -235.220001) defaultTalkWithHateli_002 / 003 / 004 / 005 / 006 / 007 [1060038] = "defaultTalkWithDaza_001", -- <<>> - 269th Order Mendicant Da Za (Western Thanalan: Somewhere in the cave around -1567, 25, -170) - defaultTalkWithDaza_002 / 003 / 004 / 005 / 006 / 007 [1060042] = "defaultTalkWithJenlyns_001", -- Jenlyns - defaultTalkWithJenlyns_002 (PLD-unlocked specific dialog?) - [1200120] = "bookTalk", -- Dusty Tomes - - Will not fire since it isn't PplStd. Identical dialog regardless. + [1200120] = "bookTalk", -- Dusty Tomes - Will not fire since it isn't PplStd. Identical dialog regardless. [1500059] = "defaultTalkWithLdhakya_001", -- <<>> - L'dhakya (Western Thanalan Ferry Docks) [1500109] = "defaultTalkWithSylviel_001", -- <<>> - Sylviel (Western Thanalan Ferry Docks) [1500110] = "defaultTalkWithSamigamduhla_001", -- <<>> - Sami Gamduhla (Western Thanalan Ferry Docks) [1500126] = "tribeTalk", -- Vavaki [1500129] = "defaultTalkWithYayatoki_001", -- Yayatoki + [1500230] = "defaultTalkCaravanChocoboUld_001", -- Pack Chocobo (needs verifying) [1700039] = "defaultTalkWithBATERICH_100", -- Baterich - [1000001] = "defaultTalkWithHamletGuardUld_001" -- TEST TEST TEST - --[1090549] = "defaultTalkWithInn_ExitDoor" -- Ul'dah Inn Exit Door pushEvent - "Leave your room?" --[1200336] = "defaultTalkWithInn_ExitDoor" -- Ul'dah Inn Exit Door talkEvent - "Leave your room?" @@ -260,23 +261,30 @@ local defaultTalkWil = { [???] = "defaultTalkWithHamletGuardUld_001" -- --]] - -- [1002110] = "processEventSOMBER", arg1, -- Flame Lieutenant Somber Meadow (Foundation Day 2012 Dialog) Spl000 staticactor - -- [1002111] = "processEventMIMIO" -- Flame Sergeant Mimio Mio (Foundation Day 2012 Dialog) Spl000 staticactor - -- [1002112] = "processEventSISIMUZA" -- Flame Private Sisimuza Tetemuza (Foundation Day 2012 Dialog) Spl000 staticactor } - - function onTalk(player, quest, npc, eventName) local npcId = npc:GetActorClassId(); local clientFunc = defaultTalkWil[npcId]; - if (npcId == 1002047) then -- Kopuru Fupuru - Inn NPC - defaultTalkWithInn(player, quest, clientFunc); + if (npcId == 1000864) then -- Otopa Pottopa (Adv. Guild Inn NPC) + if (player:IsQuestCompleted(110848)) then -- "Ring of Deceit" completed. + callClientFunction(player, "delegateEvent", player, quest, "defaultTalkWithInn_Desk"); + else + callClientFunction(player, "delegateEvent", player, quest, clientFunc); + end + elseif (npcId == 1002047) then -- Kopuru Fupuru (Rear-Entrance Inn NPC) + if (player:IsQuestCompleted(110848)) then -- "Ring of Deceit" completed. + defaultTalkWithInn(player, quest, "defaultTalkWithInn_Desk_2"); + else + callClientFunction(player, "delegateEvent", player, quest, clientFunc); + end + elseif ((npcId >= 1002110) and (npcId <= 1002112)) then -- Foundation Day 2012 NPCs + talkWithSpecial(player, npcId, clientFunc) else callClientFunction(player, "delegateEvent", player, quest, clientFunc); end @@ -284,13 +292,13 @@ function onTalk(player, quest, npc, eventName) player:EndEvent(); end + function IsQuestENPC(player, quest, npc) return defaultTalkWil[npc:GetActorClassId()] ~= nil; end - function defaultTalkWithInn(player, quest, clientFunc) local choice = callClientFunction(player, "delegateEvent", player, quest, clientFunc); @@ -304,4 +312,12 @@ function defaultTalkWithInn(player, quest, clientFunc) player:SendGameMessage(GetWorldMaster(), 51140, 0x20); --This inn is already your Secondary Homepoint end end +end + + + +function talkWithSpecial(player, npcId, clientFunc) + local splQuest = GetStaticActor("Spl000"); + local magickedPrism = 0; + callClientFunction(player, "delegateEvent", player, splQuest, clientFunc, magickedPrism); end \ No newline at end of file diff --git a/Data/scripts/quests/etc/etc3g0.lua b/Data/scripts/quests/etc/etc3g0.lua index 8faf63cb..598e6d76 100644 --- a/Data/scripts/quests/etc/etc3g0.lua +++ b/Data/scripts/quests/etc/etc3g0.lua @@ -168,6 +168,7 @@ function getJournalMapMarkerList(player, quest) local sequence = quest:getSequence(); local data = quest:GetData(); local possibleMarkers = {}; + local data = quest:GetData(); if (sequence == SEQ_000) then if (not data:GetFlag(FLAG_TALKED_SYBELL)) then table.insert(possibleMarkers, MRKR_SYBELL); end diff --git a/Data/scripts/quests/etc/etc5g0.lua b/Data/scripts/quests/etc/etc5g0.lua index 5ab4d179..6a289705 100644 --- a/Data/scripts/quests/etc/etc5g0.lua +++ b/Data/scripts/quests/etc/etc5g0.lua @@ -28,8 +28,6 @@ MRKR_PFARAHR = 11082001; MRKR_VKOROLON = 11082002; function onStart(player, quest) - quest:StartSequence(SEQ_000); - player:SendGameMessage(GetWorldMaster(), 25246, MESSAGE_TYPE_SYSTEM, ITEM_WELL_WORN_BAG, 1); end function onFinish(player, quest) @@ -57,6 +55,10 @@ function onTalk(player, quest, npc) local questAccepted = callClientFunction(player, "delegateEvent", player, quest, "processEventVKOROLONStart"); if (questAccepted == 1) then player:AcceptQuest(quest); + quest:StartSequence(SEQ_000); + wait(2); + attentionMessage(player, 25246, ITEM_WELL_WORN_BAG, 1); + end player:EndEvent(); return; diff --git a/Data/scripts/quests/etc/etc5g1.lua b/Data/scripts/quests/etc/etc5g1.lua new file mode 100644 index 00000000..c22af275 --- /dev/null +++ b/Data/scripts/quests/etc/etc5g1.lua @@ -0,0 +1,192 @@ +require("global"); + +--[[ + +Quest Script + +Name: In Plain Sight +Code: Etc5g1 +Id: 110829 +Prereq: Level 15. Etc5u1 (The Usual Suspect) completed. +Notes: + +]] + +-- Sequence Numbers +SEQ_000 = 0; +SEQ_010 = 10; + +-- Actor Class Ids +OTOPA_POTTOPA = 1000864; +VKOROLON = 1000458; +THE_ROOST_BED = 1200379; +NICOLIAUX = 1002071; -- 1000409: Can't use his public area id, otherwise a ! shows on him there also +POWLE = 1000238; +AUNILLIE = 1000410; +GAUWYN_THE_GANNET = 1002065; +HILDIBRAND = 1002067; +NASHU_MHAKARACCA = 1001996; +PRIVATE_AREA_ENTRANCE = 1090086; -- Check that this ID is free to use before merge +PRIVATE_AREA_EXIT = 1290002; + +-- DefaultTalk NPCs? +SANSA = 1000239; +ELYN = 1000411; +RYD = 1000412; + +-- Quest Items +ITEM_WANTED_GAUWYN = 10011243; + +-- Quest Markers +MRKR_ACORN_ORCHARD = 11082101; +MRKR_NICOLIAUX = 11082102; +MRKR_VKOROLON = 11082103; + + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + + +function onStateChange(player, quest, sequence) + + if (sequence == SEQ_ACCEPT) then + local hasQuestItem = player:GetItemPackage(INVENTORY_NORMAL):HasItem(ITEM_WANTED_GAUWYN); + + if (hasQuestItem == false) then + quest:SetENpc(OTOPA_POTTOPA, QFLAG_NORM); + end + quest:SetENpc(THE_ROOST_BED, 5); + quest:SetENpc(VKOROLON, QFLAG_NORM); -- Always shows despite interaction + + elseif (sequence == SEQ_000) then + quest:SetENpc(VKOROLON); + quest:SetENpc(NICOLIAUX, QFLAG_NORM); + quest:SetENpc(POWLE); + quest:SetENpc(AUNILLIE); + quest:SetENpc(GAUWYN_THE_GANNET); + quest:SetENpc(HILDIBRAND); + quest:SetENpc(NASHU_MHAKARACCA); + quest:SetENpc(PRIVATE_AREA_ENTRANCE, QFLAG_MAP, false, true, false, true); + + elseif (sequence == SEQ_010) then + quest:SetENpc(VKOROLON, QFLAG_REWARD); + quest:SetENpc(NICOLIAUX); + quest:SetENpc(POWLE); + quest:SetENpc(AUNILLIE); + quest:SetENpc(GAUWYN_THE_GANNET); + quest:SetENpc(HILDIBRAND); + quest:SetENpc(NASHU_MHAKARACCA); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc:GetActorClassId(); + + if (sequence == SEQ_ACCEPT) then + if (classId == OTOPA_POTTOPA) then + local hasQuestItem = player:GetItemPackage(INVENTORY_NORMAL):HasItem(ITEM_WANTED_GAUWYN); + + if (not hasQuestItem) then + callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart"); + giveWantedItem(player); + npc:SetQuestGraphic(player, QFLAG_NONE); + else + callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart_2"); + end + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 2075); -- Log out in The Roost w/ item. + + elseif (classId == VKOROLON) then + -- This is retail accurate. No dialog functions called. + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 2075); + end + + elseif (sequence >= SEQ_000) then + if (classId == VKOROLON) then + if (sequence == SEQ_010) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_020"); + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 500, 1, 1); + player:CompleteQuest(quest); + -- Log out in Mizzenmast Inn w/ item. + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 1070); + else + callClientFunction(player, "delegateEvent", player, quest, "processEvent_000_1"); -- Educated guess + end + elseif (classId == NICOLIAUX) then + if (sequence == SEQ_010) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1"); -- Educated guess + else + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010"); + attentionMessage(player, 25225, quest.GetQuestId()); -- objectives complete! + quest:UpdateENPCs(); -- Band-aid for a QFLAG_NORM issue + quest:StartSequence(SEQ_010); + end + elseif (classId == POWLE) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_5"); + elseif (classId == AUNILLIE) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_6"); + elseif (classId == GAUWYN_THE_GANNET) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_2"); + elseif (classId == HILDIBRAND) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_3"); + elseif (classId == NASHU_MHAKARACCA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_4"); + + end + end + + player:EndEvent() + quest:UpdateENPCs(); +end + + + +function onPush(player, quest, npc) + local npcClassId = npc.GetActorClassId(); + + player:EndEvent(); + if (npcClassId == PRIVATE_AREA_ENTRANCE) then + GetWorldManager():WarpToPrivateArea(player, "PrivateAreaMasterPast", 5, -33.709, 7.810, -1272.337, -0.810); + end +end + + + + + + +function getJournalInformation(player, quest) +end + + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + + if (sequence == SEQ_000) then + return MRKR_ACORN_ORCHARD; -- TO-DO: Check for private area and use MRKR_NICOLIAUX in place of this + elseif (sequence == SEQ_010) then + return MRKR_VKOROLON; + end +end + + +function giveWantedItem(player) + + local invCheck = player:getItemPackage(INVENTORY_NORMAL):addItem(ITEM_WANTED_GAUWYN, 1, 1); + + if (invCheck == INV_ERROR_FULL) then + -- Your inventory is full. + player:SendGameMessage(player, GetWorldMaster(), 60022, MESSAGE_TYPE_SYSTEM_ERROR); + elseif (invCheck == INV_ERROR_ALREADY_HAS_UNIQUE) then + -- You cannot have more than one in your possession at any given time. + player:SendGameMessage(player, GetWorldMaster(), 40279, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_WANTED_GAUWYN, 1); + elseif (invCheck == INV_ERROR_SYSTEM_ERROR) then + player:SendMessage(MESSAGE_TYPE_SYSTEM, "", "[DEBUG] Server Error on adding item."); + elseif (invCheck == INV_ERROR_SUCCESS) then + player:SendGameMessage(player, GetWorldMaster(), 25246, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_WANTED_GAUWYN, 1); + end +end \ No newline at end of file diff --git a/Data/scripts/quests/etc/etc5l0.lua b/Data/scripts/quests/etc/etc5l0.lua new file mode 100644 index 00000000..a5042f5d --- /dev/null +++ b/Data/scripts/quests/etc/etc5l0.lua @@ -0,0 +1,104 @@ +require("global"); + +--[[ + +Quest Script + +Name: The Ink Thief +Code: Etc5l0 +Id: 110838 +Prereq: Level 1 on any class. Second MSQ completed. (110002 Man0l1 / 110006 Man0g1 / 110010 Man0u1) +Notes: + +]] + +-- Sequence Numbers +SEQ_000 = 0; -- Talk to Sweetnix. +SEQ_001 = 1; -- Return to Mytesyn. + +-- Actor Class Ids +MYTESYN = 1000167; +SWEETNIX = 1001573; + +-- Quest Item +ITEM_INKWELL = 11000223; + +-- Quest Markers +MRKR_SWEETNIX = 11072001; +MRKR_MYTESYN = 11072002; + + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + +function onStateChange(player, quest, sequence) + if (sequence == SEQ_ACCEPT) then + quest:SetENpc(MYTESYN, QFLAG_NORM); + end + + if (sequence == SEQ_000) then + quest:SetENpc(MYTESYN); + quest:SetENpc(SWEETNIX, QFLAG_NORM); + elseif (sequence == SEQ_001) then + quest:SetENpc(MYTESYN, QFLAG_REWARD); + quest:SetENpc(SWEETNIX); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local npcClassId = npc:GetActorClassId(); + + if (sequence == SEQ_ACCEPT) then + local questAccepted = callClientFunction(player, "delegateEvent", player, quest, "processEventMYTESYNStart"); + if (questAccepted == 1) then + player:AcceptQuest(quest); + end + player:EndEvent(); + return; + elseif (sequence == SEQ_000) then + if (npcClassId == MYTESYN) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_000_1"); + elseif (npcClassId == SWEETNIX) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010"); + attentionMessage(player, 25246, ITEM_INKWELL, 1); + attentionMessage(player, 25225, quest:GetQuestId()); + quest:StartSequence(SEQ_001); + end + + elseif (sequence == SEQ_001) then + if (npcClassId == MYTESYN) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_020"); + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 200,1 ,1) + player:CompleteQuest(quest); + elseif (npcClassId == SWEETNIX) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1"); + end + end + player:EndEvent() + quest:UpdateENPCs(); +end + +function getJournalInformation(player, quest) + local sequence = quest:getSequence(); + if (sequence == SEQ_001) then + return ITEM_INKWELL; + end +end + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + + if (sequence == SEQ_000) then + return MRKR_SWEETNIX; + elseif (sequence == SEQ_001) then + return MRKR_MYTESYN; + end +end + + + diff --git a/Data/scripts/quests/etc/etc5l1.lua b/Data/scripts/quests/etc/etc5l1.lua new file mode 100644 index 00000000..207a119c --- /dev/null +++ b/Data/scripts/quests/etc/etc5l1.lua @@ -0,0 +1,166 @@ +require("global"); + +--[[ + +Quest Script + +Name: Private Eyes +Code: Etc5l1 +Id: 110839 +Prereq: Level 15. Man5g1 (In Plain Sight) complete. [110829] +Notes: + +]] + +-- Sequence Numbers +SEQ_000 = 0; -- Talk to Bertrand +SEQ_010 = 10; -- Head to the meeting point. + +-- Actor Class Ids +OTOPA_POTTOPA = 1000864; +MYTESYN = 1000167; +MIZZENMAST_BED = 1200378; +BERTRAND = 1001903; -- 1060004 also a valid ID, but doesn't look like the NPC appeared anywhere else? +ABRAHAM = 1002066; +PRIVATE_AREA_ENTRANCE = 1090087; -- Check that this ID is free to use before merge +PRIVATE_AREA_EXIT = 1290002; +CUTSCENE_PUSH_TRIGGER = 1090088; -- Check that this ID is free to use before merge + +-- Prop Actor Ids (for documentation sake) +BRONZE_CHEST = 1080056; -- bgObj 20923 w/ body 1024 +GLASS_DRINK = 1080057; -- bgObj 20901 w/ body 26624 +RECTANGULAR_BOX = 1080058; -- bgObj 20951 w/ body 1024 + +-- Quest Items +ITEM_WANTED_GAUWYN = 10011243; + +-- Quest Markers +MRKR_CAVE = 11072101; +MRKR_BERTRAND = 11072102; +MRKR_CUTSCENE = 11072103; + + + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + + +function onStateChange(player, quest, sequence) + + if (sequence == SEQ_ACCEPT) then + local hasQuestItem = player:GetItemPackage(INVENTORY_NORMAL):HasItem(ITEM_WANTED_GAUWYN); + local otopaFlag = 0; + + if (hasQuestItem == false) then + otopaFlag = 2; + end + quest:SetENpc(OTOPA_POTTOPA, otopaFlag); + quest:SetENpc(MYTESYN, QFLAG_NORM); -- Assuming this functions the same as it did in Etc5g1 + quest:SetENpc(MIZZENMAST_BED, 5); + + elseif (sequence == SEQ_000) then + quest:SetENpc(MYTESYN); + quest:SetENpc(PRIVATE_AREA_ENTRANCE, QFLAG_MAP, false, true, false, true); + quest:SetENpc(BERTRAND, QFLAG_NORM); + quest:SetENpc(ABRAHAM); + elseif (sequence == SEQ_010) then + quest:SetENpc(CUTSCENE_PUSH_TRIGGER, QFLAG_MAP,false, true, false, true); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc:GetActorClassId(); + + if (sequence == SEQ_ACCEPT) then + -- Am assuming this all functions the same as it did in Etc5g1 + if (classId == OTOPA_POTTOPA) then + local hasQuestItem = player:GetItemPackage(INVENTORY_NORMAL):HasItem(ITEM_WANTED_GAUWYN); + + if (not hasQuestItem) then + callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart"); + giveWantedItem(player); + npc:SetQuestGraphic(player, QFLAG_NONE); + else + callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart_2"); + end + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 1070); -- Log out in Mizzenmast Inn w/ item. + elseif (classId == MYTESYN) then + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 1070); + end + + elseif (sequence == SEQ_000) then + if (classId == MYTESYN) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_000_1"); + elseif (classId == BERTRAND) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010"); + quest:UpdateENPCs(); -- Band-aid for a QFLAG_NORM issue + quest:StartSequence(SEQ_010); + GetWorldManager():WarpToPublicArea(player); + elseif (classId == ABRAHAM) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1"); + end + end + + player:EndEvent() + quest:UpdateENPCs(); +end + + + +function onPush(player, quest, npc) + local classId = npc.GetActorClassId(); + + + if (classId == PRIVATE_AREA_ENTRANCE) then + choice = callClientFunction(player, "delegateEvent", player, quest, "instanceAreaJoinAskInBasaClass"); + if (choice == 1) then + GetWorldManager():WarpToPrivateArea(player, "PrivateAreaMasterPast", 5, -220.948, 16.603, -92.863, -2.090); + end + + elseif (classId == CUTSCENE_PUSH_TRIGGER) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_020"); + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 500, 1, 1); + player:CompleteQuest(quest); + end + player:EndEvent(); +end + + + +function getJournalInformation(player, quest) +end + + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + + if (sequence == SEQ_000) then + return MRKR_CAVE; + -- TO-DO: Check for private area and use MRKR_BERTRAND in place of this + elseif (sequence == SEQ_010) then + return MRKR_CUTSCENE; + end +end + + +function giveWantedItem(player) + + local invCheck = player:getItemPackage(INVENTORY_NORMAL):addItem(ITEM_WANTED_GAUWYN, 1, 1); + + if (invCheck == INV_ERROR_FULL) then + -- Your inventory is full. + player:SendGameMessage(player, GetWorldMaster(), 60022, MESSAGE_TYPE_SYSTEM_ERROR); + elseif (invCheck == INV_ERROR_ALREADY_HAS_UNIQUE) then + -- You cannot have more than one in your possession at any given time. + player:SendGameMessage(player, GetWorldMaster(), 40279, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_WANTED_GAUWYN, 1); + elseif (invCheck == INV_ERROR_SYSTEM_ERROR) then + player:SendMessage(MESSAGE_TYPE_SYSTEM, "", "[DEBUG] Server Error on adding item."); + elseif (invCheck == INV_ERROR_SUCCESS) then + player:SendGameMessage(player, GetWorldMaster(), 25246, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_WANTED_GAUWYN, 1); + end +end \ No newline at end of file diff --git a/Data/scripts/quests/etc/etc5l2.lua b/Data/scripts/quests/etc/etc5l2.lua new file mode 100644 index 00000000..9a645c32 --- /dev/null +++ b/Data/scripts/quests/etc/etc5l2.lua @@ -0,0 +1,140 @@ +require("global"); + +--[[ + +Quest Script + +Name: Mysteries of the Red Moon +Code: Etc5l2 +Id: 110840 +Prereq: Level 20. Man5l1 (Private Eyes) complete. [110839] +Notes: + +]] + +-- Sequence Numbers +SEQ_000 = 0; -- Investigate the room. +SEQ_005 = 5; -- Head to the Arrzaneth Ossuary + +-- Actor Class Ids +KOPURU_FUPURU = 1002047; +BOOK = 1200412; +INN_EXIT = 1090089; +CUTSCENE_PUSH_TRIGGER = 1090253; -- Already had from capture + +-- Quest Markers +MRKR_KOPURU_FUPURU = 11072201; +MRKR_BOOK = 11072202; +MRKR_CUTSCENE = 11072203; + +-- Quest Item +ITEM_HIDLIBRAND_DOSSIER = 10011252; + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + + +function onStateChange(player, quest, sequence) + + if (sequence == SEQ_ACCEPT) then + quest:SetENpc(KOPURU_FUPURU, QFLAG_NORM); + elseif (sequence == SEQ_000) then + quest:SetENpc(KOPURU_FUPURU, QFLAG_NORM); + quest:SetENpc(BOOK, QFLAG_NORM); + quest:SetENpc(INN_EXIT, QFLAG_MAP, false, true, false, true); + elseif (sequence == SEQ_005) then + quest:SetENpc(BOOK); + quest:SetENpc(KOPURU_FUPURU); + quest:SetENpc(INN_EXIT, QFLAG_MAP, false, true, false, true); + quest:SetENpc(CUTSCENE_PUSH_TRIGGER, QFLAG_MAP,false, true, false, true); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc:GetActorClassId(); + + -- Offer the quest + if (classId == KOPURU_FUPURU and sequence == SEQ_ACCEPT) then + local questAccepted = callClientFunction(player, "delegateEvent", player, quest, "processEventStart"); + if (questAccepted == 1) then + player:AcceptQuest(quest); + end + player:EndEvent(); + return; + -- Quest Progress + elseif (sequence == SEQ_000) then + if (classId == KOPURU_FUPURU) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent000_KOPURU"); + GetWorldManager():DoZoneChange(player, 181, "PrivateAreaMasterPast", 5, 15, 0,0,0, player.rotation); + elseif (classId == BOOK) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent000"); + quest:UpdateENPCs(); -- Band-aid for a QFLAG_NORM issue + quest:StartSequence(SEQ_005); + end + elseif (sequence == SEQ_005) then + if (classId == KOPURU_FUPURU) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent000_KOPURU"); + GetWorldManager():DoZoneChange(player, 181, "PrivateAreaMasterPast", 5, 15, 0,0,0, player.rotation); + elseif (classId == BOOK) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent000_BOOK"); + end + end + + player:EndEvent() + quest:UpdateENPCs(); +end + + + +function onPush(player, quest, npc) + local classId = npc.GetActorClassId(); + + + if (classId == INN_EXIT) then + choice = callClientFunction(player, "delegateEvent", player, quest, "processEventExit"); + if (choice == 1) then + player:EndEvent(); + GetWorldManager():DoZoneChange(player, 209, "", 0, 15, -104.296, 203, 162.257, -0.4); + end + -- Quest Complete + elseif (classId == CUTSCENE_PUSH_TRIGGER) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent005_NQ"); + --TO-DO: Get the scaled EXP for this sqrwa figured out + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 1000, 1, 1, 9); + + player:SendGameMessage(player, GetWorldMaster(), 51149, MESSAGE_TYPE_SYSTEM, ITEM_HIDLIBRAND_DOSSIER); + local itemCheck = giveWantedItem(player); + if (itemCheck == true) then + player:CompleteQuest(quest); + end + end + player:EndEvent(); +end + + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + + if (sequence == SEQ_000) then + return MRKR_KOPURU_FUPURU; + -- TO-DO: Check for private area and use MRKR_BOOK in place of this + elseif (sequence == SEQ_005) then + return MRKR_CUTSCENE; + end +end + + +function giveWantedItem(player) + + local invCheck = player:getItemPackage(INVENTORY_NORMAL):addItem(ITEM_HIDLIBRAND_DOSSIER, 1, 1); + + if (invCheck == INV_ERROR_SUCCESS) then + player:SendGameMessage(player, GetWorldMaster(), 25246, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_HIDLIBRAND_DOSSIER, 1); + return true; + end +end \ No newline at end of file diff --git a/Data/scripts/quests/etc/etc5l3.lua b/Data/scripts/quests/etc/etc5l3.lua new file mode 100644 index 00000000..5b97c0b1 --- /dev/null +++ b/Data/scripts/quests/etc/etc5l3.lua @@ -0,0 +1,253 @@ +require("global"); + +--[[ + +Quest Script + +Name: Prophecy Inspection +Code: Etc5l3 +Id: 110841 +Prereq: Level 20. Man5l2 (Mysteries of the Red Moon) complete. [110840] +Notes: + +]] + +-- Sequence Numbers +SEQ_000 = 0; -- Head to the Coffer & Coffin +SEQ_005 = 5; -- Help out Alret +SEQ_010 = 10; -- Talk to Alret + +-- Actor Class Ids +KOPURU_FUPURU = 1002047; +VKOROLON = 1000458; +MYTESYN = 1000167; +COFFER_AND_COFFIN_PUSH = 1090090; +BED_LIMSA = 1200378; +BED_GRIDANIA = 1200379; +BED_ULDAH = 1200380; + +HILDIBRAND = 1001995; +NASHU_MHAKARACCA = 1001996; +ALRET = 1002114; +BOMB_BANE_1 = 1080090; +BOMB_BANE_2 = 1080091; +BOMB_BANE_3 = 1080092; +BOMB_BANE_4 = 1080093; +BOMB_BANE_5 = 1080094; + +-- Quest Markers +MRKR_COFFIN = 11072204; +MRKR_BANE_1 = 11072205; +MRKR_BANE_2 = 11072206; +MRKR_BANE_3 = 11072207; +MRKR_BANE_4 = 11072208; +MRKR_BANE_5 = 11072209; +MRKR_ALRET = 11072210; + +-- Quest Flags +FLAG_SEQ005_BANE_1 = 0; +FLAG_SEQ005_BANE_2 = 1; +FLAG_SEQ005_BANE_3 = 2; +FLAG_SEQ005_BANE_4 = 3; +FLAG_SEQ005_BANE_5 = 4; + +-- Quest Counter +COUNTER_BANE = 0; + +-- Quest Item +ITEM_HIDLIBRAND_DOSSIER = 10011252; +ITEM_BOMB_BANE = 11000230; + + + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + + +function onStateChange(player, quest, sequence) + local data = quest:GetData(); + + -- Quest not accepted: Set up actors to let you retrieve the item & initiate the log-in check at the Inn + if (sequence == SEQ_ACCEPT) then + quest:SetENpc(KOPURU_FUPURU, QFLAG_NORM); + quest:SetENpc(VKOROLON, QFLAG_NORM); + quest:SetENpc(MYTESYN, QFLAG_NORM); + quest:SetENpc(BED_ULDAH, 5); + quest:SetENpc(BED_GRIDANIA, 5); + quest:SetENpc(BED_LIMSA, 5); + -- Quest started + elseif (sequence == SEQ_000) then + quest:SetENpc(COFFER_AND_COFFIN_PUSH, QFLAG_MAP, false, true, false, true); + elseif (sequence == SEQ_005) then + local bane1Flag = data:GetFlag(FLAG_SEQ005_BANE_1) and QFLAG_NONE or QFLAG_PLATE; + local bane2Flag = data:GetFlag(FLAG_SEQ005_BANE_2) and QFLAG_NONE or QFLAG_PLATE; + local bane3Flag = data:GetFlag(FLAG_SEQ005_BANE_3) and QFLAG_NONE or QFLAG_PLATE; + local bane4Flag = data:GetFlag(FLAG_SEQ005_BANE_4) and QFLAG_NONE or QFLAG_PLATE; + local bane5Flag = data:GetFlag(FLAG_SEQ005_BANE_5) and QFLAG_NONE or QFLAG_PLATE; + + quest:SetENpc(COFFER_AND_COFFIN_PUSH, QFLAG_MAP, false, true, false, true); + quest:SetENpc(HILDIBRAND); + quest:SetENpc(NASHU_MHAKARACCA); + quest:SetENpc(ALRET); + quest:SetENpc(BOMB_BANE_1, bane1Flag); + quest:SetENpc(BOMB_BANE_2, bane2Flag); + quest:SetENpc(BOMB_BANE_3, bane3Flag); + quest:SetENpc(BOMB_BANE_4, bane4Flag); + quest:SetENpc(BOMB_BANE_5, bane5Flag); + -- Quest finished + elseif (sequence == SEQ_010) then + quest:SetENpc(HILDIBRAND); + quest:SetENpc(NASHU_MHAKARACCA); + quest:SetENpc(ALRET, QFLAG_REWARD); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc:GetActorClassId(); + + if (sequence == SEQ_ACCEPT) then + if (classId == KOPURU_FUPURU) then + callClientFunction(player, "delegateEvent", player, quest, "processEventKOPURUStart"); + elseif (classId == VKOROLON) then + callClientFunction(player, "delegateEvent", player, quest, "processEventKOROLONStart"); + elseif (classId == MYTESYN) then + callClientFunction(player, "delegateEvent", player, quest, "processEventMYTESYNStart"); + end + giveDossierItem(player); + player:SendGameMessage(player, GetWorldMaster(), 51149, MESSAGE_TYPE_SYSTEM, ITEM_HIDLIBRAND_DOSSIER); + + elseif (sequence == SEQ_005) then + local data = quest:GetData(); + local incCounter = false; + + if (classId == HILDIBRAND) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005_1"); + elseif (classId == NASHU_MHAKARACCA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005_2"); + elseif (classId == ALRET) then + if (sequence == SEQ_005) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005_3"); + end + elseif (classId == BOMB_BANE_1) then + if not (data:GetFlag(FLAG_SEQ005_BANE_1)) then + incCounter = true; + data:SetFlag(FLAG_SEQ005_BANE_1); + end + elseif (classId == BOMB_BANE_2) then + if not (data:GetFlag(FLAG_SEQ005_BANE_2)) then + incCounter = true; + data:SetFlag(FLAG_SEQ005_BANE_2); + end + elseif (classId == BOMB_BANE_3) then + if not (data:GetFlag(FLAG_SEQ005_BANE_3)) then + incCounter = true; + data:SetFlag(FLAG_SEQ005_BANE_3); + end + elseif (classId == BOMB_BANE_4) then + if not (data:GetFlag(FLAG_SEQ005_BANE_4)) then + incCounter = true; + data:SetFlag(FLAG_SEQ005_BANE_4); + end + elseif (classId == BOMB_BANE_5) then + if not (data:GetFlag(FLAG_SEQ005_BANE_5)) then + incCounter = true; + data:SetFlag(FLAG_SEQ005_BANE_5); + end + end + + if (incCounter == true) then + counterAmount = data:IncCounter(COUNTER_BANE); + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005_4", counterAmount, 5); + wait(1); + + if (counterAmount >= 5) then + attentionMessage(player, 25225, quest:GetQuestId()); -- "Seeing the Seers" objectives complete! + quest:GetData():ClearData(); + quest:UpdateENPCs(); -- Band-aid for a QFLAG_PLATE issue + quest:StartSequence(SEQ_010); + end + end + + elseif (sequence == SEQ_010) then + if (classId == HILDIBRAND) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005_1"); + elseif (classId == NASHU_MHAKARACCA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005_2"); + elseif (classId == ALRET) then -- Finish the quest + callClientFunction(player, "delegateEvent", player, quest, "processEvent_020"); + --TO-DO: Get the scaled EXP for this sqrwa figured out + --TO-DO: Also confirm reward was issued before flagging quest as complete + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 1000, 1, 1, 9); + GetWorldManager():WarpToPublicArea(player); + player:CompleteQuest(quest); + end + end + + player:EndEvent() + quest:UpdateENPCs(); +end + + + +function onPush(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc.GetActorClassId(); + + if (classId == COFFER_AND_COFFIN_PUSH) then + if (sequence == SEQ_000) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_005"); + player:EndEvent(); + attentionMessage(player, 25246, ITEM_BOMB_BANE, 1); + quest:StartSequence(SEQ_005); + end + + GetWorldManager():WarpToPrivateArea(player, "PrivateAreaMasterPast", 5, -1732.891, 56.119, -307.285, -2.785); + actor = player.CurrentArea:FindActorInZoneByUniqueID("etc5l3_nashu"); + actor:ChangeState(ACTORSTATE_SITTING_ONFLOOR); -- Band-aid to get her sitting. + end + player:EndEvent(); +end + +function getJournalInformation(player, quest) + -- Bugged on the client's end and never shows? + return 0, ITEM_BOMB_BANE; +end + + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + local data = quest:GetData(); + local possibleMarkers = {}; + + if (sequence == SEQ_000) then + return MRKR_COFFIN; + + elseif (sequence == SEQ_005) then + local data = quest:GetData(); + if (not data:GetFlag(FLAG_SEQ005_BANE_1)) then table.insert(possibleMarkers, MRKR_BANE_1); end + if (not data:GetFlag(FLAG_SEQ005_BANE_2)) then table.insert(possibleMarkers, MRKR_BANE_2); end + if (not data:GetFlag(FLAG_SEQ005_BANE_3)) then table.insert(possibleMarkers, MRKR_BANE_3); end + if (not data:GetFlag(FLAG_SEQ005_BANE_4)) then table.insert(possibleMarkers, MRKR_BANE_4); end + if (not data:GetFlag(FLAG_SEQ005_BANE_5)) then table.insert(possibleMarkers, MRKR_BANE_5); end + return unpack(possibleMarkers) + + elseif (sequence == SEQ_010) then + return MRKR_ALRET; + end +end + + +function giveDossierItem(player) + + local invCheck = player:getItemPackage(INVENTORY_NORMAL):addItem(ITEM_HIDLIBRAND_DOSSIER, 1, 1); + + if (invCheck == INV_ERROR_SUCCESS) then + player:SendGameMessage(player, GetWorldMaster(), 25246, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_HIDLIBRAND_DOSSIER, 1); + return true; + end +end \ No newline at end of file diff --git a/Data/scripts/quests/etc/etc5u0.lua b/Data/scripts/quests/etc/etc5u0.lua new file mode 100644 index 00000000..60433e57 --- /dev/null +++ b/Data/scripts/quests/etc/etc5u0.lua @@ -0,0 +1,98 @@ +require("global"); + +--[[ + +Quest Script + +Name: Ring of Deceit +Code: Etc5u0 +Id: 110848 +Prereq: Level 1 on any class. Second MSQ completed. (110002 Man0l1 / 110006 Man0g1 / 110010 Man0u1) +Notes: Unlocks Ul'dah Inn exit from the rear entrance. Rewards 200 EXP + +]] + +-- Sequence Numbers +SEQ_000 = 0; -- Talk to Judithe +SEQ_001 = 1; -- Return to Otopa Pottopa + +-- Actor Class Ids +OTOPA_POTTOPA = 1000864; +JUDITHE = 1001443; + +-- Quest Markers +MRKR_JUDITHE = 11092001; +MRKR_OTOPA_POTTOPA = 11092002; + + + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + + +function onStateChange(player, quest, sequence) + if (sequence == SEQ_ACCEPT) then + quest:SetENpc(OTOPA_POTTOPA, QFLAG_NORM); + elseif (sequence == SEQ_000) then + quest:SetENpc(OTOPA_POTTOPA); + quest:SetENpc(JUDITHE, QFLAG_NORM); + elseif (sequence == SEQ_001) then + quest:SetENpc(OTOPA_POTTOPA, QFLAG_REWARD); + quest:SetENpc(JUDITHE); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc:GetActorClassId(); + + if (sequence == SEQ_ACCEPT) then + if (classId == OTOPA_POTTOPA) then + local questAccepted = callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart"); + + if (questAccepted == 1) then + player:AcceptQuest(quest); + end + end + elseif (sequence == SEQ_000) then + if (classId == OTOPA_POTTOPA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_000_1"); + elseif (classId == JUDITHE) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010"); + attentionMessage(player, 25225, 110848); -- objectives complete! + quest:StartSequence(SEQ_001); + end + elseif (sequence == SEQ_001) then + if (classId == JUDITHE) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1"); + elseif (classId == OTOPA_POTTOPA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_020"); + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 200, 1, 1); -- 200 exp rewarded + player:CompleteQuest(quest); + end + end + player:EndEvent() + quest:UpdateENPCs(); +end + + +function getJournalInformation(player, quest) +end + + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + local possibleMarkers = {}; + + if (sequence == SEQ_000) then + table.insert(possibleMarkers, MRKR_JUDITHE); + elseif (sequence == SEQ_001) then + table.insert(possibleMarkers, MRKR_OTOPA_POTTOPA); + end + + return unpack(possibleMarkers) +end diff --git a/Data/scripts/quests/etc/etc5u1.lua b/Data/scripts/quests/etc/etc5u1.lua new file mode 100644 index 00000000..d89bb28d --- /dev/null +++ b/Data/scripts/quests/etc/etc5u1.lua @@ -0,0 +1,174 @@ +require("global"); + +--[[ + +Quest Script + +Name: The Usual Suspect +Code: Etc5u1 +Id: 110849 +Prereq: Level 15. [110828 Etc5g0 / 110838 Etc5l0 / 110848 Etc5u0] +Notes: Rewards 500 exp + +]] + +-- Sequence Numbers +SEQ_000 = 0; +SEQ_010 = 10; + +-- Actor Class Ids +OTOPA_POTTOPA = 1000864; +HOURGLASS_BED = 1200380; +GAUWYN_THE_GANNET = 1002065; +HILDIBRAND = 1001995; +NASHU_MHAKARACCA = 1001996; +PRIVATE_AREA_ENTRANCE = 1090085; +PRIVATE_AREA_EXIT = 1290002; + +-- DefaultTalk NPCs? +UBOKHN = 1000668; +VANNES = 1001464; +XDHILOGO = 1001466; +DARIUSTEL = 1001467; +GUENCEN = 1001468; + +-- Quest Items +ITEM_WANTED_GAUWYN = 10011243; + +-- Quest Markers +MRKR_COLISEUM = 11092101; +MRKR_GAUWYN = 11092102; +MRKR_OTOPA_POTTOPA = 11092103; + + + +function onStart(player, quest) + quest:StartSequence(SEQ_000); +end + +function onFinish(player, quest) +end + + +function onStateChange(player, quest, sequence) + if (sequence == SEQ_ACCEPT) then + local hasQuestItem = player:GetItemPackage(INVENTORY_NORMAL):HasItem(ITEM_WANTED_GAUWYN); + + if (hasQuestItem == false) then + quest:SetENpc(OTOPA_POTTOPA, QFLAG_NORM); + end + quest:SetENpc(HOURGLASS_BED, 5); + end + + if (sequence == SEQ_000) then + quest:SetENpc(OTOPA_POTTOPA); + quest:SetENpc(GAUWYN_THE_GANNET, QFLAG_NORM); + quest:SetENpc(HILDIBRAND); + quest:SetENpc(NASHU_MHAKARACCA); + + --flagType, isTalkEnabled, isPushEnabled, isEmoteEnabled, isSpawned + quest:SetENpc(PRIVATE_AREA_ENTRANCE, QFLAG_MAP, false, true, false, true); + elseif (sequence == SEQ_010) then + quest:SetENpc(OTOPA_POTTOPA, QFLAG_REWARD); + quest:SetENpc(GAUWYN_THE_GANNET); + quest:SetENpc(HILDIBRAND); + quest:SetENpc(NASHU_MHAKARACCA); + end +end + +function onTalk(player, quest, npc) + local sequence = quest:getSequence(); + local classId = npc:GetActorClassId(); + + if (sequence == SEQ_ACCEPT) then + if (classId == OTOPA_POTTOPA) then + local hasQuestItem = player:GetItemPackage(INVENTORY_NORMAL):HasItem(ITEM_WANTED_GAUWYN); + + if (not hasQuestItem) then + callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart"); + giveWantedItem(player); + npc:SetQuestGraphic(player, QFLAG_NONE); + else + callClientFunction(player, "delegateEvent", player, quest, "processEventOTOPAPOTTOPAStart_2"); + end + + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 3071); + end + + elseif (sequence == SEQ_000) then + if (classId == OTOPA_POTTOPA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_000_1"); + elseif (classId == GAUWYN_THE_GANNET) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010"); + attentionMessage(player, 25225, quest.GetQuestId()); -- objectives complete! + quest:UpdateENPCs(); -- Band-aid for a QFLAG_NORM issue + quest:StartSequence(SEQ_010); + elseif (classId == HILDIBRAND) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1"); + elseif (classId == NASHU_MHAKARACCA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_2"); + end + + elseif (sequence == SEQ_010) then + if (classId == HILDIBRAND) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_1"); + elseif (classId == NASHU_MHAKARACCA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_2"); + elseif (classId == GAUWYN_THE_GANNET) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_010_3"); + elseif (classId == OTOPA_POTTOPA) then + callClientFunction(player, "delegateEvent", player, quest, "processEvent_020"); + callClientFunction(player, "delegateEvent", player, quest, "sqrwa", 500, 1, 1); + player:CompleteQuest(quest); + player:SendGameMessage(player, GetWorldMaster(), 51148, MESSAGE_TYPE_SYSTEM, 10011243, 2075); -- Log out in The Roost w/ item. + end + end + + player:EndEvent() + quest:UpdateENPCs(); +end + + +function onPush(player, quest, npc) + local npcClassId = npc.GetActorClassId(); + + player:EndEvent(); + if (npcClassId == PRIVATE_AREA_ENTRANCE) then + --TO-DO: Fill in the # below for the privateArea when it's made + GetWorldManager():WarpToPrivateArea(player, "PrivateAreaMasterPast", 5, -206.712, 195.148, 151.064, 1.821); + end +end + + + +function getJournalInformation(player, quest) +end + + +function getJournalMapMarkerList(player, quest) + local sequence = quest:getSequence(); + + if (sequence == SEQ_000) then + return MRKR_COLISEUM -- TO-DO: Add a check for that specific private area and have it return MRKR_GAUWYN? + elseif (sequence == SEQ_010) then + return MRKR_OTOPA_POTTOPA + end +end + + +function giveWantedItem(player) + + local invCheck = player:getItemPackage(INVENTORY_NORMAL):addItem(ITEM_WANTED_GAUWYN, 1, 1); + + if (invCheck == INV_ERROR_FULL) then + -- Your inventory is full. + player:SendGameMessage(player, GetWorldMaster(), 60022, MESSAGE_TYPE_SYSTEM_ERROR); + elseif (invCheck == INV_ERROR_ALREADY_HAS_UNIQUE) then + -- You cannot have more than one in your possession at any given time. + player:SendGameMessage(player, GetWorldMaster(), 40279, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_WANTED_GAUWYN, 1); + elseif (invCheck == INV_ERROR_SYSTEM_ERROR) then + player:SendMessage(MESSAGE_TYPE_SYSTEM, "", "[DEBUG] Server Error on adding item."); + elseif (invCheck == INV_ERROR_SUCCESS) then + player:SendGameMessage(player, GetWorldMaster(), 25246, MESSAGE_TYPE_SYSTEM_ERROR, ITEM_WANTED_GAUWYN, 1); + end +end \ No newline at end of file diff --git a/Map Server/Actors/Chara/Player/Player.cs b/Map Server/Actors/Chara/Player/Player.cs index ed318610..f788c5ec 100644 --- a/Map Server/Actors/Chara/Player/Player.cs +++ b/Map Server/Actors/Chara/Player/Player.cs @@ -603,7 +603,7 @@ namespace Meteor.Map.Actors public void SendZoneInPackets(WorldManager world, ushort spawnType) { QueuePacket(SetActorIsZoningPacket.BuildPacket(Id, false)); - QueuePacket(SetDalamudPacket.BuildPacket(Id, 0)); + QueuePacket(SetDalamudPacket.BuildPacket(Id, 7)); //Music Packets if (currentMainState == SetActorStatePacket.MAIN_STATE_MOUNTED)