Jump to content
  • 0

[Help] TvT Commands


Question

Posted

Core Part:

 

Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java  (revision 4011)
+++ java/com/l2jserver/Config.java  (working copy)
@@ -625,6 +630,9 @@ 
    public static TIntIntHashMap TVT_EVENT_FIGHTER_BUFFS;
    public static TIntIntHashMap TVT_EVENT_MAGE_BUFFS;
    public static boolean TVT_ALLOW_VOICED_COMMAND;
+   public static boolean TVT_ALLOW_REGISTER_VOICED_COMMAND;
+   public static boolean TVT_RESTORE_PLAYER_POS;

@@ -2009,6 +2017,16 @@
                            TVT_EVENT_START_LEAVE_TELEPORT_DELAY = Integer.parseInt(L2JModSettings.getProperty("TvTEventStartLeaveTeleportDelay", "20"));
                            TVT_EVENT_EFFECTS_REMOVAL = Integer.parseInt(L2JModSettings.getProperty("TvTEventEffectsRemoval", "0"));
                            TVT_ALLOW_VOICED_COMMAND = Boolean.parseBoolean(L2JModSettings.getProperty("TvTAllowVoicedInfoCommand", "false"));
+                           TVT_ALLOW_REGISTER_VOICED_COMMAND = Boolean.parseBoolean(L2JModSettings.getProperty("TvTAllowRegisterVoicedCommand", "false"));
+                           TVT_DISALLOW_DUALBOX = Boolean.parseBoolean(L2JModSettings.getProperty("TvTEnableDualBoxProtection", "false"));
+                           TVT_RESTORE_PLAYER_POS = Boolean.parseBoolean(L2JModSettings.getProperty("TvTRestorePlayerOldPosition", "false"));

Index: java/com/l2jserver/gameserver/model/entity/TvTEvent.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/TvTEvent.java    (revision 4011)
+++ java/com/l2jserver/gameserver/model/entity/TvTEvent.java    (working copy)
@@ -28,6 +29,7 @@
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.L2Spawn;
+import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Summon;
@@ -91,8 +94,22 @@
     */
    public static void init()
    {
+       
+       if(Config.TVT_RESTORE_PLAYER_POS)
+           TvTEventTeleporter.initializeRestoreMap();
+       
    }
@@ -459,6 +464,12 @@
            }
        }
        
+       if(Config.TVT_RESTORE_PLAYER_POS)
+           TvTEventTeleporter.clearRestoreMap();
+       
@@ -1136,7 +1291,7 @@
     */
    public static int[] getParticipantTeamCoordinates(int playerObjectId)
    {
-       return _teams[0].containsPlayer(playerObjectId) ? _teams[0].getCoordinates() : (_teams[1].containsPlayer(playerObjectId) ? _teams[1].getCoordinates() : null);
+       return getParticipantTeam(playerObjectId).getCoordinates();
    }
    
    /**
@@ -1152,7 +1307,7 @@
            return false;
        }
        
-       return _teams[0].containsPlayer(playerObjectId) || _teams[1].containsPlayer(playerObjectId);
+       return getParticipantTeam(playerObjectId) != null;

Index: java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java  (revision 4011)
+++ java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java  (working copy)
@@ -14,6 +14,8 @@
  */
package com.l2jserver.gameserver.model.entity;

+import javolution.util.FastMap;
+
import com.l2jserver.Config;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.actor.L2Summon;
@@ -28,6 +30,22 @@
    private int[] _coordinates = new int[3];
    /** Admin removed this player from event */
    private boolean _adminRemove = false;
