mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-25 17:59:34 +00:00
Remove the refresh argument to CharacterAppearanceSetItem
It's low-level, and there's only 3 callers asking for a refresh
This commit is contained in:
parent
bb36722120
commit
dcc459fa32
6 changed files with 23 additions and 27 deletions
BondageClub
Screens
Character
MiniGame/KinkyDungeon
Online/ChatRoom
Room/Shop2
Scripts
|
@ -125,7 +125,7 @@ function CharacterAppearanceValidate(C) {
|
|||
if (!AssetGroup[A].AllowNone && (CharacterAppearanceGetCurrentValue(C, AssetGroup[A].Name, "Name") == "None"))
|
||||
for (let B = 0; B < Asset.length; B++)
|
||||
if (Asset[B].Group.Name == AssetGroup[A].Name) {
|
||||
CharacterAppearanceSetItem(C, Asset[B].Group.Name, Asset[B], Asset[B].Group.DefaultColor, null, null, false);
|
||||
CharacterAppearanceSetItem(C, Asset[B].Group.Name, Asset[B], Asset[B].Group.DefaultColor);
|
||||
Refresh = true;
|
||||
break;
|
||||
}
|
||||
|
@ -166,11 +166,7 @@ function CharacterAppearanceSetDefault(C) {
|
|||
CharacterAppearanceSetItem(
|
||||
C,
|
||||
CharacterAppearanceAssets[I].Group.Name,
|
||||
CharacterAppearanceAssets[I],
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
CharacterAppearanceAssets[I]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1075,7 +1071,7 @@ function AppearancePreviewBuild(C, buildCanvases) {
|
|||
let PreviewChar = CharacterLoadSimple("AppearancePreview-" + item.Asset.Name);
|
||||
if (buildCanvases) {
|
||||
PreviewChar.Appearance = Array.from(baseAppearance);
|
||||
CharacterAppearanceSetItem(PreviewChar, item.Asset.Group.Name, item.Asset, null, null, null, false);
|
||||
CharacterAppearanceSetItem(PreviewChar, item.Asset.Group.Name, item.Asset);
|
||||
CharacterRefresh(PreviewChar, false);
|
||||
}
|
||||
AppearancePreviews.push(PreviewChar);
|
||||
|
@ -1108,15 +1104,14 @@ function AppearancePreviewUseCharacter(assetGroup) {
|
|||
* Sets an item in the character appearance
|
||||
* @param {Character} C - The character whose appearance should be changed
|
||||
* @param {AssetGroupName} Group - The name of the corresponding groupr for the item
|
||||
* @param {Asset|null} ItemAsset - The asset collection of the item to be changed
|
||||
* @param {Asset|undefined} ItemAsset - The asset collection of the item to be changed
|
||||
* @param {string|string[]} [NewColor] - The new color (as "#xxyyzz" hex value) for that item
|
||||
* @param {number} [DifficultyFactor=0] - The difficulty, on top of the base asset difficulty, that should be assigned
|
||||
* to the item
|
||||
* @param {number} [ItemMemberNumber=-1] - The member number of the player adding the item - defaults to -1
|
||||
* @param {boolean} [Refresh=true] - Determines, wether the character should be redrawn after the item change
|
||||
* @returns {null | Item} - Thew newly created item or `null` if the asset does not exist
|
||||
* @returns {Item | null} - Thew newly created item or `undefined` if the asset does not exist
|
||||
*/
|
||||
function CharacterAppearanceSetItem(C, Group, ItemAsset, NewColor, DifficultyFactor, ItemMemberNumber, Refresh) {
|
||||
function CharacterAppearanceSetItem(C, Group, ItemAsset, NewColor, DifficultyFactor, ItemMemberNumber) {
|
||||
// Sets the difficulty factor
|
||||
if (DifficultyFactor == null) DifficultyFactor = 0;
|
||||
|
||||
|
@ -1132,7 +1127,7 @@ function CharacterAppearanceSetItem(C, Group, ItemAsset, NewColor, DifficultyFac
|
|||
} else if (ItemAsset != null) ItemColor = ItemAsset.DefaultColor ? ItemAsset.DefaultColor : ItemAsset.Group.DefaultColor;
|
||||
|
||||
// Add the new item to the character appearance
|
||||
/** @type {null | Item} */
|
||||
/** @type {Item | null} */
|
||||
let NA = null;
|
||||
if (ItemAsset != null) {
|
||||
/** @type {Item} */
|
||||
|
@ -1145,8 +1140,6 @@ function CharacterAppearanceSetItem(C, Group, ItemAsset, NewColor, DifficultyFac
|
|||
C.Appearance.push(NA);
|
||||
}
|
||||
|
||||
// Draw the character canvas and calculate the effects on the character
|
||||
if (Refresh == null || Refresh) CharacterRefresh(C, false);
|
||||
return NA;
|
||||
}
|
||||
|
||||
|
@ -1362,16 +1355,19 @@ function AppearanceClick() {
|
|||
if (!Group.AllowNone && !AppearancePreviewUseCharacter(Group)) {
|
||||
const asset = CharacterAppearanceNextItem(C, Group.Name, MouseX > 1410);
|
||||
CharacterAppearanceSetItem(C, Group.Name, asset);
|
||||
CharacterRefresh(C);
|
||||
return;
|
||||
}
|
||||
else if (MouseXIn(1210, 65)) {
|
||||
const asset = CharacterAppearanceNextItem(C, Group.Name, false);
|
||||
CharacterAppearanceSetItem(C, Group.Name, asset);
|
||||
CharacterRefresh(C);
|
||||
return;
|
||||
}
|
||||
else if (MouseXIn(1545, 65)) {
|
||||
const asset = CharacterAppearanceNextItem(C, Group.Name, true);
|
||||
CharacterAppearanceSetItem(C, Group.Name, asset);
|
||||
CharacterRefresh(C);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -1491,6 +1487,7 @@ function AppearanceClick() {
|
|||
DialogExtendItem(CurrentItem);
|
||||
} else {
|
||||
CharacterAppearanceSetItem(C, C.FocusGroup.Name, DialogInventory[I].Asset);
|
||||
CharacterRefresh(C);
|
||||
DialogInventoryBuild(C);
|
||||
AppearancePreviewBuild(C, true);
|
||||
AppearanceMenuBuild(C);
|
||||
|
@ -1595,7 +1592,10 @@ function AppearanceMenuClick(C) {
|
|||
}
|
||||
|
||||
// Strips the current item
|
||||
if (Button === "Naked") CharacterAppearanceSetItem(C, C.FocusGroup.Name, null);
|
||||
if (Button === "Naked") {
|
||||
CharacterAppearanceSetItem(C, C.FocusGroup.Name, null);
|
||||
CharacterRefresh(C);
|
||||
}
|
||||
|
||||
// Jumps to the cloth page
|
||||
if (Button === "Next" || Button === "Prev") {
|
||||
|
|
|
@ -338,7 +338,7 @@ function WardrobeFastLoad(C, W, Update) {
|
|||
&& WardrobeGroupAccessible(C, A.Group, { ExcludeNonCloth: true })
|
||||
&& InventoryAvailable(Player, A.Name, A.Group.Name)
|
||||
) {
|
||||
CharacterAppearanceSetItem(C, w.Group, A, w.Color, 0, null, false);
|
||||
CharacterAppearanceSetItem(C, w.Group, A, w.Color, 0);
|
||||
if (w.Property && InventoryGet(C, w.Group)) {
|
||||
var item = InventoryGet(C, w.Group);
|
||||
if (item.Property == null) item.Property = {};
|
||||
|
@ -359,13 +359,12 @@ function WardrobeFastLoad(C, W, Update) {
|
|||
CharacterAppearanceSetItem(
|
||||
C, g.Name,
|
||||
AssetGet(C.AssetFamily, g.Name, mirrorItem.Asset.Name),
|
||||
mirrorItem.Color, null, null, false,
|
||||
mirrorItem.Color
|
||||
);
|
||||
} else {
|
||||
CharacterAppearanceSetItem(
|
||||
C, g.Name,
|
||||
AssetGroupGet(C.AssetFamily, g.Name).Asset[0],
|
||||
null, null, null, false,
|
||||
AssetGroupGet(C.AssetFamily, g.Name)?.Asset[0],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3046,7 +3046,7 @@ function KinkyDungeonAddRestraint(restraint, Tightness, Bypass, Lock, Keep, Link
|
|||
if (asset) {
|
||||
placedOnPlayer = true;
|
||||
const newColor = [...(color || asset.DefaultColor)];
|
||||
CharacterAppearanceSetItem(Player, AssetGroup, asset, newColor, 0, null, false);
|
||||
CharacterAppearanceSetItem(Player, AssetGroup, asset, newColor, 0);
|
||||
KinkyDungeonPlayerNeedsRefresh = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5028,7 +5028,7 @@ function ChatRoomSyncItem(data) {
|
|||
item: if (item) {
|
||||
|
||||
// Puts the item on the character and apply the craft & property
|
||||
const wornItem = CharacterAppearanceSetItem(ChatRoomCharacter[C], item.Asset.Group.Name, item.Asset, item.Color, item.Difficulty, null, false);
|
||||
const wornItem = CharacterAppearanceSetItem(ChatRoomCharacter[C], item.Asset.Group.Name, item.Asset, item.Color, item.Difficulty);
|
||||
if (wornItem == null) {
|
||||
valid = false;
|
||||
break item;
|
||||
|
|
|
@ -1059,10 +1059,7 @@ var Shop2 = {
|
|||
Shop2InitVars.Preview,
|
||||
Shop2Vars.EquippedItem.Asset.Group.Name,
|
||||
Shop2Vars.EquippedItem.Asset,
|
||||
Shop2Vars.EquippedItem.Color,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
Shop2Vars.EquippedItem.Color
|
||||
);
|
||||
if (item) {
|
||||
item.Property = Shop2Vars.EquippedItem.Property;
|
||||
|
|
|
@ -810,7 +810,7 @@ function InventoryWear(C, AssetName, AssetGroup, ItemColor, Difficulty, MemberNu
|
|||
const A = AssetGet(C.AssetFamily, AssetGroup, AssetName);
|
||||
if (!A) return null;
|
||||
const color = (ItemColor == null || ItemColor == "Default") ? [...A.DefaultColor] : ItemColor;
|
||||
const item = CharacterAppearanceSetItem(C, AssetGroup, A, color, Difficulty, MemberNumber, false);
|
||||
const item = CharacterAppearanceSetItem(C, AssetGroup, A, color, Difficulty, MemberNumber);
|
||||
|
||||
/**
|
||||
* TODO: grant tighter control over setting expressions.
|
||||
|
@ -903,7 +903,7 @@ function InventoryWearRandom(C, GroupName, Difficulty, Refresh = true, MustOwn =
|
|||
// Pick a random color for clothes from their schema
|
||||
const SelectedColor = IsClothes ? SelectedAsset.Group.ColorSchema[Math.floor(Math.random() * SelectedAsset.Group.ColorSchema.length)] : null;
|
||||
|
||||
let item = CharacterAppearanceSetItem(C, GroupName, SelectedAsset, SelectedColor, Difficulty, null, false);
|
||||
let item = CharacterAppearanceSetItem(C, GroupName, SelectedAsset, SelectedColor, Difficulty);
|
||||
if (Extend) {
|
||||
item = InventoryRandomExtend(C, GroupName);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue