Goodbye Happyness, welcome Happiness. Now where's my cup of tea, Elizabeth?

This commit is contained in:
Yordi 2025-01-24 19:50:09 +00:00 committed by ArpyAge
parent 2ec4f767d8
commit 90a0d056b8
26 changed files with 62 additions and 58 deletions

View File

@ -18,4 +18,8 @@ CREATE TABLE chat_bubbles (
--New texts for update chat bubbles command
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_update_chat_bubbles', 'update_chat_bubbles');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.success.cmd_update_chat_bubbles', 'Successfully updated chat bubbles');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_update_chat_bubbles', ':update_chat_bubbles');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.description.cmd_update_chat_bubbles', ':update_chat_bubbles');
UPDATE `emulator_texts` SET `key` = 'generic.pet.happiness', `value` = 'Happiness' WHERE `key` = 'generic.pet.happyness';
ALTER TABLE `pet_commands_data` CHANGE `cost_happyness` `cost_happiness` int(11) NOT NULL DEFAULT '0';
ALTER TABLE `users_pets` CHANGE `happyness` `happiness` int(11) NOT NULL DEFAULT '100';

View File

@ -34,7 +34,7 @@ public class PetInfoCommand extends Command {
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
Emulator.getTexts().getValue("generic.pet.happyness") + ": " + pet.getHappyness() + "\r" +
Emulator.getTexts().getValue("generic.pet.happiness") + ": " + pet.getHappiness() + "\r" +
Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
Emulator.getTexts().getValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? Emulator.getTexts().getValue("generic.nothing") : pet.getTask().name()) + "\r" +

View File

