net.runelite.api.Prayer Java Examples
The following examples show how to use
net.runelite.api.Prayer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BoostsPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
/** * Calculates the amount of time until boosted stats decay, * accounting for the effect of preserve prayer. * Preserve extends the time of boosted stats by 50% while active. * The length of a boost is split into 4 sections of 15 seconds each. * If the preserve prayer is active for the entire duration of the final * section it will "activate" adding an additional 15 second section * to the boost timing. If again the preserve prayer is active for that * entire section a second 15 second section will be added. * <p> * Preserve is only required to be on for the 4th and 5th sections of the boost timer * to gain full effect (seconds 45-75). * * @return integer value in ticks until next boost change */ int getChangeDownTicks() { if (lastChangeDown == -1 || config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.NEVER || (config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedUp)) { return -1; } int ticksSinceChange = client.getTickCount() - lastChangeDown; boolean isPreserveActive = client.isPrayerActive(Prayer.PRESERVE); if ((isPreserveActive && (ticksSinceChange < 75 || preserveBeenActive)) || ticksSinceChange > 125) { preserveBeenActive = true; return 150 - ticksSinceChange; } preserveBeenActive = false; return (ticksSinceChange > 100) ? 125 - ticksSinceChange : 100 - ticksSinceChange; }
Example #2
Source File: BoostsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
/** * Calculates the amount of time until boosted stats decay, * accounting for the effect of preserve prayer. * Preserve extends the time of boosted stats by 50% while active. * The length of a boost is split into 4 sections of 15 seconds each. * If the preserve prayer is active for the entire duration of the final * section it will "activate" adding an additional 15 second section * to the boost timing. If again the preserve prayer is active for that * entire section a second 15 second section will be added. * * Preserve is only required to be on for the 4th and 5th sections of the boost timer * to gain full effect (seconds 45-75). * * @return integer value in ticks until next boost change */ int getChangeDownTicks() { if (lastChangeDown == -1 || config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.NEVER || (config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedUp)) { return -1; } int ticksSinceChange = client.getTickCount() - lastChangeDown; boolean isPreserveActive = client.isPrayerActive(Prayer.PRESERVE); if ((isPreserveActive && (ticksSinceChange < 75 || preserveBeenActive)) || ticksSinceChange > 125) { preserveBeenActive = true; return 150 - ticksSinceChange; } preserveBeenActive = false; return (ticksSinceChange > 100) ? 125 - ticksSinceChange : 100 - ticksSinceChange; }
Example #3
Source File: BarbarianAssaultPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean isAnyPrayerActive() { for (Prayer pray : Prayer.values()) { if (client.isPrayerActive(pray)) { return true; } } return false; }
Example #4
Source File: StatusOrbsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onVarbitChanged(VarbitChanged e) { if (config.dynamicHpHeart()) { checkHealthIcon(); } boolean isRapidHeal = client.isPrayerActive(Prayer.RAPID_HEAL); if (wasRapidHeal != isRapidHeal) { ticksSinceHPRegen = 0; } wasRapidHeal = isRapidHeal; }
Example #5
Source File: PrayerPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean isAnyPrayerActive() { for (Prayer pray : Prayer.values())//Check if any prayers are active { if (client.isPrayerActive(pray)) { return true; } } return false; }
Example #6
Source File: PrayerPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private static double getPrayerDrainRate(Client client) { double drainRate = 0.0; for (Prayer prayer : Prayer.values()) { if (client.isPrayerActive(prayer)) { drainRate += prayer.getDrainRate(); } } return drainRate; }
Example #7
Source File: BasicBossSwapper.java From ExternalPlugins with GNU General Public License v3.0 | 5 votes |
@Subscribe public void onProjectileMoved(ProjectileMoved event) { if (run) { return; } int id = event.getProjectile().getId(); switch (id) { case 1339: if (config.swapAutos() && !client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)) { swapMage = true; } break; case 1594: if (!client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)) { swapMage = true; } break; case 1340: if (config.swapAutos() && !client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)) { swapRange = true; } break; case 1593: if (!client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)) { swapRange = true; } break; } }
Example #8
Source File: RegenMeterPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe private void onVarbitChanged(VarbitChanged ev) { boolean isRapidHeal = client.isPrayerActive(Prayer.RAPID_HEAL); if (wasRapidHeal != isRapidHeal) { ticksSinceHPRegen = 0; } wasRapidHeal = isRapidHeal; }
Example #9
Source File: PrayerPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private boolean isAnyPrayerActive() { for (Prayer pray : Prayer.values())//Check if any prayers are active { if (client.isPrayerActive(pray)) { return true; } } return false; }
Example #10
Source File: PrayerPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private static double getPrayerDrainRate(Client client) { double drainRate = 0.0; for (Prayer prayer : Prayer.values()) { if (client.isPrayerActive(prayer)) { drainRate += prayer.getDrainRate(); } } return drainRate; }
Example #11
Source File: StatusOrbsPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Subscribe private void onGameTick(GameTick event) { if ((client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) == 1000) && !config.showWhenNoChangeSpec()) { // The recharge doesn't tick when at 100% ticksSinceSpecRegen = 0; } else { ticksSinceSpecRegen = (ticksSinceSpecRegen + 1) % SPEC_REGEN_TICKS; } specialPercentage = ticksSinceSpecRegen / (double) SPEC_REGEN_TICKS; int ticksPerHPRegen = NORMAL_HP_REGEN_TICKS; hpPerMs = ticksPerHPRegen / (double) 6000000; if (client.isPrayerActive(Prayer.RAPID_HEAL)) { ticksPerHPRegen /= 2; hpPerMs *= 2; } ticksSinceHPRegen = (ticksSinceHPRegen + 1) % ticksPerHPRegen; hitpointsPercentage = ticksSinceHPRegen / (double) ticksPerHPRegen; int currentHP = client.getBoostedSkillLevel(Skill.HITPOINTS); int maxHP = client.getRealSkillLevel(Skill.HITPOINTS); if (currentHP == maxHP && !config.showWhenNoChange()) { hitpointsPercentage = 0; } else if (currentHP > maxHP) { // Show it going down hitpointsPercentage = 1 - hitpointsPercentage; } // Run Energy localPlayerRunningToDestination = prevLocalPlayerLocation != null && client.getLocalDestinationLocation() != null && prevLocalPlayerLocation.distanceTo(client.getLocalPlayer().getWorldLocation()) > 1; if (config.getNotifyBeforeHpRegenSeconds() > 0 && currentHP < maxHP && shouldNotifyHpRegenThisTick(ticksPerHPRegen)) { notifier.notify("[" + client.getLocalPlayer().getName() + "] regenerates their next hitpoint soon!"); } localPlayerRunningToDestination = prevLocalPlayerLocation != null && client.getLocalDestinationLocation() != null && prevLocalPlayerLocation.distanceTo(client.getLocalPlayer().getWorldLocation()) > 1; prevLocalPlayerLocation = client.getLocalPlayer().getWorldLocation(); recoverRate = Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT)); if (config.replaceOrbText()) { setRunOrbText(getEstimatedRunTimeRemaining(true)); } int currEnergy = client.getEnergy(); WorldPoint currPoint = client.getLocalPlayer().getWorldLocation(); if (currEnergy == 100 || (prevLocalPlayerLocation != null && currPoint.distanceTo(prevLocalPlayerLocation) > 1) || currEnergy < lastEnergy) { ticksSinceRunRegen = 0; } else if (currEnergy > lastEnergy) { if (runPercentage < 1) { ticksSinceRunRegen = (1 - runPercentage) / runRegenPerTick(); ticksSinceRunRegen = ticksSinceRunRegen > 1 ? 1 : ticksSinceRunRegen; } else { ticksSinceRunRegen = (runPercentage - 1) / runRegenPerTick(); } } else { ticksSinceRunRegen += 1; } runPercentage = ticksSinceRunRegen * runRegenPerTick(); prevLocalPlayerLocation = currPoint; lastEnergy = currEnergy; }
Example #12
Source File: PrayerPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Subscribe private void onGameTick(GameTick tick) { prayersActive = isAnyPrayerActive(); if (!config.prayerFlickLocation().equals(PrayerFlickLocation.NONE)) { startOfLastTick = Instant.now(); } if (config.showPrayerDoseIndicator()) { doseOverlay.onTick(); } if (config.showPrayerBar()) { barOverlay.onTick(); } if (config.replaceOrbText() && isAnyPrayerActive()) { setPrayerOrbText(getEstimatedTimeRemaining(true)); } if (!config.prayerIndicator()) { return; } for (PrayerType prayerType : PrayerType.values()) { Prayer prayer = prayerType.getPrayer(); int ord = prayerType.ordinal(); if (client.isPrayerActive(prayer)) { if (prayerType.isOverhead() && !config.prayerIndicatorOverheads()) { continue; } if (prayerCounter[ord] == null) { PrayerCounter counter = prayerCounter[ord] = new PrayerCounter(this, prayerType); spriteManager.getSpriteAsync(prayerType.getSpriteID(), 0, counter::setImage); infoBoxManager.addInfoBox(counter); } } else if (prayerCounter[ord] != null) { infoBoxManager.removeInfoBox(prayerCounter[ord]); prayerCounter[ord] = null; } } }
Example #13
Source File: BasicBossSwapper.java From ExternalPlugins with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onGameTick(GameTick event) { if (swapMage) { clickPrayer(Prayer.PROTECT_FROM_MAGIC); swapMage = false; } else if (swapRange) { clickPrayer(Prayer.PROTECT_FROM_MISSILES); swapRange = false; } else if (swapMelee) { clickPrayer(Prayer.PROTECT_FROM_MELEE); swapMelee = false; } if (nylo != null && run) { if (nylo.getId() == prevNylo) { return; } switch (nylo.getId()) { case 8355: { prevNylo = nylo.getId(); clickPrayer(Prayer.PROTECT_FROM_MELEE); clickPrayer(Prayer.PIETY); clickItem(config.melee()); } return; case 8356: { prevNylo = nylo.getId(); clickPrayer(Prayer.PROTECT_FROM_MAGIC); clickPrayer(Prayer.AUGURY); clickItem(config.mage()); } return; case 8357: { prevNylo = nylo.getId(); clickPrayer(Prayer.PROTECT_FROM_MISSILES); clickPrayer(Prayer.RIGOUR); clickItem(config.range()); } return; default: break; } } }
Example #14
Source File: AutoPrayFlickPlugin.java From ExternalPlugins with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onGameTick(GameTick event) { if (config.onlyInNmz() && !isInNightmareZone()) { return; } Widget widget = client.getWidget(WidgetInfo.MINIMAP_QUICK_PRAYER_ORB); if (widget != null) { bounds = widget.getBounds(); } if (toggleFlick && config.clicks()) { int p = 0; for (Prayer prayer : Prayer.values()) { if (!client.isPrayerActive(prayer)) { p++; } } if (p == 29 && !firstFlick) { singleClick(); return; } doubleClick(); if (firstFlick) { firstFlick = false; } } if (toggleFlick && !config.clicks()) { singleClick(); } }
Example #15
Source File: RegenMeterPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onGameTick(GameTick event) { if (client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) == 1000) { // The recharge doesn't tick when at 100% ticksSinceSpecRegen = 0; } else { ticksSinceSpecRegen = (ticksSinceSpecRegen + 1) % SPEC_REGEN_TICKS; } specialPercentage = ticksSinceSpecRegen / (double) SPEC_REGEN_TICKS; int ticksPerHPRegen = NORMAL_HP_REGEN_TICKS; if (client.isPrayerActive(Prayer.RAPID_HEAL)) { ticksPerHPRegen /= 2; } if (client.getVar(Varbits.TWISTED_LEAGUE_RELIC_1) == TWISTED_LEAGUE_ENDLESS_ENDURANCE_RELIC) { ticksPerHPRegen /= 4; } ticksSinceHPRegen = (ticksSinceHPRegen + 1) % ticksPerHPRegen; hitpointsPercentage = ticksSinceHPRegen / (double) ticksPerHPRegen; int currentHP = client.getBoostedSkillLevel(Skill.HITPOINTS); int maxHP = client.getRealSkillLevel(Skill.HITPOINTS); if (currentHP == maxHP && !config.showWhenNoChange()) { hitpointsPercentage = 0; } else if (currentHP > maxHP) { // Show it going down hitpointsPercentage = 1 - hitpointsPercentage; } if (config.getNotifyBeforeHpRegenSeconds() > 0 && currentHP < maxHP && shouldNotifyHpRegenThisTick(ticksPerHPRegen)) { notifier.notify("[" + client.getLocalPlayer().getName() + "] regenerates their next hitpoint soon!"); } }
Example #16
Source File: PrayerPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onGameTick(GameTick tick) { prayersActive = isAnyPrayerActive(); if (!config.prayerFlickLocation().equals(PrayerFlickLocation.NONE)) { startOfLastTick = Instant.now(); } if (config.showPrayerDoseIndicator()) { doseOverlay.onTick(); } if (config.showPrayerBar()) { barOverlay.onTick(); } if (config.replaceOrbText() && isAnyPrayerActive()) { setPrayerOrbText(getEstimatedTimeRemaining(true)); } if (!config.prayerIndicator()) { return; } for (PrayerType prayerType : PrayerType.values()) { Prayer prayer = prayerType.getPrayer(); int ord = prayerType.ordinal(); if (client.isPrayerActive(prayer)) { if (prayerType.isOverhead() && !config.prayerIndicatorOverheads()) { continue; } if (prayerCounter[ord] == null) { PrayerCounter counter = prayerCounter[ord] = new PrayerCounter(this, prayerType); spriteManager.getSpriteAsync(prayerType.getSpriteID(), 0, counter::setImage); infoBoxManager.addInfoBox(counter); } } else if (prayerCounter[ord] != null) { infoBoxManager.removeInfoBox(prayerCounter[ord]); prayerCounter[ord] = null; } } }