RuneHive-Game
Loading...
Searching...
No Matches
ClanAchievement.java
Go to the documentation of this file.
1package com.runehive.content.clanchannel.content;
2
3import com.runehive.util.Difficulty;
4
5import java.util.Optional;
6
7/**
8 * Handles the clan achievements.
9 *
10 * @author Daniel.
11 */
12public enum ClanAchievement {
13 /* Easy */
14 CLAN_MEMBERS_I("Have 10 members in your clan", 10, Difficulty.EASY),
15 TASKS_I("Complete 10 clan tasks", 10, Difficulty.EASY),
16 PLAYER_KILLER_I("Kill 25 wilderness players", 25, Difficulty.EASY),
17
18 /* Medium */
19 CLAN_MEMBERS_II("Have 50 members in your clan", 50, Difficulty.MEDIUM),
20 TASKS_II("Complete 100 clan tasks", 100, Difficulty.MEDIUM),
21 PLAYER_KILLER_II("Kill 150 wilderness players", 150, Difficulty.MEDIUM),
22
23 /* Hard */
24 CLAN_MEMBERS_III("Have 150 members in your clan", 150, Difficulty.HARD),
25 TASKS_III("Complete 500 clan tasks", 500, Difficulty.HARD),
26 PLAYER_KILLER_III("Kill 750 wilderness players", 750, Difficulty.HARD),
27 ;
28
29 /** The details of the achievement. */
30 public final String details;
31
32 /** The amount required of the achievement. */
33 public final int amount;
34
35 /** The difficulty of the achievement. */
36 public final Difficulty difficulty;
37
38 /** Constructs a new <code>ClanAchievement</code>. */
40 this.details = details;
41 this.amount = amount;
42 this.difficulty = difficulty;
43 }
44
45 /** Gets the reward points for completing an achievement. */
46 public int getPoints() {
47 switch (difficulty) {
48 case EASY:
49 return 3;
50 case MEDIUM:
51 return 5;
52 case HARD:
53 return 8;
54 }
55 return 0;
56 }
57
58 /** Gets the reward experience for completing an achivement. */
59 public double getExperience() {
60 switch (difficulty) {
61 case EASY:
62 return 2500;
63 case MEDIUM:
64 return 5000;
65 case HARD:
66 return 10000;
67 }
68 return 0;
69 }
70
71 /** Gets the clan achivement based on the ordinal. */
72 public static Optional<ClanAchievement> forOrdinal(int ordinal) {
73 for (ClanAchievement achievement : values()) {
74 if (achievement.ordinal() == ordinal)
75 return Optional.of(achievement);
76 }
77 return Optional.empty();
78 }
79}
ClanAchievement(String details, int amount, Difficulty difficulty)
Constructs a new ClanAchievement.
final String details
The details of the achievement.
final int amount
The amount required of the achievement.
static Optional< ClanAchievement > forOrdinal(int ordinal)
Gets the clan achivement based on the ordinal.
int getPoints()
Gets the reward points for completing an achievement.
double getExperience()
Gets the reward experience for completing an achivement.
final Difficulty difficulty
The difficulty of the achievement.
Created by Daniel on 2017-11-27.