mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
More documentation on gathering
This commit is contained in:
parent
e030b14bf4
commit
7c144bd05a
@ -6,51 +6,245 @@ Operates the harvesting system for mining, logging, and fishing.
|
|||||||
|
|
||||||
Functions:
|
Functions:
|
||||||
|
|
||||||
loadTextData(commandActor): Loads all gamesheets needed and instantiates a HarvestJudge.
|
loadTextData()
|
||||||
targetCancel(commandActor): Cancels the player's target.
|
Desc: Loads all gamesheets needed and instantiates a HarvestJudge.
|
||||||
turnToTarget(commandActor, harvestType, direction): Turns to a direction (name's a lie, angle must be computed lol)
|
Params: None
|
||||||
openInputWidget(commandActor, harvestType, nodeGrade): Inits the widget system (call first).
|
|
||||||
orderInputWidget(commandActor, nodeHP [max 100], ?, harvestType): Updates the node HP.
|
|
||||||
textInputWidget(commandActor, harvestType, ?, textId, ?, ?, ?): Sets the result text after a minigame is performed.
|
|
||||||
askInputWidget(commandActor, harvestType, inputPageNumber, showTutorial, showFishWait, showFishWaitAndJig, updateFishHP, showRareCatalystEffect): Gets user input after opening a ask widget.
|
|
||||||
closeInputWidget(commandActor, harvestType): Closes the widget system (call last).
|
|
||||||
rangeInputWidget(harvestType, inputPageNumber, goodMin, goodMax, bool): Unknown, currently crashing...
|
|
||||||
|
|
||||||
Notes:
|
targetCancel()
|
||||||
|
Desc: Cancels the player's target.
|
||||||
|
Params: None
|
||||||
|
|
||||||
HarvestType Ids:
|
turnToTarget()
|
||||||
|
Desc: Turns to a direction
|
||||||
|
Params: * harvestType - Harvest command used. Client script has a _waitForTurning() for Quarry/Harvest/Spearfishing
|
||||||
|
* direction - The pi radian to turn the character towards, server has to calculate the vector between the actors.
|
||||||
|
|
||||||
20002: Mine
|
openInputWidget()
|
||||||
20003: Log
|
Desc: Inits the widget system (call first).
|
||||||
20004: Fish
|
Params: * harvestType - Determines which text strings to load based on the harvestType
|
||||||
|
* nodeGrade - The grade of the node. Retail went up to grade 5.
|
||||||
|
|
||||||
|
orderInputWidget()
|
||||||
|
Desc: Updates the node HP.
|
||||||
|
Params: * nodeRemainder - Range goes from 0-100
|
||||||
|
* unk1 -
|
||||||
|
* harvestType - Doesn't appear to visually do anything? Script checks against harvest command id
|
||||||
|
|
||||||
|
textInputWidget()
|
||||||
|
Desc: Sets the result text after a minigame is performed.
|
||||||
|
Params: * harvestType - The harvest command
|
||||||
|
* unk1 - Actor to grab text from? Set to the harvestJudge so the rest of params function, otherwise widget prints whatever is set here.
|
||||||
|
* textId - Id from the harvestJudge sheet.
|
||||||
|
* textIdParam1 - Used to fill in textId details if the sheet requires it, Eg. textId #25 requires an itemId, HQ quality, and yield filled in.
|
||||||
|
* textIdParam2
|
||||||
|
* textIdParam3
|
||||||
|
* commandId - If textId = nil, client script sets it to 64 and this parameter is assigned to Param1
|
||||||
|
- Why does this exist? Setting textId to 64 and using commandId as textIdParam1 does the same job.
|
||||||
|
|
||||||
|
askInputWidget()
|
||||||
|
Desc: Gets user input after opening a ask widget. Returns two values, one being the id of the chosen command, and the "currentPower" of the minigame.
|
||||||
|
Params: * harvestType - The harvest command
|
||||||
|
* phase - The current minigame window to show. Valid ids 1 & 2.
|
||||||
|
* showTutorial - Shows Tutorial menu option in the window if not = 0.
|
||||||
|
* showFishWait -
|
||||||
|
* showFishWaitAndJig -
|
||||||
|
* updateFishHP -
|
||||||
|
* showRareCatalystEffect-
|
||||||
|
|
||||||
|
closeInputWidget()
|
||||||
|
Desc: Closes the widget system (call last).
|
||||||
|
Params: * harvestType - The harvest command
|
||||||
|
|
||||||
|
rangeInputWidget()
|
||||||
|
Desc: Unknown, currently errors the client...
|
||||||
|
Params: * harvestType
|
||||||
|
* phase
|
||||||
|
* goodMin
|
||||||
|
* goodMax
|
||||||
|
* bool
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
minerAnim = {0x14001000, 0x14002000, 0x14003000};
|
||||||
|
|
||||||
|
--[[Mooglebox - Aim
|
||||||
|
+5 = 0
|
||||||
|
+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
|
||||||
|
remainder A=40 B=60 C=70 D=80
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
nodeContainer = { -- harvestAttempts, #ofItemsBecauseLuaIsShitAtTableLength, Item1, Item2, etc
|
||||||
|
[1] = {4, 3, 1, 2, 3}
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeItems = {
|
||||||
|
--itemId, remainder, aim, sweetspot, max yield
|
||||||
|
[1] = {10009104, 70, 30, 30, 4}, -- Rock Salt
|
||||||
|
[2] = {10006001, 80, 10, 30, 4}, -- Bone Chip
|
||||||
|
[3] = {10001006, 80, 20, 30, 3} -- Copper Ore
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
require ("global")
|
require ("global")
|
||||||
|
|
||||||
function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId)
|
function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg4, checkedActorId)
|
||||||
|
|
||||||
|
debugMsg = false;
|
||||||
|
|
||||||
|
commandMine = 22002;
|
||||||
|
commandLog = 22003;
|
||||||
|
commandFish = 22004;
|
||||||
|
remainderA, remainderB, remainderC, remainderD = 40, 60, 70, 80;
|
||||||
|
|
||||||
|
|
||||||
|
currentPower = 0;
|
||||||
|
nodeGrade = 3;
|
||||||
|
showTutorial = 0;
|
||||||
|
harvestAttempts = 2;
|
||||||
|
nodeRemainder = remainderC;
|
||||||
|
item = 10001006;
|
||||||
|
|
||||||
|
harvestType = commandMine;
|
||||||
|
|
||||||
|
worldMaster = GetWorldMaster();
|
||||||
harvestJudge = GetStaticActor("HarvestJudge");
|
harvestJudge = GetStaticActor("HarvestJudge");
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "loadTextData", commandactor);
|
callClientFunction(player, "delegateCommand", harvestJudge, "loadTextData", commandActor);
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "targetCancel", commandactor);
|
--callClientFunction(player, "delegateCommand", harvestJudge, "targetCancel", commandActor);
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "turnToTarget", commandactor, 0x55F2, 2);
|
--callClientFunction(player, "delegateCommand", harvestJudge, "turnToTarget", commandActor, harvestType, nodeGrade);
|
||||||
|
|
||||||
player:ChangeState(50);
|
player:ChangeState(50);
|
||||||
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "openInputWidget", commandactor, 0x55F2, 2);
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandactor, 3, false, 0x55f2);
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandactor, 0x55f2, harvestJudge, nil, nil, nil, nil, 0);
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandactor, 0x55f2, 1, 0, false, false, nil, false);
|
|
||||||
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandactor, 0x55f2, harvestJudge, 60, nil, nil, nil, 0);
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandactor, 0x55f2, 2, 0, false, false, nil, false);
|
|
||||||
|
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandactor, 0x55f2, harvestJudge, 46,0, 0, 0, 0);
|
if harvestType == commandMine then
|
||||||
callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandactor, 0x55f2, 2, 0, false, false, nil, false);
|
player:SendGameMessage(harvestJudge, 26, MESSAGE_TYPE_SYSTEM, 1, nodeGrade);
|
||||||
|
|
||||||
|
callClientFunction(player, "delegateCommand", harvestJudge, "openInputWidget", commandActor, harvestType, nodeGrade);
|
||||||
|
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType);
|
||||||
|
callClientFunction(player, "delegateCommand", harvestJudge, "textInputWidget", commandActor, harvestType, harvestJudge, nil, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while harvestAttempts > 0 do
|
||||||
|
|
||||||
|
-- "Aim", 0 = Top of bar, 100 = Bottom. Mooglebox conversion is +5 = 0, 0 = 50, -5 = 100
|
||||||
|
menuResult, sliderPhase, ret3 = callClientFunction(player, "delegateCommand", harvestJudge, "askInputWidget", commandActor, harvestType, 1, showTutorial, false, false, nil, false);
|
||||||
|
|
||||||
|
if debugMsg then player:SendMessage(0x20, "", tostring(menuResult).." unk: "..tostring(sliderPhase).." unk: "..tostring(ret3)); end
|
||||||
|
|
||||||
|
if menuResult == 22701 then -- Begin.
|
||||||
|
player:SendGameMessage(harvestJudge, 36, MESSAGE_TYPE_SYSTEM);
|
||||||
|
nodeRemainder = remainderC;
|
||||||
|
callClientFunction(player, "delegateCommand", harvestJudge, "orderInputWidget", commandActor, nodeRemainder, nil, harvestType);
|
||||||
|
|
||||||
|
while true do
|
||||||
|
|
||||||
|
-- "Strike" 0 = Empty, 100 = Filled. Mooglebox sweespots are 1=10, 2=30, 3=70, 4=100 for Mining
|
||||||
|
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(currentPower)); end
|
||||||
|
|
||||||
|
|
||||||
|
if chosenCommand == 22702 then -- Cancel.
|
||||||
|
harvestAttempts = harvestAttempts - 1;
|
||||||
|
|
||||||
|
if harvestAttempts > 0 then
|
||||||
|
-- You can make # more gathering attempts.
|
||||||
|
player:SendGameMessage(player, worldMaster, 40344, 0x20, harvestAttempts);
|
||||||
|
else
|
||||||
|
-- There is nothing left to gather at this location.
|
||||||
|
player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts);
|
||||||
|
end
|
||||||
|
break;
|
||||||
|
elseif chosenCommand == 22703 then -- Strike.
|
||||||
|
|
||||||
|
player:PlayAnimation(minerAnim[math.random(1,3)]);
|
||||||
|
|
||||||
|
nodeRemainder = nodeRemainder - 20;
|
||||||
|
if nodeRemainder < 0 then
|
||||||
|
nodeRemainder = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--player:SendGameMessage(harvestJudge, 25, MESSAGE_TYPE_SYSTEM, item, 4, 1);
|
||||||
|
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
|
||||||
|
harvestAttempts = harvestAttempts - 1;
|
||||||
|
|
||||||
|
if harvestAttempts > 0 then
|
||||||
|
-- You can make # more gathering attempts.
|
||||||
|
player:SendGameMessage(player, worldMaster, 40344, 0x20, harvestAttempts);
|
||||||
|
else
|
||||||
|
-- There is nothing left to gather at this location.
|
||||||
|
player:SendGameMessage(player, worldMaster, 40339, 0x20, harvestAttempts);
|
||||||
|
end
|
||||||
|
|
||||||
|
wait(2);
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif chosenCommand == 22710 then -- "Strike" Tutorial.
|
||||||
|
SendTutorial(player, harvestJudge, 2);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif menuResult == 22702 then -- Cancel.
|
||||||
|
break;
|
||||||
|
elseif menuResult == 22710 then -- "Aim" Tutorial.
|
||||||
|
SendTutorial(player, harvestJudge, 1);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif harvestType == commandLog then
|
||||||
|
|
||||||
|
elseif harvestType == commandFish then
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if harvestAttempts == 0 then
|
||||||
|
player:SendGameMessage(harvestJudge, 31, MESSAGE_TYPE_SYSTEM);
|
||||||
|
end
|
||||||
|
|
||||||
|
callClientFunction(player, "delegateCommand", harvestJudge, "closeInputWidget", commandActor, harvestType);
|
||||||
|
|
||||||
|
|
||||||
player:ChangeState(0);
|
player:ChangeState(0);
|
||||||
|
|
||||||
player:EndEvent();
|
player:EndEvent();
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SendTutorial(player, harvestJudge, id)
|
||||||
|
|
||||||
|
if id == 1 then
|
||||||
|
player:SendGameMessage(harvestJudge, 1, MESSAGE_TYPE_SYSTEM);
|
||||||
|
wait(3);
|
||||||
|
player:SendGameMessage(harvestJudge, 4, MESSAGE_TYPE_SYSTEM);
|
||||||
|
elseif id == 2 then
|
||||||
|
player:SendGameMessage(harvestJudge, 7, MESSAGE_TYPE_SYSTEM);
|
||||||
|
wait(3);
|
||||||
|
player:SendGameMessage(harvestJudge, 10, MESSAGE_TYPE_SYSTEM);
|
||||||
|
wait(3);
|
||||||
|
player:SendGameMessage(harvestJudge, 13, MESSAGE_TYPE_SYSTEM);
|
||||||
|
wait(3);
|
||||||
|
player:SendGameMessage(harvestJudge, 16, MESSAGE_TYPE_SYSTEM);
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user