@ -46,7 +46,7 @@ public class InteractionPetToy extends InteractionDefault {
pet.packetUpdate = true;
HabboItem item = this;
Emulator.getThreading().run(() -> {
pet.addHappyness(25);
pet.addHappiness(25);
item.setExtradata("0");
room.updateItem(item);
new PetClearPosture(pet, RoomUnitStatus.PLAY, null, true).run();

View File

@ -385,7 +385,7 @@ public class MonsterplantPet extends Pet implements IPetLook {
if (this.mayScratch()) {
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("MonsterPlantTreater"), 5);
this.setDeathTimestamp(Emulator.getIntUnixTimestamp() + MonsterplantPet.timeToLive);
this.addHappyness(10);
this.addHappiness(10);
this.addExperience(10);
this.room.sendComposer(new PetStatusUpdateComposer(this).compose());
this.room.sendComposer(new RoomPetRespectComposer(this, RoomPetRespectComposer.PET_TREATED).compose());

View File

@ -36,7 +36,7 @@ public class Pet implements ISerialize, Runnable {
protected PetData petData;
protected int race;
protected String color;
protected int happyness;
protected int happiness;
protected int experience;
protected int energy;
protected int respect;
@ -45,7 +45,7 @@ public class Pet implements ISerialize, Runnable {
RoomUnit roomUnit;
private int chatTimeout;
private int tickTimeout = Emulator.getIntUnixTimestamp();
private int happynessDelay = Emulator.getIntUnixTimestamp();
private int happinessDelay = Emulator.getIntUnixTimestamp();
private int gestureTickTimeout = Emulator.getIntUnixTimestamp();
private int randomActionTickTimeout = Emulator.getIntUnixTimestamp();
private int postureTimeout = Emulator.getIntUnixTimestamp();
@ -65,12 +65,12 @@ public class Pet implements ISerialize, Runnable {
this.name = set.getString("name");
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(set.getInt("type"));
if (this.petData == null) {
LOGGER.error("WARNING! Missing pet data for type: " + set.getInt("type") + "! Insert a new entry into the pet_actions table for this type!");
LOGGER.error("WARNING! Missing pet data for type: {}! Insert a new entry into the pet_actions table for this type!", set.getInt("type"));
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(0);
}
this.race = set.getInt("race");
this.experience = set.getInt("experience");
this.happyness = set.getInt("happyness");
this.happiness = set.getInt("happiness");
this.energy = set.getInt("energy");
this.respect = set.getInt("respect");
this.created = set.getInt("created");
@ -88,13 +88,13 @@ public class Pet implements ISerialize, Runnable {
this.petData = Emulator.getGameEnvironment().getPetManager().getPetData(type);
if (this.petData == null) {
LOGGER.warn("Missing pet data for type: " + type + "! Insert a new entry into the pet_actions table for this type!");
LOGGER.warn("Missing pet data for type: {}! Insert a new entry into the pet_actions table for this type!", type);
}
this.race = race;
this.color = color;
this.experience = 0;
this.happyness = 100;
this.happiness = 100;
this.energy = 100;
this.respect = 0;
this.levelThirst = 0;
@ -132,14 +132,14 @@ public class Pet implements ISerialize, Runnable {
}
public void addHappyness(int amount) {
this.happyness += amount;
public void addHappiness(int amount) {
this.happiness += amount;
if (this.happyness > 100)
this.happyness = 100;
if (this.happiness > 100)
this.happiness = 100;
if (this.happyness < 0)
this.happyness = 0;
if (this.happiness < 0)
this.happiness = 0;
}
public int getRespect() {
@ -169,7 +169,7 @@ public class Pet implements ISerialize, Runnable {
if (this.needsUpdate) {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) {
if (this.id > 0) {
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_pets SET room_id = ?, experience = ?, energy = ?, respect = ?, x = ?, y = ?, z = ?, rot = ?, hunger = ?, thirst = ?, happyness = ?, created = ? WHERE id = ?")) {
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_pets SET room_id = ?, experience = ?, energy = ?, respect = ?, x = ?, y = ?, z = ?, rot = ?, hunger = ?, thirst = ?, happiness = ?, created = ? WHERE id = ?")) {
statement.setInt(1, (this.room == null ? 0 : this.room.getId()));
statement.setInt(2, this.experience);
statement.setInt(3, this.energy);
@ -180,7 +180,7 @@ public class Pet implements ISerialize, Runnable {
statement.setInt(8, this.roomUnit != null ? this.roomUnit.getBodyRotation().getValue() : 0);
statement.setInt(9, this.levelHunger);
statement.setInt(10, this.levelThirst);
statement.setInt(11, this.happyness);
statement.setInt(11, this.happiness);
statement.setInt(12, this.created);
statement.setInt(13, this.id);
statement.execute();
@ -256,7 +256,7 @@ public class Pet implements ISerialize, Runnable {
this.addEnergy(5);
this.addHappyness(1);
this.addHappiness(1);
if (this.energy == PetManager.maxEnergy(this.level)) {
this.roomUnit.removeStatus(RoomUnitStatus.LAY);
@ -296,9 +296,9 @@ public class Pet implements ISerialize, Runnable {
if (this.levelThirst < 100)
this.levelThirst++;
if (this.happyness > 0 && time - this.happynessDelay >= 30) {
this.happyness--;
this.happynessDelay = time;
if (this.happiness > 0 && time - this.happinessDelay >= 30) {
this.happiness--;
this.happinessDelay = time;
}
}
@ -315,9 +315,9 @@ public class Pet implements ISerialize, Runnable {
this.say(this.petData.randomVocal(PetVocalsType.TIRED));
if (this.energy <= 10)
this.findNest();
} else if (this.happyness > 85) {
} else if (this.happiness > 85) {
this.say(this.petData.randomVocal(PetVocalsType.GENERIC_HAPPY));
} else if (this.happyness < 15) {
} else if (this.happiness < 15) {
this.say(this.petData.randomVocal(PetVocalsType.GENERIC_SAD));
} else if (this.levelHunger > 50) {
this.say(this.petData.randomVocal(PetVocalsType.HUNGRY));
@ -408,12 +408,12 @@ public class Pet implements ISerialize, Runnable {
if (this.energy < 30) {
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, PetGestures.TIRED.getKey());
this.findNest();
} else if (this.happyness == 100) {
} else if (this.happiness == 100) {
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, PetGestures.LOVE.getKey());
} else if (this.happyness >= 90) {
} else if (this.happiness >= 90) {
this.randomHappyAction();
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, PetGestures.HAPPY.getKey());
} else if (this.happyness <= 5) {
} else if (this.happiness <= 5) {
this.randomSadAction();
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, PetGestures.SAD.getKey());
} else if (this.levelHunger > 80) {
@ -533,7 +533,7 @@ public class Pet implements ISerialize, Runnable {
}
this.level++;
this.say(this.petData.randomVocal(PetVocalsType.LEVEL_UP));
this.addHappyness(100);
this.addHappiness(100);
this.roomUnit.setStatus(RoomUnitStatus.GESTURE, "exp");
this.gestureTickTimeout = Emulator.getIntUnixTimestamp();
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLevelUp"));
@ -573,7 +573,7 @@ public class Pet implements ISerialize, Runnable {
public void scratched(Habbo habbo) {
this.addHappyness(10);
this.addHappiness(10);
this.addExperience(10);
this.addRespect();
this.needsUpdate = true;
@ -641,12 +641,12 @@ public class Pet implements ISerialize, Runnable {
this.color = color;
}
public int getHappyness() {
return this.happyness;
public int getHappiness() {
return this.happiness;
}
public void setHappyness(int happyness) {
this.happyness = happyness;
public void setHappiness(int happiness) {
this.happiness = happiness;
}
public int getExperience() {

View File

@ -24,7 +24,7 @@ public class PetCommand implements Comparable<PetCommand> {
public final int energyCost;
public final int happynessCost;
public final int happinessCost;
public final PetAction action;
@ -35,7 +35,7 @@ public class PetCommand implements Comparable<PetCommand> {
this.level = set.getInt("required_level");
this.xp = set.getInt("reward_xp");
this.energyCost = set.getInt("cost_energy");
this.happynessCost = set.getInt("cost_happyness");
this.happinessCost = set.getInt("cost_happiness");
this.action = action;
}
@ -67,7 +67,7 @@ public class PetCommand implements Comparable<PetCommand> {
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, this.action.gestureToSet);
pet.addEnergy(-this.energyCost);
pet.addHappyness(-this.happynessCost);
pet.addHappiness(-this.happinessCost);
pet.addExperience(this.xp);
}
}

View File

@ -17,7 +17,7 @@ public class ActionBeg extends PetAction {
public boolean apply(Pet pet, Habbo habbo, String[] data) {
pet.clearPosture();
if (pet.getHappyness() > 90)
if (pet.getHappiness() > 90)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -19,7 +19,7 @@ public class ActionBreatheFire extends PetAction {
public boolean apply(Pet pet, Habbo habbo, String[] data) {
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.FLAME, null, false), this.minimumActionDuration);
if (pet.getHappyness() > 50)
if (pet.getHappiness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
return true;

View File

@ -21,7 +21,7 @@ public class ActionCroak extends PetAction {
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.CROAK, null, false), 2000);
if (pet.getHappyness() > 80)
if (pet.getHappiness() > 80)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
return true;

View File

@ -18,7 +18,7 @@ public class ActionDown extends PetAction {
public boolean apply(Pet pet, Habbo habbo, String[] data) {
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, pet.getRoom().getStackHeight(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), false) + "");
if (pet.getHappyness() > 50)
if (pet.getHappiness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -23,7 +23,7 @@ public class ActionFollow extends PetAction {
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, 0));
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -20,7 +20,7 @@ public class ActionFollowLeft extends PetAction {
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, -2));
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -20,7 +20,7 @@ public class ActionFollowRight extends PetAction {
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, +2));
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -19,7 +19,7 @@ public class ActionHere extends PetAction {
pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTileInFront(habbo.getRoomUnit().getCurrentLocation(), habbo.getRoomUnit().getBodyRotation().getValue()));
pet.getRoomUnit().setCanWalk(true);
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -22,7 +22,7 @@ public class ActionJump extends PetAction {
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.JUMP, null, false), 2000);
if (pet.getHappyness() > 60)
if (pet.getHappiness() > 60)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -14,7 +14,7 @@ public class ActionPlay extends PetAction {
public boolean apply(Pet pet, Habbo habbo, String[] data) {
//Play
//TODO Implement playing for pets. For example; go to ball, toy etc.
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else {
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));

View File

@ -21,7 +21,7 @@ public class ActionPlayDead extends PetAction {
pet.getRoomUnit().setStatus(RoomUnitStatus.DEAD, pet.getRoom().getStackHeight(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), false) + "");
if (pet.getHappyness() > 50)
if (pet.getHappiness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -34,7 +34,7 @@ public class ActionPlayFootball extends PetAction {
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(foundBall.getX(), foundBall.getY()));
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -14,9 +14,9 @@ public class ActionRelax extends PetAction {
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data) {
//Relax
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_HAPPY));
else if (pet.getHappyness() < 30)
else if (pet.getHappiness() < 30)
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_SAD));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -17,7 +17,7 @@ public class ActionSit extends PetAction {
if (pet.getTask() != PetTasks.SIT && !pet.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) {
pet.getRoomUnit().setStatus(RoomUnitStatus.SIT, pet.getRoom().getStackHeight(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), false) - 0.50 + "");
if (pet.getHappyness() > 75)
if (pet.getHappiness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -21,9 +21,9 @@ public class ActionSpeak extends PetAction {
pet.setMuted(false);
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.SPEAK, null, false), 2000);
if (pet.getHappyness() > 70)
if (pet.getHappiness() > 70)
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_HAPPY));
else if (pet.getHappyness() < 30)
else if (pet.getHappiness() < 30)
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_SAD));
else if (pet.getLevelHunger() > 65)
pet.say(pet.getPetData().randomVocal(PetVocalsType.HUNGRY));

View File

@ -20,7 +20,7 @@ public class ActionStand extends PetAction {
public boolean apply(Pet pet, Habbo habbo, String[] data) {
pet.clearPosture();
if (pet.getHappyness() > 30)
if (pet.getHappiness() > 30)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));

View File

@ -18,7 +18,7 @@ public class ActionTorch extends PetAction {
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data) {
if (pet.getHappyness() < 30) {
if (pet.getHappiness() < 30) {
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
return false;
}

View File

@ -18,7 +18,7 @@ public class ActionWave extends PetAction {
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data) {
//WAV
if (pet.getHappyness() > 65) {
if (pet.getHappiness() > 65) {
pet.getRoomUnit().setStatus(RoomUnitStatus.WAVE, "0");
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.WAVE, null, false), 2000);

View File

@ -19,7 +19,7 @@ public class ActionWings extends PetAction {
public boolean apply(Pet pet, Habbo habbo, String[] data) {
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.WINGS, null, false), this.minimumActionDuration);
if (pet.getHappyness() > 50)
if (pet.getHappiness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
return true;

View File

@ -43,7 +43,7 @@ public class PetInformationComposer extends MessageComposer {
}
this.response.appendInt(this.pet.getEnergy());
this.response.appendInt(this.pet.getMaxEnergy()); //Max energy
this.response.appendInt(this.pet.getHappyness()); //this.pet.getHappyness()
this.response.appendInt(this.pet.getHappiness());
this.response.appendInt(100);
this.response.appendInt(this.pet.getRespect());
this.response.appendInt(this.pet.getUserId());