Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added wager option to normal and pvp races #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JustMe003
Copy link

Added the ability to put wager on races:

  • Race creator can set a minimum wager as an entry prize for any player who joins /race option wager [minimum]
  • Every player can increase their personal wager (/race wager increase [amount]), and decrease the additional wager they put in the race (/race wager decrease [amount])

Changes should be fairly self explanatory, added some comments here and there for more clarity if needed. Most notable changes:

  • Added new option command for the race creator. Currently this option can only be used if the race creator is the only one in the race, to avoid players suddenly increasing the minimum wager amount just before starting the race
  • Modified the /race join [player] command. It will now check if the race has a minimum entry wager and if it has, it will show a message to the player to confirm whether they want to join the race or not.
    If they confirm to join the race, the same command is runned with an extra, new parameter: /race join [player] true.
    In both cases, checks are made to see whether the player actually has enough parcoins to pay the entry wager.
  • Added new commands for increasing and decreasing. This allows any player in the race to increase the prize pool, and retract their additional wager.
  • Added fields wager and additionalWager in RacePlayer, along with getters and setters
  • Added field totalPrizePool to Race. This is used to show the prize pool of the race. When the race starts, it re-calculates it just to be sure, and adds the prizes from the prize pool to the existing prizes. This means that players can increase the prizepool of an event without overriding the event prizes
  • Added method getPlayerPoints and takePlayerPoints to PlayerWrapper

@JustMe003
Copy link
Author

Things missing:

  • Giving players their parcoins back when they are in a race that has not yet started, but do have a wager in that race
  • In case of an event, and someone adds some coins to the prize pool, the command /race info will only display the added parcoins, not the parcoins that will be handed out by the event itself
  • I honestly can't really remember what a infected race really is and how its winners are determined, so rn I don't allow a minimum wager to be set for infected races. Players can however still add an additional wager to infected races

Things not tested:

  • Starting and finishing a race with a prizepool
  • Anything related to event races
  • Infected races should not be able to have a minimum wager, haven't tested this due to a plugin malfunction (I'm new to this, leave me xD)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant