FunkFrog / ShareSuite

Risk of Rain 2 Item, Money, & Equipment sharing mod build upon BepInEx
https://thunderstore.io/package/FunkFrog-and-Sipondo/ShareSuite/
GNU General Public License v3.0
40 stars 26 forks source link

AddMoneyExternal does not work in the Bazaar if you go there via blue portal #89

Closed MagnusMagnuson closed 4 years ago

MagnusMagnuson commented 4 years ago

Installed Mods

Describe the bug AddMoneyExternal does not work when entering the bazaar via blue portal. No money is added. To test this, I used my hotkey from my mod to add money. It works outside of the bazaar and when using cheats to change to the bazaar, but not when you use the blue portal to get to the bazaar.

To Reproduce Steps to reproduce the behavior:

  1. Enter Bazaar via blue portal.
  2. Use hotkey or any other method to call AddMoneyExternal

Expected behavior Money to be added to the player(s).

Additional context Code of my testing Mod

using BepInEx;
using System;
using UnityEngine;
using RoR2;

namespace AnotherShareSuiteTest
{
    [BepInDependency("com.bepis.r2api")]
    [BepInDependency("com.funkfrog_sipondo.sharesuite", BepInDependency.DependencyFlags.SoftDependency)]
    [BepInPlugin("com.MagnusMagnuson.ShareSuiteTest", "ShareSuiteTest", "0.1.0")]
    public class ShareSuiteTest : BaseUnityPlugin
    {
        public void Update()
        {
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.G))
            {
                ShareSuite.MoneySharingHooks.AddMoneyExternal(100);
            }
        }

        public void Awake()
        {
            Run.onPlayerFirstCreatedServer += (run, playermastercontroller) =>
            {
                playermastercontroller.master.inventory.GiveItem(ItemIndex.Hoof, 25);
                playermastercontroller.master.inventory.GiveItem(ItemIndex.Feather, 200);
                playermastercontroller.master.inventory.GiveItem(ItemIndex.Crowbar, 1000);
                playermastercontroller.master.inventory.GiveItem(ItemIndex.Dagger, 200);
            };
        }

    }
}
MagnusMagnuson commented 4 years ago

I forgot to add that there are no errors.

Sipondo commented 4 years ago

I'll look into this tomorrow

MagnusMagnuson commented 4 years ago

I just looked at the code and I believe I found the issue. MapTransitionActive is never set to false when entering the bazaar, because this is done in the hook ResetClassValues() which hooks PlaceTeleporter(). But there is no teleporter in the bazaar, so the game never calls PlaceTeleporter().

Sipondo commented 4 years ago

Good find! Will implement tomorrow!

Få Outlook til Androidhttps://aka.ms/ghei36


From: MagnusMagnuson notifications@github.com Sent: Tuesday, April 21, 2020 10:10:57 PM To: FunkFrog/RoR2SharedItems RoR2SharedItems@noreply.github.com Cc: Robroek, T.T. (Ties) ties.robroek@student.ru.nl; Assign assign@noreply.github.com Subject: Re: [FunkFrog/RoR2SharedItems] AddMoneyExternal does not work in the Bazaar if you go there via blue portal (#89)

I just looked at the code and I believe I found the issue. MapTransitionActive is never set to false when entering the bazaar, because this is done in the hook ResetClassValues which hooks PlaceTeleporter. But there is no teleporter in the bazaar, so the game never calls PlaceTeleporter.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/FunkFrog/RoR2SharedItems/issues/89#issuecomment-617387953, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABPPDTWMM7QD5XTPEECBV2LRNX4VDANCNFSM4MGOTVPA.