Properly display death point values.
Thanks to Mode.
This commit is contained in:
parent
8217c8fdb2
commit
b64c9cf98e
@ -52,7 +52,10 @@ public enum StatusUpdateType
|
|||||||
REPUTATION(0x1B, creature -> creature.isPlayer() ? creature.getActingPlayer().getReputation() : 0),
|
REPUTATION(0x1B, creature -> creature.isPlayer() ? creature.getActingPlayer().getReputation() : 0),
|
||||||
|
|
||||||
CUR_CP(0x21, creature -> (int) creature.getCurrentCp()),
|
CUR_CP(0x21, creature -> (int) creature.getCurrentCp()),
|
||||||
MAX_CP(0x22, Creature::getMaxCp);
|
MAX_CP(0x22, Creature::getMaxCp),
|
||||||
|
|
||||||
|
CUR_DP(0x28, creature -> creature.isPlayer() ? creature.getActingPlayer().getDeathPoints() : 0),
|
||||||
|
MAX_DP(0x29, creature -> creature.isPlayer() ? creature.getActingPlayer().getMaxDeathPoints() : 0);
|
||||||
|
|
||||||
private int _clientId;
|
private int _clientId;
|
||||||
private Function<Creature, Integer> _valueSupplier;
|
private Function<Creature, Integer> _valueSupplier;
|
||||||
|
@ -5408,6 +5408,10 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
if ((oldValue == null) || (oldValue != newValue))
|
if ((oldValue == null) || (oldValue != newValue))
|
||||||
{
|
{
|
||||||
su.addUpdate(type, newValue);
|
su.addUpdate(type, newValue);
|
||||||
|
if ((type == StatusUpdateType.MAX_DP) && isPlayer())
|
||||||
|
{
|
||||||
|
su.addUpdate(StatusUpdateType.CUR_DP, getActingPlayer().getDeathPoints());
|
||||||
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
return oldValue;
|
return oldValue;
|
||||||
|
@ -677,6 +677,7 @@ public class PlayerInstance extends Playable
|
|||||||
private final static int DEATH_POINTS_PASSIVE = 45352;
|
private final static int DEATH_POINTS_PASSIVE = 45352;
|
||||||
private final static int DEVASTATING_MIND = 45300;
|
private final static int DEVASTATING_MIND = 45300;
|
||||||
private int _deathPoints = 0;
|
private int _deathPoints = 0;
|
||||||
|
private int _maxDeathPoints = 0;
|
||||||
|
|
||||||
// WorldPosition used by TARGET_SIGNET_GROUND
|
// WorldPosition used by TARGET_SIGNET_GROUND
|
||||||
private Location _currentSkillWorldPosition;
|
private Location _currentSkillWorldPosition;
|
||||||
@ -11317,30 +11318,34 @@ public class PlayerInstance extends Playable
|
|||||||
return _deathPoints;
|
return _deathPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxDeathPoints()
|
||||||
|
{
|
||||||
|
return _maxDeathPoints;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDeathPoints(int value)
|
public void setDeathPoints(int value)
|
||||||
{
|
{
|
||||||
// Find current max points.
|
// Check current death points passive level.
|
||||||
int maxPoints = 0;
|
|
||||||
switch (getAffectedSkillLevel(DEATH_POINTS_PASSIVE))
|
switch (getAffectedSkillLevel(DEATH_POINTS_PASSIVE))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
maxPoints = 500;
|
_maxDeathPoints = 500;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
maxPoints = 700;
|
_maxDeathPoints = 700;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
maxPoints = 1000;
|
_maxDeathPoints = 1000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set current points.
|
// Set current points.
|
||||||
_deathPoints = Math.min(maxPoints, Math.max(0, value));
|
_deathPoints = Math.min(_maxDeathPoints, Math.max(0, value));
|
||||||
// Apply devastating mind.
|
// Apply devastating mind.
|
||||||
final int expectedLevel = _deathPoints / 100;
|
final int expectedLevel = _deathPoints / 100;
|
||||||
if (expectedLevel > 0)
|
if (expectedLevel > 0)
|
||||||
@ -11355,6 +11360,11 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
getEffectList().stopSkillEffects(true, DEVASTATING_MIND);
|
getEffectList().stopSkillEffects(true, DEVASTATING_MIND);
|
||||||
}
|
}
|
||||||
|
// Send StatusUpdate.
|
||||||
|
final StatusUpdate su = new StatusUpdate(this);
|
||||||
|
computeStatusUpdate(su, StatusUpdateType.MAX_DP);
|
||||||
|
computeStatusUpdate(su, StatusUpdateType.CUR_DP);
|
||||||
|
sendPacket(su);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -13920,6 +13930,10 @@ public class PlayerInstance extends Playable
|
|||||||
addStatusUpdateValue(StatusUpdateType.LEVEL);
|
addStatusUpdateValue(StatusUpdateType.LEVEL);
|
||||||
addStatusUpdateValue(StatusUpdateType.MAX_CP);
|
addStatusUpdateValue(StatusUpdateType.MAX_CP);
|
||||||
addStatusUpdateValue(StatusUpdateType.CUR_CP);
|
addStatusUpdateValue(StatusUpdateType.CUR_CP);
|
||||||
|
if (isPlayer() && (getActingPlayer().getClassId().getId() > 195))
|
||||||
|
{
|
||||||
|
addStatusUpdateValue(StatusUpdateType.CUR_DP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrainingHolder getTraingCampInfo()
|
public TrainingHolder getTraingCampInfo()
|
||||||
|
@ -648,6 +648,14 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
player.updateAbnormalVisualEffects();
|
player.updateAbnormalVisualEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Death Knight death points init.
|
||||||
|
if (player.getClassId().getId() > 195)
|
||||||
|
{
|
||||||
|
// Send twice.
|
||||||
|
player.setDeathPoints(500);
|
||||||
|
player.setDeathPoints(0); // TODO: Store death point values?
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.ENABLE_ATTENDANCE_REWARDS)
|
if (Config.ENABLE_ATTENDANCE_REWARDS)
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(() ->
|
ThreadPool.schedule(() ->
|
||||||
|
@ -54,6 +54,7 @@ public class StatusUpdate implements IClientOutgoingPacket
|
|||||||
case CUR_HP:
|
case CUR_HP:
|
||||||
case CUR_MP:
|
case CUR_MP:
|
||||||
case CUR_CP:
|
case CUR_CP:
|
||||||
|
case CUR_DP:
|
||||||
{
|
{
|
||||||
_isVisible = true;
|
_isVisible = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user