L2JMobius

C6 Unstuck doesn't show any effects

G-hamsteR · 5 · 5162

Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
Hello,

The /unstuck command doesn't show any cast effects and other players can't see that you are using it.



Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
I fixed it using the skill 2099. However, the unstuck interval config doesn't work anymore. you have to change the hitTime from data\stats\skills\2000-2099.xml

Here are my changes:

Code: [Select]
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java
index fa22098..19521c2 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/usercommandhandlers/Escape.java
@@ -17,9 +17,8 @@
 package org.l2jmobius.gameserver.handler.usercommandhandlers;
 
 import org.l2jmobius.Config;
-import org.l2jmobius.commons.concurrent.ThreadPool;
-import org.l2jmobius.gameserver.GameTimeController;
 import org.l2jmobius.gameserver.ai.CtrlIntention;
+import org.l2jmobius.gameserver.datatables.SkillTable;
 import org.l2jmobius.gameserver.enums.TeleportWhereType;
 import org.l2jmobius.gameserver.handler.IUserCommandHandler;
 import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
@@ -28,9 +27,6 @@
 import org.l2jmobius.gameserver.model.entity.event.DM;
 import org.l2jmobius.gameserver.model.entity.event.TvT;
 import org.l2jmobius.gameserver.model.entity.event.VIP;
-import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
-import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
-import org.l2jmobius.gameserver.util.Broadcast;
 
 public class Escape implements IUserCommandHandler
 {
@@ -130,18 +126,8 @@
  }
 
  player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
- // SoE Animation section
  player.setTarget(player);
- player.disableAllSkills();
-
- player.setTarget(null); // Like retail we haven't self target
- Broadcast.toSelfAndKnownPlayersInRadius(player, new MagicSkillUse(player, 1050, 1, unstuckTimer, 0), 810000);
- player.sendPacket(new SetupGauge(0, unstuckTimer));
- // End SoE Animation section
- final EscapeFinalizer ef = new EscapeFinalizer(player);
- // continue execution later
- player.setSkillCast(ThreadPool.schedule(ef, unstuckTimer));
- player.setSkillCastEndTime(10 + GameTimeController.getGameTicks() + (unstuckTimer / GameTimeController.MILLIS_IN_TICK));
+ player.doCast(SkillTable.getInstance().getInfo(2099, 1));
  return true;
  }
 


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16135
Try this.
Code: [Select]
/*
 * This file is part of the L2J Mobius project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.l2jmobius.gameserver.handler.usercommandhandlers;

import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.gameserver.GameTimeController;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.TeleportWhereType;
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.event.CTF;
import org.l2jmobius.gameserver.model.entity.event.DM;
import org.l2jmobius.gameserver.model.entity.event.TvT;
import org.l2jmobius.gameserver.model.entity.event.VIP;
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
import org.l2jmobius.gameserver.util.Broadcast;

public class Escape implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
52
};

@Override
public boolean useUserCommand(int id, PlayerInstance player)
{
final int unstuckTimer = player.isGM() ? 1000 : Config.UNSTUCK_INTERVAL * 1000;

// Check to see if the current player is in Festival.
if (player.isFestivalParticipant())
{
player.sendMessage("You may not use an escape command in a festival.");
return false;
}

// Check to see if the current player is in TVT Event.
if (player._inEventTvT && TvT.isStarted())
{
player.sendMessage("You may not use an escape skill in TvT.");
return false;
}

// Check to see if the current player is in CTF Event.
if (player._inEventCTF && CTF.isStarted())
{
player.sendMessage("You may not use an escape skill in CTF.");
return false;
}

// Check to see if the current player is in DM Event.
if (player._inEventDM && DM.hasStarted())
{
player.sendMessage("You may not use an escape skill in DM.");
return false;
}

// Check to see if the current player is in Vip Event.
if (player._inEventVIP && VIP._started)
{
player.sendMessage("You may not use an escape skill in VIP.");
return false;
}

// Check to see if the current player is in Grandboss zone.
if ((GrandBossManager.getInstance().getZone(player) != null) && !player.isGM())
{
player.sendMessage("You may not use an escape command in a grand boss zone.");
return false;
}

// Check to see if the current player is in jail.
if (player.isInJail())
{
player.sendMessage("You can not escape from jail.");
return false;
}

// Check to see if the current player is in fun event.
if (player.isInFunEvent())
{
player.sendMessage("You may not escape from an event.");
return false;
}

// Check to see if the current player is in Observer Mode.
if (player.inObserverMode())
{
player.sendMessage("You may not escape during observer mode.");
return false;
}

// Check to see if the current player is sitting.
if (player.isSitting())
{
player.sendMessage("You may not escape when you sitting.");
return false;
}

// Check player status.
if (player.isCastingNow() || player.isMovementDisabled() || player.isMuted() || player.isAlikeDead() || player.isInOlympiadMode())
{
return false;
}

if (unstuckTimer < 60000)
{
player.sendMessage("You use Escape: " + (unstuckTimer / 1000) + " seconds.");
}
else
{
player.sendMessage("You use Escape: " + (unstuckTimer / 60000) + " minutes.");
}

// Abort combat.
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.abortAttack();
player.abortCast(true);
player.disableAllSkills();
player.setTarget(null); // Like retail we haven't self target.

// Cast escape animation.
Broadcast.toSelfAndKnownPlayersInRadius(player, new MagicSkillUse(player, player, 1050, 1, unstuckTimer, 0), 810000);
player.sendPacket(new SetupGauge(0, unstuckTimer));

// Continue execution later.
final EscapeFinalizer escapeFinalizer = new EscapeFinalizer(player);
player.setSkillCast(ThreadPool.schedule(escapeFinalizer, unstuckTimer));
player.setSkillCastEndTime(10 + GameTimeController.getGameTicks() + (unstuckTimer / GameTimeController.MILLIS_IN_TICK));

return true;
}

private static class EscapeFinalizer implements Runnable
{
private final PlayerInstance _player;

EscapeFinalizer(PlayerInstance player)
{
_player = player;
}

@Override
public void run()
{
if (_player.isDead())
{
return;
}

_player.setIn7sDungeon(false);
_player.enableAllSkills();

try
{
if ((_player.getKarma() > 0) && Config.ALT_KARMA_TELEPORT_TO_FLORAN)
{
_player.teleToLocation(17836, 170178, -3507, true); // Floran
return;
}

_player.teleToLocation(TeleportWhereType.TOWN);
}
catch (Throwable e)
{
}
}
}

@Override
public int[] getUserCommandList()
{
return COMMAND_IDS;
}
}


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 335
It's working, thank you!

Try this.
Code: [Select]
/*
 * This file is part of the L2J Mobius project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.l2jmobius.gameserver.handler.usercommandhandlers;

import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.gameserver.GameTimeController;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.enums.TeleportWhereType;
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.event.CTF;
import org.l2jmobius.gameserver.model.entity.event.DM;
import org.l2jmobius.gameserver.model.entity.event.TvT;
import org.l2jmobius.gameserver.model.entity.event.VIP;
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
import org.l2jmobius.gameserver.util.Broadcast;

public class Escape implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
52
};

@Override
public boolean useUserCommand(int id, PlayerInstance player)
{
final int unstuckTimer = player.isGM() ? 1000 : Config.UNSTUCK_INTERVAL * 1000;

// Check to see if the current player is in Festival.
if (player.isFestivalParticipant())
{
player.sendMessage("You may not use an escape command in a festival.");
return false;
}

// Check to see if the current player is in TVT Event.
if (player._inEventTvT && TvT.isStarted())
{
player.sendMessage("You may not use an escape skill in TvT.");
return false;
}

// Check to see if the current player is in CTF Event.
if (player._inEventCTF && CTF.isStarted())
{
player.sendMessage("You may not use an escape skill in CTF.");
return false;
}

// Check to see if the current player is in DM Event.
if (player._inEventDM && DM.hasStarted())
{
player.sendMessage("You may not use an escape skill in DM.");
return false;
}

// Check to see if the current player is in Vip Event.
if (player._inEventVIP && VIP._started)
{
player.sendMessage("You may not use an escape skill in VIP.");
return false;
}

// Check to see if the current player is in Grandboss zone.
if ((GrandBossManager.getInstance().getZone(player) != null) && !player.isGM())
{
player.sendMessage("You may not use an escape command in a grand boss zone.");
return false;
}

// Check to see if the current player is in jail.
if (player.isInJail())
{
player.sendMessage("You can not escape from jail.");
return false;
}

// Check to see if the current player is in fun event.
if (player.isInFunEvent())
{
player.sendMessage("You may not escape from an event.");
return false;
}

// Check to see if the current player is in Observer Mode.
if (player.inObserverMode())
{
player.sendMessage("You may not escape during observer mode.");
return false;
}

// Check to see if the current player is sitting.
if (player.isSitting())
{
player.sendMessage("You may not escape when you sitting.");
return false;
}

// Check player status.
if (player.isCastingNow() || player.isMovementDisabled() || player.isMuted() || player.isAlikeDead() || player.isInOlympiadMode())
{
return false;
}

if (unstuckTimer < 60000)
{
player.sendMessage("You use Escape: " + (unstuckTimer / 1000) + " seconds.");
}
else
{
player.sendMessage("You use Escape: " + (unstuckTimer / 60000) + " minutes.");
}

// Abort combat.
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.abortAttack();
player.abortCast(true);
player.disableAllSkills();
player.setTarget(null); // Like retail we haven't self target.

// Cast escape animation.
Broadcast.toSelfAndKnownPlayersInRadius(player, new MagicSkillUse(player, player, 1050, 1, unstuckTimer, 0), 810000);
player.sendPacket(new SetupGauge(0, unstuckTimer));

// Continue execution later.
final EscapeFinalizer escapeFinalizer = new EscapeFinalizer(player);
player.setSkillCast(ThreadPool.schedule(escapeFinalizer, unstuckTimer));
player.setSkillCastEndTime(10 + GameTimeController.getGameTicks() + (unstuckTimer / GameTimeController.MILLIS_IN_TICK));

return true;
}

private static class EscapeFinalizer implements Runnable
{
private final PlayerInstance _player;

EscapeFinalizer(PlayerInstance player)
{
_player = player;
}

@Override
public void run()
{
if (_player.isDead())
{
return;
}

_player.setIn7sDungeon(false);
_player.enableAllSkills();

try
{
if ((_player.getKarma() > 0) && Config.ALT_KARMA_TELEPORT_TO_FLORAN)
{
_player.teleToLocation(17836, 170178, -3507, true); // Floran
return;
}

_player.teleToLocation(TeleportWhereType.TOWN);
}
catch (Throwable e)
{
}
}
}

@Override
public int[] getUserCommandList()
{
return COMMAND_IDS;
}
}