Skip to content

Commit ec536f1

Browse files
committed
Restrict edge case when there is a given id for key
1 parent 18142d8 commit ec536f1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Fika.Core/Networking/Packets/Player/Common/SubPackets/WorldInteractionPacket.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void Execute(FikaPlayer player)
6262
keyHandler.UnlockResult.Value.RaiseEvents(player.InventoryController, CommandStatus.Begin);
6363
action = new(keyHandler.HandleKeyEvent);
6464
}
65-
else if (worldInteractiveObject is Switch && InteractionStage is EInteractionStage.Execute) // edge case for switches, e.g. labyrinth puzzles
65+
else if (worldInteractiveObject is Switch && InteractionStage is EInteractionStage.Execute && !string.IsNullOrWhiteSpace(ItemId)) // edge case for switches, e.g. labyrinth puzzles
6666
{
6767
var success = GetKeyHandler(player, worldInteractiveObject, out var keyHandler);
6868
if (!success)
@@ -108,21 +108,21 @@ private bool GetKeyHandler(FikaPlayer player, WorldInteractiveObject worldIntera
108108
keyHandler = new(player);
109109
if (string.IsNullOrEmpty(ItemId))
110110
{
111-
FikaGlobals.LogWarning("WorldInteractionPacket: ItemID was null!");
111+
FikaGlobals.LogError("WorldInteractionPacket: ItemID was null!");
112112
return false;
113113
}
114114

115115
var result = player.FindItemById(ItemId, false, false);
116116
if (!result.Succeeded)
117117
{
118-
FikaGlobals.LogWarning("WorldInteractionPacket: Could not find item: " + ItemId);
118+
FikaGlobals.LogError("WorldInteractionPacket: Could not find item: " + ItemId);
119119
return false;
120120
}
121121

122122
var keyComponent = result.Value.GetItemComponent<KeyComponent>();
123123
if (keyComponent == null)
124124
{
125-
FikaGlobals.LogWarning("WorldInteractionPacket: keyComponent was null!");
125+
FikaGlobals.LogError("WorldInteractionPacket: keyComponent was null!");
126126
return false;
127127
}
128128

@@ -133,7 +133,7 @@ private bool GetKeyHandler(FikaPlayer player, WorldInteractiveObject worldIntera
133133
keyHandler.UnlockResult = worldInteractiveObject.UnlockOperation(keyComponent, player, worldInteractiveObject);
134134
if (keyHandler.UnlockResult.Error != null)
135135
{
136-
FikaGlobals.LogWarning("WorldInteractionPacket: Error when processing unlockResult: " + keyHandler.UnlockResult.Error);
136+
FikaGlobals.LogError("WorldInteractionPacket: Error when processing unlockResult: " + keyHandler.UnlockResult.Error);
137137
return false;
138138
}
139139

0 commit comments

Comments
 (0)