Secret Experience

Secret Experience (https://secretexperience.net/)
-   [Lineage] Java Mods (https://secretexperience.net/lineage-java-mods/)
-   -   [L2JServer] Triple TvT (https://secretexperience.net/lineage-java-mods/22368-triple-tvt.html)

Optus 16-06-2010 12:23 AM

Triple TvT
 
Triple TvT
3 Times
Código:

Index: L2_GameServer_It/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java        (revision 1433)
+++ L2_GameServer_It/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java        (working copy)
@@ -57,7 +57,7 @@
        }
 
        /**        The teams of the TvTEvent<br> */
-        private static TvTEventTeam[] _teams = new TvTEventTeam[2]; // event only allow max 2 teams
+        private static TvTEventTeam[] _teams = new TvTEventTeam[3]; // event only allow max 2 teams
        /** The state of the TvTEvent<br> */
        private static EventState _state = EventState.INACTIVE;
        /** The spawn of the participation npc<br> */
@@ -78,6 +78,7 @@
        {
                _teams[0] = new TvTEventTeam(Config.TVT_EVENT_TEAM_1_NAME, Config.TVT_EVENT_TEAM_1_COORDINATES);
                _teams[1] = new TvTEventTeam(Config.TVT_EVENT_TEAM_2_NAME, Config.TVT_EVENT_TEAM_2_COORDINATES);
+                _teams[2] = new TvTEventTeam(Config.TVT_EVENT_TEAM_3_NAME, Config.TVT_EVENT_TEAM_3_COORDINATES);
        }
 
        /**
@@ -143,11 +144,12 @@
                setState(EventState.STARTING);
 
                // not enought participants
-                if (_teams[0].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS || _teams[1].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS)
+                if (_teams[0].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS || _teams[1].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS || _teams[2].getParticipatedPlayerCount() < Config.TVT_EVENT_MIN_PLAYERS_IN_TEAMS)
                {
                        setState(EventState.INACTIVE);
                        _teams[0].cleanMe();
                        _teams[1].cleanMe();
+                        _teams[2].cleanMe();
                        unSpawnNpc();
                        return false;
                }
@@ -185,16 +187,16 @@
          */
        public static String calculateRewards()
        {
-                if (_teams[0].getPoints() == _teams[1].getPoints())
+                if (_teams[0].getPoints() == _teams[1].getPoints() || (_teams[0].getPoints() == _teams[2].getPoints() || _teams[1].getPoints() == _teams[2].getPoints()))
                {
-                        if (_teams[0].getParticipatedPlayerCount() == 0 || _teams[1].getParticipatedPlayerCount() == 0)
+                        if (_teams[0].getParticipatedPlayerCount() == 0 || _teams[1].getParticipatedPlayerCount() == 0 || _teams[2].getParticipatedPlayerCount() == 0)
                        {
                                // the fight cannot be completed
                                setState(EventState.REWARDING);
                                return "TvT Event: Event finish. No team won, cause of inactivity!";
                        }
 
-                        sysMsgToAllParticipants("TvT Event: Both teams are at a tie, next team to get a kill wins!");
+                        sysMsgToAllParticipants("TvT Event: Teams are at a tie, next team to get a kill wins!");
                }
 
                while (_teams[0].getPoints() == _teams[1].getPoints())
@@ -209,7 +211,7 @@
 
                setState(EventState.REWARDING); // after state REWARDING is set, nobody can point anymore
 
-                byte teamId = (byte)(_teams[0].getPoints() > _teams[1].getPoints() ? 0 : 1); // which team wins?
+                byte teamId = (byte)(_teams[0].getPoints() > _teams[1].getPoints() || (_teams[0].getPoints() > _teams[2].getPoints()) || (_teams[1].getPoints() > _teams[2].getPoints()) ? 0 : 1); // which team wins?
                TvTEventTeam team = _teams[teamId];
 
                for (String playerName : team.getParticipatedPlayerNames())
@@ -292,6 +294,7 @@
 
                _teams[0].cleanMe();
                _teams[1].cleanMe();
+                _teams[2].cleanMe();
                setState(EventState.INACTIVE);
        }
 
@@ -310,10 +313,12 @@
 
                byte teamId = 0;
 
-                if (_teams[0].getParticipatedPlayerCount() == _teams[1].getParticipatedPlayerCount())
-                        teamId = (byte)(Rnd.get(2));
+                if (_teams[0].getParticipatedPlayerCount() == _teams[1].getParticipatedPlayerCount() || (_teams[0].getParticipatedPlayerCount() == _teams[2].getParticipatedPlayerCount() || (_teams[1].getParticipatedPlayerCount() == _teams[2].getParticipatedPlayerCount())))
+                        teamId = (byte)(Rnd.get(3));
                else
                        teamId = (byte)(_teams[0].getParticipatedPlayerCount() > _teams[1].getParticipatedPlayerCount() ? 1 : 0);
+                        teamId = (byte)(_teams[0].getParticipatedPlayerCount() > _teams[2].getParticipatedPlayerCount() ? 1 : 0);
+                        teamId = (byte)(_teams[1].getParticipatedPlayerCount() > _teams[2].getParticipatedPlayerCount() ? 1 : 0);
 
                return _teams[teamId].addPlayer(playerInstance);
        }
@@ -357,6 +362,12 @@
                        if (playerInstance != null)
                                playerInstance.sendMessage(message);
                }
+               
+                for (L2PcInstance playerInstance : _teams[2].getParticipatedPlayers().values())
+                {
+                        if (playerInstance != null)
+                                playerInstance.sendMessage(message);
+                }
        }
 
        /**
@@ -451,11 +462,11 @@
                                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Cursed weapon owners are not allowed to participate.</body></html>");
                        else if (playerInstance.getKarma() > 0)
                                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Chaotic players are not allowed to participate.</body></html>");
-                        else if (_teams[0].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[1].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)
+                        else if (_teams[0].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[1].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[2].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)
                                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Sorry the event is full!</body></html>");
                        else if (playerLevel < Config.TVT_EVENT_MIN_LVL || playerLevel > Config.TVT_EVENT_MAX_LVL)
                                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Only players from level " + Config.TVT_EVENT_MIN_LVL + " to level " + Config.TVT_EVENT_MAX_LVL + " are allowed tro participate.</body></html>");
-                        else if (_teams[0].getParticipatedPlayerCount() > 19 && _teams[1].getParticipatedPlayerCount() > 19)
+                        else if (_teams[0].getParticipatedPlayerCount() > 19 && _teams[1].getParticipatedPlayerCount() > 19 && _teams[2].getParticipatedPlayerCount() > 19)
                                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>The event is full! Maximum of " + Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS + "  player are allowed in one team.</body></html>");
                        else if (addParticipant(playerInstance))
                                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>You are on the registration list now.</body></html>");
@@ -723,7 +734,7 @@
          */
        public static byte getParticipantTeamId(String playerName)
        {
-                return (byte)(_teams[0].containsPlayer(playerName) ? 0 : (_teams[1].containsPlayer(playerName) ? 1 : -1));
+                return (byte)(_teams[0].containsPlayer(playerName) ? 0 : (_teams[1].containsPlayer(playerName) ? 1 : (_teams[2].containsPlayer(playerName) ? 2 : -1)));
        }
 
        /**
@@ -734,7 +745,7 @@
          */
        public static int[] getParticipantTeamCoordinates(String playerName)
        {
-                return _teams[0].containsPlayer(playerName) ? _teams[0].getCoordinates() : (_teams[1].containsPlayer(playerName) ? _teams[1].getCoordinates() : null);
+                return _teams[0].containsPlayer(playerName) ? _teams[0].getCoordinates() : (_teams[1].containsPlayer(playerName) ? _teams[1].getCoordinates() : (_teams[2].containsPlayer(playerName) ? _teams[2].getCoordinates() : null));
        }
 
 
