diff options
author | KHobbits <rob@khobbits.co.uk> | 2011-12-13 04:29:16 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2011-12-13 04:29:16 +0000 |
commit | d3dd8208ef32259cb5f27c3ccd0269e098882fa9 (patch) | |
tree | 0589abafce8c044807665add0805c456a2703315 | |
parent | a00f07040055c29ca399c82eca0a6cc07e183d8e (diff) | |
download | Essentials-d3dd8208ef32259cb5f27c3ccd0269e098882fa9.tar Essentials-d3dd8208ef32259cb5f27c3ccd0269e098882fa9.tar.gz Essentials-d3dd8208ef32259cb5f27c3ccd0269e098882fa9.tar.lz Essentials-d3dd8208ef32259cb5f27c3ccd0269e098882fa9.tar.xz Essentials-d3dd8208ef32259cb5f27c3ccd0269e098882fa9.zip |
Fixing Sell/Buy Signs which use EXP as a currency.
4 files changed, 36 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index 09d3c294d..c7038e905 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -65,7 +65,7 @@ public interface IUser void setJail(String jail); - public int getTotalExperience(); + public int getXP(); - public void setTotalExperience(int l); + public void setXP(int l); } diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index 1c8e20db9..8ca6ede1b 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -80,7 +80,7 @@ public class Trade } if (exp != null && exp > 0 - && user.getTotalExperience() < exp) { + && user.getXP() < exp) { throw new ChargeException(_("notEnoughExperience")); } } @@ -115,7 +115,7 @@ public class Trade } if (getExperience() != null) { - user.setTotalExperience(user.getTotalExperience() + getExperience()); + user.setXP(user.getXP() + getExperience()); } return success; } @@ -154,12 +154,12 @@ public class Trade } if (getExperience() != null) { - final int experience = user.getTotalExperience(); + final int experience = user.getXP(); if (experience < getExperience() && getExperience() > 0) { throw new ChargeException(_("notEnoughExperience")); } - user.setTotalExperience(experience - getExperience()); + user.setXP(experience - getExperience()); } } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 8c678d734..6f389f749 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -544,4 +544,21 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { return teleportRequestTime; } + + @Override + public int getXP() { + return base.getTotalExperience(); + } + + @Override + public void setXP(int l) { + base.setExp(0); + base.setLevel(0); + base.setTotalExperience(0); + for(int i=0;i<l; ++i) { + base.giveExp(1); + } + this.sendMessage("new exp: " + base.getExp() + " total exp: " + base.getTotalExperience()); + } + } diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java index 0e544ae06..724920b38 100644 --- a/Essentials/src/com/earth2me/essentials/user/User.java +++ b/Essentials/src/com/earth2me/essentials/user/User.java @@ -196,4 +196,17 @@ public class User extends UserBase implements IUser unlock(); } } + + @Override + public int getXP() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setXP(int l) + { + throw new UnsupportedOperationException("Not supported yet."); + } + } |