Skip to content

Commit

Permalink
Merge pull request #17 from TadMaj/flea-rework
Browse files Browse the repository at this point in the history
Fixed a few bugs with keybinds and unjacked flea more
  • Loading branch information
TadMaj authored Dec 8, 2024
2 parents 8111d47 + 2b36066 commit 7412311
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,5 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
/Patches/TestPatch.cs
6 changes: 4 additions & 2 deletions Patches/ConfigController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ private static Item SelectItem()
var preloader = GameObject.Find("/Preloader UI/Preloader UI");
if (preloader == null)
{
Utils.SendError("Preloader not found");
Utils.SendDebugNotification("Preloader not found");
return null;
}
var raycaster = preloader.GetComponent<GraphicRaycaster>() ?? preloader.AddComponent<GraphicRaycaster>();
PointerEventData eventData = new(EventSystem.current)
Expand All @@ -80,7 +81,8 @@ private static Item SelectItem()
var target = GameObject.Find("InventoryScreen");
if (target == null)
{
Utils.SendError("InventoryScreen not found");
Utils.SendDebugNotification("InventoryScreen not found");
return null;
}

raycaster = target.GetComponent<GraphicRaycaster>() ?? target.AddComponent<GraphicRaycaster>();
Expand Down
19 changes: 1 addition & 18 deletions Patches/QuickSell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ public static void SellFlea(Item item)
var tradingScreen = Singleton<MenuUI>.Instance.TradingScreen;
if (tradingScreen == null) Utils.SendError("Counldnt Load tradingScreen");

//RagfairScreen flea = (RagfairScreen)typeof(TradingScreen).GetField("_ragfairScreen", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(tradingScreen);
//if (flea == null) Utils.SendError("Counldnt Load flea");

//flea.method_4();

var session = GetSession();
if (session == null) Utils.SendError("Counldnt Load session");

Expand Down Expand Up @@ -176,7 +171,7 @@ void res(ItemMarketPrices result)



session.RagfairAddOffer(false, [item.Id], [.. list], new Callback(FleaSellerFixer));
session.RagfairAddOffer(false, [item.Id], [.. list], new Callback(PlaySellSound));

}
catch (Exception ex)
Expand Down Expand Up @@ -234,18 +229,6 @@ private static void PlaySellSound(IResult result)
if (result.Succeed) Singleton<GUISounds>.Instance.PlayUISound(EUISoundType.TradeOperationComplete);

}
//For some reason selling on the flea causes black screens if the flea market screen is still open
// This is a janky fix for that issue, i am not putting more tim
private static void FleaSellerFixer(IResult result)
{
if (!result.Succeed) return;

var rotator = GameObject.Find("/Rotator parent");
if (rotator != null) GameObject.Destroy(rotator);


PlaySellSound(result);
}
private static void forceReloadTraders()
{
traders = GetSession().Traders.Where(new Func<TraderClass, bool>(MainMenuController.Class1378.class1378_0.method_3)).ToArray<TraderClass>();
Expand Down
1 change: 1 addition & 0 deletions QuickSell.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<Compile Include="MultiSelectInterop.cs" />
<Compile Include="Patches\ConfigController.cs" />
<Compile Include="Patches\QuickSell.cs" />
<Compile Include="Patches\TestPatch.cs" />
<Compile Include="Patches\TraderInventoryLoadingPatch.cs" />
<Compile Include="Patches\Utils.cs" />
<Compile Include="Plugin.cs" />
Expand Down

0 comments on commit 7412311

Please sign in to comment.