mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
Added 'rpg admin level take' command
This commit is contained in:
parent
06b3aee9bf
commit
7b16bced13
@ -99,6 +99,11 @@ public class PlayerProfessions {
|
|||||||
level.put(profession.getId(), value);
|
level.put(profession.getId(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void takeLevels(Profession profession, int value) {
|
||||||
|
int current = level.getOrDefault(profession.getId(), 1);
|
||||||
|
level.put(profession.getId(), Math.max(1, current - value));
|
||||||
|
}
|
||||||
|
|
||||||
public void setExperience(Profession profession, int value) {
|
public void setExperience(Profession profession, int value) {
|
||||||
exp.put(profession.getId(), value);
|
exp.put(profession.getId(), value);
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,11 @@ public class PlayerData extends OfflinePlayerData {
|
|||||||
getStats().updateStats();
|
getStats().updateStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void takeLevels(int value) {
|
||||||
|
this.level = Math.max(1, level - value);
|
||||||
|
getStats().updateStats();
|
||||||
|
}
|
||||||
|
|
||||||
public void giveLevels(int value, EXPSource source) {
|
public void giveLevels(int value, EXPSource source) {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
while (value-- > 0)
|
while (value-- > 0)
|
||||||
|
@ -24,6 +24,8 @@ public class LevelCommandTreeNode extends CommandTreeNode {
|
|||||||
(professions, profession, value) -> professions.setLevel(profession, value)));
|
(professions, profession, value) -> professions.setLevel(profession, value)));
|
||||||
addChild(new ActionCommandTreeNode(this, "give", (data, value) -> data.giveLevels(value, EXPSource.COMMAND),
|
addChild(new ActionCommandTreeNode(this, "give", (data, value) -> data.giveLevels(value, EXPSource.COMMAND),
|
||||||
(professions, profession, value) -> professions.giveLevels(profession, value, EXPSource.COMMAND)));
|
(professions, profession, value) -> professions.giveLevels(profession, value, EXPSource.COMMAND)));
|
||||||
|
addChild(new ActionCommandTreeNode(this, "take", (data, value) -> data.takeLevels(value),
|
||||||
|
(professions, profession, value) -> professions.takeLevels(profession, value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActionCommandTreeNode extends CommandTreeNode {
|
public class ActionCommandTreeNode extends CommandTreeNode {
|
||||||
|
Loading…
Reference in New Issue
Block a user