mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Implemented split combat levels
A split combat level (e.g. 50+5) will be displayed for a player when the player is on a PvP world and does not have a summoning pouch or a familiar summoned. A split combat level will also be shown if the player is on a world with wilderness PvP enabled, the player is in the wilderness, and does not have a summoning pouch or a familiar summoned. If the world is a PvP world, display other players' combat levels in white if they are outside of combat range, or shades of green/yellow/orange/red if they are within combat range. If the world is not a PvP world, always display other players' combat levels in shades of green/yellow/orange/red.
This commit is contained in:
parent
a6d5961226
commit
417db14d5c
5 changed files with 33 additions and 13 deletions
|
|
@ -607,9 +607,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
|||
setVarp(owner, 1176, 0);
|
||||
setVarp(owner, 1175, 182986);
|
||||
setVarp(owner, 1174, -1);
|
||||
if (owner.getSkullManager().isWilderness()) {
|
||||
owner.getAppearance().sync();
|
||||
}
|
||||
owner.getInterfaceManager().setViewedTab(3);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,10 +178,8 @@ public final class FamiliarManager {
|
|||
} else {
|
||||
familiar.refreshTimer();
|
||||
}
|
||||
if (player.getSkullManager().isWilderness()) {
|
||||
player.getAppearance().sync();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Summons a familiar.
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public final class InventoryListener implements ContainerListener {
|
|||
}
|
||||
}
|
||||
player.getFamiliarManager().setHasPouch(pouch);
|
||||
if (hadPouch != pouch && player.getSkullManager().isWilderness()) {
|
||||
if (hadPouch != pouch) {
|
||||
player.getAppearance().sync();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import core.game.node.entity.combat.equipment.WeaponInterface;
|
|||
import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.EntityFlag;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.game.node.entity.combat.CombatPulse;
|
||||
|
|
@ -231,8 +233,12 @@ public final class Properties {
|
|||
public int getCurrentCombatLevel() {
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
if (player.getFamiliarManager().isUsingSummoning() || !player.getSkullManager().isWilderness()) {
|
||||
return player.getFamiliarManager().getSummoningCombatLevel() + combatLevel;
|
||||
if ((GameWorld.getSettings().isPvp() || (GameWorld.getSettings().getWild_pvp_enabled() && player.getSkullManager().isWilderness()))
|
||||
&& !player.getFamiliarManager().isUsingSummoning()) {
|
||||
//TODO: Split combat levels should also be used for Bounty Hunter
|
||||
return combatLevel;
|
||||
} else {
|
||||
return combatLevel + player.getFamiliarManager().getSummoningCombatLevel();
|
||||
}
|
||||
}
|
||||
return combatLevel;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import core.game.node.entity.impl.ForceMovement
|
|||
import core.game.node.entity.player.Player
|
||||
import core.tools.*
|
||||
import core.api.*
|
||||
import core.game.world.GameWorld
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlin.reflect.*
|
||||
|
|
@ -74,7 +75,7 @@ sealed class PlayerFlags530 (p: Int, o: Int, f: EntityFlag) : EFlagProvider (530
|
|||
val appearance = context.appearance
|
||||
appearance.prepareBodyData(context)
|
||||
var settings = appearance.gender.toByte().toInt()
|
||||
val nonPvp = context.skullManager.isWilderness && context.skullManager.isWildernessDisabled
|
||||
val nonPvp = context.skullManager.isWilderness && context.skullManager.isWildernessDisabled //nonPvp is always false
|
||||
if (context.size() > 1)
|
||||
settings += (context.size() - 1) shl 3
|
||||
if (nonPvp)
|
||||
|
|
@ -107,9 +108,26 @@ sealed class PlayerFlags530 (p: Int, o: Int, f: EntityFlag) : EFlagProvider (530
|
|||
buffer.p1 (context.properties.currentCombatLevel) //with summoning
|
||||
buffer.p2 (context.skills.getTotalLevel())
|
||||
} else {
|
||||
buffer.p1 (context.properties.currentCombatLevel) //without summoning
|
||||
buffer.p1 (context.properties.combatLevel) //with summoning
|
||||
//client-side code determines how the combat level will be displayed, based on
|
||||
//the combat level values that are sent
|
||||
if ((GameWorld.settings!!.isPvp || (GameWorld.settings!!.wild_pvp_enabled && context.skullManager.isWilderness))
|
||||
&& !context.familiarManager.isUsingSummoning) {
|
||||
//client will display separate base and summoning combat levels (e.g. "50+5")
|
||||
//TODO: Split combat levels should also be used for Bounty Hunter
|
||||
buffer.p1 (context.properties.combatLevel) //without summoning
|
||||
buffer.p1 (context.properties.combatLevel + context.familiarManager.summoningCombatLevel) //with summoning
|
||||
} else {
|
||||
//client will display a combined combat level (e.g. "55")
|
||||
buffer.p1 (context.properties.currentCombatLevel) //with summoning
|
||||
buffer.p1 (context.properties.currentCombatLevel) //with summoning
|
||||
}
|
||||
if (GameWorld.settings!!.isPvp) {
|
||||
//displays a player's combat level in white if the player is not within combat range
|
||||
buffer.p1 (context.skullManager.level) //combat range
|
||||
} else {
|
||||
//disables the client code that makes combat levels white
|
||||
buffer.p1 (-1) //combat range
|
||||
}
|
||||
}
|
||||
buffer.p1 (0) //this is the sound radius, and if set, 4 shorts need to be set as well which include the sound IDs
|
||||
//to play to everyone in that radius when the player is rendered onscreen for the first time.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue