mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-24 05:37:46 +00:00
More cleanup of the craft command
This commit is contained in:
parent
6d66f6aae3
commit
9a47f47698
1 changed files with 12 additions and 8 deletions
|
@ -160,7 +160,7 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
local MENU_CANCEL, MENU_MAINHAND, MENU_OFFHAND, MENU_REQUEST = 0, 1, 2, 3;
|
local 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;
|
local MENU_RECENT, MENU_AWARDED, MENU_RECENT_DETAILED, MENU_AWARDED_DETAILED = 7, 8, 9, 10;
|
||||||
|
|
||||||
local debugMessage = false;
|
local debugMessage = true;
|
||||||
|
|
||||||
local isRecipeRecentSent = false;
|
local isRecipeRecentSent = false;
|
||||||
local isRecipeAwardSent = false;
|
local isRecipeAwardSent = false;
|
||||||
|
@ -169,8 +169,8 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
local recipeResolver = GetRecipeResolver();
|
local recipeResolver = GetRecipeResolver();
|
||||||
|
|
||||||
local operationResult;
|
local operationResult;
|
||||||
local operationMode;
|
local operationMode = -1;
|
||||||
local recipeMode;
|
local recipeMode = -1;
|
||||||
local chosenMaterials;
|
local chosenMaterials;
|
||||||
|
|
||||||
local facilityId = 0;
|
local facilityId = 0;
|
||||||
|
@ -187,8 +187,6 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
|
|
||||||
while operationMode ~= 0 do
|
while operationMode ~= 0 do
|
||||||
|
|
||||||
if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Menu ID: "..tostring(operationMode).." Recipe : "..tostring(recipeMode).." Quest : "..chosenQuest); end
|
|
||||||
|
|
||||||
-- Operate the start crafting window... confusing shit
|
-- Operate the start crafting window... confusing shit
|
||||||
if (craftStartWidgetOpen == false) then
|
if (craftStartWidgetOpen == false) then
|
||||||
-- Shows the initial window
|
-- Shows the initial window
|
||||||
|
@ -198,13 +196,13 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
end
|
end
|
||||||
operationResult = {callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, facilityId, isRequestedItemsMode, unpack(startMats))};
|
operationResult = {callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, facilityId, isRequestedItemsMode, unpack(startMats))};
|
||||||
craftStartWidgetOpen = true;
|
craftStartWidgetOpen = true;
|
||||||
elseif ((operationMode == MENU_RECENT or operationMode == MENU_AWARDED) and chosenOperation[2] != 0) then
|
elseif ((operationMode == MENU_RECENT or operationMode == MENU_AWARDED) and recipeMode != 0) then
|
||||||
local prepedMaterials;
|
local prepedMaterials;
|
||||||
-- Recent Recipes/Awarded Recipes
|
-- Recent Recipes/Awarded Recipes
|
||||||
if (operationMode == MENU_RECENT) then
|
if (operationMode == MENU_RECENT) then
|
||||||
prepedMaterials = recipeResolver.RecipeToMatIdTable(recentRecipes[chosenOperation[2]]);
|
prepedMaterials = recipeResolver.RecipeToMatIdTable(recentRecipes[recipeMode]);
|
||||||
else
|
else
|
||||||
prepedMaterials = recipeResolver.RecipeToMatIdTable(awardedRecipes[chosenOperation[2]]);
|
prepedMaterials = recipeResolver.RecipeToMatIdTable(awardedRecipes[recipeMode]);
|
||||||
end
|
end
|
||||||
-- Causes the item info window to appear for recent/awarded recipes. Only happens if a recipe was chosen.
|
-- Causes the item info window to appear for recent/awarded recipes. Only happens if a recipe was chosen.
|
||||||
operationResult = {callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -2, isRequestedItemsMode, unpack(prepedMaterials))};
|
operationResult = {callClientFunction(player, "delegateCommand", craftJudge, "start", commandactor, -2, isRequestedItemsMode, unpack(prepedMaterials))};
|
||||||
|
@ -216,6 +214,8 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
operationMode = operationResult[1];
|
operationMode = operationResult[1];
|
||||||
recipeMode = operationResult[2];
|
recipeMode = operationResult[2];
|
||||||
|
|
||||||
|
if debugMessage then player:SendMessage(0x20, "", "[DEBUG] Menu ID: " .. tostring(operationMode) .. ", RecipeMode : " .. recipeMode); end
|
||||||
|
|
||||||
-- Operation
|
-- Operation
|
||||||
if operationMode == MENU_CANCEL then
|
if operationMode == MENU_CANCEL then
|
||||||
closeCraftStartWidget(player, craftJudge, commandactor);
|
closeCraftStartWidget(player, craftJudge, commandactor);
|
||||||
|
@ -276,6 +276,8 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
closeCraftStartWidget(player, craftJudge, commandactor);
|
closeCraftStartWidget(player, craftJudge, commandactor);
|
||||||
isRecipeRecentSent = false;
|
isRecipeRecentSent = false;
|
||||||
isRecipeAwardSent = false;
|
isRecipeAwardSent = false;
|
||||||
|
|
||||||
|
-- CRAFTING STARTED
|
||||||
currentlyCrafting = startCrafting(player, commandactor, craftJudge, operationMode, chosenRecipe, currentCraftQuestGuildleve, 80, 100, 50);
|
currentlyCrafting = startCrafting(player, commandactor, craftJudge, operationMode, chosenRecipe, currentCraftQuestGuildleve, 80, 100, 50);
|
||||||
|
|
||||||
--Once crafting is over, return to the original non-quest state.
|
--Once crafting is over, return to the original non-quest state.
|
||||||
|
@ -334,6 +336,8 @@ function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg
|
||||||
chosenRecipe.crystalQuantity2,
|
chosenRecipe.crystalQuantity2,
|
||||||
0,
|
0,
|
||||||
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
|
if (recipeConfirmed) then
|
||||||
closeCraftStartWidget(player, craftJudge, commandactor);
|
closeCraftStartWidget(player, craftJudge, commandactor);
|
||||||
isRecipeRecentSent = false;
|
isRecipeRecentSent = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue