Compare commits

..

No commits in common. "d5a769604a9c415153618931b256c2870dfacfd0" and "22269f32f9ce0cbf939cd105884e1e4dc81e3588" have entirely different histories.

4 changed files with 11 additions and 19 deletions

View File

@ -43,5 +43,5 @@ I would strongly recommend contributing code to the [2009Scape project](https://
## License ## License
Like 2009Scape, this is AGPLv3. This is, in my opinion, the only proper license for an open source RSPS. The key term of the license being if you wish to use this code to host your own server, you must also offer the source code for people to inspect and use, and allow them to make modifications to it as I did with 2009Scape's code. Like 2009Scape, this is AGPLv3. This is, in my opinion, the only proper license for an open source RSPS. The key term of the license being if you wish to use this code, you must also offer the source code for people to inspect and use! (eg no private, for profit RSPS).

View File

@ -46,23 +46,23 @@ enum class RandomEvents(val npc: RandomEventNPC, val loot: WeightBasedTable? = n
WeightedItem(Items.TOOTH_HALF_OF_A_KEY_985,1,1,0.1), WeightedItem(Items.TOOTH_HALF_OF_A_KEY_985,1,1,0.1),
WeightedItem(Items.LOOP_HALF_OF_A_KEY_987,1,1,0.1) WeightedItem(Items.LOOP_HALF_OF_A_KEY_987,1,1,0.1)
)), )),
// MAZE(npc = MazeNPC()), MAZE(npc = MazeNPC()),
DRILL_DEMON(npc = SergeantDamienNPC()), DRILL_DEMON(npc = SergeantDamienNPC()),
EVIL_CHICKEN(npc = EvilChickenNPC()), EVIL_CHICKEN(npc = EvilChickenNPC()),
// STRANGE_PLANT(npc = StrangePlantNPC()), STRANGE_PLANT(npc = StrangePlantNPC()),
// SWARM(npc = SwarmNPC()), SWARM(npc = SwarmNPC()),
// EVIL_BOB(npc = EvilBobNPC(), skillIds = intArrayOf(Skills.FISHING, Skills.MAGIC)), EVIL_BOB(npc = EvilBobNPC(), skillIds = intArrayOf(Skills.FISHING, Skills.MAGIC)),
DRUNKEN_DWARF(npc = DrunkenDwarfNPC()), DRUNKEN_DWARF(npc = DrunkenDwarfNPC()),
RICK_TURPENTINE(npc = RickTurpentineNPC(), loot = CERTER.loot), RICK_TURPENTINE(npc = RickTurpentineNPC(), loot = CERTER.loot),
SURPRISE_EXAM(npc = MysteriousOldManNPC(), type = "sexam"), SURPRISE_EXAM(npc = MysteriousOldManNPC(), type = "sexam"),
FREAKY_FORESTER(npc = FreakyForesterNPC(), skillIds = intArrayOf(Skills.WOODCUTTING)), FREAKY_FORESTER(npc = FreakyForesterNPC(), skillIds = intArrayOf(Skills.WOODCUTTING)),
// PILLORY(npc = PilloryNPC(), skillIds = intArrayOf(Skills.THIEVING)), PILLORY(npc = PilloryNPC(), skillIds = intArrayOf(Skills.THIEVING)),
TREE_SPIRIT(npc = TreeSpiritRENPC(), skillIds = intArrayOf(Skills.WOODCUTTING)), TREE_SPIRIT(npc = TreeSpiritRENPC(), skillIds = intArrayOf(Skills.WOODCUTTING)),
QUIZ_MASTER(npc = QuizMasterNPC()), QUIZ_MASTER(npc = QuizMasterNPC()),
RIVER_TROLL(RiverTrollRENPC(), skillIds = intArrayOf(Skills.FISHING)), RIVER_TROLL(RiverTrollRENPC(), skillIds = intArrayOf(Skills.FISHING)),
// ROCK_GOLEM(RockGolemRENPC(), skillIds = intArrayOf(Skills.MINING)), ROCK_GOLEM(RockGolemRENPC(), skillIds = intArrayOf(Skills.MINING)),
SHADE(ShadeRENPC(), skillIds = intArrayOf(Skills.PRAYER)); SHADE(ShadeRENPC(), skillIds = intArrayOf(Skills.PRAYER)),
// ZOMBIE(ZombieRENPC(), skillIds = intArrayOf(Skills.PRAYER)); ZOMBIE(ZombieRENPC(), skillIds = intArrayOf(Skills.PRAYER));
companion object { companion object {
@JvmField @JvmField

View File

@ -128,12 +128,7 @@ public final class FamiliarManager {
} }
if (currentPet != -1) { if (currentPet != -1) {
int last = this.petDetails.get(currentPet).size() - 1; int last = this.petDetails.get(currentPet).size() - 1;
PetDetails details; PetDetails details = this.petDetails.get(currentPet).get(last);
if (last < 0) { //missing data in save due to historical bug (see GL !2077)
details = new PetDetails(0);
} else {
details = this.petDetails.get(currentPet).get(last);
}
Pets pets = Pets.forId(currentPet); Pets pets = Pets.forId(currentPet);
familiar = new Pet(player, details, currentPet, pets.getNpcId(currentPet)); familiar = new Pet(player, details, currentPet, pets.getNpcId(currentPet));
} else if (familiarData.containsKey("familiar")) { } else if (familiarData.containsKey("familiar")) {
@ -419,9 +414,6 @@ public final class FamiliarManager {
* @param details The new pet details. * @param details The new pet details.
*/ */
public void addDetails(int itemId, PetDetails details) { public void addDetails(int itemId, PetDetails details) {
if (petDetails.get(itemId) == null) {
petDetails.put(itemId, new ArrayList<>());
}
petDetails.get(itemId).add(details); petDetails.get(itemId).add(details);
} }

View File

@ -129,8 +129,8 @@ public final class Pet extends Familiar {
if (pet.isKitten(itemId)) { if (pet.isKitten(itemId)) {
owner.incrementAttribute("/save:stats_manager:cats_raised"); owner.incrementAttribute("/save:stats_manager:cats_raised");
} }
owner.getFamiliarManager().addDetails(newItemId, details);
owner.getFamiliarManager().removeDetails(getItemId()); owner.getFamiliarManager().removeDetails(getItemId());
owner.getFamiliarManager().addDetails(newItemId, details);
owner.getFamiliarManager().morphPet(new Item(newItemId), false, location, details.getHunger(), 0); owner.getFamiliarManager().morphPet(new Item(newItemId), false, location, details.getHunger(), 0);
owner.getPacketDispatch().sendMessage("<col=ff0000>Your pet has grown larger.</col>"); owner.getPacketDispatch().sendMessage("<col=ff0000>Your pet has grown larger.</col>");
} }