- Joined
- Nov 30, 2007
- Messages
- 511
- Reaction score
- 0
.-.
Yeah. gainCloseness() adds to a pet's closeness. It's used for NPC scripts. :|
In NPCConversationManager.java:
Add to your imports:
Example of usage:
Huge thanks to Leifde for bringing pets to OdinMS!
A few more commands to satisfy your inner lazy:
In NPCConversationManager.java, find:
Underneath it place:
Find:
Replace it with:
Thanks RMZero213 for fixing the previous nub function.
Thanks Leifde(<3) for adding in level up checking.
Yeah. gainCloseness() adds to a pet's closeness. It's used for NPC scripts. :|
In NPCConversationManager.java:
PHP:
public void gainCloseness(int closeness) {
if (pet.getCloseness() < 30000 || pet.getLevel() < 30) {
if ((pet.getCloseness() + closeness) > 30000) {
pet.setCloseness(30000);
} else {
pet.setCloseness(pet.getCloseness() + closeness);
}
while (pet.getCloseness() > ExpTable.getClosenessNeededForLevel(pet.getLevel()+1)) {
pet.setLevel(pet.getLevel()+1);
getClient().getSession().write(MaplePacketCreator.showPetLevelUp());
}
getPlayer().getClient().getSession().write(MaplePacketCreator.updatePet(pet.getPosition(), pet.getItemId(), pet.getUniqueId(), pet.getName(), pet.getLevel(), pet.getCloseness(), pet.getFullness(), true));
}
}
Add to your imports:
Code:
import net.sf.odinms.client.MaplePet;
Example of usage:
Code:
cm.gainCloseness(5);
Huge thanks to Leifde for bringing pets to OdinMS!
PHP:
public void gainCloseness(int closeness) {
MaplePet pet = getPlayer().getPet();
if (pet.getCloseness() < 30000 || pet.getLevel() < 30) {
pet.setCloseness(pet.getCloseness() + closeness);
} else {
pet.setCloseness(pet.getCloseness() + 0);
}
}
A few more commands to satisfy your inner lazy:
PHP:
public int getPetLevel() {
return pet.getLevel();
}
public int getFullness() {
return pet.getFullness();
}
public String getPetName() {
return pet.getName();
}
public void setPetName(String petname) {
pet.setName(petname);
}
In NPCConversationManager.java, find:
PHP:
public class NPCConversationManager extends AbstractPlayerInteraction {
private int npc;
private String getText;
Underneath it place:
Code:
private MaplePet pet = getPlayer().getPet();
Find:
PHP:
public void gainCloseness(int closeness) {
MaplePet pet = getPlayer().getPet();
if (pet.getCloseness() < 30000 || pet.getLevel() < 30) {
pet.setCloseness(pet.getCloseness() + closeness);
} else {
pet.setCloseness(pet.getCloseness() + 0);
}
}
Replace it with:
PHP:
public void gainCloseness(int closeness) {
if (pet.getCloseness() < 30000 || pet.getLevel() < 30) {
if ((pet.getCloseness() + closeness) > 30000) {
pet.setCloseness(30000);
} else {
pet.setCloseness(pet.getCloseness() + closeness);
}
while (pet.getCloseness() > ExpTable.getClosenessNeededForLevel(pet.getLevel()+1)) {
pet.setLevel(pet.getLevel()+1);
getClient().getSession().write(MaplePacketCreator.showPetLevelUp());
}
getPlayer().getClient().getSession().write(MaplePacketCreator.updatePet(pet.getPosition(), pet.getItemId(), pet.getUniqueId(), pet.getName(), pet.getLevel(), pet.getCloseness(), pet.getFullness(), true));
}
}
Thanks RMZero213 for fixing the previous nub function.
Thanks Leifde(<3) for adding in level up checking.
Last edited: