More Crafting Scripts (WIP)

More Crafting Scripts (WIP)
This commit is contained in:
Ben987 2022-05-30 22:56:46 -04:00
parent b63a67cb02
commit b55cd6f629
5 changed files with 86 additions and 8 deletions
BondageClub
Icons
Screens
Character/Player
Room/Crafting
Scripts

Binary file not shown.

After

(image error) Size: 9.4 KiB

View file

@ -79,6 +79,7 @@ SelectItem,,,Select an item to use.,,
SelectItemGroup,,,Select an item to use on the GroupName.,,
SelectActivity,,,Select an activity.,,
SelectActivityGroup,,,Select an activity to use on the GroupName.,,
CraftedItemProperties,,,Crafted item properties.,,
CannotUseOnSelf,,,Cannot use on yourself.,,
RequireSelfBondage1,,,Requires self-bondage 1.,,
RequireSelfBondage2,,,Requires self-bondage 2.,,
@ -131,6 +132,10 @@ Cancel,,,Cancel,,
Exit,,,Back to character,,
Next,,,View next items,,
Prev,,,View previous items,,
Crafting,,,Crafted properties,,
CraftingMember,,,Crafter: MemberName (MemberNumber),,
CraftingName,,,Item name: CraftName,,
CraftingDescription,,,Description: CraftDescription,,
NextPage,,,View next page,,
PrevPage,,,View previous page,,
Remove,,,Remove the item,,
@ -146,6 +151,7 @@ Unlock,,,Unlock the item,,
PickLock,,,Try to pick the lock,,
PickLockJammed,,,Try to pick the lock (jammed),,
LockCancel,,,Return to the item menu,,
CraftingCancel,,,Return to the item menu,,
InspectLock,,,Inspect the lock,,
InspectLockDisabled,,,Unable to inspect due to player permissions,,
Remote,,,Use your remote,,

1 PlayerGagged (You can use or remove items by selecting specific body regions on yourself.)
79 SelectItemGroup Select an item to use on the GroupName.
80 SelectActivity Select an activity.
81 SelectActivityGroup Select an activity to use on the GroupName.
82 CraftedItemProperties Crafted item properties.
83 CannotUseOnSelf Cannot use on yourself.
84 RequireSelfBondage1 Requires self-bondage 1.
85 RequireSelfBondage2 Requires self-bondage 2.
132 Exit Back to character
133 Next View next items
134 Prev View previous items
135 Crafting Crafted properties
136 CraftingMember Crafter: MemberName (MemberNumber)
137 CraftingName Item name: CraftName
138 CraftingDescription Description: CraftDescription
139 NextPage View next page
140 PrevPage View previous page
141 Remove Remove the item
151 PickLock Try to pick the lock
152 PickLockJammed Try to pick the lock (jammed)
153 LockCancel Return to the item menu
154 CraftingCancel Return to the item menu
155 InspectLock Inspect the lock
156 InspectLockDisabled Unable to inspect due to player permissions
157 Remote Use your remote

View file

@ -11,7 +11,7 @@ SelectLock,Select a lock to use with your PropertyName AssetDescription.
SelectName,Enter a name and description for your PropertyName AssetDescription.
EnterName,Name of the crafted item
EnterDescription,Engrave a description
EnterColor,Color schema (Experimental)
EnterColor,Color schema (Use commas to split colors)
EmptySlot,Empty
PropertyNormal,Normal
PropertyLarge,Large

1 Exit Return to the main hall
11 SelectName Enter a name and description for your PropertyName AssetDescription.
12 EnterName Name of the crafted item
13 EnterDescription Engrave a description
14 EnterColor Color schema (Experimental) Color schema (Use commas to split colors)
15 EmptySlot Empty
16 PropertyNormal Normal
17 PropertyLarge Large

View file

@ -48,6 +48,7 @@ var DialogSortOrder = {
var DialogSelfMenuSelected = null;
var DialogLeaveDueToItem = false; // This allows dynamic items to call DialogLeave() without crashing the game
var DialogLockMenu = false;
var DialogCraftingMenu = false;
var DialogLentLockpicks = false;
var DialogGamingPreviousRoom = "";
var DialogGamingPreviousModule = "";
@ -632,6 +633,7 @@ function DialogLeaveItemMenu(resetPermissionsMode = true) {
DialogInventory = null;
StruggleProgress = -1;
DialogLockMenu = false;
DialogCraftingMenu = false;
StruggleLockPickOrder = null;
DialogColor = null;
DialogMenuButton = [];
@ -932,7 +934,12 @@ function DialogMenuButtonBuild(C) {
DialogMenuButton.push(LockBlockedOrLimited ? "InspectLockDisabled" : "InspectLock");
}
} else if (DialogCraftingMenu) {
DialogMenuButton.push("CraftingCancel");
} else {
if ((DialogInventory != null) && (DialogInventory.length > 12) && ((Player.CanInteract() && !IsGroupBlocked) || DialogItemPermissionMode)) {
DialogMenuButton.push("Next");
DialogMenuButton.push("Prev");
@ -951,9 +958,13 @@ function DialogMenuButtonBuild(C) {
&& (Item.Property != null) && (Item.Property.LockedBy != null) && (Item.Property.LockedBy != "")) {
DialogMenuButton.push("LockMenu");
}
if ((Item != null) && (C.ID == 0) && (!Player.CanInteract() || (IsItemLocked && !DialogCanUnlock(C, Item))) && (DialogMenuButton.indexOf("Unlock") < 0) && InventoryAllow(C, Item.Asset) && !IsGroupBlocked)
DialogMenuButton.push("Struggle");
if ((Item != null) && (Item.Craft != null))
DialogMenuButton.push("Crafting");
// If the Asylum GGTS controls the item, we show a disabled button and hide the other buttons
if (AsylumGGTSControlItem(C, Item)) {
DialogMenuButton.push("GGTSControl");
@ -1411,7 +1422,6 @@ function DialogMenuButtonClick() {
return;
}
// When the user cancels out of lock menu, we recall the original color
else if (Item && DialogMenuButton[I] == "LockCancel") {
DialogLockMenu = false;
@ -1419,13 +1429,27 @@ function DialogMenuButtonClick() {
DialogMenuButtonBuild(C);
return;
}
// When the user selects the lock menu, we enter
else if (Item && DialogMenuButton[I] == "LockMenu") {
DialogLockMenu = true;
DialogMenuButtonBuild(C);
return;
}
// When the user selects the lock menu, we enter
else if (Item && DialogMenuButton[I] == "Crafting") {
DialogCraftingMenu = true;
DialogMenuButtonBuild(C);
return;
}
// When the user cancels out of lock menu, we recall the original color
else if (Item && DialogMenuButton[I] == "CraftingCancel") {
DialogCraftingMenu = false;
DialogMenuButtonBuild(C);
return;
}
// When the user wants to select a sexual activity to perform
else if (DialogMenuButton[I] == "Activity") {
@ -1717,7 +1741,7 @@ function DialogClick() {
if ((MouseX >= 1000) && (MouseX < 2000) && (MouseY >= 15) && (MouseY <= 105)) DialogMenuButtonClick();
// If the user clicks on one of the items
if ((MouseX >= 1000) && (MouseX <= 1975) && (MouseY >= 125) && (MouseY <= 1000) && ((DialogItemPermissionMode && (Player.FocusGroup != null)) || (Player.CanInteract() && !InventoryGroupIsBlocked(C, null, true))) && (StruggleProgress < 0 && !StruggleLockPickOrder) && (DialogColor == null)) {
if ((MouseX >= 1000) && (MouseX <= 1975) && (MouseY >= 125) && (MouseY <= 1000) && !DialogCraftingMenu && ((DialogItemPermissionMode && (Player.FocusGroup != null)) || (Player.CanInteract() && !InventoryGroupIsBlocked(C, null, true))) && (StruggleProgress < 0 && !StruggleLockPickOrder) && (DialogColor == null)) {
// For each items in the player inventory
let X = 1000;
let Y = 125;
@ -1898,6 +1922,7 @@ function DialogExtendItem(Item, SourceItem) {
StruggleProgress = -1;
StruggleLockPickOrder = null;
DialogLockMenu = false;
DialogCraftingMenu = false;
DialogColor = null;
DialogFocusItem = Item;
DialogFocusSourceItem = SourceItem;
@ -2009,6 +2034,23 @@ function DialogIsMenuButtonDisabled(ButtonName) {
return DialogButtonDisabledTester.test(ButtonName);
}
/**
* Draw the item menu dialog
* @param {Character} C - The character on which the item is used
* @param {Object} Item - The item that was used
* @returns {void} - Nothing
*/
function DialogDrawCrafting(C, Item) {
if ((C == null) || (Item == null) || (Item.Craft == null)) return;
DrawTextWrap(DialogFind(Player, "CraftedItemProperties"), 1000, 0, 975 - DialogMenuButton.length * 110, 125, "White", null, 3);
if ((Item.Craft.MemberName != null) && (Item.Craft.MemberNumber != null))
DrawTextWrap(DialogFind(Player, "CraftingMember").replace("MemberName", Item.Craft.MemberName).replace("MemberNumber", Item.Craft.MemberNumber.toString()), 1050, 250, 900, 125, "White", null, 3);
if (Item.Craft.Name != null)
DrawTextWrap(DialogFind(Player, "CraftingName").replace("CraftName", Item.Craft.Name), 1050, 500, 900, 125, "White", null, 3);
if (Item.Craft.Description != null)
DrawTextWrap(DialogFind(Player, "CraftingDescription").replace("CraftDescription", Item.Craft.Description), 1050, 750, 900, 125, "White", null, 3);
}
/**
* Draw the item menu dialog
* @param {Character} C - The character for whom the activity selection dialog is drawn. That can be the player or another character.
@ -2017,10 +2059,7 @@ function DialogIsMenuButtonDisabled(ButtonName) {
function DialogDrawItemMenu(C) {
const FocusItem = InventoryGet(C, C.FocusGroup.Name);
if (DialogColor != null && FocusItem) {
return ItemColorDraw(C, C.FocusGroup.Name, 1200, 25, 775, 950, true);
}
if (DialogColor != null && FocusItem) return ItemColorDraw(C, C.FocusGroup.Name, 1200, 25, 775, 950, true);
// Gets the default text that will reset after 5 seconds
if (DialogTextDefault == "") DialogTextDefault = DialogFindPlayer("SelectItemGroup").replace("GroupName", C.FocusGroup.Description.toLowerCase());
@ -2028,7 +2067,7 @@ function DialogDrawItemMenu(C) {
// Draws the top menu text & icons
if (DialogMenuButton.length === 0) DialogMenuButtonBuild(CharacterGetCurrent());
if ((DialogColor == null) && Player.CanInteract() && (StruggleProgress < 0 && !StruggleLockPickOrder) && !InventoryGroupIsBlocked(C) && DialogMenuButton.length < 8) DrawTextWrap((!DialogItemPermissionMode) ? DialogText : DialogFind(Player, "DialogPermissionMode"), 1000, 0, 975 - DialogMenuButton.length * 110, 125, "White", null, 3);
if ((DialogColor == null) && Player.CanInteract() && (StruggleProgress < 0 && !StruggleLockPickOrder) && !DialogCraftingMenu && !InventoryGroupIsBlocked(C) && DialogMenuButton.length < 8) DrawTextWrap((!DialogItemPermissionMode) ? DialogText : DialogFind(Player, "DialogPermissionMode"), 1000, 0, 975 - DialogMenuButton.length * 110, 125, "White", null, 3);
for (let I = DialogMenuButton.length - 1; I >= 0; I--) {
const ButtonColor = DialogGetMenuButtonColor(DialogMenuButton[I]);
const ButtonImage = DialogGetMenuButtonImage(DialogMenuButton[I], FocusItem);
@ -2037,6 +2076,9 @@ function DialogDrawItemMenu(C) {
DrawButton(1885 - I * 110, 15, 90, 90, "", ButtonColor, "Icons/" + ButtonImage + ".png", ButtonHoverText, ButtonDisabled);
}
// Draws the crafting properties control
if (DialogCraftingMenu && (FocusItem != null) && (FocusItem.Craft != null)) return DialogDrawCrafting(C, FocusItem);
// Draws the color picker
if (!FocusItem && DialogColor != null) {
ElementPosition("InputColor", 1450, 65, 300);

View file

@ -184,7 +184,36 @@ function StruggleProgressAutoDraw(C, Offset) {
}
}
// Applies crafted properties to the item used
function StruggleApplyCraft(C, GroupName, Craft) {
// Gets the item first
let Item = InventoryGet(C, GroupName);
if (Item == null) return;
// Applies the color schema, separated by commas
if ((Craft.Color != null) && (Craft.Color.indexOf(",") > 0)) {
Item.Color = Craft.Color.replace(" ", "").split(",");
for (let C of Item.Color)
if (CommonIsColor(C) == false)
C = "default";
}
// Applies a lock to the item
if ((Craft.Lock != null) && (Craft.Lock != ""))
InventoryLock(C, Item, Craft.Lock, C.MemberNumber, false);
// Sets the crafter name and ID
Item.Craft.MemberNumber = C.MemberNumber;
Item.Craft.MemberName = CharacterNickname(C);
// Refreshes the character
CharacterRefresh(C, true);
}
function StruggleProgressCheckEnd(C) {
// If the operation is completed
if (StruggleProgress >= 100) {
@ -197,6 +226,7 @@ function StruggleProgressCheckEnd(C) {
let Color = (DialogColorSelect == null) ? "Default" : DialogColorSelect;
if ((StruggleProgressNextItem.Craft != null) && CommonIsColor(StruggleProgressNextItem.Craft.Color)) Color = StruggleProgressNextItem.Craft.Color;
InventoryWear(C, StruggleProgressNextItem.Asset.Name, StruggleProgressNextItem.Asset.Group.Name, Color, SkillGetWithRatio("Bondage"), Player.MemberNumber, StruggleProgressNextItem.Craft);
if (StruggleProgressNextItem.Craft != null) StruggleApplyCraft(C, StruggleProgressNextItem.Asset.Group.Name, StruggleProgressNextItem.Craft);
}
// The player can use another item right away, for another character we jump back to her reaction