@@ -746,7 +757,7 @@
          */
        public static boolean isPlayerParticipant(String playerName)
        {
-                return _teams[0].containsPlayer(playerName) || _teams[1].containsPlayer(playerName);
+                return _teams[0].containsPlayer(playerName) || _teams[1].containsPlayer(playerName) || _teams[2].containsPlayer(playerName);
        }
 
        /**
@@ -756,7 +767,7 @@
          */
        public static int getParticipatedPlayersCount()
        {
-                return _teams[0].getParticipatedPlayerCount() + _teams[1].getParticipatedPlayerCount();
+                return _teams[0].getParticipatedPlayerCount() + _teams[1].getParticipatedPlayerCount() + _teams[2].getParticipatedPlayerCount();
        }
 
        /**
@@ -766,7 +777,7 @@
          */
        public static String[] getTeamNames()
        {
-                return new String[]{_teams[0].getName(), _teams[1].getName()};
+                return new String[]{_teams[0].getName(), _teams[1].getName(), _teams[2].getName()};
        }
 
        /**
@@ -776,7 +787,7 @@
          */
        public static int[] getTeamsPlayerCounts()
        {
-                return new int[]{_teams[0].getParticipatedPlayerCount(), _teams[1].getParticipatedPlayerCount()};
+                return new int[]{_teams[0].getParticipatedPlayerCount(), _teams[1].getParticipatedPlayerCount(), _teams[2].getParticipatedPlayerCount()};
        }
 
        /**
@@ -786,6 +797,6 @@
          */
        public static int[] getTeamsPoints()
        {
-                return new int[]{_teams[0].getPoints(), _teams[1].getPoints()};
+                return new int[]{_teams[0].getPoints(), _teams[1].getPoints(), _teams[2].getPoints()};
        }
 }
Index: L2_GameServer_It/java/net/sf/l2j/Config.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/Config.java        (revision 1433)
+++ L2_GameServer_It/java/net/sf/l2j/Config.java        (working copy)
@@ -863,6 +863,8 @@
    public static int[] TVT_EVENT_TEAM_1_COORDINATES = new int[3];
    public static String TVT_EVENT_TEAM_2_NAME;
    public static int[] TVT_EVENT_TEAM_2_COORDINATES = new int[3];
+    public static String TVT_EVENT_TEAM_3_NAME;
+    public static int[] TVT_EVENT_TEAM_3_COORDINATES = new int[3];
    public static List<int[]> TVT_EVENT_REWARDS = new FastList<int[]>();
    public static boolean TVT_EVENT_TARGET_TEAM_MEMBERS_ALLOWED;
    public static boolean TVT_EVENT_POTIONS_ALLOWED;
@@ -1887,7 +1889,9 @@
                        TVT_EVENT_START_LEAVE_TELEPORT_DELAY        = Integer.parseInt(L2JModSettings.getProperty("TvTEventStartLeaveTeleportDelay", "20"));
 
                        TVT_EVENT_TEAM_1_NAME                      = L2JModSettings.getProperty("TvTEventTeam1Name", "Team1");
+                        TVT_EVENT_TEAM_2_NAME                      = L2JModSettings.getProperty("TvTEventTeam2Name", "Team2");
                        propertySplit                              = L2JModSettings.getProperty("TvTEventTeam1Coordinates", "0,0,0").split(",");
