Cash Pet Food issue + BRPQ minor patch
As issued by vcoc, some pet items not working properly has been patches. New BRPQ reward announcer NPC. More minor patches.
This commit is contained in:
@@ -54,25 +54,12 @@ public final class PetCommandHandler extends AbstractMaplePacketHandler {
|
||||
if (petCommand == null) {
|
||||
return;
|
||||
}
|
||||
boolean success = false;
|
||||
|
||||
if (Randomizer.nextInt(101) <= petCommand.getProbability()) {
|
||||
success = true;
|
||||
if (pet.getCloseness() < 30000) {
|
||||
int newCloseness = pet.getCloseness() + petCommand.getIncrease();
|
||||
if (newCloseness > 30000) {
|
||||
newCloseness = 30000;
|
||||
}
|
||||
pet.setCloseness(newCloseness);
|
||||
if (newCloseness >= ExpTable.getClosenessNeededForLevel(pet.getLevel())) {
|
||||
pet.setLevel((byte) (pet.getLevel() + 1));
|
||||
c.announce(MaplePacketCreator.showOwnPetLevelUp(chr.getPetIndex(pet)));
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.showPetLevelUp(c.getPlayer(), chr.getPetIndex(pet)));
|
||||
}
|
||||
pet.saveToDb();
|
||||
Item petz = chr.getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
|
||||
chr.forceUpdateItem(petz);
|
||||
}
|
||||
pet.gainClosenessFullness(chr, petCommand.getIncrease(), 0, command);
|
||||
}
|
||||
else {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.commandResponse(chr.getId(), petIndex, command, false));
|
||||
}
|
||||
chr.getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.commandResponse(chr.getId(), petIndex, command, success), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,51 +68,9 @@ public final class PetFoodHandler extends AbstractMaplePacketHandler {
|
||||
if (use == null || (itemId / 10000) != 212 || use.getItemId() != itemId) {
|
||||
return;
|
||||
}
|
||||
boolean gainCloseness = false;
|
||||
if (Randomizer.nextInt(101) > 50) {
|
||||
gainCloseness = true;
|
||||
}
|
||||
if (pet.getFullness() < 100) {
|
||||
int newFullness = pet.getFullness() + 30;
|
||||
if (newFullness > 100) {
|
||||
newFullness = 100;
|
||||
}
|
||||
pet.setFullness(newFullness);
|
||||
if (gainCloseness && pet.getCloseness() < 30000) {
|
||||
int newCloseness = pet.getCloseness() + 1;
|
||||
if (newCloseness > 30000) {
|
||||
newCloseness = 30000;
|
||||
}
|
||||
pet.setCloseness(newCloseness);
|
||||
if (newCloseness >= ExpTable.getClosenessNeededForLevel(pet.getLevel())) {
|
||||
pet.setLevel((byte) (pet.getLevel() + 1));
|
||||
c.announce(MaplePacketCreator.showOwnPetLevelUp(chr.getPetIndex(pet)));
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.showPetLevelUp(c.getPlayer(), chr.getPetIndex(pet)));
|
||||
}
|
||||
}
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.commandResponse(chr.getId(), slot, 0, true));
|
||||
} else {
|
||||
if (gainCloseness) {
|
||||
int newCloseness = pet.getCloseness() - 1;
|
||||
if (newCloseness < 0) {
|
||||
newCloseness = 0;
|
||||
}
|
||||
pet.setCloseness(newCloseness);
|
||||
if (pet.getLevel() > 1 && newCloseness < ExpTable.getClosenessNeededForLevel(pet.getLevel())) {
|
||||
pet.setLevel((byte) (pet.getLevel() - 1));
|
||||
}
|
||||
}
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.commandResponse(chr.getId(), slot, 0, false));
|
||||
}
|
||||
|
||||
// 50% chance to get +1 closeness
|
||||
pet.gainClosenessFullness(chr, (Randomizer.nextInt(101) <= 50) ? 1 : 0, 30, 1);
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, pos, (short) 1, false);
|
||||
|
||||
pet.saveToDb();
|
||||
|
||||
Item petz = chr.getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
|
||||
if (petz == null){ //Not a real fix but fuck it you know?
|
||||
return;
|
||||
}
|
||||
|
||||
chr.forceUpdateItem(petz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +66,12 @@ public final class QuestActionHandler extends AbstractMaplePacketHandler {
|
||||
//System.out.println(slea.toString());
|
||||
int npc = slea.readInt();
|
||||
slea.readInt();
|
||||
if(quest.canComplete(player, npc)) {
|
||||
QuestScriptManager.getInstance().end(c, questid, npc);
|
||||
player.getClient().getSession().write(MaplePacketCreator.showSpecialEffect(9)); //show effect when completion
|
||||
player.getMap().broadcastMessage(player, MaplePacketCreator.showForeignEffect(player.getId(), 9));//show effect around players I guess
|
||||
}
|
||||
|
||||
if(quest.canComplete(player, npc)) {
|
||||
QuestScriptManager.getInstance().end(c, questid, npc);
|
||||
player.getClient().getSession().write(MaplePacketCreator.showSpecialEffect(9)); //show effect when completion
|
||||
player.getMap().broadcastMessage(player, MaplePacketCreator.showForeignEffect(player.getId(), 9));//show effect around players I guess
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import client.inventory.Equip;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import constants.ExpTable;
|
||||
import constants.ItemConstants;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@@ -435,22 +434,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
|
||||
MaplePet pet = player.getPet(i);
|
||||
if (pet != null) {
|
||||
if (pet.canConsume(itemId)) {
|
||||
pet.setFullness(100);
|
||||
if (pet.getCloseness() + 100 > 30000) {
|
||||
pet.setCloseness(30000);
|
||||
} else {
|
||||
pet.gainCloseness(100);
|
||||
}
|
||||
|
||||
while (pet.getCloseness() >= ExpTable.getClosenessNeededForLevel(pet.getLevel())) {
|
||||
pet.setLevel((byte) (pet.getLevel() + 1));
|
||||
byte index = player.getPetIndex(pet);
|
||||
c.announce(MaplePacketCreator.showOwnPetLevelUp(index));
|
||||
player.getMap().broadcastMessage(MaplePacketCreator.showPetLevelUp(c.getPlayer(), index));
|
||||
}
|
||||
Item item = player.getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
|
||||
player.forceUpdateItem(item);
|
||||
player.getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.commandResponse(player.getId(), i, 1, true), true);
|
||||
pet.gainClosenessFullness(player, 100, 100, 1);
|
||||
remove(c, itemId);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user