Fixed double rounding of shared Xp, rounding up final result instead

This commit is contained in:
bm01 2013-02-02 04:33:26 +01:00
parent 60033d47ec
commit 1898537149

View File

@ -37,17 +37,20 @@ public final class ShareHandler {
*/ */
public static void handleEqualXpShare(int xp, Player player, Party party, SkillType skillType) { public static void handleEqualXpShare(int xp, Player player, Party party, SkillType skillType) {
running = true; running = true;
int newExp = xp;
if (party.getXpShareMode() == XpShareMode.EQUAL) { if (party.getXpShareMode() == XpShareMode.EQUAL) {
List<Player> nearMembers = PartyManager.getNearMembers(player, party, Config.getInstance().getPartyShareRange()); List<Player> nearMembers = PartyManager.getNearMembers(player, party, Config.getInstance().getPartyShareRange());
if (nearMembers.size() > 0) { if (nearMembers.size() <= 0) {
newExp = (int) ((xp / (nearMembers.size() + 1)) * Config.getInstance().getPartyShareBonus()); running = false;
return;
} }
double partySize = nearMembers.size() + 1;
double splitXp = xp / partySize * Config.getInstance().getPartyShareBonus();
for (Player member : nearMembers) { for (Player member : nearMembers) {
Users.getPlayer(member).addXp(skillType, newExp); Users.getPlayer(member).addXp(skillType, (int) Math.ceil(splitXp));
} }
} }