+                        propertySplit                              = L2JModSettings.getProperty("TvTEventTeam2Coordinates", "0,0,0").split(",");
 
                        if (propertySplit.length < 3)
                        {
@@ -1899,9 +1903,13 @@
                            TVT_EVENT_TEAM_1_COORDINATES[0]    = Integer.parseInt(propertySplit[0]);
                            TVT_EVENT_TEAM_1_COORDINATES[1]    = Integer.parseInt(propertySplit[1]);
                            TVT_EVENT_TEAM_1_COORDINATES[2]    = Integer.parseInt(propertySplit[2]);
+                           
+                            TVT_EVENT_TEAM_2_COORDINATES[0]    = Integer.parseInt(propertySplit[0]);
+                            TVT_EVENT_TEAM_2_COORDINATES[1]    = Integer.parseInt(propertySplit[1]);
+                            TVT_EVENT_TEAM_2_COORDINATES[2]    = Integer.parseInt(propertySplit[2]);
 
-                            TVT_EVENT_TEAM_2_NAME            = L2JModSettings.getProperty("TvTEventTeam2Name", "Team2");
-                            propertySplit                    = L2JModSettings.getProperty("TvTEventTeam2Coordinates", "0,0,0").split(",");
+                            TVT_EVENT_TEAM_3_NAME            = L2JModSettings.getProperty("TvTEventTeam3Name", "Team2");
+                            propertySplit                    = L2JModSettings.getProperty("TvTEventTeam3Coordinates", "0,0,0").split(",");
 
                            if (propertySplit.length < 3)
                            {
@@ -1910,9 +1918,9 @@
                            }
                            else
                            {
-                                TVT_EVENT_TEAM_2_COORDINATES[0]    = Integer.parseInt(propertySplit[0]);
-                                TVT_EVENT_TEAM_2_COORDINATES[1]    = Integer.parseInt(propertySplit[1]);
-                                TVT_EVENT_TEAM_2_COORDINATES[2]    = Integer.parseInt(propertySplit[2]);
+                                TVT_EVENT_TEAM_3_COORDINATES[0]    = Integer.parseInt(propertySplit[0]);
+                                TVT_EVENT_TEAM_3_COORDINATES[1]    = Integer.parseInt(propertySplit[1]);
+                                TVT_EVENT_TEAM_3_COORDINATES[2]    = Integer.parseInt(propertySplit[2]);
                                propertySplit                    = L2JModSettings.getProperty("TvTEventReward", "57,100000").split(";");
 
                                for (String reward : propertySplit)
Index: L2_GameServer_It/java/config/l2jmods.properties
===================================================================
--- L2_GameServer_It/java/config/l2jmods.properties        (revision 1433)
+++ L2_GameServer_It/java/config/l2jmods.properties        (working copy)
@@ -96,38 +96,54 @@
 #---------------------------------------------------------------
 # enable TvTEvent
 TvTEventEnabled = false
+
 # Time Between TvT events (in minutes, 300 = 5 hours)
 TvTEventInterval = 300
+
 #  Registration timer (in minutes) from start of event.
 TvTEventParticipationTime = 60
+
 #  Event running time, in minutes
 TvTEventRunningTime = 20
+
 # TvT Event NPC Details (create a custom npc of type L2TvTEventNpc)
 TvTEventParticipationNpcId = 70010
 TvTEventParticipationNpcCoordinates = 83425,148585,-3406
+
 # Minimum amount of players allowed in each team
 TvTEventMinPlayersInTeams = 1
 TvTEventMaxPlayersInTeams = 20
+
 # Level rules
 TvTEventMinPlayerLevel = 1
 TvTEventMaxPlayerLevel = 80
+
 # Teleport delay Timers (in seconds)
 TvTEventRespawnTeleportDelay = 10
 TvTEventStartLeaveTeleportDelay = 10
+
 # First Team Details (name, start and death x,y,z tp point)
 TvTEventTeam1Name = Team1
 TvTEventTeam1Coordinates = 148695,46725,-3414
+
 # Second Team Details (name, start and death x,y,z tp point)
 TvTEventTeam2Name = Team2
 TvTEventTeam2Coordinates = 149999,46728,-3414
+
+# Third Team Details (name, start and death x,y,z tp point)
+TvTEventTeam3Name = Team3
+TvTEventTeam3Coordinates = 149999,46730,-3414
+
 # Reward for winning team
 # itemId,amount;itemId,amount;itemId,amount;...
 # no ";" at the start or end
 TvTEventReward = 57,100000;5575,1000
+
 # TvTEvent Rules
 TvTEventTargetTeamMembersAllowed = true
 TvTEventPotionsAllowed = false
 TvTEventSummonByItemAllowed = false
+
 # Door id's to close/open on start/end
 # ex.: 1;2;3;4;5;6
 # no ";" at the start or end

Index: L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java        (revision 1433)
+++ L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java        (working copy)
@@ -68,6 +68,8 @@
                                npcHtmlMessage.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
                                npcHtmlMessage.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
                                npcHtmlMessage.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
+                                npcHtmlMessage.replace("%team3name%", Config.TVT_EVENT_TEAM_3_NAME);
+                                npcHtmlMessage.replace("%team3playercount%", String.valueOf(teamsPlayerCounts[2]));
                            playerInstance.sendPacket(npcHtmlMessage);
                    }
                }
