Implement HCIM rework

This commit is contained in:
ceikry
2021-12-15 20:45:15 -06:00
parent 178bbbc05c
commit e234c9fa28
5 changed files with 53 additions and 12 deletions
+2
View File
@@ -70,3 +70,5 @@
- Shooting star discovery bonus xp is now gradually disbursed instead of lump-sum. - Shooting star discovery bonus xp is now gradually disbursed instead of lump-sum.
- Spending points to cancel your slayer task no longer sets your task streak to 0. - Spending points to cancel your slayer task no longer sets your task streak to 0.
- Stars now have bots that will spawn and help mine for stars higher than level 5. - Stars now have bots that will spawn and help mine for stars higher than level 5.
- Implemented HCIM Rework
< --- ABOVE Released December 15, 2021 https://gitlab.com/2009scape/2009scape/-/tags/Dec-15-2021 ---- >
@@ -137,7 +137,11 @@ public final class HansDialoguePlugin extends DialoguePlugin {
case 12: case 12:
switch(buttonId){ switch(buttonId){
case 1: case 1:
options("1.0x","2.5x","Stay 5.0x"); if(player.getAttributes().containsKey("permadeath")){
options("1.0x", "2.5x", "Stay 5.0x", "(HCIM Only) 10x");
} else {
options("1.0x", "2.5x", "Stay 5.0x");
}
stage++; stage++;
break; break;
case 2: case 2:
@@ -169,6 +173,14 @@ public final class HansDialoguePlugin extends DialoguePlugin {
playerl(FacialExpression.FRIENDLY, "I'd rather stay 5x, thank you."); playerl(FacialExpression.FRIENDLY, "I'd rather stay 5x, thank you.");
stage = END_DIALOGUE; stage = END_DIALOGUE;
return true; return true;
case 4:
if (player.newPlayer) {
player.getSkills().experienceMutiplier = 10.0;
stage = 14;
} else {
stage = 15;
}
break;
} }
npc("One moment, please..."); npc("One moment, please...");
break; break;
@@ -325,6 +337,9 @@ public final class HansDialoguePlugin extends DialoguePlugin {
interpreter.sendDialogues(npc, FacialExpression.NEUTRAL,"I have changed your Iron Man mode to: ","" + (buttonId == 1 ? "Standard" : "<col=8A0808>Hardcore</col>" + " Ironman mode.")); interpreter.sendDialogues(npc, FacialExpression.NEUTRAL,"I have changed your Iron Man mode to: ","" + (buttonId == 1 ? "Standard" : "<col=8A0808>Hardcore</col>" + " Ironman mode."));
player.getSettings().toggleAcceptAid(); player.getSettings().toggleAcceptAid();
player.getIronmanManager().setMode(IronmanMode.values()[buttonId]); player.getIronmanManager().setMode(IronmanMode.values()[buttonId]);
if(buttonId == 2) {
player.setAttribute("/save:permadeath",true);
}
player.sendMessage("Your Iron Man status has been changed."); player.sendMessage("Your Iron Man status has been changed.");
stage = 50; stage = 50;
break; break;
@@ -55,7 +55,7 @@ public abstract class Entity extends Node {
/** /**
* The entity's skills. * The entity's skills.
*/ */
private final Skills skills = new Skills(this); public Skills skills = new Skills(this);
/** /**
* The entity's extension classes. * The entity's extension classes.
@@ -703,6 +703,11 @@ public abstract class Entity extends Node {
return attributes.getAttributes(); return attributes.getAttributes();
} }
public void clearAttributes() {
this.attributes.getAttributes().clear();
this.attributes.getSavedAttributes().clear();
}
/** /**
* Sets an attribute value. * Sets an attribute value.
* @param key The attribute name. * @param key The attribute name.
@@ -9,6 +9,7 @@ import core.game.container.impl.InventoryListener;
import core.game.content.activity.pyramidplunder.PlunderObjectManager; import core.game.content.activity.pyramidplunder.PlunderObjectManager;
import core.game.content.dialogue.DialogueInterpreter; import core.game.content.dialogue.DialogueInterpreter;
import core.game.content.quest.miniquest.barcrawl.BarcrawlManager; import core.game.content.quest.miniquest.barcrawl.BarcrawlManager;
import core.game.content.quest.tutorials.tutorialisland.TutorialSession;
import core.game.content.ttrail.TreasureTrailManager; import core.game.content.ttrail.TreasureTrailManager;
import core.game.interaction.Interaction; import core.game.interaction.Interaction;
import core.game.interaction.item.brawling_gloves.BrawlingGlovesManager; import core.game.interaction.item.brawling_gloves.BrawlingGlovesManager;
@@ -79,10 +80,12 @@ import rs09.game.content.ame.RandomEventManager;
import rs09.game.ge.PlayerGrandExchange; import rs09.game.ge.PlayerGrandExchange;
import rs09.game.node.entity.combat.CombatSwingHandler; import rs09.game.node.entity.combat.CombatSwingHandler;
import rs09.game.node.entity.combat.equipment.EquipmentDegrader; import rs09.game.node.entity.combat.equipment.EquipmentDegrader;
import rs09.game.node.entity.player.info.login.PlayerSaver;
import rs09.game.node.entity.skill.runecrafting.PouchManager; import rs09.game.node.entity.skill.runecrafting.PouchManager;
import rs09.game.node.entity.state.newsys.State; import rs09.game.node.entity.state.newsys.State;
import rs09.game.node.entity.state.newsys.StateRepository; import rs09.game.node.entity.state.newsys.StateRepository;
import rs09.game.world.GameWorld; import rs09.game.world.GameWorld;
import rs09.game.world.repository.DisconnectionQueue;
import rs09.game.world.repository.Repository; import rs09.game.world.repository.Repository;
import rs09.game.world.update.MapChunkRenderer; import rs09.game.world.update.MapChunkRenderer;
import rs09.game.world.update.NPCRenderer; import rs09.game.world.update.NPCRenderer;
@@ -201,7 +204,7 @@ public class Player extends Entity {
/** /**
* The quest repository. * The quest repository.
*/ */
private final QuestRepository questRepository = new QuestRepository(this); private QuestRepository questRepository = new QuestRepository(this);
/** /**
* The prayer manager. * The prayer manager.
@@ -241,7 +244,7 @@ public class Player extends Entity {
/** /**
* The saved data. * The saved data.
*/ */
private final SavedData savedData = new SavedData(this); private SavedData savedData = new SavedData(this);
/** /**
* The request manager. * The request manager.
@@ -613,12 +616,28 @@ public class Player extends Entity {
if (!getZoneMonitor().handleDeath(killer) && (!getProperties().isSafeZone() && getZoneMonitor().getType() != ZoneType.SAFE.getId()) && getDetails().getRights() != Rights.ADMINISTRATOR) { if (!getZoneMonitor().handleDeath(killer) && (!getProperties().isSafeZone() && getZoneMonitor().getType() != ZoneType.SAFE.getId()) && getDetails().getRights() != Rights.ADMINISTRATOR) {
//If player was a Hardcore Ironman, announce that they died //If player was a Hardcore Ironman, announce that they died
if (this.getIronmanManager().getMode().equals(IronmanMode.HARDCORE)){ //if this was checkRestriction, ultimate irons would be moved to HARDCORE_DEAD as well if (this.getIronmanManager().getMode().equals(IronmanMode.HARDCORE)){ //if this was checkRestriction, ultimate irons would be moved to HARDCORE_DEAD as well
String gender = this.isMale() ? "Man " : "Woman "; String gender = this.isMale() ? "man " : "woman ";
Repository.sendNews("Hardcore Iron " + gender + " " + this.getUsername() +" has fallen. Total Level: " + this.getSkills().getTotalLevel()); // Not enough room for XP if (getAttributes().containsKey("permadeath")) {
Repository.sendNews("Permadeath Hardcore Iron" + gender + " " + this.getUsername() + " has fallen. Total Level: " + this.getSkills().getTotalLevel()); // Not enough room for XP
TutorialSession.getExtension(this).setStage(0);
equipment.clear();
inventory.clear();
bank.clear();
skills = new Skills(this);
clearAttributes();
setAttribute("/save:permadeath", true);
savedData = new SavedData(this);
questRepository = new QuestRepository(this);
new PlayerSaver(this).save();
clear(true);
return;
} else {
Repository.sendNews("Hardcore Iron " + gender + " " + this.getUsername() + " has fallen. Total Level: " + this.getSkills().getTotalLevel()); // Not enough room for XP
this.getIronmanManager().setMode(IronmanMode.STANDARD); this.getIronmanManager().setMode(IronmanMode.STANDARD);
asPlayer().getSavedData().getActivityData().setHardcoreDeath(true); asPlayer().getSavedData().getActivityData().setHardcoreDeath(true);
this.sendMessage("You have fallen as a Hardcore Iron Man, your Hardcore status has been revoked."); this.sendMessage("You have fallen as a Hardcore Iron Man, your Hardcore status has been revoked.");
} }
}
GroundItemManager.create(new Item(526), getLocation(), k); GroundItemManager.create(new Item(526), getLocation(), k);
final Container[] c = DeathTask.getContainers(this); final Container[] c = DeathTask.getContainers(this);
boolean gravestone = graveManager.generateable() && getIronmanManager().getMode() != IronmanMode.ULTIMATE; boolean gravestone = graveManager.generateable() && getIronmanManager().getMode() != IronmanMode.ULTIMATE;
@@ -48,6 +48,7 @@ class PlayerSaveParser(val player: Player) {
if (read) { if (read) {
launch { launch {
parseCore() parseCore()
parseAttributes()
parseSkills() parseSkills()
parseSettings() parseSettings()
parseSlayer() parseSlayer()
@@ -80,7 +81,6 @@ class PlayerSaveParser(val player: Player) {
parseEmoteManager() parseEmoteManager()
parseStatistics() parseStatistics()
parseBrawlingGloves() parseBrawlingGloves()
parseAttributes()
parseAchievements() parseAchievements()
parsePouches() parsePouches()
} }
@@ -373,7 +373,7 @@ class PlayerSaveParser(val player: Player) {
player.skills.experienceMutiplier = GameWorld.settings?.default_xp_rate!! player.skills.experienceMutiplier = GameWorld.settings?.default_xp_rate!!
} }
val divisor: Double val divisor: Double
if(player.skills.experienceMutiplier >= 10){ if(player.skills.experienceMutiplier >= 10 && !player.attributes.containsKey("permadeath")){ //exclude permadeath HCIMs from XP squish
divisor = player.skills.experienceMutiplier / 5.0 divisor = player.skills.experienceMutiplier / 5.0
player.skills.correct(divisor) player.skills.correct(divisor)
} }