harbingerofme/DebugToolkit

New Command: remove_money AND/OR Change Command: give_money

Closed this issue · 1 comments

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

  • Mechanics that check if the player doesn't have enough money for something (like how a sound plays in ror2 if you cant purchase something due to too low money)
  • Implementations similar to RoR1's Golden Gun (scales damage off player's money)

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.