@@ -89,7 +91,10 @@
                                npcHtmlMessage.replace("%team1points%", String.valueOf(teamsPointsCounts[0]));
                                npcHtmlMessage.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
                                npcHtmlMessage.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
-                                npcHtmlMessage.replace("%team2points%", String.valueOf(teamsPointsCounts[1])); // <---- array index from 0 to 1 thx DaRkRaGe
+                                npcHtmlMessage.replace("%team2points%", String.valueOf(teamsPointsCounts[1]));
+                                npcHtmlMessage.replace("%team3name%", Config.TVT_EVENT_TEAM_3_NAME);
+                                npcHtmlMessage.replace("%team3playercount%", String.valueOf(teamsPlayerCounts[2]));
+                                npcHtmlMessage.replace("%team3points%", String.valueOf(teamsPointsCounts[2]));
                            playerInstance.sendPacket(npcHtmlMessage);
                    }
                }

Index: Data/data/html/mods/TvTEventParticipation.htm
===================================================================
--- Data/data/html/mods/TvTEventParticipation.htm        (revision 680)
+++ Data/data/html/mods/TvTEventParticipation.htm        (working copy)
@@ -1,7 +1,8 @@
 <html><title>TvT Event</title><body>
 Registration for TvT Event:<br><br><center>
 %team1name%&nbsp;&nbsp;&nbsp;&nbsp;(%team1playercount% players in)<br1>
-%team2name%&nbsp;&nbsp;&nbsp;&nbsp;(%team2playercount% players in)<br>
+%team2name%&nbsp;&nbsp;&nbsp;&nbsp;(%team2playercount% players in)<br1>
+%team3name%&nbsp;&nbsp;&nbsp;&nbsp;(%team3playercount% players in)<br>
 <button value="Participate" action="bypass -h npc_%objectId%_tvt_event_participation" width=50 height=15 back="sek.cbui94" fore="sek.cbui92">
 <button value="Close" action="bypass -h npc_%objectId%_Close" width=50 height=15 back="sek.cbui94" fore="sek.cbui92">
 </center></body></html>
Index: Data/data/html/mods/TvTEventStatus.htm
===================================================================
--- Data/data/html/mods/TvTEventStatus.htm        (revision 680)
+++ Data/data/html/mods/TvTEventStatus.htm        (working copy)
@@ -1,5 +1,6 @@
 <html><title>TvT Event</title><body>
 Status:<br><br><center>
 %team1name% with %team1playercount% players and %team1points% points.<br1>
-%team2name% with %team2playercount% players and %team2points% points.<br>
+%team2name% with %team2playercount% players and %team2points% points.<br1>
+%team3name% with %team3playercount% players and %team3points% points.<br>
 </center></body></html>


Lorde 16-06-2010 03:15 PM

como assim triple tvt ?? 3 times ????

Optus 17-06-2010 04:14 AM

Isso 3 times!

Mazokista 18-06-2010 05:50 PM

Muito Massa Ja Vi esse Mod Sao 3Time
Um Rosa Azul e Vermelho Vlw Por Compartilhar

vicfelipe 18-06-2010 05:55 PM

Se o TvT fosse configurável pela DB era só adicionar o 3º time na tabela "tvt", mas como é pela config por isso precisa ter essa modificação no java.
Obrigado por compartilhar com a SE.

Donator 06-01-2012 10:56 PM

mejor pone semi - deathmatch xD

OliverSykes 07-01-2012 06:48 PM

Amigo cuidado com posta agradecimentos basta apenas clicka no botão Obrigado encontrado no topico abaixo dele !


Horários baseados na GMT -3. Agora são 04:26 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0