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
@ -518,7 +518,7 @@ public class Pet implements ISerialize, Runnable {
|
|||||||
if (this.room != null) {
|
if (this.room != null) {
|
||||||
this.room.sendComposer(new RoomPetExperienceComposer(this, amount).compose());
|
this.room.sendComposer(new RoomPetExperienceComposer(this, amount).compose());
|
||||||
|
|
||||||
if (this.level < PetManager.experiences.length + 1 && this.experience >= PetManager.experiences[this.level - 1]) {
|
if(this.level < PetManager.experiences.length + 1 && this.experience >= PetManager.experiences[this.level - 1]) {
|
||||||
this.levelUp();
|
this.levelUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,20 +526,20 @@ public class Pet implements ISerialize, Runnable {
|
|||||||
|
|
||||||
|
|
||||||
protected void levelUp() {
|
protected void levelUp() {
|
||||||
if (this.level >= PetManager.experiences.length)
|
if (this.level >= PetManager.experiences.length + 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.experience < PetManager.experiences[this.level]) {
|
if (this.experience > PetManager.experiences[this.level - 1]) {
|
||||||
this.experience = PetManager.experiences[this.level];
|
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, "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());
|
||||||
}
|
}
|
||||||
this.level++;
|
|
||||||
this.say(this.petData.randomVocal(PetVocalsType.LEVEL_UP));
|
|
||||||
this.addHappyness(100);
|
|
||||||
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, PetGestures.LVLUP.getKey());
|
|
||||||
this.gestureTickTimeout = Emulator.getIntUnixTimestamp();
|
|
||||||
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLevelUp"));
|
|
||||||
this.room.sendComposer(new PetLevelUpdatedComposer(this).compose());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void addThirst(int amount) {
|
public void addThirst(int amount) {
|
||||||
|
@ -83,7 +83,7 @@ public class PetManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getLevel(int experience) {
|
public static int getLevel(int experience) {
|
||||||
int index = 0;
|
int index = -1;
|
||||||
|
|
||||||
for (int i = 0; i < experiences.length; i++) {
|
for (int i = 0; i < experiences.length; i++) {
|
||||||
if (experiences[i] > experience) {
|
if (experiences[i] > experience) {
|
||||||
@ -92,6 +92,7 @@ public class PetManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(index == -1) { index = experiences.length; }
|
||||||
return index + 1;
|
return index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user