RuneHive-Game
Loading...
Searching...
No Matches
ClanDetails.java
Go to the documentation of this file.
1package com.runehive.content.clanchannel.channel;
2
3import com.runehive.content.clanchannel.ClanMember;
4import com.runehive.content.clanchannel.ClanType;
5import com.runehive.content.clanchannel.content.ClanAchievement;
6import com.runehive.content.clanchannel.content.ClanLevel;
7import com.runehive.content.clanchannel.content.ClanMemberComporator;
8import com.runehive.content.clanchannel.content.ClanTask;
9
10import java.util.HashMap;
11import java.util.LinkedList;
12import java.util.List;
13
14/**
15 * The clan channel details.
16 *
17 * @author Daniel.
18 */
19public class ClanDetails {
20
21 /** The clan channel instance. */
22 private final ClanChannel channel;
23
24 /** The clan channel owner. */
25 public String owner;
26
27 public String created;
28
29 public ClanType type;
30
32
34
35 public int taskAmount;
36
37 /** The clan channel points. */
38 public int points;
39
40 /** The clan channel total experience. */
41 public double experience;
42
43 /** The date the clan channel was created. */
44 public String established;
45
46 /** The clan achievements. */
47 public HashMap<ClanAchievement, Integer> achievements = new HashMap<ClanAchievement, Integer>(ClanAchievement.values().length) {
48 private static final long serialVersionUID = 1842952445111093360L;
49
50 {
51 for (final ClanAchievement achievement : ClanAchievement.values())
52 put(achievement, 0);
53 }
54 };
55
56 /** Constructs a new <code>ClanDetails</code>. */
58 this.channel = channel;
59 }
60
62 int count = 0;
63 if (achievements.containsKey(achievement)) {
64 count = achievements.get(achievement);
65 }
66 return count;
67 }
68
71 int goal = achievement.amount;
72 return progress == goal;
73 }
74
75 /** Gets the average total level of the clan. */
76 public int getAverageTotal() {
77 return 0;
78// int total = 0;
79// Iterator<ClanMember> iterator = channel.iterator();
80// while (iterator.hasNext()) {
81// ClanMember member = iterator.next();
82// total += member.totalLevel;
83// }
84// return total / channel.size();
85 }
86
87 public int getClanRank(ClanMember member) {
88 List<ClanMember> members = new LinkedList<>();
89 members.addAll(channel.getMembers());
90 members.sort(ClanMemberComporator.NAME);
91
92 int index = 0;
93 for (ClanMember next : members) {
94 index++;
95 if (next.equals(member)) {
96 return index;
97 }
98 }
99 return index;
100 }
101
102}
Handles the clan channel member.
String established
The date the clan channel was created.
ClanDetails(ClanChannel channel)
Constructs a new ClanDetails.
int getAchievementCompletion(ClanAchievement achievement)
int getAverageTotal()
Gets the average total level of the clan.
HashMap< ClanAchievement, Integer > achievements
The clan achievements.
boolean completedAchievement(ClanAchievement achievement)
double experience
The clan channel total experience.
final ClanChannel channel
The clan channel instance.
Handles the clan levels (based off the total experience earned).
Definition ClanLevel.java:8