mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Implemented pet shoo-away
This commit is contained in:
parent
1d12dd741f
commit
08241eb1db
2 changed files with 14 additions and 9 deletions
|
|
@ -283,9 +283,11 @@ public final class FamiliarManager {
|
||||||
details = new PetDetails(pets.getGrowthRate() == 0.0 ? 100.0 : 0.0);
|
details = new PetDetails(pets.getGrowthRate() == 0.0 ? 100.0 : 0.0);
|
||||||
for (individual = 0; taken.contains(individual) && individual < 0xFFFF; individual++) {}
|
for (individual = 0; taken.contains(individual) && individual < 0xFFFF; individual++) {}
|
||||||
details.setIndividual(individual);
|
details.setIndividual(individual);
|
||||||
item.setCharge(individual);
|
// Make a copy of the item to extract what the item's idHash will be when including the individual ID as a "charge" value.
|
||||||
itemIdHash = item.getIdHash(); //updates the hashed item to include the new "charge" value
|
// The copy is necessary since the player's inventory still contains the default-charged item, which we will be removing only later.
|
||||||
petDetails.put(itemIdHash, details);
|
Item newItem = item.copy();
|
||||||
|
newItem.setCharge(individual);
|
||||||
|
petDetails.put(newItem.getIdHash(), details);
|
||||||
}
|
}
|
||||||
int npcId = pets.getNpcId(itemId);
|
int npcId = pets.getNpcId(itemId);
|
||||||
if (npcId > 0) {
|
if (npcId > 0) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public final class KittenInteractDialogue extends DialoguePlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean open(Object... args) {
|
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;
|
stage = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -113,11 +113,14 @@ public final class KittenInteractDialogue extends DialoguePlugin {
|
||||||
case 560:
|
case 560:
|
||||||
switch (buttonId) {
|
switch (buttonId) {
|
||||||
case 1:// yes
|
case 1:// yes
|
||||||
player.sendChat("Shoo cat!");
|
if (player.getFamiliarManager().hasFamiliar()) { //in case the cat had already run away from hunger by the time the player clicked 'yes'
|
||||||
player.getFamiliarManager().getFamiliar().sendChat("Miaow!");
|
player.sendChat("Shoo cat!");
|
||||||
// player.getFamiliarManager().getFamiliar().dismiss();//TODO:
|
Pet currentPet = (Pet) player.getFamiliarManager().getFamiliar();
|
||||||
// Pet
|
player.getFamiliarManager().getFamiliar().sendChat("Miaow!");
|
||||||
player.getPacketDispatch().sendMessage("The cat has run away.");
|
player.getFamiliarManager().removeDetails(currentPet.getItemIdHash());
|
||||||
|
player.getFamiliarManager().getFamiliar().dismiss();
|
||||||
|
player.getPacketDispatch().sendMessage("The cat has run away.");
|
||||||
|
}
|
||||||
end();
|
end();
|
||||||
break;
|
break;
|
||||||
case 2:// no
|
case 2:// no
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue