Merge branch 'summoning-renew' into 'master'
Allow renewing summoning familiars, and make bobs drop items on dismissal even... See merge request 2009scape/2009scape!365
This commit is contained in:
@@ -83,3 +83,4 @@
|
|||||||
- Fix wine of zamorak pickup interaction.
|
- Fix wine of zamorak pickup interaction.
|
||||||
- Static clue drop ids replaced with their level appropriate proxy values
|
- Static clue drop ids replaced with their level appropriate proxy values
|
||||||
- Fix a bug where clue scrolls were rerolled to easy for most NPCs
|
- Fix a bug where clue scrolls were rerolled to easy for most NPCs
|
||||||
|
- Allow renewing summoning familiars, and make bobs drop items on dismissal even if their owners are ironmen.
|
||||||
|
|||||||
+2
-2
@@ -55,13 +55,13 @@ public abstract class BurdenBeast extends Familiar {
|
|||||||
if (owner.getInterfaceManager().hasMainComponent(671)) {
|
if (owner.getInterfaceManager().hasMainComponent(671)) {
|
||||||
owner.getInterfaceManager().close();
|
owner.getInterfaceManager().close();
|
||||||
}
|
}
|
||||||
if (!owner.getIronmanManager().isIronman()) {
|
|
||||||
for (Item item : container.toArray()) {
|
for (Item item : container.toArray()) {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
GroundItemManager.create(new GroundItem(item, location, 500, owner));
|
GroundItemManager.create(new GroundItem(item, location, 500, owner));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
container.clear();
|
container.clear();
|
||||||
super.dismiss();
|
super.dismiss();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,13 +311,20 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void refreshTimer() {
|
||||||
|
ticks = maximumTicks;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the time remaining.
|
* Sends the time remaining.
|
||||||
*/
|
*/
|
||||||
private void sendTimeRemaining() {
|
private void sendTimeRemaining() {
|
||||||
int minutes = (int) Math.ceil(ticks * 0.01);
|
int minutes = ticks / 100;
|
||||||
int hash = minutes << 7 | ((ticks - (minutes * 100)) > 49 ? 1 : 0) << 6;
|
int centiminutes = ticks % 100;
|
||||||
owner.getConfigManager().set(1176, hash);
|
owner.varpManager.get(1176)
|
||||||
|
.setVarbit(7, minutes)
|
||||||
|
.setVarbit(6, centiminutes > 49 ? 1 : 0)
|
||||||
|
.send(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+12
-1
@@ -126,9 +126,14 @@ public final class FamiliarManager {
|
|||||||
* @param deleteItem we should delete the item.
|
* @param deleteItem we should delete the item.
|
||||||
*/
|
*/
|
||||||
public void summon(Item item, boolean pet, boolean deleteItem) {
|
public void summon(Item item, boolean pet, boolean deleteItem) {
|
||||||
|
boolean renew = false;
|
||||||
if (hasFamiliar()) {
|
if (hasFamiliar()) {
|
||||||
|
if(familiar.getPouchId() == item.getId()) {
|
||||||
|
renew = true;
|
||||||
|
} else {
|
||||||
player.getPacketDispatch().sendMessage("You already have a follower.");
|
player.getPacketDispatch().sendMessage("You already have a follower.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (player.getZoneMonitor().isRestricted(ZoneRestriction.FOLLOWERS) && !player.getLocks().isLocked("enable_summoning")) {
|
if (player.getZoneMonitor().isRestricted(ZoneRestriction.FOLLOWERS) && !player.getLocks().isLocked("enable_summoning")) {
|
||||||
player.getPacketDispatch().sendMessage("This is a Summoning-free area.");
|
player.getPacketDispatch().sendMessage("This is a Summoning-free area.");
|
||||||
@@ -151,24 +156,30 @@ public final class FamiliarManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int npcId = pouch.getNpcId();
|
final int npcId = pouch.getNpcId();
|
||||||
Familiar fam = FAMILIARS.get(npcId);
|
Familiar fam = !renew ? FAMILIARS.get(npcId) : familiar;
|
||||||
if (fam == null) {
|
if (fam == null) {
|
||||||
player.getPacketDispatch().sendMessage("Invalid familiar " + npcId + " - report on 2009scape github");
|
player.getPacketDispatch().sendMessage("Invalid familiar " + npcId + " - report on 2009scape github");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(!renew) {
|
||||||
fam = fam.construct(player, npcId);
|
fam = fam.construct(player, npcId);
|
||||||
if (fam.getSpawnLocation() == null) {
|
if (fam.getSpawnLocation() == null) {
|
||||||
player.getPacketDispatch().sendMessage("The spirit in this pouch is too big to summon here. You will need to move to a larger");
|
player.getPacketDispatch().sendMessage("The spirit in this pouch is too big to summon here. You will need to move to a larger");
|
||||||
player.getPacketDispatch().sendMessage("area.");
|
player.getPacketDispatch().sendMessage("area.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!player.getInventory().remove(item)) {
|
if (!player.getInventory().remove(item)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.getSkills().updateLevel(Skills.SUMMONING, -pouch.getSummonCost(), 0);
|
player.getSkills().updateLevel(Skills.SUMMONING, -pouch.getSummonCost(), 0);
|
||||||
player.getSkills().addExperience(Skills.SUMMONING, pouch.getSummonExperience());
|
player.getSkills().addExperience(Skills.SUMMONING, pouch.getSummonExperience());
|
||||||
|
if(!renew) {
|
||||||
familiar = fam;
|
familiar = fam;
|
||||||
spawnFamiliar();
|
spawnFamiliar();
|
||||||
|
} else {
|
||||||
|
familiar.refreshTimer();
|
||||||
|
}
|
||||||
if (player.getSkullManager().isWilderness()) {
|
if (player.getSkullManager().isWilderness()) {
|
||||||
player.getAppearance().sync();
|
player.getAppearance().sync();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user