Fixed a duplication bug with pyramid

This commit is contained in:
Ceikry 2020-03-25 17:13:57 -05:00
parent b837912bea
commit daa4e1afba
2 changed files with 16 additions and 3 deletions

View file

@ -110,6 +110,11 @@ public final class ActivityData implements SavingModule {
*/
private boolean hardcoreDeath;
/**
* Pyramid plunder top (is it grabbed?)
*/
boolean topGrabbed;
/**
* Constructs a new {@code ActivityInfo} {@code Object}.
*/
@ -160,6 +165,7 @@ public final class ActivityData implements SavingModule {
SavedData.save(buffer, fogRating, 19);
SavedData.save(buffer, borkKills, 20);
SavedData.save(buffer, hardcoreDeath, 21);
SavedData.save(buffer, topGrabbed, 22);
buffer.put((byte) 0);
}
@ -239,6 +245,9 @@ public final class ActivityData implements SavingModule {
case 21:
hardcoreDeath = SavedData.getBoolean(buffer);
break;
case 22:
topGrabbed = SavedData.getBoolean(buffer);
break;
}
}
}
@ -649,4 +658,8 @@ public final class ActivityData implements SavingModule {
public void setHardcoreDeath(boolean hardcoreDeath) {
this.hardcoreDeath = hardcoreDeath;
}
public void setTopGrabbed(boolean topGrabbed){
this.topGrabbed = topGrabbed;
}
public boolean isTopGrabbed(){return topGrabbed;}
}

View file

@ -152,7 +152,7 @@ public final class AgilityPyramidCourse extends AgilityCourse {
}
player.getDialogueInterpreter().sendDialogue("You climb down the steep passage. It leads to the base of the", "pyramid.");
player.getProperties().setTeleportLocation(Location.create(3364, 2830, 0));
player.setAttribute("hasptop",false);
player.getSavedData().getActivityData().setTopGrabbed(false);
break;
}
return true;
@ -368,7 +368,7 @@ public final class AgilityPyramidCourse extends AgilityCourse {
* @param object the object.
*/
private void handlePyramidTop(final Player player, final GameObject object) {
if(player.getAttribute("hasptop",false)){
if(player.getSavedData().getActivityData().isTopGrabbed() == true){
player.getPacketDispatch().sendMessage("You've already claimed this!");
return;
} else {
@ -382,7 +382,7 @@ public final class AgilityPyramidCourse extends AgilityCourse {
return true;
}
addConfig(player, 10869, 1, true);
player.setAttribute("hasptop", true);
player.getSavedData().getActivityData().setTopGrabbed(true);
player.getInventory().add(PYRAMID_TOP, player);
player.getDialogueInterpreter().sendItemMessage(PYRAMID_TOP, "You find a golden pyramid!");
return true;