Implemented pet shoo-away

This commit is contained in:
Player Name 2024-02-14 11:33:56 +00:00 committed by Ryan
parent 1d12dd741f
commit 08241eb1db
2 changed files with 14 additions and 9 deletions

View file

@ -283,9 +283,11 @@ public final class FamiliarManager {
details = new PetDetails(pets.getGrowthRate() == 0.0 ? 100.0 : 0.0);
for (individual = 0; taken.contains(individual) && individual < 0xFFFF; individual++) {}
details.setIndividual(individual);
item.setCharge(individual);
itemIdHash = item.getIdHash(); //updates the hashed item to include the new "charge" value
petDetails.put(itemIdHash, details);
// Make a copy of the item to extract what the item's idHash will be when including the individual ID as a "charge" value.
// The copy is necessary since the player's inventory still contains the default-charged item, which we will be removing only later.
Item newItem = item.copy();
newItem.setCharge(individual);
petDetails.put(newItem.getIdHash(), details);
}
int npcId = pets.getNpcId(itemId);
if (npcId > 0) {

View file

@ -49,7 +49,7 @@ public final class KittenInteractDialogue extends DialoguePlugin {
@Override
public boolean open(Object... args) {
interpreter.sendOptions("Interact with Kitten", "Stroke", "Chase-Vermin", "Shoo-away.");
interpreter.sendOptions("Interact with Kitten", "Stroke", "Chase vermin", "Shoo away");
stage = 0;
return true;
}
@ -113,11 +113,14 @@ public final class KittenInteractDialogue extends DialoguePlugin {
case 560:
switch (buttonId) {
case 1:// yes
if (player.getFamiliarManager().hasFamiliar()) { //in case the cat had already run away from hunger by the time the player clicked 'yes'
player.sendChat("Shoo cat!");
Pet currentPet = (Pet) player.getFamiliarManager().getFamiliar();
player.getFamiliarManager().getFamiliar().sendChat("Miaow!");
// player.getFamiliarManager().getFamiliar().dismiss();//TODO:
// Pet
player.getFamiliarManager().removeDetails(currentPet.getItemIdHash());
player.getFamiliarManager().getFamiliar().dismiss();
player.getPacketDispatch().sendMessage("The cat has run away.");
}
end();
break;
case 2:// no