From 0de09ee9f5a613b20c3a71187aa3ac0440b60d70 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 27 May 2023 22:00:12 -0500 Subject: [PATCH] trebs now show correct time remaining to spawn --- src/engine/net/client/msg/ManageNPCMsg.java | 44 ++++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index 571dead5..46fd32fd 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -465,18 +465,42 @@ public class ManageNPCMsg extends ClientNetMsg { writer.putInt(0); writer.putInt(1); writer.putInt(1); - writer.put((byte) 0); + long curTime = System.currentTimeMillis() / 1000; - long upgradeTime = mob.getTimeToSpawnSiege() / 1000; + long upgradeTime = (mob.deathTime + (mob.spawnTime * 1000)) / 1000; long timeLife = upgradeTime - curTime; - - writer.putInt(900); - writer.putInt(900); - writer.putInt((int) timeLife); //time remaining? - writer.putInt(0); - writer.put((byte) 0); - writer.putString(mob.getName()); - writer.put((byte) 0); + if (upgradeTime * 1000 > System.currentTimeMillis()) { + if(mob.npcOwner.isAlive()) { + writer.put((byte) 0);//shows respawning timer + writer.putInt(mob.spawnTime); + writer.putInt(mob.spawnTime); + writer.putInt((int) timeLife); //time remaining for mob that is dead + writer.putInt(0); + writer.put((byte) 0); + writer.putString(mob.getNameOverride().isEmpty() ? mob.getName() : mob.getNameOverride()); + writer.put((byte) 0); + } + else{ + writer.put((byte) 0);//shows respawning timer + writer.putInt(0); + writer.putInt(0); + writer.putInt(0); //time remaining for mob that is dead + writer.putInt(0); + writer.put((byte) 0); + writer.putString(mob.getNameOverride().isEmpty() ? mob.getName() : mob.getNameOverride()); + writer.put((byte) 0); + } + } else { + //nothing required for countdown for a mob that is alive + writer.put((byte) 1);//shows "Standing By" + writer.putInt(0); + writer.putInt(0); + writer.putInt(0); + writer.putInt(0); + writer.put((byte) 0); + writer.putString(mob.getNameOverride().isEmpty() ? mob.getName() : mob.getNameOverride()); + writer.put((byte) 0); + } } return;