hey, everytime i pickup my pet, it show up again and follow me
Here is my pet code:
rs\game\player\content\pet\Pets.java
rs\game\player\content\pet\PetManager.javaCode:package com.rs.game.player.content.pet;
import java.util.HashMap;
import java.util.Map;
import com.rs.game.player.Player;
/**
* An enum containing all the pets and their info.
* @author Emperor
*
*/
public enum Pets {
/**
* A cat/kitten pet.
*/
CAT(1555, 1561, 1567, 761, 768, 774, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
CAT_1(1556, 1562, 1568, 762, 769, 775, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
CAT_2(1557, 1563, 1569, 763, 770, 776, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
CAT_3(1558, 1564, 1570, 764, 771, 777, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
CAT_4(1559, 1565, 1571, 765, 772, 778, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
CAT_5(1560, 1566, 1572, 766, 773, 779, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
HELLCAT(7583, 7582, 7581, 3505, 3504, 3503, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
CAT_7(14089, 14090, 15092, 8217, 8214, 8216, 0.0154320987654321, 0, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 1927),
/**
* A clockwork cat.
*/
CLOCKWORK_CAT(7771, 7772, -1, 3598, -1, -1, 0.0, 0),
/**
* The firemaker's curse pets.
*/
SEARING_FLAME(22994, -1, -1, 14769, -1, -1, 0.0, 0),
GLOWING_EMBER(22993, -1, -1, 14768, -1, -1, 0.0, 0),
TWISTED_FIRESTARTER(22995, -1, -1, 14770, -1, -1, 0.0, 0),
WARMING_FLAME(22992, -1, -1, 14767, -1, -1, 0.0, 0),
/**
* Troll baby pet.
*/
TROLL_BABY(23030, 23030, -1, 14846, -1, -1, 0.0, 0),
/**
* A bulldog pet.
*/
BULLDOG(12522, 12523, -1, 6969, 6968, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
BULLDOG_1(12720, 12721, -1, 7259, 7257, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
BULLDOG_2(12722, 12723, -1, 7260, 7258, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
/**
* A dalmation pet.
*/
DALMATIAN(12518, 12519, -1, 6964, 6965, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
DALMATIAN_1(12712, 12713, -1, 7249, 7250, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
DALMATIAN_2(12714, 12715, -1, 7251, 7252, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
/**
* A greyhound pet.
*/
GREYHOUND(12514, 12515, -1, 6960, 6961, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
GREYHOUND_1(12704, 12705, -1, 7241, 7242, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
GREYHOUND_2(12706, 12707, -1, 7243, 7244, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
/**
* A labrador pet.
*/
LABRADOR(12516, 12517, -1, 6962, 6963, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
LABRADOR_1(12708, 12709, -1, 7245, 7246, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
LABRADOR_2(12710, 12711, -1, 7247, 7248, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
/**
* A sheepdog pet.
*/
SHEEPDOG(12520, 12521, -1, 6966, 6967, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
SHEEPDOG_1(12716, 12717, -1, 7253, 7254, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
SHEEPDOG_2(12718, 12719, -1, 7255, 7256, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
/**
* A terrier pet.
*/
TERRIER(12512, 12513, -1, 6958, 6859, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
TERRIER_1(12700, 12701, -1, 7237, 7238, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
TERRIER_2(12702, 12703, -1, 7239, 7240, -1, 0.0033333333333333, 4, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 526),
/**
* A creeping hand pet.
*/
CREEPING_HAND(14652, -1, -1, 8619, -1, -1, 0.0033333333333333, 4, 1059),
/**
* Minitrice pet.
*/
MINITRICE(14653, -1, -1, 8620, -1, -1, 0.0033333333333333, 4, 225),
/**
* Baby basilisk pet.
*/
BABY_BASILISK(14654, -1, -1, 8621, -1, -1, 0.0033333333333333, 4, 221),
/**
* Baby kurask pet.
*/
BABY_KURASK(14655, -1, -1, 8622, -1, -1, 0.0033333333333333, 4, 526),
/**
* Abyssal minion pet.
*/
ABYSSAL_MINION(14651, -1, -1, 8624, -1, -1, 0.0033333333333333, 4, 592),
/**
* Rune guardian pets.
*/
RUNE_GUARDIAN(15626, -1, -1, 9656, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_1(15627, -1, -1, 9657, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_2(15628, -1, -1, 9658, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_3(15629, -1, -1, 9659, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_4(15630, -1, -1, 9660, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_5(15631, -1, -1, 9661, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_6(15632, -1, -1, 9662, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_7(15633, -1, -1, 9663, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_8(15634, -1, -1, 9664, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_9(15635, -1, -1, 9665, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_10(15636, -1, -1, 9666, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_11(15637, -1, -1, 9667, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_12(15638, -1, -1, 9668, -1, -1, 0.0033333333333333, 4),
RUNE_GUARDIAN_13(15639, -1, -1, 9669, -1, -1, 0.0033333333333333, 4),
/**
* Gecko pet.
*/
GECKO(12488, 12489, -1, 6915, 6916, -1, 0.005, 10, 12125, 12127),
GECKO_1(12738, 12742, -1, 7277, 7281, -1, 0.005, 10, 12125, 12127),
GECKO_2(12739, 12743, -1, 7278, 7282, -1, 0.005, 10, 12125, 12127),
GECKO_3(12740, 12744, -1, 7279, 7283, -1, 0.005, 10, 12125, 12127),
GECKO_4(12741, 12745, -1, 7280, 7284, -1, 0.005, 10, 12125, 12127),
/**
* The platypus pet.
*/
PLATYPUS(12551, 12548, -1, 7018, 7015, -1, 0.0046296296296296, 10, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 313, 12129),
PLATYPUS_1(12552, 12549, -1, 7019, 7016, -1, 0.0046296296296296, 10, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 313, 12129),
PLATYPUS_2(12553, 12550, -1, 7020, 7017, -1, 0.0046296296296296, 10, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 313, 12129),
/**
* The broav pet.
*/
BROAV(14533, -1, -1, 8491, -1, -1, 0.0, 23, 2970),
/**
* The penguin pet.
*/
PENGUIN(12481, 12482, -1, 6908, 6909, -1, 0.0046296296296296, 30, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
PENGUIN_1(12763, 12762, -1, 7313, 7314, -1, 0.0046296296296296, 30, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
PENGUIN_2(12765, 12764, -1, 7316, 7317, -1, 0.0046296296296296, 30, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
/**
* A tooth creature pet.
*/
TOOTH_CREATURE(18671, 18669, -1, 11411, 11413, -1, 0.075757575757576, 37, 1927, 1977),
/**
* A giant crab pet.
*/
GIANT_CRAB(12500, 12501, -1, 6947, 6948, -1, 0.0069444444444444, 40, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
GIANT_CRAB_1(12746, 12747, -1, 7293, 7294, -1, 0.0069444444444444, 40, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
GIANT_CRAB_2(12748, 12749, -1, 7295, 7296, -1, 0.0069444444444444, 40, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
GIANT_CRAB_3(12750, 12751, -1, 7297, 7298, -1, 0.0069444444444444, 40, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
GIANT_CRAB_4(12752, 12753, -1, 7299, 7300, -1, 0.0069444444444444, 40, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
/**
* A Raven pet.
*/
RAVEN(12484, 12485, -1, 6911, 6912, -1, 0.00698888, 50, 313, 12129),
RAVEN_1(12724, 12725, -1, 7261, 7262, -1, 0.00698888, 50, 313, 12129),
RAVEN_2(12726, 12727, -1, 7263, 7264, -1, 0.00698888, 50, 313, 12129),
RAVEN_3(12728, 12729, -1, 7265, 7266, -1, 0.00698888, 50, 313, 12129),
RAVEN_4(12730, 12731, -1, 7267, 7268, -1, 0.00698888, 50, 313, 12129),
RAVEN_5(12732, 12733, -1, 7269, 7270, -1, 0.00698888, 50, 313, 12129),
/**
* A squirrel pet.
*/
SQUIRREL(12490, 12491, -1, 6919, 6920, -1, 0.0071225071225071, 60, 12130),
SQUIRREL_1(12754, 12755, -1, 7301, 7302, -1, 0.0071225071225071, 60, 12130),
SQUIRREL_2(12756, 12757, -1, 7303, 7304, -1, 0.0071225071225071, 60, 12130),
SQUIRREL_3(12758, 12759, -1, 7305, 7306, -1, 0.0071225071225071, 60, 12130),
SQUIRREL_4(12760, 12761, -1, 7307, 7308, -1, 0.0071225071225071, 60, 12130),
/**
* Godbirds.
*/
SARADOMIN_OWL(12503, 12504, 12505, 6949, 6950, 6951, 0.0069444444444444, 70, 313, 12129),
ZAMORAK_HAWK(12506, 12507, 12508, 6952, 6953, 6954, 0.0069444444444444, 70, 313, 12129),
GUTHIX_RAPTOR(12509, 12510, 12511, 6955, 6956, 6957, 0.0069444444444444, 70, 313, 12129),
/**
* Ex-ex parrot
*/
EX_EX_PARROT(13335, -1, -1, 7844, -1, -1, 0.0, 71, 13379),
/**
* The phoenix eggling pets.
*/
CUTE_PHOENIX_EGGLING(14627, -1, -1, 8578, -1, -1, 0.0, 72, 592),
MEAN_PHOENIX_EGGLING(14626, -1, -1, 8577, -1, -1, 0.0, 72, 592),
/**
* A raccoon pet.
*/
RACCOON(12486, 12487, -1, 6913, 6914, -1, 0.0029444444444444, 80, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 2132, 2134, 2136, 2138, 10816, 9986, 9978),
RACCOON_1(12734, 12735, -1, 7271, 7272, -1, 0.0029444444444444, 80, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 2132, 2134, 2136, 2138, 10816, 9986, 9978),
RACCOON_2(12736, 12737, -1, 7273, 7274, -1, 0.0029444444444444, 80, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270, 2132, 2134, 2136, 2138, 10816, 9986, 9978),
/**
* A sneaker peeper pet.
*/
SNEAKER_PEEPER(19894, 19895, -1, 13089, 13090, -1, 0.05, 80, 221),
/**
* A vulture pet.
*/
VULTURE(12498, 12499, -1, 6945, 6946, -1, 0.0078, 85, 313, 12129),
VULTURE_1(12766, 12767, -1, 7319, 7320, -1, 0.0078, 85, 313, 12129),
VULTURE_2(12768, 12769, -1, 7321, 7322, -1, 0.0078, 85, 313, 12129),
VULTURE_3(12770, 12771, -1, 7323, 7324, -1, 0.0078, 85, 313, 12129),
VULTURE_4(12772, 12773, -1, 7325, 7326, -1, 0.0078, 85, 313, 12129),
VULTURE_5(12774, 12775, -1, 7327, 7328, -1, 0.0078, 85, 313, 12129),
/**
* A chameleon pet.
*/
CHAMELEON(12492, 12493, -1, 6922, 6923, -1, 0.0069444444444444, 90, 12125),
/**
* A monkey pet.
*/
MONKEY(12496, 12497, -1, 6942, 6943, -1, 0.0069444444444444, 95, 1963),
MONKEY_1(12682, 12683, -1, 7210, 7211, -1, 0.0069444444444444, 95, 1963),
MONKEY_2(12684, 12685, -1, 7212, 7213, -1, 0.0069444444444444, 95, 1963),
MONKEY_3(12686, 12687, -1, 7214, 7215, -1, 0.0069444444444444, 95, 1963),
MONKEY_4(12688, 12689, -1, 7216, 7217, -1, 0.0069444444444444, 95, 1963),
MONKEY_5(12690, 12691, -1, 7218, 7219, -1, 0.0069444444444444, 95, 1963),
MONKEY_6(12692, 12693, -1, 7220, 7221, -1, 0.0069444444444444, 95, 1963),
MONKEY_7(12694, 12695, -1, 7222, 7223, -1, 0.0069444444444444, 95, 1963),
MONKEY_8(12696, 12697, -1, 7224, 7225, -1, 0.0069444444444444, 95, 1963),
MONKEY_9(12698, 12699, -1, 7226, 7227, -1, 0.0069444444444444, 95, 1963),
/**
* A baby dragon pet.
*/
BABY_DRAGON(12469, 12470, -1, 6900, 6901, -1, 0.0052, 99, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
BABY_DRAGON_1(12471, 12472, -1, 6902, 6903, -1, 0.0052, 99, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
BABY_DRAGON_2(12473, 12474, -1, 6904, 6905, -1, 0.0052, 99, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
BABY_DRAGON_3(12475, 12476, -1, 6906, 6907, -1, 0.0052, 99, 2132, 2134, 2136, 2138, 10816, 9986, 9978, 321, 363, 341, 15264, 345, 377, 353, 389, 7944, 349, 331, 327, 395, 383, 317, 371, 335, 359, 15264, 15270),
/**
* TzRek-Jad pet.
*/
TZREK_JAD(21512, -1, -1, 3604, -1, -1, 0.0, 99),
/**
* Dragonkk's pet, as requested.
*/
FERRET(10092, -1, -1, 5559, -1, -1, 0.0, 99),
/**
* Emperor's (me) pet.
*/
GIANT_WOLPERTINGER(8888, -1, -1, 6990, -1, -1, 0.0, 99),
/**
* Danny's (me) pet.
*/
QUEEN_BLACK_DRAGON(24385, -1, -1, 15454, -1, -1, 0.0, 99),
/* New Pets*/
CHICKARRA(33778,-1,-1,20530,-1,-1,0.0,1),
COMMANDERMINIANA(33807,-1,-1,20533,-1,-1,0.0,1),
GENERALAWWDOR(33806,-1,-1,20532,-1,-1,0.0,1),
KRILTINYROTH(33805,-1,-1,20531,-1,-1,0.0,1),
NEXTERMINATOR(33808,-1,-1,20534,-1,-1,0.0,1),
MOLLY(33813,-1,-1,20539,-1,-1,0.0,1),
SHRIMPY(33788,-1,-1,20540,-1,-1,0.0,1),
KINGBLACKDRAGONLING(33792,-1,-1,20544,-1,-1,0.0,1),
QUEENBLACKDRAGONLING(33799,-1,-1,20551,-1,-1,0.0,1),
KALPHITEGRUBLET(33790,-1,-1,20543,-1,-1,0.0,1),
KALPHITEGRUBLING(33789,-1,-1,20541,-1,-1,0.0,1),
CORPORALPUPPY(33786,-1,-1,20538,-1,-1,0.0,1),
ELLIE(33785,-1,-1,20537,-1,-1,0.0,1),
LEGIOPRIMULUS(33819,-1,-1,20545,-1,-1,0.0,1),
LEGIOSECUNDULUS(33820,-1,-1,20546,-1,-1,0.0,1),
LEGIOTERTIOLUS(33821,-1,-1,20547,-1,-1,0.0,1),
LEGIOGUARTULUS(33822,-1,-1,20548,-1,-1,0.0,1),
LEGIOQUINTULUS(33823,-1,-1,20549,-1,-1,0.0,1),
LEGIOSEXTULUS(33824,-1,-1,20550,-1,-1,0.0,1),
REXHATCHLING(33801,-1,-1,20553,-1,-1,0.0,1),
PRIMEHATCHLING(33800,-1,-1,20552,-1,-1,0.0,1),
SUPREMEHATCHLING(33802,-1,-1,20554,-1,-1,0.0,1),
DUCKSSSSSSS(33803,-1,-1,20555,-1,-1,0.0,1),
BOMBI(33717,-1,-1,20461,-1,-1,0.0,1),
BABY_JADINKO(19983, -1, -1, 13165, -1, -1, 0.0, 1),
BARRY(33809,-1,-1,20535,-1,-1,0.0,1),
DAVE(31748,-1,-1,19475,-1,-1,0.0,1),
STEVE(31749,-1,-1,19476,-1,-1,0.0,1),
PETE(31750,-1,-1,19477,-1,-1,0.0,1),
GAVIN(31751,-1,-1,19478,-1,-1,0.0,1),
LANA(31752,-1,-1,19479,-1,-1,0.0,1),
BILL(31753,-1,-1,19480,-1,-1,0.0,1),
VITALIS(28630,-1,-1,17186,-1,-1,0.0,1),
MALLORY(33784,-1,-1,20536,-1,-1,0.0,1),
BESTIAL_GHOST_PET(15385,-1,-1,20588,-1,-1,0.0,1);
/* End of new Pets*/
//BABY_JADINKO(19983, -1, -1, 13165, -1, -1, 0.0, 1);
/**
* The baby pets mapping.
*/
private static final Map<Integer, Pets> babyPets = new HashMap<Integer, Pets>();
/**
* The grown pets mapping.
*/
private static final Map<Integer, Pets> grownPets = new HashMap<Integer, Pets>();
/**
* The overgrown pets mapping.
*/
private static final Map<Integer, Pets> overgrownPets = new HashMap<Integer, Pets>();
/**
* Populates the mappings.
*/
static {
for (Pets pet : Pets.values()) {
babyPets.put(pet.babyItemId, pet);
if (pet.grownItemId > 0) {
grownPets.put(pet.grownItemId, pet);
if (pet.getOvergrownItemId() > 0) {
overgrownPets.put(pet.overgrownItemId, pet);
}
}
}
}
/**
* Gets the pet object for the item id.
* @[Only registered and activated users can see links. Click Here To Register...] itemId The item id.
* @[Only registered and activated users can see links. Click Here To Register...] The pet object.
*/
public static Pets forId(int itemId) {
Pets pet = babyPets.get(itemId);
if (pet == null) {
pet = grownPets.get(itemId);
if (pet == null) {
return overgrownPets.get(itemId);
}
return pet;
}
return pet;
}
/**
* Checks if a player has a pet.
* @[Only registered and activated users can see links. Click Here To Register...] player The player.
* @[Only registered and activated users can see links. Click Here To Register...] {@code True} if so.
*/
public static boolean hasPet(Player player) {
for (int itemId : babyPets.keySet()) {
if (player.getInventory().containsOneItem(itemId)) {
return true;
}
}
for (int itemId : grownPets.keySet()) {
if (player.getInventory().containsOneItem(itemId)) {
return true;
}
}
for (int itemId : overgrownPets.keySet()) {
if (player.getInventory().containsOneItem(itemId)) {
return true;
}
}
return false;
}
/**
* The baby item id.
*/
private final int babyItemId;
/**
* The grown pet's item id.
*/
private final int grownItemId;
/**
* The overgrown pet's item id.
*/
private final int overgrownItemId;
/**
* The baby pet NPC id.
*/
private final int babyNpcId;
/**
* The grown pet NPC id.
*/
private final int grownNpcId;
/**
* The overgrown pet NPC id.
*/
private final int overgrownNpcId;
/**
* The growth rate.
*/
private final double growthRate;
/**
* The summoning level required.
*/
private final int summoningLevel;
/**
* The food this pet uses.
*/
private final int[] food;
/**
* Constructs a new {@code Pets} {@code Object}.
* @[Only registered and activated users can see links. Click Here To Register...] babyItemId The baby pet item id.
* @[Only registered and activated users can see links. Click Here To Register...] grownItemId The grown pet item id.
* @[Only registered and activated users can see links. Click Here To Register...] overgrownItemId The overgrown item id.
* @[Only registered and activated users can see links. Click Here To Register...] babyNpcId The baby pet npc id.
* @[Only registered and activated users can see links. Click Here To Register...] grownNpcId The grown pet npc id.
* @[Only registered and activated users can see links. Click Here To Register...] overgrownNpcId The overgrown npc id.
* @[Only registered and activated users can see links. Click Here To Register...] growthRate The growth rate (amount to increase growth with every tick).
* @[Only registered and activated users can see links. Click Here To Register...] summoningLevel The summoning level required.
* @[Only registered and activated users can see links. Click Here To Register...] food The food item ids the pet uses.
*/
private Pets(int babyItemId, int grownItemId, int overgrownItemId, int babyNpcId, int grownNpcId, int overgrownNpcId, double growthRate, int summoningLevel, int...food) {
this.babyItemId = babyItemId;
this.grownItemId = grownItemId;
this.overgrownItemId = overgrownItemId;
this.babyNpcId = babyNpcId;
this.grownNpcId = grownNpcId;
this.overgrownNpcId = overgrownNpcId;
this.growthRate = growthRate;
this.summoningLevel = summoningLevel;
this.food = food;
}
/**
* Gets the babyItemId.
* @[Only registered and activated users can see links. Click Here To Register...] The babyItemId.
*/
public int getBabyItemId() {
return babyItemId;
}
/**
* Gets the grownItemId.
* @[Only registered and activated users can see links. Click Here To Register...] The grownItemId.
*/
public int getGrownItemId() {
return grownItemId;
}
/**
* Gets the overgrownItemId.
* @[Only registered and activated users can see links. Click Here To Register...] The overgrownItemId.
*/
public int getOvergrownItemId() {
return overgrownItemId;
}
/**
* Gets the babyNpcId.
* @[Only registered and activated users can see links. Click Here To Register...] The babyNpcId.
*/
public int getBabyNpcId() {
return babyNpcId;
}
/**
* Gets the grownNpcId.
* @[Only registered and activated users can see links. Click Here To Register...] The grownNpcId.
*/
public int getGrownNpcId() {
return grownNpcId;
}
/**
* Gets the overgrownNpcId.
* @[Only registered and activated users can see links. Click Here To Register...] The overgrownNpcId.
*/
public int getOvergrownNpcId() {
return overgrownNpcId;
}
/**
* Gets the growthRate.
* @[Only registered and activated users can see links. Click Here To Register...] The growthRate.
*/
public double getGrowthRate() {
return growthRate;
}
/**
* Gets the summoningLevel.
* @[Only registered and activated users can see links. Click Here To Register...] The summoningLevel.
*/
public int getSummoningLevel() {
return summoningLevel;
}
/**
* Gets the food.
* @[Only registered and activated users can see links. Click Here To Register...] The food.
*/
public int[] getFood() {
return food;
}
/**
* Gets the NPC id for this pet.
* @[Only registered and activated users can see links. Click Here To Register...] stage The stage of the pet.
* @[Only registered and activated users can see links. Click Here To Register...] The NPc id.
*/
public int getNpcId(int stage) {
switch (stage) {
case 0:
return babyNpcId;
case 1:
return grownNpcId;
case 2:
return overgrownNpcId;
}
return 0;
}
/**
* Gets the item id for this pet.
* @[Only registered and activated users can see links. Click Here To Register...] stage The stage of the pet.
* @[Only registered and activated users can see links. Click Here To Register...] The item id.
*/
public int getItemId(int stage) {
switch (stage) {
case 0:
return babyItemId;
case 1:
return grownItemId;
case 2:
return overgrownItemId;
}
return 0;
}
}
src\com\rs\game\npc\Pets.javaCode:package com.rs.game.player.content.pet;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.rs.cache.loaders.ItemDefinitions;
import com.rs.game.Animation;
import com.rs.game.ForceTalk;
import com.rs.game.item.Item;
import com.rs.game.npc.pet.Pet;
import com.rs.game.player.Player;
import com.rs.game.player.content.ItemConstants;
/**
* The pet manager.
* @author Emperor
*
*/
public final class PetManager implements Serializable {
/**
* The serial UID.
*/
private static final long serialVersionUID = -3379270918966667109L;
/**
* The pet details mapping, sorted by item id.
*/
private final Map<Integer, PetDetails> petDetails = new HashMap<Integer, PetDetails>();
/**
* The player.
*/
private Player player;
/**
* The current NPC id.
*/
private int npcId;
/**
* The current item id.
*/
private int itemId;
/**
* The troll baby's name (if any).
*/
private String trollBabyName;
/**
* Constructs a new {@code PetManager} {@code Object}.
*/
public PetManager() {
/*
* empty.
*/
}
/**
* Spawns a pet.
* @[Only registered and activated users can see links. Click Here To Register...] itemId The item id.
* @[Only registered and activated users can see links. Click Here To Register...] deleteItem If the item should be removed.
* @[Only registered and activated users can see links. Click Here To Register...] {@code True} if we were dealing with a pet item id.
*/
public boolean spawnPet(int itemId, boolean deleteItem) {
Pets pets = Pets.forId(itemId);
if (pets == null) {
return false;
}
if (player.getPet() != null || player.getFamiliar() != null) {
player.getPackets().sendGameMessage("You already have a follower.");
return true;
}
if (!hasRequirements(pets)) {
return true;
}
int baseItemId = pets.getBabyItemId();
PetDetails details = petDetails.get(baseItemId);
if (details == null) {
details = new PetDetails(pets.getGrowthRate() == 0.0 ? 100.0 : 0.0);
petDetails.put(baseItemId, details);
}
int id = pets.getItemId(details.getStage());
if (itemId != id) {
player.getPackets().sendGameMessage("This is not the right pet, grow the pet correctly.");
return true;
}
int npcId = pets.getNpcId(details.getStage());
if (npcId > 0) {
Pet pet = new Pet(npcId, itemId, player, player, details);
this.npcId = npcId;
this.itemId = itemId;
pet.setGrowthRate(pets.getGrowthRate());
player.setPet(pet);
if (deleteItem) {
player.setNextAnimation(new Animation(827));
player.getInventory().deleteItem(itemId, 1);
}
return true;
}
return true;
}
/**
* Checks if the player has the requirements for the pet.
* @[Only registered and activated users can see links. Click Here To Register...] pet The pet.
* @[Only registered and activated users can see links. Click Here To Register...] {@code True} if so.
*/
@[Only registered and activated users can see links. Click Here To Register...]ressWarnings("incomplete-switch")
private boolean hasRequirements(Pets pet) {
switch (pet) {
case TZREK_JAD:
if (!player.isExtremeDonator() || !player.isLegendaryDonator()) {
player.getPackets().sendGameMessage("You need to be Extreme donator to use this pet.");
return false;
}
if (!player.isCompletedFightCaves()) {
player.getPackets().sendGameMessage("You need to complete at least one fight cave minigame to use this pet.");
return false;
}
if (!player.isWonFightPits()) {
player.getPackets().sendGameMessage("You need to win at least one fight pits minigame to use this pet.");
return false;
}
return true;
case SARADOMIN_OWL:
case GUTHIX_RAPTOR:
case ZAMORAK_HAWK:
case VULTURE_1:
case VULTURE_2:
case VULTURE_3:
case VULTURE_4:
case VULTURE_5:
case CHAMELEON:
if (!player.isDonator() || !player.isExtremeDonator() || !player.isLegendaryDonator()) {
player.getPackets().sendGameMessage("You need to be donator to use this pet.");
return false;
}
return true;
case BABY_DRAGON_1:
case BABY_DRAGON_2:
case BABY_DRAGON_3:
case SEARING_FLAME:
case GLOWING_EMBER:
case TWISTED_FIRESTARTER:
case WARMING_FLAME:
if (!player.isExtremeDonator() || !player.isLegendaryDonator()) {
player.getPackets().sendGameMessage("You need to be Extreme donator to use this pet.");
return false;
}
return true;
case FERRET:
case GIANT_WOLPERTINGER:
return player.getRights() > 1;
}
return true;
}
/**
* Initializes the pet manager.
*/
public void init() {
if (npcId > 0 && itemId > 0) {
spawnPet(itemId, false);
}
}
/**
* Makes the pet eat.
* @[Only registered and activated users can see links. Click Here To Register...] foodId The food item id.
* @[Only registered and activated users can see links. Click Here To Register...] npc The pet NPC.
*/
public void eat(int foodId, Pet npc) {
if (npc != player.getPet()) {
player.getPackets().sendGameMessage("This isn't your pet!");
return;
}
Pets pets = Pets.forId(itemId);
if (pets == null) {
return;
}
if (pets == Pets.TROLL_BABY) {
if (!ItemConstants.isTradeable(new Item(foodId))) {
player.getPackets().sendGameMessage("Your troll baby won't eat this item.");
return;
}
if (trollBabyName == null) {
trollBabyName = ItemDefinitions.getItemDefinitions(foodId).getName();
npc.setName(trollBabyName);
npc.setNextForceTalk(new ForceTalk("YUM! Me likes " + trollBabyName + "!"));
}
player.getInventory().deleteItem(foodId, 1);
player.getPackets().sendGameMessage("Your pet happily eats the " + ItemDefinitions.getItemDefinitions(foodId).getName() + ".");
return;
}
for (int food : pets.getFood()) {
if (food == foodId) {
player.getInventory().deleteItem(food, 1);
player.getPackets().sendGameMessage("Your pet happily eats the " + ItemDefinitions.getItemDefinitions(food).getName() + ".");
player.setNextAnimation(new Animation(827));
npc.getDetails().updateHunger(-15.0);
return;
}
}
player.getPackets().sendGameMessage("Nothing interesting happens.");
}
/**
* Removes the details for this pet.
* @[Only registered and activated users can see links. Click Here To Register...] npcId The item id of the pet.
*/
public void removeDetails(int itemId) {
Pets pets = Pets.forId(itemId);
if (pets == null) {
return;
}
petDetails.remove(pets.getBabyItemId());
}
/**
* Gets the player.
* @[Only registered and activated users can see links. Click Here To Register...] The player.
*/
public Player getPlayer() {
return player;
}
/**
* Sets the player.
* @[Only registered and activated users can see links. Click Here To Register...] player The player to set.
*/
public void setPlayer(Player player) {
this.player = player;
}
/**
* Gets the npcId.
* @[Only registered and activated users can see links. Click Here To Register...] The npcId.
*/
public int getNpcId() {
return npcId;
}
/**
* Sets the npcId.
* @[Only registered and activated users can see links. Click Here To Register...] npcId The npcId to set.
*/
public void setNpcId(int npcId) {
this.npcId = npcId;
}
/**
* Gets the itemId.
* @[Only registered and activated users can see links. Click Here To Register...] The itemId.
*/
public int getItemId() {
return itemId;
}
/**
* Sets the itemId.
* @[Only registered and activated users can see links. Click Here To Register...] itemId The itemId to set.
*/
public void setItemId(int itemId) {
this.itemId = itemId;
}
/**
* Gets the trollBabyName.
* @[Only registered and activated users can see links. Click Here To Register...] The trollBabyName.
*/
public String getTrollBabyName() {
return trollBabyName;
}
/**
* Sets the trollBabyName.
* @[Only registered and activated users can see links. Click Here To Register...] trollBabyName The trollBabyName to set.
*/
public void setTrollBabyName(String trollBabyName) {
this.trollBabyName = trollBabyName;
}
}
bumpCode:package com.rs.game.npc.pet;
import com.rs.game.World;
import com.rs.game.WorldTile;
import com.rs.game.npc.NPC;
import com.rs.game.npc.familiar.Familiar;
import com.rs.game.player.Player;
import com.rs.game.player.content.pet.PetDetails;
import com.rs.game.player.content.pet.Pets;
import com.rs.utils.Utils;
/**
* Represents a pet.
* @author Emperor
*
*/
public final class Pet extends NPC {
/**
* The serial UID.
*/
private static final long serialVersionUID = -2848843157767889742L;
/**
* The owner.
*/
private final Player owner;
/**
* The "near" directions.
*/
private final int[][] checkNearDirs;
/**
* The item id.
*/
private final int itemId;
/**
* The pet details.
*/
private final PetDetails details;
/**
* The growth rate of the pet.
*/
private double growthRate;
/**
* The pets type.
*/
private final Pets pet;
/**
* Constructs a new {@code Pet} {@code Object}.
* @[Only registered and activated users can see links. Click Here To Register...] id The NPC id.
* @[Only registered and activated users can see links. Click Here To Register...] itemId The item id.
* @[Only registered and activated users can see links. Click Here To Register...] owner The owner.
* @[Only registered and activated users can see links. Click Here To Register...] tile The world tile.
*/
public Pet(int id, int itemId, Player owner, WorldTile tile, PetDetails details) {
super(id, tile, -1, false);
this.owner = owner;
this.itemId = itemId;
this.checkNearDirs = Utils.getCoordOffsetsNear(super.getSize());
this.details = details;
this.pet = Pets.forId(itemId);
if (pet == Pets.TROLL_BABY && owner.getPetManager().getTrollBabyName() != null) {
setName(owner.getPetManager().getTrollBabyName());
}
sendMainConfigurations();
sendFollowerDetails();
}
@Override
public void processNPC() {
unlockOrb();
if (pet == Pets.TROLL_BABY || pet.getFood().length > 0) {
details.updateHunger(0.025);
owner.getPackets().sendConfigByFile(4286, (int) details.getHunger());
}
if (details.getHunger() >= 90.0 && details.getHunger() < 90.025) {
owner.getPackets().sendGameMessage("<col=ff0000>Your pet is starving, feed it before it runs off.</col>");
} else if (details.getHunger() == 100.0) {
owner.getPetManager().setNpcId(-1);
owner.getPetManager().setItemId(-1);
owner.setPet(null);
owner.getPetManager().removeDetails(itemId);
owner.getPackets().sendGameMessage("Your pet has ran away to find some food!");
switchOrb(false);
owner.getPackets().closeInterface(owner.getInterfaceManager().hasRezizableScreen() ? 98 : 212);
owner.getPackets().sendIComponentSettings(747, 17, 0, 0, 0);
finish();
return;
}
if (growthRate > 0.000) {
details.updateGrowth(growthRate);
owner.getPackets().sendConfigByFile(4285, (int) details.getGrowth());
if (details.getGrowth() == 100.0) {
growNextStage();
}
}
if (!withinDistance(owner, 12)) {
call();
return;
}
sendFollow();
}
/**
* Grows into the next stage of this pet (if any).
*/
public void growNextStage() {
if (details.getStage() == 3) {
return;
}
if (pet == null) {
return;
}
int npcId = pet.getNpcId(details.getStage() + 1);
if (npcId < 1) {
return;
}
details.setStage(details.getStage() + 1);
int itemId = pet.getItemId(details.getStage());
if (pet.getNpcId(details.getStage() + 1) > 0) {
details.updateGrowth(-100.0);
}
owner.getPetManager().setItemId(itemId);
owner.getPetManager().setNpcId(npcId);
finish();
Pet newPet = new Pet(npcId, itemId, owner, owner, details);
newPet.growthRate = growthRate;
owner.setPet(newPet);
owner.getPackets().sendGameMessage("<col=ff0000>Your pet has grown larger.</col>");
}
/**
* Picks up the pet.
*/
public void pickup() {
owner.getInventory().addItem(itemId, 1);
owner.setPet(null);
owner.getPetManager().setNpcId(-1);
owner.getPetManager().setItemId(-1);
switchOrb(false);
owner.getPackets().closeInterface(owner.getInterfaceManager().hasRezizableScreen() ? 98 : 212);
owner.getPackets().sendIComponentSettings(747, 17, 0, 0, 0);
finish();
}
/**
* Calls the pet.
*/
public void call() {
int size = getSize();
WorldTile teleTile = null;
for (int dir = 0; dir < checkNearDirs[0].length; dir++) {
final WorldTile tile = new WorldTile(new WorldTile(owner.getX() + checkNearDirs[0][dir], owner.getY()
+ checkNearDirs[1][dir], owner.getPlane()));
if (World.canMoveNPC(tile.getPlane(), tile.getX(), tile.getY(), size)) {
teleTile = tile;
break;
}
}
if (teleTile == null) {
return;
}
setNextWorldTile(teleTile);
}
/**
* Follows the owner.
*/
protected void sendFollow() {
if (getLastFaceEntity() != owner.getClientIndex()) {
setNextFaceEntity(owner);
}
if (getFreezeDelay() >= Utils.currentTimeMillis()) {
return;
}
int size = getSize();
int distanceX = owner.getX() - getX();
int distanceY = owner.getY() - getY();
if (distanceX < size && distanceX > -1 && distanceY < size
&& distanceY > -1 && !owner.hasWalkSteps() && !hasWalkSteps()) {
resetWalkSteps();
if (!addWalkSteps(owner.getX() + 1, getY())) {
resetWalkSteps();
if (!addWalkSteps(owner.getX() - size , getY())) {
resetWalkSteps();
if (!addWalkSteps(getX(), owner.getY() + 1)) {
resetWalkSteps();
addWalkSteps(getX(), owner.getY() - size );
}
}
}
return;
}
if ((!clipedProjectile(owner, true)) || distanceX > size || distanceX < -1 || distanceY > size || distanceY < -1) {
resetWalkSteps();
addWalkStepsInteract(owner.getX(), owner.getY(), getRun() ? 2 : 1, size, true);
return;
}
resetWalkSteps();
}
/**
* Sends the main configurations for the Pet interface (+ summoning orb).
*/
public void sendMainConfigurations() {
switchOrb(true);
owner.getPackets().sendConfig(448, itemId);// configures
owner.getPackets().sendConfig(1160, 243269632); // sets npc emote
owner.getPackets().sendGlobalConfig(1436, 0);
unlockOrb(); // temporary
}
/**
* Sends the follower details.
*/
public void sendFollowerDetails() {
owner.getPackets().sendConfigByFile(4285, (int) details.getGrowth());
owner.getPackets().sendConfigByFile(4286, (int) details.getHunger());
boolean res = owner.getInterfaceManager().hasRezizableScreen();
owner.getPackets().sendInterface(true, res ? 746 : 548, res ? 119 : 179, 662);
unlock();
owner.getPackets().sendGlobalConfig(168, 8);// tab id
}
/**
* Switch the Summoning orb state.
* @[Only registered and activated users can see links. Click Here To Register...] enable If the orb should be enabled.
*/
public void switchOrb(boolean enable) {
owner.getPackets().sendConfig(1174, enable ? getId() : 0);
if (enable) {
unlock();
return;
}
lockOrb();
}
/**
* Unlocks the orb.
*/
public void unlockOrb() {
owner.getPackets().sendHideIComponent(747, 9, false);
Familiar.sendLeftClickOption(owner);
}
/**
* Unlocks the interfaces.
*/
public void unlock() {
owner.getPackets().sendHideIComponent(747, 9, false);
}
/**
* Locks the orb.
*/
public void lockOrb() {
owner.getPackets().sendHideIComponent(747, 9, true);
}
/**
* Gets the details.
* @[Only registered and activated users can see links. Click Here To Register...] The details.
*/
public PetDetails getDetails() {
return details;
}
/**
* Gets the growthRate.
* @[Only registered and activated users can see links. Click Here To Register...] The growthRate.
*/
public double getGrowthRate() {
return growthRate;
}
/**
* Sets the growthRate.
* @[Only registered and activated users can see links. Click Here To Register...] growthRate The growthRate to set.
*/
public void setGrowthRate(double growthRate) {
this.growthRate = growthRate;
}
/**
* Gets the item id of the pet.
* @[Only registered and activated users can see links. Click Here To Register...] The item id.
*/
public int getItemId() {
return itemId;
}
}
