Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfr0676 committed Aug 3, 2024
1 parent 510fdf2 commit bdfef66
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions EXILED/Exiled.Events/Patches/Generic/ArmorDropPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
int continueIndex = newInstructions.FindIndex(x => x.Is(OpCodes.Call, Method(typeof(Dictionary<ushort, ItemBase>.Enumerator), nameof(Dictionary<ushort, ItemBase>.Enumerator.MoveNext)))) - 1;
newInstructions[continueIndex].WithLabels(continueLabel);

// before: if (keyValuePair.Value.Category != ItemCategory.Armor)
// after: if (keyValuePair.Value.Category != ItemCategory.Armor && keyValuePair.Value.Category != ItemCategory.None)
int index = newInstructions.FindIndex(x => x.Is(OpCodes.Ldc_I4_S, 9));

newInstructions.InsertRange(index, new CodeInstruction[]
{
// && keyValuePair.Value.Category != ItemCategory.None)
new(OpCodes.Ldloca_S, 4),
new(OpCodes.Call, PropertyGetter(typeof(KeyValuePair<ushort, ItemBase>), nameof(KeyValuePair<ushort, ItemBase>.Value))),
new(OpCodes.Ldfld, Field(typeof(ItemBase), nameof(ItemBase.Category))),
Expand Down

0 comments on commit bdfef66

Please sign in to comment.