1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-25 22:27:45 +00:00

Updated Scripts, removed all the old unique ones for the opening quest.

This commit is contained in:
Filip Maj 2022-01-25 22:54:44 -05:00
parent 2279ee7017
commit 958a87edf2
31 changed files with 985 additions and 792 deletions

View file

@ -1,19 +1,108 @@
--[[
TaskBoard
Operates the Task Board actor located in each of the Adventurers' Guilds.
Calls from the Noc000 static actor, which also applies to specific guild NPCs involved in that as well.
Functions: (only including those from Noc000 which apply to the Task Board)
pETaskBoardAskLimsa()
Desc: Show guild menu with valid options for Limsa Lominsa.
Params: None
Returns: Value dictating which item on the list was selected.
pETaskBoardAskUldah()
Desc: Show guild menu with valid options for Ul'dah.
Params: None
Returns: Value dictating which item on the list was selected.
pETaskBoardAskGridania()
Desc: Show guild menu with valid options for Gridania.
Params: None
Returns: Value dictating which item on the list was selected.
pETaskBoardGuild(guildId)
Desc: Plays back a message "The following tasks are available:".
Params: * guildId - Class Id from xtx_text_jobName. EN doesn't make use of it, but JP/DE/FR do. Thanks Koji.
pETaskBoardOrder(recommendedLvl itemId, hq, amount)
Desc: Takes the params and tells the player what the guild still needs turned in.
Params: * recommendedLvl - Recommended level the player be at
* itemId - Id of the item from xtx_itemName
* hq - Quality of item (1 = NQ, 2 = +1, 3 = +2 4 = +3)
* amount - Amount needed (The amount the player needs to turn-in, not the amount guild needs overall)
--]]
require ("global") require ("global")
local guildItem = {
-- [guildId] = { (recommendedLvl itemId, hq, amount, 2nd-recommendedLvl 2nd-itemId, 2nd-hq, 2nd-amount) }
[29] = {1, 4100604, 1, 1, 10, 4030706, 1, 1}, -- Carpenters'
[30] = {1, 4040004, 1, 1, 10, 4030004, 1, 1}, -- Blacksmiths'
[31] = {1, 6080009, 1, 1, 10, 8070606, 1, 1}, -- Armorers'
[32] = {1, 5020007, 1, 1, 10,10004103, 1, 1}, -- Goldsmiths'
[33] = {1, 4020107, 1, 1, 10, 8031514, 1, 1}, -- Leatherworkers'
[34] = {1, 8030819, 1, 1, 10, 8030821, 1, 1}, -- Weavers'
[35] = {1, 3011530, 1,12, 10, 3020527, 1, 4}, -- Alchemists'
[36] = {1, 3010103, 1, 6, 10, 3011503, 1, 6}, -- Culinarians'
[39] = {1,10009101, 1,10, 10,10001116, 1,10}, -- Miners'
[40] = {1,10005403, 1,10, 10,10008106, 1,10}, -- Botanists'
[41] = {1, 3011106, 1,10, 10, 3011113, 1,10} -- Fishermans'
}
local menuToGuild = { -- Get a guild id from a given task board's Return result
[1] = {0, 30, 31, 36, 41}, -- Limsa
[2] = {0, 29, 33, 40, 0}, -- Gridania
[3] = {0, 32, 34, 35, 39} -- Ul'dah
}
function init(npc) function init(npc)
return false, false, 0, 0; return false, false, 0, 0;
end end
function onEventStarted(player, npc, triggerName) function onEventStarted(player, npc, triggerName)
questNOC = GetStaticActor("Noc000");
local questNOC = GetStaticActor("Noc000");
local npcId = npc:GetActorClassId();
while (true) do
local guildId = 0;
if (npc:GetActorClassId() == 1200193) then if (npcId == 1200193) then -- Limsa
callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskLimsa", nil, nil, nil); local choice = callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskLimsa");
elseif (npc:GetActorClassId() == 1200194) then
callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskUldah", nil, nil, nil); if (choice == 1 or choice == nil) then
else break; -- Exited menu
callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskGridania", nil, nil, nil); else
end guildId = menuToGuild[1][choice];
end
player:EndEvent(); elseif (npcId == 1200194) then -- Ul'dah
end local choice = callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskUldah");
if (choice == 1 or choice == nil) then
break; -- Exited menu
else
guildId = menuToGuild[3][choice];
end
else -- Gridania
local choice = callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardAskGridania");
if (choice == 1 or choice == nil) then
break; -- Exited menu
else
guildId = menuToGuild[2][choice];
end
end
if (guildId > 0) then
callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardGuild", guildId);
local gItem = guildItem[guildId]
callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardOrder", unpack(gItem, 1, 4));
callClientFunction(player, "delegateEvent", player, questNOC, "pETaskBoardOrder", unpack(gItem, 5, 8));
end
end
player:EndEvent();
end

View file

