credit to RMZero213
nx food bug:
if you use your nx food to level up your pet, when you have 26100 closeness,
your pet will be level 30 and when you'll get 30000 closeness your pet will be level 31 and you wont be able to use commands..
so this is how you fix it. very very simple...
open UseCashItemHandler.java
and replace this line
with this one
if you want to add chek level and closeness:
add those lines[if you already hace one just replace]
before line if(bla bla bla)
replace your if(bla bla bla)
with this
add those lines
after those lines
its should look like this
nx food bug:
if you use your nx food to level up your pet, when you have 26100 closeness,
your pet will be level 30 and when you'll get 30000 closeness your pet will be level 31 and you wont be able to use commands..
so this is how you fix it. very very simple...
open UseCashItemHandler.java
and replace this line
Code:
while (c.getPlayer().getPet().getCloseness() >= ExpTable.getClosenessNeededForLevel(c.getPlayer().getPet().getLevel())) {
with this one
Code:
while (c.getPlayer().getPet().getCloseness() >= ExpTable.getClosenessNeededForLevel(c.getPlayer().getPet().getLevel() + 1)) {
if you want to add chek level and closeness:
add those lines[if you already hace one just replace]
Code:
int closeness = c.getPlayer().getPet().getCloseness();
int level= c.getPlayer().getPet().getLevel();
before line if(bla bla bla)
replace your if(bla bla bla)
with this
Code:
if ( closeness < 30000 || level < 30) {
add those lines
Code:
else {
c.getPlayer().getPet().setFullness(100);
c.getPlayer().getPet().setCloseness(c.getPlayer().getPet().getCloseness() + 0);
c.getSession().write(MaplePacketCreator.updatePet(c.getPlayer().getPet().getPosition(), c.getPlayer().getPet().getItemId(), c.getPlayer().getPet().getUniqueId(), c.getPlayer().getPet().getName(), c.getPlayer().getPet().getLevel(), c.getPlayer().getPet().getCloseness(), c.getPlayer().getPet().getFullness(), true));
}
after those lines
Code:
c.getPlayer().getPet().setLevel(c.getPlayer().getPet().getLevel()+1);
c.getSession().write(MaplePacketCreator.updatePet(c.getPlayer().getPet().getPosition(), c.getPlayer().getPet().getItemId(), c.getPlayer().getPet().getUniqueId(), c.getPlayer().getPet().getName(), c.getPlayer().getPet().getLevel(), c.getPlayer().getPet().getCloseness(), c.getPlayer().getPet().getFullness(), true));
c.getSession().write(MaplePacketCreator.showPetLevelUp());
}
}
its should look like this
Code:
int closeness = c.getPlayer().getPet().getCloseness();
int level= c.getPlayer().getPet().getLevel();
if ( closeness < 30000 || level < 30) {
c.getPlayer().getPet().setFullness(100);
c.getPlayer().getPet().setCloseness(c.getPlayer().getPet().getCloseness() + 100);
c.getSession().write(MaplePacketCreator.updatePet(c.getPlayer().getPet().getPosition(), c.getPlayer().getPet().getItemId(), c.getPlayer().getPet().getUniqueId(), c.getPlayer().getPet().getName(), c.getPlayer().getPet().getLevel(), c.getPlayer().getPet().getCloseness(), c.getPlayer().getPet().getFullness(), true));
//log.info("To be sent: {}", MaplePacketCreator.commandResponse(player.getId(), (byte) 1, true, true));
c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.commandResponse(c.getPlayer().getId(), (byte) 1, true, true), true);
while (c.getPlayer().getPet().getCloseness() >= ExpTable.getClosenessNeededForLevel(c.getPlayer().getPet().getLevel() + 1)) {
c.getPlayer().getPet().setLevel(c.getPlayer().getPet().getLevel()+1);
c.getSession().write(MaplePacketCreator.updatePet(c.getPlayer().getPet().getPosition(), c.getPlayer().getPet().getItemId(), c.getPlayer().getPet().getUniqueId(), c.getPlayer().getPet().getName(), c.getPlayer().getPet().getLevel(), c.getPlayer().getPet().getCloseness(), c.getPlayer().getPet().getFullness(), true));
c.getSession().write(MaplePacketCreator.showPetLevelUp());
}
} else {
c.getPlayer().getPet().setFullness(100);
c.getPlayer().getPet().setCloseness(c.getPlayer().getPet().getCloseness() + 0);
c.getSession().write(MaplePacketCreator.updatePet(c.getPlayer().getPet().getPosition(), c.getPlayer().getPet().getItemId(), c.getPlayer().getPet().getUniqueId(), c.getPlayer().getPet().getName(), c.getPlayer().getPet().getLevel(), c.getPlayer().getPet().getCloseness(), c.getPlayer().getPet().getFullness(), true));
}
}