Skip to content

Commit

Permalink
Formatted classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkhax committed Sep 8, 2018
1 parent 642bed9 commit 9f53dac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
12 changes: 4 additions & 8 deletions Bookcase/Events/NPC/NPCReceiveGiftEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
using System.Text;
using System.Threading.Tasks;

namespace Bookcase.Events
{
namespace Bookcase.Events {
/// <summary>
/// Event fired when an NPC is given a gift.
/// </summary>
public class NPCReceiveGiftEvent : Event
{
public class NPCReceiveGiftEvent : Event {
/// <summary>
/// The NPC being given the gift. Immutable.
/// </summary>
Expand Down Expand Up @@ -42,8 +40,7 @@ public class NPCReceiveGiftEvent : Event
/// </summary>
public bool ShowResponse { get; set; }

public NPCReceiveGiftEvent(NPC instance, StardewValley.Object o, Farmer giver, bool updateGiftLimitInfo, float friendshipChangeMultiplier, bool showResponse)
{
public NPCReceiveGiftEvent(NPC instance, StardewValley.Object o, Farmer giver, bool updateGiftLimitInfo, float friendshipChangeMultiplier, bool showResponse) {
Target = instance;
Gift = o;
Giver = giver;
Expand All @@ -52,8 +49,7 @@ public NPCReceiveGiftEvent(NPC instance, StardewValley.Object o, Farmer giver, b
ShowResponse = showResponse;
}

public override bool CanCancel()
{
public override bool CanCancel() {
return true;
}
}
Expand Down
11 changes: 4 additions & 7 deletions Bookcase/Patches/StardewValley/NPC/NPCReceiveGiftPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@
using System.Text;
using System.Threading.Tasks;

namespace Bookcase.Patches
{
namespace Bookcase.Patches {
/// <summary>
/// Patches NPC.receiveGift and runs when an NPC receives a gift from a player.
/// </summary>
public class NPCReceiveGiftPatch : IGamePatch
{
public class NPCReceiveGiftPatch : IGamePatch {
public Type TargetType => typeof(NPC);

public MethodBase TargetMethod => TargetType.GetMethod("receiveGift");

public static bool Prefix(NPC __instance, ref StardewValley.Object o, ref Farmer giver, ref bool updateGiftLimitInfo, ref float friendshipChangeMultiplier, ref bool showResponse)
{
NPCReceiveGiftEvent args = new NPCReceiveGiftEvent(__instance, o, giver, updateGiftLimitInfo, friendshipChangeMultiplier,showResponse);
public static bool Prefix(NPC __instance, ref StardewValley.Object o, ref Farmer giver, ref bool updateGiftLimitInfo, ref float friendshipChangeMultiplier, ref bool showResponse) {
NPCReceiveGiftEvent args = new NPCReceiveGiftEvent(__instance, o, giver, updateGiftLimitInfo, friendshipChangeMultiplier, showResponse);
BookcaseEvents.NPCReceiveGiftPre.Post(args);
o = args.Gift;
giver = args.Giver;
Expand Down
2 changes: 1 addition & 1 deletion Bookcase/Utils/NPCUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ public static bool TryGetNPCsUnderCursor(out List<NPC> npc, Func<NPC, bool> filt
return npc.Count > 0;
}
}
}
}
2 changes: 1 addition & 1 deletion Bookcase/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net452" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0" targetFramework="net452" />
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.2.0-beta-20180819" targetFramework="net452" />
</packages>

0 comments on commit 9f53dac

Please sign in to comment.