mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Fixed Pet Levelling.
This commit is contained in:
parent
c8b4848f49
commit
1638dcb758
@ -526,16 +526,16 @@ public class Pet implements ISerialize, Runnable {
|
||||
|
||||
|
||||
protected void levelUp() {
|
||||
if (this.level >= PetManager.experiences.length)
|
||||
if (this.level >= PetManager.experiences.length + 1)
|
||||
return;
|
||||
|
||||
if (this.experience < PetManager.experiences[this.level]) {
|
||||
this.experience = PetManager.experiences[this.level];
|
||||
if (this.experience > PetManager.experiences[this.level - 1]) {
|
||||
this.experience = PetManager.experiences[this.level - 1];
|
||||
}
|
||||
this.level++;
|
||||
this.say(this.petData.randomVocal(PetVocalsType.LEVEL_UP));
|
||||
this.addHappyness(100);
|
||||
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, PetGestures.LVLUP.getKey());
|
||||
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, "exp");
|
||||
this.gestureTickTimeout = Emulator.getIntUnixTimestamp();
|
||||
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLevelUp"));
|
||||
this.room.sendComposer(new PetLevelUpdatedComposer(this).compose());
|
||||
|
@ -83,7 +83,7 @@ public class PetManager {
|
||||
}
|
||||
|
||||
public static int getLevel(int experience) {
|
||||
int index = 0;
|
||||
int index = -1;
|
||||
|
||||
for (int i = 0; i < experiences.length; i++) {
|
||||
if (experiences[i] > experience) {
|
||||
@ -92,6 +92,7 @@ public class PetManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(index == -1) { index = experiences.length; }
|
||||
return index + 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user