@ -1,38 +1,381 @@
--[[ --[[
PopulacePassiveGLPublisher Script PopulacePassiveGLPublisher
Operates the Local Levequest selection menus.
Functions: Functions:
askOfferPack() - Show Classes askOfferPack(player)
askOfferRank() - Show Ranks Desc: Show class selection menu.
askOfferQuest(player) Params: * player - The player actor.
confirmOffer(nil, questId) Returns: Value dictating which item on the list was selected (1-8 for class, nil if exited/canceled)
confirmMaxOffer()
talkOfferWelcome(actor, leveAllowances) askOfferRank(player)
Desc: Show Level selection menu.
Params: * player - The player actor.
Returns: Value dictating which item on the list was selected (1 = Lv01, 2 = Lv20, 3 = Lv40, nil if exited/canceled)
askOfferQuest(player, ?, questId1, questId2, questId3, questId4, questId5, questId6, questId7, questId8)
Desc: Show Leve quest selection menu with up to 8 questId entries
Params: * player - The player actor.
* ? - Unused param. Capture has a 2.
* questId 1-8 - The local levequests available up to 8 quests.
Returns: 1 through 8 for an accepted leve in the order sent, -1 for hitting "Return", and Nil for "Cancel"
confirmOffer(player, questId)
Desc: Opens prompt asking whether to activate the leve and begin it.
Params: * player - The player actor.
* questId - The quest being confirmed.
Returns: Boolean - True on Yes, false on No or hitting escape.
confirmMaxOffer(player)
Desc: Opens ask widget stating you'll be capped on leves after accepting.
Params: * player - The player actor. Unused.
Returns: Boolean - True on Accept, false on "Quit" or hitting escape.
talkOfferWelcome(player, numAllowance)
Desc: NPC intro dialog as well as stating your available leve allowances.
Params: * player - The player actor.
* numAllowance - The number of leve allowances the player still has.
talkOfferDecide() talkOfferDecide()
Desc: Makes the NPC say dialog following the acceptance of a leve.
Params: None
talkOfferMaxOver() talkOfferMaxOver()
selectDiscardGuildleve(player) Desc: Makes the NPC say dialog stating the player is carrying too many leves currently.
confirmJournal() Params: None
askDiscardGuildleve()
confirmDiscardGuildleve(nil, questId)
askRetryRegionalleve(questId, leveAllowances)
finishTalkTurn() finishTalkTurn()
Desc: Ends the npc actor's turn towards you. Call this at the end of the script or the
npc will be stuck "facing" the player.
Params: None
selectDiscardGuildleve()
Desc: Opens the Journal widget to select a leve to discard. This is a follow-up to askDiscardGuildleve().
Params: None
Returns: Quest Actor
confirmJournal(questId, difficulty, unused, itemsCompleted, remainingMats, hasMaterials, unused)
Desc: Opens askJournalDetailWidget displaying current status of the leve.
Params: * questId - The current quest being confirmed.
* difficulty - The difficulty of the quest.
* unused - Unused param.
* itemsComplete - Sets the number of items crafted.
* remainingMats - Sets the remaining materials.
* hasMaterials - If set to 1, shows the progress section.
* unused - While loaded into widget, it doesn't do anything with this journalType (13).
Returns: True on "Exchange", Nil on "Return" or hitting Escape key
askDiscardGuildleve()
Desc: Opens an ask widget, stating the player cannot accept any more guildleves and if they'd want to return one to make room.
Params: None
Returns: Boolean
confirmDiscardGuildleve(?, questId, guildleveId)
Desc: Opens an ask widget, confirming the returning of the selected guildleve.
Params: * ? - Most likely a player actor, but unused.
* questId - The dialog is "Returning <quest>. Are you certain?". This is the questId being returned.
* guildleveId - This is mostly unused, Japanese localization has a weird switch to use this. Can be nil.
Returns: Boolean
askRetryRegionalleve(questId, numAllowance)
Desc: Opens an ask widget to re-attempt leve questId while showing leveAllowances. If no is selected, a second widget appears to confirm abandoning it.
Params: * questId - The questId being retried.
* numAllowance - The number of leve allowances the player still has.
Returns: Menu1 - Is 1 if yes is selected, 2 if no. Nil if Escape is hit (resend function in this case?)
Menu2 - Is 1 if yes is selected (leve abandoned), 2 if no. Nil if Menu1 isn't set to 2
Notes:
50141 - You have <num> leve allowances remaining.
50142 - You have run out of leve allowances. You cannot accept any more levequests at this time.
50143 - You cannot accept any more levequests at this time.
Local Leves:
~~Limsa~~
CRP: Baderon's New Counter (120007)
The Mad Fisher (120017)
Building Bridges (120039)
High Stakes (120047)
Training and Trees (120061)
BSM: Baderon's New Sword (120005)
Got Ingots (120013)
Ship Shape (120014)
A Want of Weapons (120015)
Skull Valley Delivery (120035)
Fruit's of a Vintner's Whinings (120043)
Premiums Paid (120051)
Training and Trading (120059)
Waiting on Weapons (120067)
ARM: Baderon's New Barbuts (120009)
Seeing Sallets to the See (120019)
A Step Ahead (120020)
Mailed Sailors (120021)
Running Rings (120036)
Watching the Shore (120044)
Watching the Knoll (120052)
Rings Around the Rock (120063)
Dead Ringers (120068)
GSM: Baderon's New Bands (120010)
2 x 2 Eyes (120022)
Going Brandanas (120041)
Brand New Brands (120049)
Staves to Fashion (120064)
LTW: Baderon's New Shoes (120008)
The Mad Tanner (120018)
Under Foot (120040)
Shoeing the Shore (120048)
Training and Tanning (120062)
WVR: Baderon's New Clothes (120006)
The Mad Hatter (120016)
Wear and Tear (120038)
Outfitting the Shore (120046)
Training and Tailoring (120060)
ALC: Baderon's New Soles (120011)
A Sticky Situation (120023)
Feeding Trainees (120042)
Suffering Soldiers (120050)
Training and Eating (120065)
CUL: Baderon's New Breakfast (120012)
Tall, Cool One (120024)
The Captain's Cravings (120025)
A Feast Fit for an Admiral (120026)
Supper at the Skull (120037)
The Last Supper (120045)
A Meal to Remember (120053)
Just Desserts (120066)
A Job Well Done (120069)
~~Gridania~~
CRP: A Mother's Carpentry (120203)
Shields for the Masses (120211)
Canes for the Citizens (120212)
High Tension (120213)
Bowing to Pressure (120223)
Pole Positioning (120229)
Driving up the Wall (120237)
Restocking the Stockade (120245)
Plinks Aplenty (120247)
BSM: A Mother's Metallurgy (120201)
It's All in the File (120209)
Training in Bentbranch (120221)
Re-crating the Scene (120231)
Training in Emerald Moss (120239)
ARM: A Mother's Foundry (120205)
Tending to Tendons (120217)
A Little Rusty (120225)
Springripple Rising (120233)
In Sod We Rust (120241)
GSM: A Mother's Jewelry (120206)
The Band's Bands (120218)
Dusting the Knuckles (120226)
In Arm's Reach (120234)
Knuckling Down (120242)
LTW: A Mother's Booties (120204)
Strapped for Straps (120214)
Fire and Hide (120215)
Choke Hold (120216)
Work of Friction (120224)
Hungry Like the Wolves (120230)
Back in the Harness (120238)
Morbol Measures (120246)
Harnessing Help (120248)
WVR: A Mother's Frippery (120202)
Quelling Bloody Rumors (120210)
Clearing Bentbranch (120222)
Clearing Nine Ivies (120232)
Clearing Emerald Moss (120240)
ALC: A Mother's Delicacies (120207)
Mixing It Up (120219)
Keeping It Green (120227)
Arboreal Alchemy (120235)
Growing Strains (120243)
CUL: A Mother's Muselix (120208)
Better Baker's Bounty (120220)
On a Full Belly (120228)
A Well-Deserved Dinner (120236)
Seafood Smorgasbord (120244)
~~Uldah~~
CRP: Momodi's Sturdy Supports (120403)
The Walk of Death (120413)
Pointed Ambitions (120425)
Off With Their Heads (120435)
Act of Pure Weevil (120443)
BSM: Momodi's Dancing Daggers (120401)
Pointy Props (120409)
Hammering the Point (120423)
Molten Metal (120434)
Looking to Horizon (120442)
ARM: Momodi's Sturdy Suits (120405)
Battered and Bent (120415)
Arming the Unarmed (120427)
Provisioning Drybone (120437)
Buckling Under (120445)
GSM: Momodi's Radiant Rings (120406)
A Scarcity of Scepters (120416)
Pleasure and Pain (120417)
In the Sultana's Wake (120418)
A Shining Example (120428)
A Drybone Induction (120432)
A Horizon Promotion (120440)
A Bluefog Induction (120448)
A Broken Water Promotion (120451)
LTW: Momodi's Sashed Shoes (120404)
Showing Some Leg (120414)
World-weary Souls (120426)
Camp Drybone Cares (120436)
I Would Walk 500 Malms (120444)
WVR: Momodi's Budget Breeches (120402)
Just for Kecks (120410)
Pants Make the Man (120411)
Holes in Their Defense (120412)
Hanging by a Thread (120424)
Exposed to the Elements (120433)
Busier Than the Blades (120441)
A Spot in the Shade (120449)
Fire on the Water (120452)
ALC: Momodi's Condiment Conundrum (120407)
Exports of Import (120419)
Fertile Lies (120420)
A Blind Fool (120421)
Saint Allene's Fire (120429)
Treating Steel (120431)
Blue in the Eye (120439)
Preserving the Region (120447)
Provisioning Broken Water (120450)
CUL: Momodi's Breakfast Bread (120408)
Finger Food (120422)
Irrational Behavior (120430)
Tender Victuals (120438)
Some Like It Wet (120446)
--]] --]]
require ("global") require ("global")
local limsaLocalLeves = {
{120007, 120017, 120039, 120047, 120061}, --CRP
{120005, 120013, 120014, 120015, 120035, 120043, 120051, 120059, 120067}, --BSM
{120009, 120019, 120020, 120021, 120036, 120044, 120052, 120063, 120068}, --ARM
{120010, 120022, 120041, 120049, 120064}, --GSM
{120008, 120018, 120040, 120048, 120062}, --LTW
{120006, 120016, 120038, 120046, 120060}, --WVR
{120011, 120023, 120042, 120050, 120065}, --ALC
{120012, 120024, 120025, 120026, 120037, 120045, 120053, 120066, 120069} --CUL
};
local gridaniaLocalLeves = {
{120203, 120211, 120212, 120213, 120223, 120229, 120237, 120245, 120247}, --CRP
{120201, 120209, 120221, 120231, 120239}, --BSM
{120205, 120217, 120225, 120233, 120241}, --ARM
{120206, 120218, 120226, 120234, 120242}, --GSM
{120204, 120214, 120215, 120216, 120224, 120230, 120238, 120246, 120248}, --LTW
{120202, 120210, 120222, 120232, 120240}, --WVR
{120207, 120219, 120227, 120235, 120243}, --ALC
{120208, 120220, 120228, 120236, 120244} --CUL
};
local uldahLocalLeves = {
{120403, 120413, 120425, 120435, 120443}, --CRP
{120401, 120409, 120423, 120434, 120442}, --BSM
{120405, 120415, 120427, 120437, 120445}, --ARM
{120406, 120416, 120417, 120418, 120428, 120432, 120440, 120448, 120451}, --GSM
{120404, 120414, 120426, 120436, 120444}, --LTW
{120402, 120410, 120411, 120412, 120424, 120433, 120441, 120449, 120452}, --WVR
{120407, 120419, 120420, 120421, 120429, 120431, 120439, 120447, 120450}, --ALC
{120408, 120422, 120430, 120438, 120446} --CUL
};
function init(npc) function init(npc)
return false, false, 0, 0; return false, false, 0, 0;
end end
function onEventStarted(player, npc) function onEventStarted(player, npc, triggerName)
callClientFunction(player, "talkOfferWelcome", player, 1);
local leveAllowances = 16;
local quest = 120438;
callClientFunction(player, "confirmJournal", quest, 1);
callClientFunction(player, "confirmJournal", quest, 2);
callClientFunction(player, "confirmJournal", quest, 3);
callClientFunction(player, "confirmJournal", quest, 4);
--[[callClientFunction(player, "talkOfferWelcome", player, leveAllowances);
while (true) do
-- Class Menu
local classChoice = callClientFunction(player, "askOfferPack");
if (classChoice != nil) then
while (true) do
-- Level Difficulty Menu
local levelChoice = callClientFunction(player, "askOfferRank");
if levelChoice != nil then
if levelChoice == 1 then
local levequest = callClientFunction(player, "askOfferQuest", player, 1, 120438, 120025);
if (levequest != nil and levequest > 0) then
player:SendMessage(0x20, "", "[DEBUG] Leve : " .. tostring(pickedLeve));
player:SendGameMessage(GetWorldMaster(), 50141, 0x20, leveAllowances);
end
elseif levelChoice == 2 then
pickedLeve = callClientFunction(player, "askOfferQuest", player, 1, 120026, 120027);
if (pickedLeve != nil) or (pickedLeve != -1) then
player:SendMessage(0x20, "", "[DEBUG] Leve : " .. tostring(pickedLeve));
player:SendGameMessage(GetWorldMaster(), 50141, 0x20, leveAllowances);
end
elseif levelChoice == 3 then
pickedLeve = callClientFunction(player, "askOfferQuest", player, 1, 120028, 120029);
if (pickedLeve != nil) or (pickedLeve != -1) then
player:SendMessage(0x20, "", "[DEBUG] Leve : " .. tostring(pickedLeve));
player:SendGameMessage(GetWorldMaster(), 50141, 0x20, leveAllowances)
end
end
else
break
end
end
else
break;
end
end]]--
callClientFunction(player, "finishTalkTurn");
player:EndEvent(); player:EndEvent();
end end
function onEventUpdate(player, npc, step, menuOptionSelected, lsName, lsCrest) function getAvailableLeves(class, rank)
--callClientFunction(player, "askOfferQuest", player, 1000);
end end

View file

@ -1,13 +1,87 @@
require("global");
--[[
Populace Standard Script
Functions:
eventSwitch(questId1, questId2, questId3, questId4, currentPage, maxPages, titleId) - Shows a dialog box with which quest to trigger
when more than one quest is active for this npc.
Notes:
This scripts fires for all normal standard ENpcs in the world. Because of how the FFXIV dialog system works, everything is technically
a quest; including the DefaultTalk responses. This script checks both static default quests and any relevant ones for that actor class
id. If only one exists; it is automatically triggered otherwise a dialog box will appear for the player to choose what quest to do.
--]]
function init(npc) function init(npc)
return false, false, 0, 0; return false, false, 0, 0;
end end
function onEventStarted(player, npc) function onEventStarted(player, npc, eventType, eventName)
player:SendMessage(0x20, "", "This PopulaceStandard actor has no event set. Actor Class Id: " .. tostring(npc:GetActorClassId())); local defaultTalk = player:GetDefaultTalkQuest(npc);
player:EndEvent(); local tutorialTalk = player:GetTutorialQuest(npc);
local activeQuests = player:GetQuestsForNpc(npc);
local possibleQuests = {};
-- Create the switch table for this npc
if (defaultTalk ~= nil and eventType == EVENT_TALK) then
table.insert(possibleQuests, defaultTalk);
end
if (tutorialTalk ~= nil and eventType == EVENT_TALK) then
table.insert(possibleQuests, tutorialTalk);
end
if (activeQuests ~= nil) then
table.insert(possibleQuests, unpack(activeQuests));
end
-- Either let the player choose the quest or start it if it's the only one.
local chosenQuest = nil;
if (#possibleQuests > 1) then
local currentPage = 0;
local numPages = math.floor((#possibleQuests-1)/4) + 1;
while (true) do
local page, index = callClientFunction(player, "switchEvent", possibleQuests[currentPage * 4 + 1], possibleQuests[currentPage * 4 + 2], possibleQuests[currentPage * 4 + 3], possibleQuests[currentPage * 4 + 4], currentPage + 1, numPages, 0x3F1);
if (page == 0) then
chosenQuest = possibleQuests[(currentPage * 4) + index];
break;
elseif (page > 0) then
currentPage = page - 1;
else
player:EndEvent();
return;
end
end
elseif (#possibleQuests == 1) then
chosenQuest = possibleQuests[1];
end
-- Run the quest event or tell the devs it's missing.
if (chosenQuest ~= nil) then
doQuestEvent(player, npc, chosenQuest, eventType, eventName);
else
local msg = string.format("ERROR: This PopulaceStandard actor has no defaultTalk or quest set. \nActor Class Id: %s\nEvent Name: %s", tostring(npc:GetActorClassId()), eventName);
printf(msg);
player:SendMessage(0x20, "", msg);
player:EndEvent();
end
end end
function onEventUpdate(player, npc, blah, menuSelect) function doQuestEvent(player, npc, quest, eventType, eventName)
player:EndEvent(); if (eventType == 0) then
quest:OnCommand(player, npc, eventName);
elseif (eventType == 1) then
quest:OnTalk(player, npc);
elseif (eventType == 2) then
quest:OnPush(player, npc, eventName);
elseif (eventType == 3) then
quest:OnEmote(player, npc, eventName);
elseif (eventType == 5) then
quest:OnNotice(player, npc, eventName);
end
end end

View file

@ -11,47 +11,36 @@ loadTextData()
Params: None Params: None
start(facility, requestsMode, material1, material2, material3, material4, material5, material6, material7, material8) start(facility, requestsMode, material1, material2, material3, material4, material5, material6, material7, material8)
Desc: Opens the Craft Start widget, with any preloaded materials. Widget has two modes; one for normal synthesis and another Desc: Opens the Craft Start widget, with any preloaded materials. Widget has two modes; one for normal synthesis and another
for local leve "requested items" mode. for local leve "requested items" mode.
Params: * facility/widgetMode - The current facility id buff the player may have. After opening a recipe tab, start() has to be called with this Params: * facility - The current facility id buff the player may have.
set to -1. After the player chooses a recipe, start() has to be called with this set to -2. * requestMode - If true, switches the UI to Requested Items mode otherwise it opens Normal Synthesis mode.
* requestMode - If true, switches the UI to Requested Items mode otherwise it opens Normal Synthesis mode. * material1-8 - ItemID for each of the 8 material slots. If empty, they must be set to 0 or the client will crash.
* material1-8 - ItemID for each of the 8 material slots. If empty, they must be set to 0 or the client will crash.
closeCraftStartWidget() closeCraftStartWidget()
Desc: Closes the Craft Start widget. Desc: Closes the Craft Start widget.
Params: None Params: None
selectRcp(item1, item2, item3, item4, item5, item6, item7, item8) selectRcp(itemId)
Desc: Opens a recipe selection window. If one recipe is provided, automatically selects that recipe. Desc: Selects the recipe to be crafted. May be a legacy function but still required to properly initialize the UI. Requires start() to have
Params: * itemId1-8 - The itemIDs to show in the list. If only one provided, select it. been called.
Params: * itemId - The itemID of the item to be crafted.
confirmRcp(craftedItem, quantity, crystalItem1, crystalQuantity1, crystalQuantity1, crystalItem2, crystalQuantity2, recommendedSkill, recommendedFacility) confirmRcp(craftedItem, quantity, crystalItem1, crystalQuantity1, crystalQuantity1, crystalItem2, crystalQuantity2, recommendedSkill, recommendedFacility)
Desc: Opens the confirmation window, detailing what is needed and the item that will be created. Requires a selectRcp() call first. Desc: Opens the confirmation window, detailing what is needed and the item that will be created. Requires a selectRcp() call first.
Params: * craftedItem - The itemID of the item to be crafted. Params: * craftedItem - The itemID of the item to be crafted.
* quantity - Quantity of crafted items. * quantity - Quantity of crafted items.
* crystalItem1 - The first required crystal itemID for crafting. * crystalItem1 - The first required crystal itemID for crafting.
* crystalQuantity1 - Quantity of the first crystal. * crystalQuantity1 - Quantity of the first crystal.
* crystalItem2 - The second required crystal itemID for crafting. * crystalItem2 - The second required crystal itemID for crafting.
* crystalQuantity2 - Quantity of the second crystal. * crystalQuantity2 - Quantity of the second crystal.
* recommendedSkill - Which itemID to display under the "Recommended Skill" panel. * recommendedSkill - Which itemID to display under the "Recommended Skill" panel.
* recommendedFacility - Which facility to display under the "Recommended Facility" panel. * recommendedFacility - Which facility to display under the "Recommended Facility" panel.
selectCraftQuest() selectCraftQuest()
Desc: Opens the journal to select the local leve that the player would like to do. Desc: Opens the journal to select the local leve that the player would like to do.
Params: None Params: None
confirmLeve()
Desc: Opens the summery page for the local leve.
Params: * localLeveID -
* craftedItem -
* ?
* ?
* itemsCompleted -
* remainingMaterials -
* ?
* ?
askContinueLocalLeve(localLeveID, craftedItem, itemsCompleted, craftTotal, attempts) askContinueLocalLeve(localLeveID, craftedItem, itemsCompleted, craftTotal, attempts)
Desc: Opens the dialog to continue crafting for a local leve after an item was completed. Desc: Opens the dialog to continue crafting for a local leve after an item was completed.
Params: * localLeveID - The id of the current leve in progress. Params: * localLeveID - The id of the current leve in progress.
@ -79,7 +68,7 @@ craftCommandUI(classID, hasWait, command1, command2, command3, command4, command
* command1-5 - Five possible crafting commands (crafting skills). * command1-5 - Five possible crafting commands (crafting skills).
craftTuningUI(command1, command2, command3, command4, command5, command6, command7, command8) craftTuningUI(command1, command2, command3, command4, command5, command6, command7, command8)
Desc: Displays only the provided commands for the "Double Down" phase that happens after crafting. Desc: Displays a full list of commands for the legacy "Tuning" phase that happens after crafting. Deprecated in 1.23b.
Params: * command1-8 - The list of commands available. Params: * command1-8 - The list of commands available.
updateInfo(progress, durability, quality, tuningItem, tuningItemQuality, tuningItemQuantity, hqChance) updateInfo(progress, durability, quality, tuningItem, tuningItemQuality, tuningItemQuantity, hqChance)
@ -100,6 +89,17 @@ cfmQst()
Desc: Quest confirmation window for when starting a crafting quest from the journal. Desc: Quest confirmation window for when starting a crafting quest from the journal.
Params: Params:
confirmLeve()
Desc: Opens the summery page for the local leve.
Params: * localLeveID - The quest id of the leve you are confirming.
* difficulty - Changes the objective.
* craftedItem? -
* ? -
* numSuccess - The number of successful crafts you did.
* remainingMaterials - The number of materials you have left.
* hasMaterials - Shows the in-progress panel of successes and attempts left.
* ? -
startRepair(craftMode, item, quality, durability, hasMateria, spiritbind) startRepair(craftMode, item, quality, durability, hasMateria, spiritbind)
Desc: Opens the repair item widget. Desc: Opens the repair item widget.
Params: * craftMode - Either 0 or 1. Anything else crashes. Params: * craftMode - Either 0 or 1. Anything else crashes.
@ -133,214 +133,289 @@ Class ID + Starting skill
35 ALC = 22586 35 ALC = 22586
36 CUL = 22592 36 CUL = 22592
Leve objectives/rewards are in passiveGL_craft.
* Index 1:
* Index 2: Recommended Class
* Index 3: Issuing Authority
* Index 7: Levequest Location
* Index 8: Deliver Display Name
* Starts at index 14. Four sections for the four difficulties.
* Required Item, Amount, ?, Recommended Level, , Reward Item, Reward Amount, |
--]] --]]
require ("global") require ("global")
local skillAnim = {
skillAnim = {
[22553] = 0x10002000; [22553] = 0x10002000;
[22554] = 0x10001000; [22554] = 0x10001000;
[22555] = 0x10003000; [22555] = 0x10003000;
[29531] = 0x10009002; [29531] = 0x10009002;
} }
local craftStartWidgetOpen = false;
materialSlots = {0,0,0,0,0,0,0,0}; -- The 8 slots
recentRecipe = {10008205, 4030706, 4070009} -- Recent Recipe list
awardedRecipe = {7020105, 7030011} -- Awarded Recipe list
materialRecipe = { -- Always 8 params because we can't have any nils here for "start" command
[6071007] = {4070402, 4070309,0,0,0,0,0,0},
[10008205] = {10008005,10008005,0,0,0,0,0,0},
[10009617] = {4040009, 4040010, 4040011,0,0,0,0,0},
[4070009] = {4070006, 10005401, 10008203,0,0,0,0,0},
[4070010] = {10008204,10008106,10005302,0,0,0,0,0}
}
materialQuest = { -- What a quest or leve will preload slots with, in addition to any extras the player does manual
[0] = {0,0,0,0,0,0,0,0},
[1] = {0,0,0,0,0,0,0,0},
[110442] = {11000075, 11000074, 0, 0, 0, 0, 0, 0}
}
function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId) function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId)
local MENU_CANCEL, MENU_MAINHAND, MENU_OFFHAND, MENU_REQUEST = 0, 1, 2, 3;
MENU_CANCEL, MENU_MAINHAND, MENU_OFFHAND, MENU_REQUEST = 0, 1, 2, 3; local MENU_RECENT, MENU_AWARDED, MENU_RECENT_DETAILED, MENU_AWARDED_DETAILED = 7, 8, 9, 10;
MENU_RECIPE, MENU_AWARDED, MENU_RECIPE_DETAILED, MENU_AWARDED_DETAILED = 7, 8, 9, 10;
debugMessage = false; local debugMessage = true;
isRecipeRecentSent = false; local isRecipeRecentSent = false;
isRecipeAwardSent = false; local isRecipeAwardSent = false;
detailWindow = true;
isRequested = false; -- False = The default state. True = User picked a quest recipe/local leve local craftJudge = GetStaticActor("CraftJudge");
facilityId = 0; local recipeResolver = GetRecipeResolver();
chosenQuest = 0; -- Use this to store any chosen recipe/local leve
recipeDetail = 0;
detailWindowState = 0;
craftJudge = GetStaticActor("CraftJudge");
callClientFunction(player, "delegateCommand", craftJudge, "loadTextData", commandactor);
chosenOperation = -1;
while chosenOperation ~= 0 do local operationResult;
local operationMode = -1;
player:ChangeState(30); local recipeMode = -1;
local chosenMaterials;
if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Menu ID: "..tostring(chosenOperation).." Recipe : "..tostring(recipeMode).." Quest : "..chosenQuest); end
local facilityId = 0;
local isRequestedItemsMode = false; -- False = The default state. True = User picked a quest recipe/local leve
if materialQuest[chosenQuest] then local recentRecipes;
if debugMessage then player:SendMessage(0x20, "", "Key is valid: "..chosenQuest); end local awardedRecipes;
materialSlots = materialQuest[chosenQuest];
else local currentCraftQuest = nil; -- Use this to store any chosen craft quest
if debugMessage then player:SendMessage(0x20, "", "Key is not valid: "..chosenQuest); end local currentCraftQuestGuildleve = nil; -- Use this to store any chosen local leve
end
callClientFunction(player, "delegateCommand", craftJudge, "loadTextData", commandactor);
player:ChangeState(30);
if isRecipeRecentSent == false then -- If Recipe button not hit, aka default state.
chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, facilityId, isRequested, unpack(materialSlots)); -- Initial window while operationMode ~= 0 do
-- Figure out the prepped materials.
local prepedMaterials = {0,0,0,0,0,0,0,0};
-- Quest requested mode materials
if (isRequestedItemsMode == true) then
prepedMaterials = recipeResolver.RecipeToMatIdTable(currentCraftQuestGuildleve.getRecipe());
-- Recent Recipes/Awarded recipes materials
elseif ((operationMode == MENU_RECENT or operationMode == MENU_AWARDED) and recipeMode != 0) then
if (operationMode == MENU_RECENT) then
prepedMaterials = recipeResolver.RecipeToMatIdTable(recentRecipes[recipeMode]);
else
prepedMaterials = recipeResolver.RecipeToMatIdTable(awardedRecipes[recipeMode]);
end
end
-- Set this param correctly
local facilityIdParam = facilityId;
if ((operationMode == MENU_RECENT or operationMode == MENU_AWARDED) and recipeMode != 0) then
facilityIdParam = -2;
elseif (craftStartWidgetOpen == true) then
craftStartWidgetOpen = true;
facilityIdParam = -1;
end
-- Run start and grab the result operation/recipeMode/prepped
operationResult = {callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, facilityIdParam, isRequestedItemsMode, unpack(prepedMaterials))};
operationMode = operationResult[1];
recipeMode = operationResult[2];
if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Menu ID: " .. tostring(operationMode) .. ", RecipeMode : " .. recipeMode); end
-- Operation
if operationMode == MENU_CANCEL then
closeCraftStartWidget(player, craftJudge, commandactor);
elseif (operationMode == MENU_MAINHAND or operationMode == MENU_OFFHAND) then
-- Recipe choosing loop
while (true) do
-- Figure out the number of preloaded mats
local materials = {};
-- Handle the possible args returned: Either 0 player items, 1 player item, 2+ palyer items. The rest is always the remaining prepped items.
if (type(operationResult[3]) == "number") then
materials = {unpack(operationResult, 3)};
elseif (type(operationResult[3]) ~= "number") then
for i=1,8 do
if (i - 1 < operationResult[3].numItems) then
materials[i] = player:GetItemPackage(operationResult[3].itemPackages[i-1]):GetItemAtSlot(operationResult[3].itemSlots[i-1]).itemId;
player:SendMessage(0x20, "", "[DEBUG] " .. tostring(materials[i]));
else
materials[i] = operationResult[3 + (i - operationResult[3].numItems)];
player:SendMessage(0x20, "", "[DEBUG] " .. tostring(materials[i]));
end
end
end
-- Choosing a recipe from the given materials
local recipes = recipeResolver.GetRecipeFromMats(unpack(materials));
local itemIds = recipeResolver.RecipesToItemIdTable(recipes);
-- No recipes found
if (#itemIds == 0) then
player:SendGameMessage(GetWorldMaster(), 40201, 0x20); -- You cannot synthesize with those materials.
break;
end
local chosenRecipeIndex = callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(itemIds));
-- Hit back on recipe list
if (chosenRecipeIndex <= 0) then break end;
chosenRecipe = recipes[chosenRecipeIndex-1];
if (chosenRecipe ~= nil) then
-- Player confirms recipe
local recipeConfirmed = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor,
chosenRecipe.resultItemID,
chosenRecipe.resultQuantity,
chosenRecipe.crystalId1,
chosenRecipe.crystalQuantity1,
chosenRecipe.crystalId2,
chosenRecipe.crystalQuantity2,
0,
0);
elseif isRecipeRecentSent == true and recipeMode == 0 then -- If recipe window/award tab was hit if recipeConfirmed then
chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -1, isRequested, unpack(materialSlots)); -- Keep window going closeCraftStartWidget(player, craftJudge, commandactor);
isRecipeRecentSent = false;
elseif isRecipeRecentSent == true and recipeMode > 0 then -- If recipe item picked isRecipeAwardSent = false;
if recipeDetail then
chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -2, isRequested, unpack(recipeDetail)); -- Item mat(s) for picked item. -- CRAFTING STARTED
else currentlyCrafting = startCrafting(player, commandactor, craftJudge, operationMode, chosenRecipe, currentCraftQuestGuildleve, 80, 100, 50);
chosenOperation, recipeMode = callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -2, isRequested, 10009617,0,0,0,0,0,0,0); -- Show dummy info for unfilled item
end --Once crafting is over, return to the original non-quest state.
end isRequestedItemsMode = false;
currentCraftQuestGuildleve = nil;
currentCraftQuest = nil;
if chosenOperation == MENU_CANCEL then
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); break;
end
end
elseif (chosenOperation == MENU_MAINHAND or chosenOperation == MENU_OFFHAND) then end
-- End of Recipe choosing loops
if isRequested == true then elseif operationMode == MENU_REQUEST then -- Conditional button label based on isRequestedItemsMode
recipeResult = callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, 10009617); closeCraftStartWidget(player, craftJudge, commandactor);
else
recipeResult = callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, 10009617,6071007,5030112,5030007,10009617,6071007,5030112,5030007); if isRequestedItemsMode == false then -- "Request Items" hit, close Start and open up the Quest select
end
if recipeResult == 0 then -- Closed/Return hit.
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor);
currentlyCrafting = -1;
elseif (recipeResult >= 1 or recipeResult <= 8) then
--item yld, xstal1, qty, xstal2, qty
recipeConfirmed = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor, 10009617, 1, 0xF4247, 1, 0xf4245, 1, 0, 0);
if recipeConfirmed then
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor);
isRecipeRecentSent = false;
isRecipeAwardSent = false;
currentlyCrafting = startCrafting(player, chosenOperation, isRequested, 80, 100, 50);
end
end
elseif chosenOperation == MENU_REQUEST then -- Conditional button label based on isRequested
if isRequested == false then -- "Request Items" hit, close Start and open up the Quest select
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor);
isRecipeRecentSent = false; isRecipeRecentSent = false;
isRecipeAwardSent = false; isRecipeAwardSent = false;
local questConfirmed, returnedQuest = GetCraftQuest(player, craftjudge, commandactor); local quest = getCraftQuest(player, craftJudge, commandactor);
chosenQuest = tonumber(returnedQuest); if (quest ~= nil) then
isRequestedItemsMode = true;
if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Chosen Quest: "..tostring(chosenQuest)); end if (quest.isCraftPassiveGuildleve()) then
currentCraftQuestGuildleve = quest;
if questConfirmed then else
isRequested = true; currentCraftQuest = quest;
end end
end
elseif isRequestedItemsMode == true then -- "Normal Synthesis" button hit
elseif isRequested == true then -- "Normal Synthesis" button hit isRequestedItemsMode = false;
isRequested = false; currentCraftQuestGuildleve = nil;
chosenQuest = 0; currentCraftQuest = nil;
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor); end
elseif operationMode == MENU_RECENT then -- "Recipes" button hit
end
elseif chosenOperation == MENU_RECIPE then -- "Recipes" button hit
if isRecipeRecentSent == false then if isRecipeRecentSent == false then
callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(recentRecipe)); -- Load up recipe list recentRecipes = player.GetRecentRecipes();
local itemIds = recipeResolver.RecipesToItemIdTable(recentRecipes);
callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(itemIds)); -- Load up recipe list
isRecipeRecentSent = true; isRecipeRecentSent = true;
end end
elseif operationMode == MENU_AWARDED then -- "Awarded Recipes" tab hit
recipeDetail = materialRecipe[recentRecipe[recipeMode]];
elseif chosenOperation == MENU_AWARDED then -- "Awarded Recipes" tab hit
if isRecipeAwardSent == false then if isRecipeAwardSent == false then
callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(awardedRecipe)); -- Load up Award list awardedRecipes = player.GetAwardedRecipes();
local itemIds = recipeResolver.RecipesToItemIdTable(awardedRecipes);
callClientFunction(player, "delegateCommand", craftJudge, "selectRcp", commandactor, unpack(itemIds)); -- Load up Award list
isRecipeAwardSent = true; isRecipeAwardSent = true;
end end
elseif ((operationMode == MENU_RECENT_DETAILED or operationMode == MENU_AWARDED_DETAILED) and recipeMode > 0) then -- Pop-up for an item's stats/craft mats on a recent recipe
recipeDetail = materialRecipe[awardedRecipe[recipeMode]]; local chosenRecipe = operationMode == MENU_RECENT_DETAILED and recentRecipes[recipeMode-1] or recentRecipes[awardedMode-1];
local recipeConfirmed = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor,
elseif (chosenOperation == MENU_RECIPE_DETAILED or chosenOperation == MENU_AWARDED_DETAILED) and recipeMode > 0 then -- Pop-up for an item's stats/craft mats chosenRecipe.resultItemID,
detailWindowState = callClientFunction(player, "delegateCommand", craftJudge, "confirmRcp", commandactor, 10009617, 1, 0xF4247, 1, 0xf4245, 1, 0, 0); chosenRecipe.resultQuantity,
chosenRecipe.crystalId1,
chosenRecipe.crystalQuantity1,
chosenRecipe.crystalId2,
chosenRecipe.crystalQuantity2,
0,
0);
-- This should never call? The window with this button only appears when you select a recent recipe with not enough materials. Otherwise it just auto-fills your "table".
if (recipeConfirmed) then
closeCraftStartWidget(player, craftJudge, commandactor);
isRecipeRecentSent = false;
isRecipeAwardSent = false;
currentlyCrafting = startCrafting(player, commandactor, craftJudge, operationMode, chosenRecipe, isRequestedItemsMode, 80, 100, 50);
end
else else
break; break;
end end
end end
player:ChangeMusic(7); -- Need way to reset music back to the zone's default
player:ChangeState(0);
player:EndEvent();
player:ResetMusic();
player:ChangeState(0);
player:EndEvent();
end end
-- Handles the menus to pick a crafter quest or local leve quest that run separate widgets from the Start command. -- Handles the menus to pick a crafter quest or local leve quest that run separate widgets from the Start command.
-- Returns whether a quest was selected, and what id the quest is. -- Returns whether a quest was selected, and what id the quest is.
function GetCraftQuest(player, craftjudge, commandactor); function getCraftQuest(player, craftJudge, commandactor);
local questId = nil;
while (true) do
local questCommandId = callClientFunction(player, "delegateCommand", craftJudge, "selectCraftQuest", commandactor);
if questCommandId then
questId = questCommandId - 0xA0F00000;
-- Craft Quest Chosen
if isCraftQuest(questId) then
local quest = player.GetQuest(questId);
local confirm = callClientFunction(player, "delegateCommand", craftJudge, "cfmQst", commandactor, quest.getQuestId(), 20, 1, 1, 1, 0, 0, "<Path Companion>");
if confirm == true then
player:SendGameMessage(craftJudge, 21, 0x20);
return quest;
end
-- PassiveGL Quest Chosen
elseif isLocalLeve(questId) then
local difficulty = 0;
local hasMaterials = 1;
local quest = player:getQuestGuildleve(questId);
if (quest ~= nil) then
-- Did they pickup the materials?
if (quest:hasMaterials() == false) then
player:SendGameMessage(GetWorldMaster(), 40210, 0x20); -- You have not obtained the proper materials from the client.
-- Did they use em all up?
elseif (quest:getRemainingMaterials() == 0) then
player:SendGameMessage(GetWorldMaster(), 40211, 0x20); -- You have used up all of the provided materials.
-- Confirm dialog
else
local confirm = callClientFunction(player, "delegateCommand", craftJudge, "confirmLeve", commandactor,
quest:getQuestId(),
quest:getCurrentDifficulty() + 1, -- Lua, 1-indexed
0,
quest:getCurrentCrafted(),
quest:getRemainingMaterials(),
quest:hasMaterials() and 1 or 0, -- Fucked up way of doing terneries on Lua
0
);
local questOffset = 0xA0F00000; -- Quest confirmed
local questId = 0; if (confirm == true) then
local requestState = false; return quest;
local requestedMenuChoice = callClientFunction(player, "delegateCommand", craftJudge, "selectCraftQuest", commandactor); end
end
if requestedMenuChoice then else
questId = requestedMenuChoice - questOffset; return nil; -- Shouldn't happen unless db fucked with
end
if isCraftQuest(questId) then -- Scenario Quest Chosen
confirm = callClientFunction(player, "delegateCommand", craftJudge, "cfmQst", commandactor, questId, 20, 1, 1, 1, 0, 0, "<Path Companion>"); else
-- TEMP for now. Cannot find source for what happens if you confirm a non-craft quest.
if confirm == true then player:SendGameMessage(GetWorldMaster(), 40209, 0x20); -- You cannot undertake that endeavor.
requestState = true; end
player:SendGameMessage(craftJudge, 21, 0x20); else
end return nil;
end
elseif isLocalLeve(questId) then end
confirm = callClientFunction(player, "delegateCommand", craftJudge, "confirmLeve", commandactor, questId, 0, 8030421, 5, 50, 0, 0);
if confirm == true then
requestState = true;
itemSlots = { unpack(materialRecipe[4070010])};
end
elseif isScenarioQuest(questId) == true then
-- TEMP for now. Cannot find source for what happens if you confirm a non-craft quest.
player:SendGameMessage(GetWorldMaster(), 40209, 0x20);
end
end
return requestState, questId;
end end
function isScenarioQuest(id) function isScenarioQuest(id)
if (id >= 110001 and id <= 120026) then if (id >= 110001 and id <= 120026) then
return true; return true;
else else
@ -359,7 +434,6 @@ end
function isLocalLeve(id) function isLocalLeve(id)
if (id >= 120001 and id <= 120452) then if (id >= 120001 and id <= 120452) then
return true; return true;
else else
@ -367,58 +441,73 @@ function isLocalLeve(id)
end end
end end
function closeCraftStartWidget(player, craftJudge, commandactor)
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftStartWidget", commandactor);
craftStartWidgetOpen = false;
end
-- No real logic in this function. Just smoke and mirrors to 'see' the minigame in action at the minimum level. -- No real logic in this function. Just smoke and mirrors to 'see' the minigame in action at the minimum level.
function startCrafting(player, hand, quest, startDur, startQly, startHQ) function startCrafting(player, commandactor, craftJudge, hand, recipe, quest, startDur, startQly, startHQ)
local worldMaster = GetWorldMaster(); local worldMaster = GetWorldMaster();
local craftProg = 0; local progress = 0;
local attempts = 5; local attempts = 5;
local craftedCount = 0; local craftedCount = 0;
local craftTotal = 2; local craftTotal = 2;
local itemId = 10009617;
player:ChangeState(30+hand); -- Craft kneeling w/ appropriate tool out player:ChangeState(30+hand); -- Craft kneeling w/ appropriate tool out
player:ChangeMusic(73); player:ChangeMusic(73);
callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ); callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ);
while true do while (true) do
local progDiff = math.random(30,50);
local progDiff = math.random(25,25);
local duraDiff = math.random(1,3); local duraDiff = math.random(1,3);
local qltyDiff = math.random(0,2); local qltyDiff = math.random(0,2);
if craftProg >= 100 then if (progress >= 100) then
testChoice2 = callClientFunction(player, "delegateCommand", craftJudge, "updateInfo", commandactor, 100, 10, 20, 5020111, 69, 70, 75);
-- From Lodestone: If the HQ odds are 1% or better, players will have the option of selecting either Finish or Double Down.
-- By electing to double down, the player takes a chance on creating an HQ item at the risk of losing the completed item if the attempt fails
testChoice = callClientFunction(player, "delegateCommand", craftJudge, "craftTuningUI", commandactor, 22503, 22504);
player:SendGameMessage(GetWorldMaster(), 40111, 0x20, player, itemId, 3, 8); -- "You create <#3 quantity> <#1 item> <#2 quality>."
callClientFunction(player, "delegateCommand", craftJudge, "closeCraftProgressWidget", commandactor); callClientFunction(player, "delegateCommand", craftJudge, "closeCraftProgressWidget", commandactor);
if quest then -- Handle local levequest craft success
continueLeve = callClientFunction(player, "delegateCommand", craftJudge, "askContinueLocalLeve", 120001, itemId, craftedCount, craftTotal, attempts); if quest then
quest:craftSuccess();
if (quest:getCurrentCrafted() >= quest:getObjectiveQuantity()) then
attentionMessage(player, 40121, quest:getQuestId(), quest:getCurrentCrafted(), quest:getObjectiveQuantity()); -- "All items for <QuestId> complete!"
else
attentionMessage(player, 40119, quest:getQuestId(), quest:getCurrentCrafted(), quest:getObjectiveQuantity()); -- "<QuestId> Successfull. (<crafted> of <attempts>)"
end
-- Continue local levequest (should this be in here??)
if (quest:getRemainingMaterials() ~= 0) then
continueLeve = callClientFunction(player, "delegateCommand", craftJudge, "askContinueLocalleve", commandactor,
quest:getQuestId(),
quest:getRecipe().resultItemID,
quest:getCurrentCrafted(),
quest:getObjectiveQuantity(),
quest:getRemainingMaterials()
);
if continueLeve == true then if (continueLeve == 1) then
craftProg = 0; progress = 0;
callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ); callClientFunction(player, "delegateCommand", craftJudge, "openCraftProgressWidget", commandactor, startDur, startQly, startHQ);
else else
break; break;
end end
else else
break; break;
end
-- Normal synth craft success
else
player:SendGameMessage(GetWorldMaster(), 40111, 0x20, player, recipe.resultItemID, 1, recipe.resultQuantity); -- "You create <#3 quantity> <#1 item> <#2 quality>."
player:getItemPackage(location):addItem(recipe.resultItemID, recipe.resultQuantity, 1);
break;
end end
end end
choice = callClientFunction(player, "delegateCommand", craftJudge, "craftCommandUI", commandactor, 29, 2, 29530,29531,29532,29533,29534); choice = callClientFunction(player, "delegateCommand", craftJudge, "craftCommandUI", commandactor, 29, 2, 29530,29531,29532,29533,29534);
--player:SendMessage(0x20, "", "[DEBUG] Command id selected: "..choice); --player:SendMessage(0x20, "", "[DEBUG] Command id selected: "..choice);
if (choice) then
if choice then
if skillAnim[choice] then if skillAnim[choice] then
player:PlayAnimation(skillAnim[choice]); player:PlayAnimation(skillAnim[choice]);
@ -428,11 +517,11 @@ function startCrafting(player, hand, quest, startDur, startQly, startHQ)
player:SendGameMessage(worldMaster, 40108, 0x20, choice,2); player:SendGameMessage(worldMaster, 40108, 0x20, choice,2);
if choice ~= 29531 then if (choice ~= 29531) then
craftProg = craftProg + progDiff; progress = progress + progDiff;
if craftProg >= 100 then if (progress >= 100) then
craftProg = 100; progress = 100;
end end
startDur = startDur - duraDiff; startDur = startDur - duraDiff;
@ -443,12 +532,9 @@ function startCrafting(player, hand, quest, startDur, startQly, startHQ)
player:SendGameMessage(worldMaster, 40104, 0x20, qltyDiff); player:SendGameMessage(worldMaster, 40104, 0x20, qltyDiff);
end end
--prg dur qly, ???, ???, ???, HQ --prg dur qly, ???, ???, ???, HQ
callClientFunction(player, "delegateCommand", craftJudge, "updateInfo", commandactor, craftProg, startDur, startQly, nil, nil, nil, nil, nil); callClientFunction(player, "delegateCommand", craftJudge, "updateInfo", commandactor, progress, startDur, startQly, nil, nil, nil, nil, nil);
--testChoice = callClientFunction(player, "delegateCommand", craftJudge, "craftTuningUI", commandactor, 29501, 24233, 29501,29501, 24223, 29501,12008,12004);
end end
end end
end
return -1;
end

View file

@ -62,41 +62,38 @@ rangeInputWidget()
* goodMin * goodMin
* goodMax * goodMax
* bool * bool
Notes:
* Aim = Where on the aim gauge the player chose.
* Remainder = How many attempts you get on the section portion of the minigame
* Sweetspot = Where you hit on the second portion of the minigame
--]] --]]
minerAnim = {0x14001000, 0x14002000, 0x14003000}; minerAnim = {0x14001000, 0x14002000, 0x14003000};
--[[ Mooglebox - Aim --[[Mooglebox - Aim
+5 +4 +3 +2 +1 0 -1 -2 -3 -4 -5 +5 = 0
0 10 20 30 40 50 60 70 80 90 100 +4 = 10
+3 = 20
+2 = 30
+1 = 40
0 = 50
-1 = 60
-2 = 70
-3 = 80
-4 = 90
-5 = 100
Sweetspots 1=10 2=30 3=70 4=100 for Mining Sweetspots 1=10 2=30 3=70 4=100 for Mining
Remainder A=40 B=60 C=70 D=80 remainder A=40 B=60 C=70 D=80
--]] --]]
harvestNodeContainer = { -- nodeGrade, harvestAttempts, #ofItemsBecauseICantIntoIpairs, Item1, Item2, etc nodeContainer = { -- harvestAttempts, #ofItemsBecauseLuaIsShitAtTableLength, Item1, Item2, etc
[1001] = {2, 2, 3, 1, 2, 3}, [1] = {4, 3, 1, 2, 3}
[1002] = {2, 4, 5, 3005, 3003, 3002, 3001, 3004}
} }
harvestNodeItems = { nodeItems = {
--itemId, remainder, aim, sweetspot, max yield --itemId, remainder, aim, sweetspot, max yield
[1] = {10009104, 70, 30, 30, 4}, -- Rock Salt [1] = {10009104, 70, 30, 30, 4}, -- Rock Salt
[2] = {10006001, 80, 10, 30, 4}, -- Bone Chip [2] = {10006001, 80, 10, 30, 4}, -- Bone Chip
[3] = {10001006, 80, 20, 30, 3}, -- Copper Ore [3] = {10001006, 80, 20, 30, 3} -- Copper Ore
[3001] = {10001003, 80, 50, 30, 3},
[3002] = {10001006, 70, 70, 10, 4},
[3003] = {10001005, 80, 90, 70, 1},
[3004] = {10009104, 40, 10, 100, 2},
[3005] = {10001007, 40, 0, 30, 1}
} }
@ -106,23 +103,18 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
debugMsg = false; debugMsg = false;
powerCurrent = 0;
powerLast = 0;
powerRange = 10; -- 'Feels' look a good amount compared to vids/ARR's minigame.
showTutorial = 0;
commandMine = 22002; commandMine = 22002;
commandLog = 22003; commandLog = 22003;
commandFish = 22004; commandFish = 22004;
remainderA, remainderB, remainderC, remainderD = 40, 60, 70, 80;
harvestNodeId = 1001; -- What the server should send eventually
harvestNode = BuildHarvestNode(player, harvestNodeId); -- [1-11] = {itemId, remainder, sweetspot, maxYield} currentPower = 0;
harvestGrade = harvestNodeContainer[harvestNodeId][1] or 0; nodeGrade = 3;
harvestAttempts = harvestNodeContainer[harvestNodeId][2] or 0; showTutorial = 0;
nodeRemainder = 0; harvestAttempts = 2;
nodeRemainder = remainderC;
item = 10001006;
harvestType = commandMine; harvestType = commandMine;
@ -134,12 +126,12 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
player:ChangeState(50); player:ChangeState(50);
if harvestType == commandMine then if harvestType == commandMine then
player:SendGameMessage(harvestJudge, 26, MESSAGE_TYPE_SYSTEM, 1, harvestGrade); player:SendGameMessage(harvestJudge, 26, MESSAGE_TYPE_SYSTEM, 1, nodeGrade);
callClientFunction(player, "delegateCommand", harvestJudge, "openInputWidget", commandActor, harvestType, harvestGrade); callClientFunction(player, "delegateCommand", harvestJudge, "openInputWidget", commandActor, harvestType, nodeGrade);
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType); callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType);
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0); callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0);
@ -147,42 +139,22 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
while harvestAttempts > 0 do while harvestAttempts > 0 do
-- "Aim", 0 = Top of bar, 100 = Bottom. -- "Aim", 0 = Top of bar, 100 = Bottom. Mooglebox conversion is +5 = 0, 0 = 50, -5 = 100
menuResult, sliderPhase, unk3 = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 1, showTutorial, false, false, nil, false); menuResult, sliderPhase, ret3 = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 1, showTutorial, false, false, nil, false);
if debugMsg then player:SendMessage(0x20, "", "menuResult: "..tostring(menuResult).." sliderPhase: "..tostring(sliderPhase).." Unk: "..tostring(unk3)); end
if debugMsg then player:SendMessage(0x20, "", tostring(menuResult).." unk: "..tostring(sliderPhase).." unk: "..tostring(ret3)); end
if menuResult == 22701 then -- Begin. if menuResult == 22701 then -- Begin.
player:SendGameMessage(harvestJudge, 36, MESSAGE_TYPE_SYSTEM);
local aimSlot = (sliderPhase/10)+1; -- Thanks LUA index = 1 nodeRemainder = remainderC;
local nodeDetails = harvestNode[aimSlot];
local nodeItem = nodeDetails[1];
local nodeRemainder = nodeDetails[2];
local nodeSweetspot = nodeDetails[3];
local nodeYield = nodeDetails[4];
local isFirstSwing = true;
local sweetspotDifference;
local sweetspotDifferencePrevious;
if debugMsg then
player:SendMessage(0x20, "", "aimSlot: "..(aimSlot).." itemId:"..tostring(nodeDetails[1]).." remainder: "..tostring(nodeDetails[2]));
end
player:SendGameMessage(harvestJudge, 36, MESSAGE_TYPE_SYSTEM); -- "You set your sights on an area."
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType); callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType);
while true do while true do
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0);
-- "Strike" 0 = Empty, 100 = Filled. Mooglebox sweespots are 1=10, 2=30, 3=70, 4=100 for Mining -- "Strike" 0 = Empty, 100 = Filled. Mooglebox sweespots are 1=10, 2=30, 3=70, 4=100 for Mining
chosenCommand, powerCurrent = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 2, showTutorial, false, false, nil, false); -- Strike chosenCommand, currentPower = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 2, showTutorial, false, false, nil, false); -- Strike
if debugMsg then player:SendMessage(0x20, "", tostring(chosenCommand).." Power: "..tostring(powerCurrent)); end if debugMsg then player:SendMessage(0x20, "", tostring(chosenCommand).." Power: "..tostring(currentPower)); end
if chosenCommand == 22702 then -- Cancel. if chosenCommand == 22702 then -- Cancel.
@ -196,64 +168,23 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts); player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts);
end end
break; break;
elseif chosenCommand == 22703 then -- Strike. elseif chosenCommand == 22703 then -- Strike.
player:PlayAnimation(minerAnim[math.random(1,3)]);
nodeRemainder = nodeRemainder - 20; nodeRemainder = nodeRemainder - 20;
if nodeRemainder < 0 then if nodeRemainder < 0 then
nodeRemainder = 0; nodeRemainder = 0;
end end
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0);
player:PlayAnimation(minerAnim[math.random(1,3)]);
wait(2);
sweetspotDifference = math.abs(powerCurrent - nodeSweetspot);
if powerRange >= sweetspotDifference then
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, false, harvestType);
-- "You obtain <yield> <item> <quality>"
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 25, nodeItem, 0, nodeYield, 0);
player:SendGameMessage(player, worldMaster, 40301, MESSAGE_TYPE_SYSTEM, player, nodeItem, nodeYield); -- TODO: Refer to caps to see wtf is going on here
HarvestReward(player, nodeItem, nodeYield);
nodeRemainder = 0;
else
if isFirstSwing then
if sweetspotDifference < 19 then -- TODO: TWEAK THESE, likely need to be larger
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 45);
player:SendGameMessage(harvestJudge, 45, MESSAGE_TYPE_SYSTEM); -- "You feel something promising."
elseif sweetspotDifference > 20 then
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 42);
player:SendGameMessage(harvestJudge, 42, MESSAGE_TYPE_SYSTEM); -- "You feel nothing promising."
end
else
if sweetspotDifference > sweetspotDifferencePrevious then
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 43);
player:SendGameMessage(harvestJudge, 43, MESSAGE_TYPE_SYSTEM); -- "You are getting farther from the mark."
elseif sweetspotDifference < sweetspotDifferencePrevious then
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 44);
player:SendGameMessage(harvestJudge, 44, MESSAGE_TYPE_SYSTEM); -- "You are getting closer to the mark."
else
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 42);
player:SendGameMessage(harvestJudge, 42, MESSAGE_TYPE_SYSTEM); -- "You feel nothing promising."
end
end
end
if not isFirstSwing then
powerLast = powerCurrent;
end;
--player:SendGameMessage(harvestJudge, 25, MESSAGE_TYPE_SYSTEM, item, 4, 1);
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, false, harvestType); callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, false, harvestType);
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, 25, item, 4, 1, 0);
if nodeRemainder == 0 then if nodeRemainder == 0 then
harvestAttempts = harvestAttempts - 1; harvestAttempts = harvestAttempts - 1;
@ -262,20 +193,13 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
player:SendGameMessage(player, worldMaster, 40344, 0x20, harvestAttempts); player:SendGameMessage(player, worldMaster, 40344, 0x20, harvestAttempts);
else else
-- There is nothing left to gather at this location. -- There is nothing left to gather at this location.
player:ChangeMusic(101);
player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts); player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts);
end end
wait(2); wait(2);
break; break;
end end
if isFirstSwing and debugMsg then player:SendMessage(0x20, "", "First swing"); end
isFirstSwing = false;
sweetspotDifferencePrevious = sweetspotDifference;
elseif chosenCommand == 22710 then -- "Strike" Tutorial. elseif chosenCommand == 22710 then -- "Strike" Tutorial.
SendTutorial(player, harvestJudge, 2); SendTutorial(player, harvestJudge, 2);
end end
@ -295,12 +219,8 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
end end
player:SendGameMessage(harvestJudge, 31, MESSAGE_TYPE_SYSTEM);
if harvestAttempts == 0 then if harvestAttempts == 0 then
player:SendGameMessage(player, worldMaster, 40310, 0x20); -- "The deposit has been exhausted." player:SendGameMessage(harvestJudge, 31, MESSAGE_TYPE_SYSTEM);
--TO:DO Despawn node + whatever logic to respawn an exsiting expired node in the area.
end end
callClientFunction(player, "delegateCommand", harvestJudge, "closeInputWidget", commandActor, harvestType); callClientFunction(player, "delegateCommand", harvestJudge, "closeInputWidget", commandActor, harvestType);
@ -311,67 +231,6 @@ function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg
end end
-- Returns a table in the following format: nodeTable = { [1-11] = {itemId, remainder, sweetspot, maxYield} }
function BuildHarvestNode(player, sentNode)
if harvestNodeContainer[sentNode] then
local node = harvestNodeContainer[sentNode];
local nodeTable = {};
local nodeItems = {};
local nodeItemCount = node[3];
local grade = node[1];
local attempts = node[2];
-- Load up nodeItems[] with the harvestNodeItems{} key and Aim point
for i=1, nodeItemCount do
local nodeItemKey = node[3+i];
local item = harvestNodeItems[ node[3+i] ]
nodeItems[i] = { nodeItemKey, ((item[3] / 10)+1) };
if debugMsg then player:SendMessage(0x20, "", "nodeItems: "..nodeItems[i][1].." "..nodeItems[i][2]); end
end
-- Iterate through the 11 Aim spots
for i=1,11,1 do
local hasItem = false;
-- See if there's a nodeItems[] that has an Aim spot that matches the current loop
-- TODO: Just set nodeItems[] keys to the actual slots to skip this loop inside a loop
for j=1, nodeItemCount do
if nodeItems[j][2] == i then
hasItem = j;
break;
end
end
if hasItem then
local item = harvestNodeItems[ nodeItems[hasItem][1] ];
-- Assign itemId, remainder, sweetspot, yield to this slot
nodeTable[i] = {item[1], item[2], item[4], item[5] };
if debugMsg then
player:SendMessage(0x20, "", "nodeTable: "..i.." "..nodeTable[i][1].." "..nodeTable[i][2].." "..nodeTable[i][3].." "..nodeTable[i][3]);
end
else
nodeTable[i] = {0,0,0,0};
if debugMsg then player:SendMessage(0x20, "", "nodeTable: "..i); end
end
end
return nodeTable
end
end
function SendTutorial(player, harvestJudge, id) function SendTutorial(player, harvestJudge, id)
if id == 1 then if id == 1 then
@ -388,24 +247,4 @@ function SendTutorial(player, harvestJudge, id)
player:SendGameMessage(harvestJudge, 16, MESSAGE_TYPE_SYSTEM); player:SendGameMessage(harvestJudge, 16, MESSAGE_TYPE_SYSTEM);
end end
end
function HarvestReward(player, item, qty) -- Really should get a helper function for this
local worldMaster = GetWorldMaster();
local location = INVENTORY_NORMAL;
local invCheck = player:getItemPackage(location):addItem(item, qty, 1);
if (invCheck == INV_ERROR_FULL) then
-- Your inventory is full.
player:SendGameMessage(player, worldMaster, 60022, MESSAGE_TYPE_SYSTEM_ERROR);
elseif (invCheck == INV_ERROR_ALREADY_HAS_UNIQUE) then
-- You cannot have more than one <itemId> <quality> in your possession at any given time.
player:SendGameMessage(player, worldMaster, 40279, MESSAGE_TYPE_SYSTEM_ERROR, item, 1);
elseif (invCheck == INV_ERROR_SYSTEM_ERROR) then
player:SendMessage(MESSAGE_TYPE_SYSTEM_ERROR, "", "[DEBUG] Server Error on adding item.");
elseif (invCheck == INV_ERROR_SUCCESS) then
--player:SendMessage(MESSAGE_TYPE_SYSTEM, "", message);
player:SendGameMessage(player, worldMaster, 25246, MESSAGE_TYPE_SYSTEM, item, qty);
end
end end

View file

@ -174,7 +174,7 @@ function equipItem(player, equipSlot, item)
if (gItem:IsWeaverWeapon() == true) then graphicSlot = GRAPHICSLOT_SPOFFHAND; end if (gItem:IsWeaverWeapon() == true) then graphicSlot = GRAPHICSLOT_SPOFFHAND; end
if (gItem:IsGoldSmithWeapon() == true) then graphicSlot = GRAPHICSLOT_SPOFFHAND; end if (gItem:IsGoldSmithWeapon() == true) then graphicSlot = GRAPHICSLOT_SPOFFHAND; end
end end
--Graphic Slot was set, otherwise it's a special case --Graphic Slot was set, otherwise it's a special case
if (graphicSlot ~= nil) then if (graphicSlot ~= nil) then
player:GraphicChange(graphicSlot, item); player:GraphicChange(graphicSlot, item);

View file

@ -11,13 +11,13 @@ require("global")
function onEventStarted(player, actor, triggerName, pushCommand, unk1, unk2, unk3, ownerActorId, unk4, unk5, unk6, unk7) function onEventStarted(player, actor, triggerName, pushCommand, unk1, unk2, unk3, ownerActorId, unk4, unk5, unk6, unk7)
actor = player:GetActorInInstance(ownerActorId); actor = player:GetActorInInstance(ownerActorId);
print("TESSSSSSSSSSSSSST");
harvestCommand = GetStaticActorById(0xA0F055F7);
if (actor != nil) then if (actor != nil) then
if (actor:GetActorClassId() == 1200052) then if (actor:GetActorClassId() == 1200052) then
player:kickEvent(actor, "commandJudgeMode", "commandJudgeMode"); player:KickEventSpecial(harvestCommand, 0, "commandJudgeMode", 0, 0, 0, 0, 0x4E26, 0, nil, 0xF, actor, nil, nil, nil, nil);
else else
printf("TEST"); --player:kickEvent(actor, "pushCommand", false);
player:kickEvent(actor, "pushCommand", "pushCommand");
end end
else else
player:endEvent(); player:endEvent();