+   /** Old Player Coordinates */
+   private static FastMap<Integer, Integer[]> _oldPlayerPos;
+   /** Color name identifier per Team */
+   private static final int[] _colorNames =
+   {
+       // White
+       16777215,
+       // Blue
+       26367,
+       // Red
+       16711680,
+       // Green
+       3407718,
+       // Yellow
+       16776960
+   };
    
    /**
     * Initialize the teleporter and start the delayed task<br><br>
@@ -94,13 +112,55 @@

        _playerInstance.doRevive();

-       _playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false );
+       int objId = _playerInstance.getObjectId();
+       if(Config.TVT_RESTORE_PLAYER_POS && TvTEvent.isStarted() && !_adminRemove)
+       {
+           final Integer[] oldCoords =
+           {
+               _playerInstance.getX(),
+               _playerInstance.getY(),
+               _playerInstance.getZ()
+           };
+           
+           _oldPlayerPos.put(objId, oldCoords);
+       }
+
+       if(Config.TVT_RESTORE_PLAYER_POS && !TvTEvent.isStarted())
+       {
+           Integer[] coor = _oldPlayerPos.get(objId);
+           
+           if(coor != null)
+           {
+               _playerInstance.teleToLocation(coor[0], coor[1], coor[2], false);
+           }
+           else
+           {
+               _playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false );
+           }
+       }
+       else
+           _playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false );
        
        if (TvTEvent.isStarted() && !_adminRemove)
-           _playerInstance.setTeam(TvTEvent.getParticipantTeamId(_playerInstance.getObjectId()) + 1);
+       {
+           int team = TvTEvent.getParticipantTeamId(_playerInstance.getObjectId()) + 1;
+           
+           if(Config.TVT_TEAMS_COUNT == 2)
+               _playerInstance.setTeam(team);
+           else
+               _playerInstance.getAppearance().setNameColor(_colorNames[team]);
+       }
        else
-           _playerInstance.setTeam(0);
+       {   
+           if(Config.TVT_TEAMS_COUNT == 2)
+               _playerInstance.setTeam(0);
+           else
+               _playerInstance.getAppearance().setNameColor(_colorNames[0]);
+       }
        
+       if(_oldPlayerPos.containsKey(objId))
+           _oldPlayerPos.remove(objId);
+       
        _playerInstance.setCurrentCp(_playerInstance.getMaxCp());
        _playerInstance.setCurrentHp(_playerInstance.getMaxHp());
        _playerInstance.setCurrentMp(_playerInstance.getMaxMp());
@@ -108,4 +168,22 @@
        _playerInstance.broadcastStatusUpdate();
        _playerInstance.broadcastUserInfo();
    }
+   
+   /**
+    * Initializes the map where the player position
+    * will be stored
+    */
+   public static void initializeRestoreMap()
+   {
+       if(_oldPlayerPos == null)
+           _oldPlayerPos = new FastMap<Integer, Integer[]>();
+   }
+   
+   /**
+    * Clear all containing data for a new event
+    */
+   public static void clearRestoreMap()
+   {
+       _oldPlayerPos.clear();
+   }
}
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties  (revision 4011)
+++ java/config/l2jmods.properties  (working copy)
@@ -172,6 +175,15 @@
TvTEventTeam2Name = Team2
TvTEventTeam2Coordinates = 149999,46728,-3414
+#Restore previous char position when TvT ends
+TvTRestorePlayerOldPosition = False

 

DP Part:

 

Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java    (revision 7189)
+++ data/scripts/handlers/MasterHandler.java    (working copy)
@@ -265,8 +265,8 @@
            VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding());
        if (Config.BANKING_SYSTEM_ENABLED)
            VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Banking());
-       if (Config.TVT_ALLOW_VOICED_COMMAND)
-           VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new TvTVoicedInfo());
+       if (Config.TVT_ALLOW_VOICED_COMMAND || Config.TVT_ALLOW_REGISTER_VOICED_COMMAND)
+           VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new TvTVoiced());

Index: data/scripts/handlers/voicedcommandhandlers/TvTVoiced.java
===================================================================
--- data/scripts/handlers/voicedcommandhandlers/TvTVoiced.java  (revision 7189)
+++ data/scripts/handlers/voicedcommandhandlers/TvTVoiced.java  (working copy)
@@ -27,40 +27,72 @@
  * 
  * @author denser
  */
-public class TvTVoicedInfo implements IVoicedCommandHandler
+public class TvTVoiced implements IVoicedCommandHandler
{
-   private static final String[] _voicedCommands = { "tvt" };
+   private static final String[] _voicedCommands = 
+   { 
+       "tvt", 
+       "tvtjoin",
+       "tvtleave"
+   };
@@ -74,6 +106,20 @@
                activeChar.sendPacket(ActionFailed.STATIC_PACKET);
            }
        }
