Skip to content

Commit 73da252

Browse files
committed
update: hotkeys and bags handling for DragAndDrop_HandleDrop
- Required logic update after fixes for item's icon handling. - (bags seriously need a big refactor): replaced direct packet store (buggy) and slider (never been coded properly) for at least, a simple and functional YesNo Prompt that stores whole item stacks from inventory. - HotbarItem case returns false (required so items don't go invisible when placing them to hotbars). - SpellItem to Hotbar case returns false (required so spells don't go invisible when placing them to hotbars).
1 parent 44c1a0a commit 73da252

4 files changed

Lines changed: 14 additions & 20 deletions

File tree

Intersect.Client.Core/Entities/Player.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,41 +1121,32 @@ public void TryStoreItemInBag(int inventorySlotIndex, int bagSlotIndex)
11211121
}
11221122

11231123
var quantity = inventorySlot.Quantity;
1124-
var maxQuantity = quantity;
1125-
1126-
if (maxQuantity < 2)
1127-
{
1128-
PacketSender.SendStoreBagItem(inventorySlotIndex, 1, bagSlotIndex);
1129-
return;
1130-
}
11311124

11321125
_ = new InputBox(
11331126
title: Strings.Bags.StoreItem,
11341127
prompt: Strings.Bags.StoreItemPrompt.ToString(itemDescriptor.Name),
1135-
inputType: InputType.NumericSliderInput,
1128+
inputType: InputType.YesNo,
11361129
quantity: quantity,
1137-
maximumQuantity: maxQuantity,
1138-
userData: new Tuple<int, int>(inventorySlotIndex, bagSlotIndex),
1130+
userData: new Tuple<int, int, int>(inventorySlotIndex, bagSlotIndex, quantity),
11391131
onSubmit: TryStoreItemInBagOnSubmit
11401132
);
11411133
}
11421134

11431135
private static void TryStoreItemInBagOnSubmit(Base sender, InputSubmissionEventArgs args)
11441136
{
1145-
if (sender is not InputBox { UserData: (int inventorySlotIndex, int bagSlotIndex) })
1137+
if (sender is not InputBox { UserData: (int inventorySlotIndex, int bagSlotIndex, int quantity) })
11461138
{
11471139
return;
11481140
}
11491141

1150-
if (args.Value is not NumericalSubmissionValue submissionValue)
1142+
if (args.Value is not BooleanSubmissionValue submissionValue)
11511143
{
11521144
return;
11531145
}
11541146

1155-
var value = (int)Math.Round(submissionValue.Value);
1156-
if (value > 0)
1147+
if (submissionValue.Value)
11571148
{
1158-
PacketSender.SendStoreBagItem(inventorySlotIndex, value, bagSlotIndex);
1149+
PacketSender.SendStoreBagItem(inventorySlotIndex, quantity, bagSlotIndex);
11591150
}
11601151
}
11611152

Intersect.Client.Core/Interface/Game/Inventory/InventoryItem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
421421

422422
case BagItem bagItem:
423423
player.TryStoreItemInBag(SlotIndex, bagItem.SlotIndex);
424-
return true;
424+
return false;
425425

426426
case BankItem bankItem:
427427
return player.TryStoreItemInBank(
@@ -433,11 +433,11 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
433433

434434
case HotbarItem hotbarItem:
435435
player.AddToHotbar(hotbarItem.SlotIndex, 0, SlotIndex);
436-
return true;
436+
return false;
437437

438438
case ShopWindow:
439439
player.TrySellItem(SlotIndex);
440-
return true;
440+
return false;
441441

442442
default:
443443
targetNode = targetNode.Parent;

Intersect.Client.Core/Interface/Game/Spells/SpellItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
173173

174174
case HotbarItem hotbarItem:
175175
player.AddToHotbar(hotbarItem.SlotIndex, 1, SlotIndex);
176-
return true;
176+
return false;
177177

178178
default:
179179
targetNode = targetNode.Parent;

Intersect.Client.Core/Localization/Strings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,10 @@ public partial struct Bags
541541
public static LocalizedString StoreItem = @"Store Item";
542542

543543
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
544-
public static LocalizedString StoreItemPrompt = @"How many/much {00} would you like to store?";
544+
public static LocalizedString StoreMultipleItemPrompt = @"How many/much {00} would you like to store?";
545+
546+
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
547+
public static LocalizedString StoreItemPrompt = @"Do you wish to store the item: {00} ?";
545548

546549
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
547550
public static LocalizedString Title = @"Bag";

0 commit comments

Comments
 (0)