harbingerofme / DebugToolkit

Debugging commands for Risk of Rain 2. Previously known as RoR2Cheats.
https://thunderstore.io/package/IHarbHD/DebugToolkit/
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

New Command: remove_money AND/OR Change Command: give_money #144

Closed DestroyedClone closed 8 months ago

DestroyedClone commented 1 year ago

Describe your new command remove_money value Removes value amount of money from the player, with the reduction being changed to prevent the player's money from going negative. OR give_money value Have it also parse negative values to instead remove money with the same restrictions as above

Use cases

SChinchi commented 11 months ago

I also support this. I was once tested the income of some effects and being able to zero the money would have been convenient. Making give_money support negative values would also bring it in line with the behavior of give_lunar.

The only thing is we'd need to do away with master.GiveMoney and just use something like money = max(0, money + num). This is what the game does to remove money and it is unfortunate there is no DeductMoney method like there is for lunar coins. Similarly we'd need to reinvent TeamManager.GiveTeamMoney for the same reason.

ShareSuite is also a bit peculiar. While the money is added in the money pool, the pool itself is not enforced if the game is not in multiplayer (ShareSuite.Update()), so the check for using ShareSuite should also take that into account. At the moment after calling the ShareSuite API, the code doesn't exit prematurely, but also goes through the usual GiveMoney/GiveTeamMoney stuff, so the fact that the money pool doesn't take effect in single player isn't an issue. However, I think the two shouldn't be mixed. ShareSuite also enforces the money pool for all players, regardless of what team they are on, while the command uses the internal GiveTeamMoney which can technically have a different effect if the command caller has switched their teams.

Also, it seems this line is bugged

if (args.sender != null && args.Count < 2 || args[1].ToUpper() != Lang.ALL || args[1].ToUpper() != Lang.DEFAULT_VALUE)

as this would cause a dedicated server to always choose the whole team. args[1] != "some string" || args[1] != "some other string" will also always be true, so it seems the command doesn't behave as stated.