View file

@ -0,0 +1,30 @@
require("global");
properties = {
permissions = 0,
parameters = "ddd",
description =
[[
Sets anim id for current target
!anim <animID> |
]],
}
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;

View file

@ -46,7 +46,7 @@ function onTrigger(player, argc, item, qty, location, name, lastName)
location = INVENTORY_NORMAL; location = INVENTORY_NORMAL;
end; end;
local invCheck = player:getItemPackage(location):addItem(item, qty, 1); local invCheck = player:getItemPackage(location):addItem(item, qty, 1);
if (invCheck == INV_ERROR_FULL) then if (invCheck == INV_ERROR_FULL) then
-- Your inventory is full. -- Your inventory is full.

View file

@ -18,24 +18,20 @@ function onTrigger(player, argc, slot, wId, eId, vId, cId)
wId = tonumber(wId) or 0; wId = tonumber(wId) or 0;
eId = tonumber(eId) or 0; eId = tonumber(eId) or 0;
vId = tonumber(vId) or 0; vId = tonumber(vId) or 0;
cId = tonumber(cId) or 0; cId = tonumber(cId) or 0;
local actor = GetWorldManager():GetActorInWorld(player.currentTarget) or nil; local actor = GetWorldManager():GetActorInWorld(player.currentTarget) or player;
if player and actor then
if player and argc > 0 then if player and argc > 0 then
if argc > 2 then
-- player.appearanceIds[5] = player.achievementPoints; actor:GraphicChange(slot, wId, eId, vId, cId);
if argc > 2 then player:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot));
actor:GraphicChange(slot, wId, eId, vId, cId); else
--player.achievementPoints = player.achievementPoints + 1; actor:GraphicChange(slot, wId);
actor:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot)); player:SendMessage(messageID, sender, string.format("Changing appearance on slot %u", slot));
actor:SendMessage(messageID, sender, string.format("points %u", player.appearanceIds[5])); end
else actor:SendAppearance();
actor.appearanceIds[slot] = wId; else
end player:SendMessage(messageID, sender, "No parameters sent! Usage: "..properties.description);
actor:SendAppearance(); end;
else
player:SendMessage(messageID, sender, "No parameters sent! Usage: "..properties.description);
end;
end;
end; end;

