RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.donators.Donation Class Reference

This class handles everything related to donators. More...

Collaboration diagram for com.runehive.content.donators.Donation:

Public Member Functions

 Donation (Player player)
int getCredits ()
int getSpent ()
void redeem (DonatorBond bond)
void setCredits (int credits)
void setSpent (int spent)
void updateRank (boolean login)

Private Attributes

int credits
final Player player
int spent

Static Private Attributes

static final Logger logger = LogManager.getLogger(Donation.class)

Detailed Description

This class handles everything related to donators.

Author
Daniel

Definition at line 19 of file Donation.java.

Constructor & Destructor Documentation

◆ Donation()

com.runehive.content.donators.Donation.Donation ( Player player)

Definition at line 27 of file Donation.java.

27 {
28 this.player = player;
29 }

References player.

Member Function Documentation

◆ getCredits()

int com.runehive.content.donators.Donation.getCredits ( )

◆ getSpent()

int com.runehive.content.donators.Donation.getSpent ( )

Definition at line 75 of file Donation.java.

75 {
76 return spent;
77 }

References spent.

Referenced by com.runehive.content.dialogue.impl.RoyalKingDialogue.myStats(), and redeem().

Here is the caller graph for this function:

◆ redeem()

void com.runehive.content.donators.Donation.redeem ( DonatorBond bond)

Definition at line 31 of file Donation.java.

31 {
32 setSpent(getSpent() + bond.moneySpent);
33 setCredits(getCredits() + bond.credits);
34 player.message("<col=FF0000>You have claimed your donator bond. You now have " + Utility.formatDigits(getCredits()) + " donator credits!");
35 World.sendMessage("<col=CF2192>osroyale: <col=" + player.right.getColor() + ">" + player.getName() + " </col>has opened <col=CF2192>" + Utility.formatEnum(bond.name()) + "");
36 updateRank(false);
37 }

References com.runehive.content.donators.DonatorBond.credits, com.runehive.util.Utility.formatDigits(), com.runehive.util.Utility.formatEnum(), getCredits(), getSpent(), com.runehive.content.donators.DonatorBond.moneySpent, player, com.runehive.game.world.World.sendMessage(), setCredits(), setSpent(), and updateRank().

Here is the call graph for this function:

◆ setCredits()

void com.runehive.content.donators.Donation.setCredits ( int credits)

Definition at line 79 of file Donation.java.

79 {
80 this.credits = credits;
81 }

References credits.

Referenced by com.runehive.content.store.currency.impl.DonatorPointCurrency.recieveCurrency(), redeem(), and com.runehive.content.store.currency.impl.DonatorPointCurrency.takeCurrency().

Here is the caller graph for this function:

◆ setSpent()

void com.runehive.content.donators.Donation.setSpent ( int spent)

Definition at line 83 of file Donation.java.

83 {
84 this.spent = spent;
85 }

References spent.

Referenced by redeem().

Here is the caller graph for this function:

◆ updateRank()

void com.runehive.content.donators.Donation.updateRank ( boolean login)

Definition at line 39 of file Donation.java.

39 {
40 PlayerRight rank = PlayerRight.forSpent(spent);
41
42 if (rank == null) {
43 return;
44 }
45
46 if (player.right.equals(rank)) {
47 return;
48 }
49
50 if (login) {
51 if (!PlayerRight.isIronman(player) && !PlayerRight.isHelper(player)) {
52 player.right = rank;
53 player.updateFlags.add(UpdateFlag.APPEARANCE);
54 }
55 return;
56 }
57
58 if (PlayerRight.isIronman(player)) {
59 player.message("Since you are an iron man, your rank icon will not change.");
60 } else if (!PlayerRight.isModerator(player)) {
61 player.right = rank;
62 player.updateFlags.add(UpdateFlag.APPEARANCE);
63 }
64
65 String name = rank.getName();
66 player.send(new SendAnnouncement("Rank Level Up!", "You are now " + Utility.getAOrAn(name) + " " + PlayerRight.getCrown(player) + " " + name + "!", 0x1C889E));
67 player.dialogueFactory.sendStatement("You are now " + Utility.getAOrAn(name) + " " + PlayerRight.getCrown(player) + " " + name + "!").execute();
68 InterfaceWriter.write(new InformationWriter(player));
69 }

References com.runehive.game.world.entity.mob.UpdateFlag.APPEARANCE, com.runehive.game.world.entity.mob.player.PlayerRight.forSpent(), com.runehive.util.Utility.getAOrAn(), com.runehive.game.world.entity.mob.player.PlayerRight.getCrown(), com.runehive.game.world.entity.mob.player.PlayerRight.getName(), com.runehive.game.world.entity.mob.player.PlayerRight.isHelper(), com.runehive.game.world.entity.mob.player.PlayerRight.isIronman(), com.runehive.game.world.entity.mob.player.PlayerRight.isModerator(), player, spent, and com.runehive.content.writer.InterfaceWriter.write().

Referenced by redeem().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ credits

int com.runehive.content.donators.Donation.credits
private

Definition at line 24 of file Donation.java.

Referenced by getCredits(), and setCredits().

◆ logger

final Logger com.runehive.content.donators.Donation.logger = LogManager.getLogger(Donation.class)
staticprivate

Definition at line 21 of file Donation.java.

◆ player

final Player com.runehive.content.donators.Donation.player
private

Definition at line 23 of file Donation.java.

Referenced by Donation(), redeem(), and updateRank().

◆ spent

int com.runehive.content.donators.Donation.spent
private

Definition at line 25 of file Donation.java.

Referenced by getSpent(), setSpent(), and updateRank().


The documentation for this class was generated from the following file: