Fixed SetupGauge send proper objId.

Contributed by Sahar.
This commit is contained in:
MobiusDev 2018-05-18 23:49:48 +00:00
parent e93064859b
commit 0c49dce9a5
9 changed files with 23 additions and 28 deletions

View File

@ -496,7 +496,7 @@ public class AdminMobGroup implements IAdminCommandHandler
private void doAnimation(L2PcInstance activeChar)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, 1008, 1, 4000, 0), 1500);
activeChar.sendPacket(new SetupGauge(0, 4000));
activeChar.sendPacket(new SetupGauge(activeChar.getObjectId(), 0, 4000));
}
private void attackGrp(String command, L2PcInstance activeChar)

View File

@ -165,7 +165,7 @@ public class AdminPolymorph implements IAdminCommandHandler
final L2Character Char = (L2Character) obj;
final MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0);
Char.broadcastPacket(msk);
final SetupGauge sg = new SetupGauge(0, 4000);
final SetupGauge sg = new SetupGauge(Char.getObjectId(), 0, 4000);
Char.sendPacket(sg);
}
// end of animation

View File

@ -131,7 +131,7 @@ public class RentPet implements IBypassHandler
}
player.mount(petId, 0, false);
final SetupGauge sg = new SetupGauge(3, time * 1000);
final SetupGauge sg = new SetupGauge(player.getObjectId(), 3, time * 1000);
player.sendPacket(sg);
player.startRentPet(time);
}

View File

@ -106,7 +106,7 @@ public class Unstuck implements IUserCommandHandler
final MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, unstuckTimer, 0);
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 900);
final SetupGauge sg = new SetupGauge(0, unstuckTimer);
final SetupGauge sg = new SetupGauge(activeChar.getObjectId(), 0, unstuckTimer);
activeChar.sendPacket(sg);
// End SoE Animation section

View File

@ -466,7 +466,7 @@ public class Wedding implements IVoicedCommandHandler
final MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, teleportTimer, 0);
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 900);
final SetupGauge sg = new SetupGauge(0, teleportTimer);
final SetupGauge sg = new SetupGauge(activeChar.getObjectId(), 0, teleportTimer);
activeChar.sendPacket(sg);
// End SoE Animation section

View File

@ -353,13 +353,13 @@ public class RecipeController
final MagicSkillUse msk = new MagicSkillUse(_player, _skillId, _skillLevel, _delay, 0);
_player.broadcastPacket(msk);
_player.sendPacket(new SetupGauge(0, _delay));
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
ThreadPool.schedule(this, 100 + _delay);
}
else
{
// for alt mode, sleep delay msec before finishing
_player.sendPacket(new SetupGauge(0, _delay));
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
try
{
@ -536,7 +536,7 @@ public class RecipeController
// rest (wait for HP)
if (Config.ALT_GAME_CREATION && isWait)
{
_player.sendPacket(new SetupGauge(0, _delay));
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
ThreadPool.schedule(this, 100 + _delay);
}
else
@ -558,7 +558,7 @@ public class RecipeController
// rest (wait for MP)
if (Config.ALT_GAME_CREATION && isWait)
{
_player.sendPacket(new SetupGauge(0, _delay));
_player.sendPacket(new SetupGauge(_player.getObjectId(), 0, _delay));
ThreadPool.schedule(this, 100 + _delay);
}
else

View File

@ -1168,7 +1168,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Check if the L2Character is a L2PcInstance
if (isPlayer())
{
sendPacket(new SetupGauge(SetupGauge.RED, sAtk + reuse));
sendPacket(new SetupGauge(getObjectId(), SetupGauge.RED, sAtk + reuse));
}
// Create a new hit task with Medium priority
@ -1237,7 +1237,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
sendPacket(SystemMessageId.YOUR_CROSSBOW_IS_PREPARING_TO_FIRE);
// Send a Server->Client packet SetupGauge
final SetupGauge sg = new SetupGauge(SetupGauge.RED, sAtk + reuse);
final SetupGauge sg = new SetupGauge(getObjectId(), SetupGauge.RED, sAtk + reuse);
sendPacket(sg);
}
@ -1909,7 +1909,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Send a Server->Client packet SetupGauge with the color of the gauge and the casting time
if (isPlayer() && !simultaneously)
{
sendPacket(new SetupGauge(SetupGauge.BLUE, skillTime));
sendPacket(new SetupGauge(getObjectId(), SetupGauge.BLUE, skillTime));
}
if (skill.isChanneling() && (skill.getChannelingSkillId() > 0))

View File

@ -6408,7 +6408,7 @@ public final class L2PcInstance extends L2Playable
}
final boolean wasFlying = isFlying();
sendPacket(new SetupGauge(3, 0, 0));
sendPacket(new SetupGauge(getObjectId(), 3, 0, 0));
final int petId = _mountNpcId;
setMount(0, 0);
stopFeed();
@ -10501,7 +10501,7 @@ public final class L2PcInstance extends L2Playable
}
_taskWater.cancel(false);
_taskWater = null;
sendPacket(new SetupGauge(2, 0));
sendPacket(new SetupGauge(getObjectId(), 2, 0));
}
public void startWaterTask()
@ -10511,7 +10511,7 @@ public final class L2PcInstance extends L2Playable
return;
}
final int timeinwater = (int) calcStat(Stats.BREATH, 60000, this, null);
sendPacket(new SetupGauge(2, timeinwater));
sendPacket(new SetupGauge(getObjectId(), 2, timeinwater));
_taskWater = ThreadPool.scheduleAtFixedRate(new WaterTask(this), timeinwater, 1000);
}
@ -12638,7 +12638,7 @@ public final class L2PcInstance extends L2Playable
{
setCurrentFeed(((L2PetInstance) getSummon()).getCurrentFed());
_controlItemId = getSummon().getControlObjectId();
sendPacket(new SetupGauge(3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume()));
sendPacket(new SetupGauge(getObjectId(), 3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume()));
if (!isDead())
{
_mountFeedTask = ThreadPool.scheduleAtFixedRate(new PetFeedTask(this), 10000, 10000);
@ -12647,7 +12647,7 @@ public final class L2PcInstance extends L2Playable
else if (_canFeed)
{
setCurrentFeed(getMaxFeed());
final SetupGauge sg = new SetupGauge(3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume());
final SetupGauge sg = new SetupGauge(getObjectId(), 3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume());
sendPacket(sg);
if (!isDead())
{
@ -12694,7 +12694,7 @@ public final class L2PcInstance extends L2Playable
{
final boolean lastHungryState = isHungry();
_curFeed = num > getMaxFeed() ? getMaxFeed() : num;
final SetupGauge sg = new SetupGauge(3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume());
final SetupGauge sg = new SetupGauge(getObjectId(), 3, (getCurrentFeed() * 10000) / getFeedConsume(), (getMaxFeed() * 10000) / getFeedConsume());
sendPacket(sg);
// broadcast move speed change when strider becomes hungry / full
if (lastHungryState != isHungry())

View File

@ -17,7 +17,6 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
public final class SetupGauge implements IClientOutgoingPacket
@ -26,20 +25,22 @@ public final class SetupGauge implements IClientOutgoingPacket
public static final int RED = 1;
public static final int CYAN = 2;
private final int _charObjId;
private final int _dat1;
private final int _time;
private final int _time2;
private int _charObjId;
public SetupGauge(int dat1, int time)
public SetupGauge(int charObjId, int dat1, int time)
{
_charObjId = charObjId;
_dat1 = dat1; // color 0-blue 1-red 2-cyan 3-green
_time = time;
_time2 = time;
}
public SetupGauge(int color, int currentTime, int maxTime)
public SetupGauge(int charObjId, int color, int currentTime, int maxTime)
{
_charObjId = charObjId;
_dat1 = color; // color 0-blue 1-red 2-cyan 3-green
_time = currentTime;
_time2 = maxTime;
@ -55,10 +56,4 @@ public final class SetupGauge implements IClientOutgoingPacket
packet.writeD(_time2);
return true;
}
@Override
public void runImpl(L2PcInstance player)
{
_charObjId = player.getObjectId();
}
}