View file

@ -8,12 +8,12 @@ properties = {
function onTrigger(player) function onTrigger(player)
local pos = player:GetPos(); local pos = player:GetPos();
local x = pos[0]; local x = pos[1];
local y = pos[1]; local y = pos[2];
local z = pos[2]; local z = pos[3];
local rot = pos[3]; local rot = pos[4];
local zone = pos[4]; local zone = pos[5];
local messageID = MESSAGE_TYPE_SYSTEM_ERROR; local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "[mypos] "; local sender = "[mypos] ";
local message = string.format("X:%.3f Y:%.3f Z:%.3f (Rotation: %.3f) Zone:%d", x, y, z, rot, zone); local message = string.format("X:%.3f Y:%.3f Z:%.3f (Rotation: %.3f) Zone:%d", x, y, z, rot, zone);

View file

@ -14,14 +14,7 @@ Sets player or <targetname>'s maximum tp to <tp> and heals them to full.
function onTrigger(player, argc, tp) function onTrigger(player, argc, tp)
local sender = "[setmaxtp] "; local sender = "[setmaxtp] ";
tp = tonumber(tp) or 0;
player:AddTP(tp);
if player then
tp = tonumber(tp) or 0;
location = INVENTORY_CURRENCY;
player:SetTP(tp);
else
print(sender.."unable to add experience, ensure player name is valid.");
end;
end; end;

View file

@ -160,9 +160,9 @@ function onTrigger(player, argc, width, height, blockCount)
for i = 0, w do for i = 0, w do
for j = 0, h do for j = 0, h do
local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true); local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
actor.ChangeNpcAppearance(2200905); --actor.ChangeNpcAppearance(2200905);
actor.SetMaxHP(5000); actor.SetMaxHP(500);
actor.SetHP(5000); actor.SetHP(500);
actor.SetMod(modifiersGlobal.CanBlock, 1); actor.SetMod(modifiersGlobal.CanBlock, 1);
actor.SetMod(modifiersGlobal.AttackRange, 3); actor.SetMod(modifiersGlobal.AttackRange, 3);
actor.SetMod(modifiersGlobal.MovementSpeed, 5); actor.SetMod(modifiersGlobal.MovementSpeed, 5);

View file

@ -52,7 +52,7 @@ function onEventStarted(player, director, triggerName)
wait(6); --Should be wait for mobkill wait(6); --Should be wait for mobkill
worldMaster = GetWorldMaster(); worldMaster = GetWorldMaster();
player:SendDataPacket("attention", worldMaster, "", 51073, 1); attentionMessage(player, 51073, 1);
wait(7); wait(7);
player:ChangeMusic(7); player:ChangeMusic(7);
player:ChangeState(0); player:ChangeState(0);

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_7", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_12", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_9", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,31 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onSpawn(player, npc)
man0l0Quest = player:GetQuest("man0l0");
if (man0l0Quest ~= nil) then
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE3) == false) then
npc:SetQuestGraphic(player, 0x2);
else
npc:SetQuestGraphic(player, 0x0);
end
end
end
function onEventStarted(player, npc, triggerName)
man0l0Quest = player:GetQuest("man0l0");
if (triggerName == "talkDefault") then
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE3) == false) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini003", nil, nil, nil);
npc:SetQuestGraphic(player, 0x0);
man0l0Quest:SetQuestFlag(MAN0L0_FLAG_MINITUT_DONE3, true);
man0l0Quest:SaveData();
player:GetDirector("OpeningDirector"):onTalkEvent(player, npc);
else
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_8", nil, nil, nil);
end
end
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_6", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,49 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onSpawn(player, npc)
man0l0Quest = player:GetQuest("Man0l0");
if (man0l0Quest ~= nil) then
if (man0l0Quest ~= nil and man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE1) == true and man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE2) == true and man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE3) == true) then
player:SetEventStatus(npc, "pushDefault", true, 0x2);
npc:SetQuestGraphic(player, 0x3);
else
player:SetEventStatus(npc, "pushDefault", true, 0x0);
npc:SetQuestGraphic(player, 0x0);
end
end
end
function onEventStarted(player, npc, triggerName)
man0l0Quest = player:GetQuest("Man0l0");
choice = callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEventNewRectAsk", nil);
if (choice == 1) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_2", nil, nil, nil, nil);
player:EndEvent();
man0l0Quest:NextPhase(5);
contentArea = player:GetZone():CreateContentArea(player, "/Area/PrivateArea/Content/PrivateAreaMasterSimpleContent", "man0l01", "SimpleContent30002", "Quest/QuestDirectorMan0l001");
if (contentArea == nil) then
player:EndEvent();
return;
end
director = contentArea:GetContentDirector();
player:AddDirector(director);
director:StartDirector(false);
player:KickEvent(director, "noticeEvent", true);
player:SetLoginDirector(director);
GetWorldManager():DoZoneChangeContent(player, contentArea, -5, 16.35, 6, 0.5, 16);
else
player:EndEvent();
end
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_17", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_14", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,10 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_16", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,10 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_15", nil, nil, nil, nil);
player:EndEvent();
end

View file

@ -1,51 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onSpawn(player, npc)
man0l0Quest = player:GetQuest("Man0l0");
if (man0l0Quest ~= nil) then
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE1) == false) then
npc:SetQuestGraphic(player, 0x2);
end
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_STARTED_TALK_TUT) == true) then
player:SetEventStatus(npc, "pushDefault", false, 0x2);
end
end
end
function onEventStarted(player, npc, triggerName)
man0l0Quest = player:GetQuest("Man0l0");
if (man0l0Quest ~= nil) then
if (triggerName == "pushDefault") then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrNomal002", nil, nil, nil);
elseif (triggerName == "talkDefault") then
--Is doing talk tutorial?
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_STARTED_TALK_TUT) == false) then
player:SetEventStatus(npc, "pushDefault", false, 0x2);
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrNomal003", nil, nil, nil);
man0l0Quest:SetQuestFlag(MAN0L0_FLAG_STARTED_TALK_TUT, true);
npc:SetQuestGraphic(player, 0x2);
man0l0Quest:SaveData();
player:GetDirector("OpeningDirector"):onTalkEvent(player, npc);
--Was he talked to for the mini tutorial?
else
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini001", nil, nil, nil);
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE1) == false) then
npc:SetQuestGraphic(player, 0x0);
man0l0Quest:SetQuestFlag(MAN0L0_FLAG_MINITUT_DONE1, true);
man0l0Quest:SaveData();
player:GetDirector("OpeningDirector"):onTalkEvent(player, npc);
end
end
end
end
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_11", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_5", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_10", nil, nil, nil);
player:EndEvent();
end

View file

@ -1,33 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onSpawn(player, npc)
man0l0Quest = player:GetQuest("man0l0");
if (man0l0Quest ~= nil) then
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE2) == false) then
npc:SetQuestGraphic(player, 0x2);
else
npc:SetQuestGraphic(player, 0x0);
end
end
end
function onEventStarted(player, npc, triggerName)
man0l0Quest = player:GetQuest("man0l0");
if (man0l0Quest ~= nil) then
if (triggerName == "talkDefault") then
if (man0l0Quest:GetQuestFlag(MAN0L0_FLAG_MINITUT_DONE2) == false) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini002", nil, nil, nil);
npc:SetQuestGraphic(player, 0x0);
man0l0Quest:SetQuestFlag(MAN0L0_FLAG_MINITUT_DONE2, true);
man0l0Quest:SaveData();
player:GetDirector("OpeningDirector"):onTalkEvent(player, npc);
else
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_13", nil, nil, nil);
end
end
end
player:EndEvent();
end

View file

@ -1,8 +0,0 @@
require ("global")
require ("quests/man/man0l0")
function onEventStarted(player, npc, triggerName)
man0l0Quest = GetStaticActor("Man0l0");
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processEvent000_4", nil, nil, nil);
player:EndEvent();
end

View file

@ -0,0 +1,7 @@
require ("global")
function onEventStarted(player, npc)
defaultSea = GetStaticActor("DftSea");
callClientFunction(player, "delegateEvent", player, defaultSea, "defaultTalkWithKurtz_001");
player:endEvent();
end