Skip to content

Commit

Permalink
Fix exp save
Browse files Browse the repository at this point in the history
  • Loading branch information
NeumimTo committed Mar 15, 2018
1 parent 3c39356 commit aa4d05a
Showing 1 changed file with 8 additions and 39 deletions.
47 changes: 8 additions & 39 deletions Plugin/src/main/java/cz/neumimto/rpg/players/CharacterService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,15 @@

import cz.neumimto.core.ioc.Inject;
import cz.neumimto.core.ioc.Singleton;
import cz.neumimto.rpg.Arg;
import cz.neumimto.rpg.GroupService;
import cz.neumimto.rpg.MissingConfigurationException;
import cz.neumimto.rpg.NtRpgPlugin;
import cz.neumimto.rpg.Pair;
import cz.neumimto.rpg.TextHelper;
import cz.neumimto.rpg.*;
import cz.neumimto.rpg.configuration.Localization;
import cz.neumimto.rpg.configuration.PluginConfig;
import cz.neumimto.rpg.damage.DamageService;
import cz.neumimto.rpg.effects.EffectParams;
import cz.neumimto.rpg.effects.EffectService;
import cz.neumimto.rpg.effects.IEffect;
import cz.neumimto.rpg.effects.IEffectConsumer;
import cz.neumimto.rpg.effects.IEffectContainer;
import cz.neumimto.rpg.effects.IGlobalEffect;
import cz.neumimto.rpg.effects.InternalEffectSourceProvider;
import cz.neumimto.rpg.effects.*;
import cz.neumimto.rpg.effects.common.def.ClickComboActionEvent;
import cz.neumimto.rpg.effects.common.def.CombatEffect;
import cz.neumimto.rpg.entities.EntityService;
import cz.neumimto.rpg.events.CancellableEvent;
import cz.neumimto.rpg.events.CharacterAttributeChange;
import cz.neumimto.rpg.events.CharacterChangeClassEvent;
import cz.neumimto.rpg.events.CharacterChangeGroupEvent;
import cz.neumimto.rpg.events.CharacterEvent;
import cz.neumimto.rpg.events.CharacterGainedLevelEvent;
import cz.neumimto.rpg.events.CharacterInitializedEvent;
import cz.neumimto.rpg.events.*;
import cz.neumimto.rpg.events.character.CharacterWeaponUpdateEvent;
import cz.neumimto.rpg.events.character.EventCharacterArmorPostUpdate;
import cz.neumimto.rpg.events.character.PlayerDataPreloadComplete;
Expand All @@ -70,12 +53,7 @@
import cz.neumimto.rpg.players.properties.DefaultProperties;
import cz.neumimto.rpg.players.properties.PropertyService;
import cz.neumimto.rpg.players.properties.attributes.ICharacterAttribute;
import cz.neumimto.rpg.skills.ExtendedSkillInfo;
import cz.neumimto.rpg.skills.ISkill;
import cz.neumimto.rpg.skills.SkillData;
import cz.neumimto.rpg.skills.SkillService;
import cz.neumimto.rpg.skills.SkillTree;
import cz.neumimto.rpg.skills.SkillTreeSpecialization;
import cz.neumimto.rpg.skills.*;
import cz.neumimto.rpg.utils.SkillTreeActionResult;
import cz.neumimto.rpg.utils.Utils;
import org.slf4j.Logger;
Expand All @@ -86,16 +64,7 @@
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.inventory.equipment.EquipmentType;

import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -1079,7 +1048,7 @@ public void addExperiences(IActiveCharacter character, double exp, ExtendedNClas
double levellimit = levels[level];

double newcurrentexp = lvlexp + exp;

double k = total + exp;
while (newcurrentexp > levellimit) {
level++;
if (!onlyinit) {
Expand All @@ -1104,12 +1073,12 @@ public void addExperiences(IActiveCharacter character, double exp, ExtendedNClas
}

if (!onlyinit) {
aClass.setExperiences(newcurrentexp);
aClass.setExperiences(k);
aClass.setExperiencesFromLevel(newcurrentexp);
Gui.showExpChange(character, aClass.getConfigClass().getName(), exp);
} else {
aClass.setExperiencesFromLevel(newcurrentexp);
}
Gui.showExpChange(character, aClass.getConfigClass().getName(), exp);
aClass.setLevel(level);
}

Expand Down

0 comments on commit aa4d05a

Please sign in to comment.