+       else if(command.equalsIgnoreCase("tvtjoin"))
+       {
+           if(Config.TVT_ALLOW_REGISTER_VOICED_COMMAND)
+               TvTEvent.onBypass("tvt_event_participation", activeChar);
+           else
+               activeChar.sendMessage("Command disabled");
+       }
+       else if(command.equalsIgnoreCase("tvtleave"))
+       {
+           if(Config.TVT_ALLOW_REGISTER_VOICED_COMMAND)
+               TvTEvent.onBypass("tvt_event_remove_participation", activeChar);
+           else
+               activeChar.sendMessage("Command disabled");
+       }

 

That's my code and i need help to finish it.

Its my first code so... i dont know if it is good coded, so i need some1 who tell me if it is good or will not work, and why, what else need the code.

Well, thats all. Thanx

4 answers to this question

Recommended Posts

  • 0
Posted

Try to compile, see errors

-> if there isn't, try ingame

        -> if there aren't errors, GG

        -> if there are, post here.

 

It's part of developper to test himself its creations, so until you didn't show any error, I don't get the point of the topic.

  • 0
Posted

Try to compile, see errors

-> if there isn't, try ingame

        -> if there aren't errors, GG

        -> if there are, post here.

 

It's part of developper to test himself its creations, so until you didn't show any error, I don't get the point of the topic.

 

You have right, thanx a lot.

And FighterBoss, thanx for the information.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • LIVE VERIFICATION? SUMSUB? “IMPOSSIBLE”? ▪ Spoiler: it is possible — if you know who to work with. A client came in with a task to pass **live verification** on **WantToPay**, a Telegram virtual card service. On the platform side — **Sumsub**: liveness check, SMS, manual review. “Fast” and “by eye” simply don’t work here. › What was done: → analyzed the verification scenario and Sumsub requirements → built the correct flow: phone number, email, timing → **completed live verification remotely, without account handover** → handled SMS and confirmation codes → brought the process to final approval ▪ Result: → verification passed → access granted → no flags or repeat requests ▪ Live verification is not luck. It’s scenario-based preparation — not hope. › TG: @mustang_service ( https:// t.me/ mustang_service ) › Channel: Mustang Service ( https:// t.me/ +6RAKokIn5ItmYjEx ) *All data is published with the client’s consent.* #verification #sumsub #livecheck #kyc #case
    • IMPORTANT INFO: In a few days, I will switch to completely new code, written from scratch with a new download system, patch building and management system. The Updater will become true 2026 code with "foolproof systems". I'm going to create a Discord server for customers to request new ideas and features. FIRST CUSTOMERS ARE ALREADY USING THE NEW UPDATER ON LIVE SERVERS! Watch this topic for upcoming info because the new updater is around the corner! Yes, you can still use self-update on the previous updater! No, the new updater won't be compatible with the old patch system! A new build is required, but players who already have game files won't have to download the entire patch again! New templates and updates to existing templates are coming soon! Sneak peek:  
    • i used guytis IL project and source. i found in his project there are 3 Client version source... 1,CliExt_H5   --->this one cant be compiled in VS2005,i did know why..is it for H5 client? 2,CliExtNew  --->this one is IL version ,but when i compiled it and use it.player cant login game,MD5Checksum wrong.i check the source code,but not found any hints. 3,L2Server    --->this one for HB client?im not sure...   so my question is what are the differences between these three versions of cliext.dll?how can i fix the issue of the MD5Checksum not matching problem?   01/29/2026 21:04:11.366, [CCliExt::HandleCheckSum] Invalid Checksum[1130415144] vs [-721420287] packet[dd] len[29] sum[2698] key[30] HWID[] Account[]! 01/29/2026 21:04:11.366, SocketLimiter::UserSocketBadunknownprotocol 11111111111 01/29/2026 21:04:11.366, [usersocket]unknown protocol from ip[113.137.149.115]!      
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..