Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P datapack_development
- Index: data/html/mods/partycontrol/general.htm
- ===================================================================
- --- data/html/mods/partycontrol/general.htm (revision 0)
- +++ data/html/mods/partycontrol/general.htm (revision 0)
- @@ -0,0 +1,8 @@
- +<html><body>
- +<center>
- +Party control general options.<br>
- +<a action="bypass -h partycontrol 3">Recall party members.</a><br1>
- +<a action="bypass -h partycontrol 0 general_teleport.htm">Teleport party members.</a><br>
- +<a action="bypass -h partycontrol 0 main.htm">Back.</a>
- +</center>
- +</body></html>
- \ No newline at end of file
- Index: data/html/mods/partycontrol/general_teleport.htm
- ===================================================================
- --- data/html/mods/partycontrol/general_teleport.htm (revision 0)
- +++ data/html/mods/partycontrol/general_teleport.htm (revision 0)
- @@ -0,0 +1,7 @@
- +<html><body>
- +<center>
- +Party control general options. Teleport.<br>
- +<a action="bypass -h partycontrol 4 -71602 258087 -3128">Humans' starting location.</a><br>
- +<a action="bypass -h partycontrol 0 general.htm">Back.</a>
- +</center>
- +</body></html>
- \ No newline at end of file
- Index: data/html/mods/partycontrol/pvpparties.htm
- ===================================================================
- --- data/html/mods/partycontrol/pvpparties.htm (revision 0)
- +++ data/html/mods/partycontrol/pvpparties.htm (revision 0)
- @@ -0,0 +1,6 @@
- +<html><body>
- +<center>
- +Pvp parties:<br>
- +%pvpparties%
- +</center>
- +</body></html>
- \ No newline at end of file
- Index: data/html/mods/partycontrol/pvpmode.htm
- ===================================================================
- --- data/html/mods/partycontrol/pvpmode.htm (revision 0)
- +++ data/html/mods/partycontrol/pvpmode.htm (revision 0)
- @@ -0,0 +1,10 @@
- +<html><body>
- +<center>
- +Party control pvp mode options.<br>
- +<a action="bypass -h partycontrol 1">Set party in pvp mode.</a><br1>
- +<a action="bypass -h partycontrol 2">Remove party from pvp mode.</a><br>
- +<edit var="box" width=80 height=15><br1>
- +<a action="bypass -h partycontrol 5 $box">Set party main assister.</a>
- +<a action="bypass -h partycontrol 0 main.htm">Back.</a>
- +</center>
- +</body></html>
- \ No newline at end of file
- Index: data/html/mods/partycontrol/readme.txt
- ===================================================================
- --- data/html/mods/partycontrol/readme.txt (revision 0)
- +++ data/html/mods/partycontrol/readme.txt (revision 0)
- @@ -0,0 +1,13 @@
- +These are the following actions which you can use on bypasses:
- +
- +- 0. It is followed by a html, it just redirects the player to the specified html. Example: bypass -h partycontrol 0 main.htm.
- +- 1. It sets the party in pvp mode. Example: bypass -h partycontrol 1.
- +- 2. It removes the party from pvp mode. Example: bypass -h partycontrol 2.
- +- 3. It teleports all the party members to the clan leader. Example: bypass -h partycontrol 3.
- +- 4. It teleports all the party members to the selection location. Example: bypass -h partycontrol 4 -71602 258087 -3128.
- +- 5. It sets the party's main assister. Example: bypass -h partycontrol 5 Anarchy.
- +
- +Please note that if you disable a feature from the configs, you have to remove the bypass from htmls too because they are not
- +hard-coded.
- +
- +By Anarchy.
- \ No newline at end of file
- Index: data/html/mods/partycontrol/main.htm
- ===================================================================
- --- data/html/mods/partycontrol/main.htm (revision 0)
- +++ data/html/mods/partycontrol/main.htm (revision 0)
- @@ -0,0 +1,7 @@
- +<html><body>
- +<center>
- +Party control options.<br>
- +<a action="bypass -h partycontrol 0 pvpmode.htm">Pvp mode options.</a><br1>
- +<a action="bypass -h partycontrol 0 general.htm">General options.</a>
- +</center>
- +</body></html>
- \ No newline at end of file
- #P L2_GameServer_It
- Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/PartyControlVC.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/PartyControlVC.java (revision 0)
- +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/PartyControlVC.java (revision 0)
- @@ -0,0 +1,101 @@
- +/*
- + * 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.model.L2Object;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.entity.PartyControl;
- +import net.sf.l2j.gameserver.serverpackets.GMViewItemList;
- +/**
- + * @author Anarchy
- + *
- + */
- +public class PartyControlVC implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS = { "partycontrol", "showpvpparties", "viewinventory" };
- +
- + @Override
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
- + {
- + if (command.equals("partycontrol"))
- + {
- + if (activeChar.getParty() == null)
- + {
- + activeChar.sendMessage("You are not in a party.");
- + return false;
- + }
- +
- + if (activeChar.getParty().getLeader() != activeChar)
- + {
- + activeChar.sendMessage("Only your party leader can control your party.");
- + return false;
- + }
- +
- + PartyControl.showPartyControlWindow(activeChar);
- + }
- +
- + if (command.equals("showpvpparties"))
- + {
- + if (Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PVP_PARTIES_COMMAND)
- + {
- + PartyControl.showPvpPartiesWindow(activeChar);
- + }
- + }
- +
- + if (command.equals("viewinventory"))
- + {
- + if (!Config.ALLOW_VIEW_INVENTORY_COMMAND)
- + {
- + return false;
- + }
- +
- + L2Object obj = activeChar.getTarget();
- + if (obj == null)
- + {
- + activeChar.sendMessage("You need to target a party member to use this.");
- + return false;
- + }
- + if (!(obj instanceof L2PcInstance))
- + {
- + activeChar.sendMessage("You need to target a party member to use this.");
- + return false;
- + }
- +
- + L2PcInstance trg = (L2PcInstance)obj;
- + if (activeChar.getParty() == null)
- + {
- + activeChar.sendMessage("You need to target a party member to use this.");
- + return false;
- + }
- + if (!activeChar.getParty().getPartyMembers().contains(trg))
- + {
- + activeChar.sendMessage("You need to target a party member to use this.");
- + return false;
- + }
- +
- + activeChar.sendPacket(new GMViewItemList(trg));
- + }
- +
- + return true;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5388)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -52,6 +52,7 @@
- import net.sf.l2j.gameserver.ai.L2PlayerAI;
- import net.sf.l2j.gameserver.cache.HtmCache;
- import net.sf.l2j.gameserver.cache.WarehouseCacheManager;
- +import net.sf.l2j.gameserver.clientpackets.Say2;
- import net.sf.l2j.gameserver.communitybbs.BB.Forum;
- import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
- import net.sf.l2j.gameserver.datatables.CharTemplateTable;
- @@ -138,6 +139,7 @@
- import net.sf.l2j.gameserver.serverpackets.ChangeWaitType;
- import net.sf.l2j.gameserver.serverpackets.CharInfo;
- import net.sf.l2j.gameserver.serverpackets.ConfirmDlg;
- +import net.sf.l2j.gameserver.serverpackets.CreatureSay;
- import net.sf.l2j.gameserver.serverpackets.EtcStatusUpdate;
- import net.sf.l2j.gameserver.serverpackets.ExAutoSoulShot;
- import net.sf.l2j.gameserver.serverpackets.ExDuelUpdateUserInfo;
- @@ -310,6 +312,42 @@
- cubic.doAction(target);
- }
- }
- +
- + if (target instanceof L2PcInstance)
- + {
- + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_MAIN_ASSISTER && getPlayer().getParty() != null && getPlayer().getParty().isInPvpMode() && getPlayer().getParty().getMainAssister() == getPlayer() && !getPlayer().getParty().getPartyMembers().contains(target))
- + {
- + if (Config.ALLOW_AUTO_TARGET_ASSISTER)
- + {
- + for (L2PcInstance p : getPlayer().getParty().getPartyMembers())
- + {
- + if (Config.AUTO_TARGET_DISALLOWED_CLASSES.contains(p.getClassId().getId()))
- + {
- + continue;
- + }
- +
- + if (p.isInsideRadius(getPlayer().getX(), getPlayer().getY(), 5000, false) && p.getTarget() != target)
- + {
- + p.setTarget(target);
- + p.sendPacket(new ActionFailed());
- + }
- + }
- + }
- +
- + if (Config.ALLOW_ASSISTER_TARGET_MESSAGE)
- + {
- + CreatureSay cs = new CreatureSay(getPlayer().getObjectId(), Say2.TELL, getPlayer().getName(), "ASSIST ME > "+target.getName());
- +
- + for (L2PcInstance p : getPlayer().getParty().getPartyMembers())
- + {
- + if (p != getPlayer() && p.getTarget() != target)
- + {
- + p.sendPacket(cs);
- + }
- + }
- + }
- + }
- + }
- }
- @Override
- Index: java/net/sf/l2j/gameserver/model/L2Party.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Party.java (revision 5388)
- +++ java/net/sf/l2j/gameserver/model/L2Party.java (working copy)
- @@ -51,6 +51,7 @@
- */
- public class L2Party
- {
- + public static FastList<L2Party> _allParties = new FastList<L2Party>();
- private static final double[] BONUS_EXP_SP = {1, 1.30, 1.39, 1.50, 1.54, 1.58, 1.63, 1.67, 1.71};
- private List<L2PcInstance> _members = null;
- private int _pendingInvitation = 0; // Number of players that already have been invited (but not replied yet)
- @@ -58,6 +59,8 @@
- private int _itemDistribution = 0;
- private int _itemLastLoot = 0;
- private L2CommandChannel _commandChannel = null;
- + private boolean _pvpMode = false;
- + private L2PcInstance _mainAssister = null;
- private DimensionalRift _dr;
- @@ -77,6 +80,10 @@
- _itemDistribution = itemDistribution;
- getPartyMembers().add(leader);
- _partyLvl = leader.getLevel();
- + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE)
- + {
- + _allParties.add(this);
- + }
- }
- /**
- @@ -250,6 +257,19 @@
- {
- _partyLvl = player.getLevel();
- }
- +
- + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
- + {
- + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
- + {
- + player.getAppearance().setNameColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
- + }
- + else
- + {
- + player.getAppearance().setTitleColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
- + }
- + player.broadcastUserInfo();
- + }
- // update partySpelled
- for(L2PcInstance member : getPartyMembers())
- @@ -269,7 +289,25 @@
- {
- getPartyMembers().remove(player);
- recalculatePartyLevel();
- +
- + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
- + {
- + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
- + {
- + player.getAppearance().setNameColor(0xFFFFFF);
- + }
- + else
- + {
- + player.getAppearance().setTitleColor(0xFFFFFF);
- + }
- + player.broadcastUserInfo();
- + }
- + if (getMainAssister() == player)
- + {
- + setMainAssister(null);
- + }
- +
- if (player.isFestivalParticipant())
- SevenSignsFestival.getInstance().updateParticipants(player, this);
- @@ -292,6 +330,10 @@
- if (getPartyMembers().size() == 1)
- {
- getLeader().setParty(null);
- + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE)
- + {
- + _allParties.remove(this);
- + }
- if (getLeader().isInDuel())
- DuelManager.getInstance().onRemoveFromParty(getLeader());
- }
- @@ -757,4 +799,24 @@
- public DimensionalRift getDimensionalRift() { return _dr; }
- public L2PcInstance getLeader() { return getPartyMembers().get(0); }
- +
- + public boolean isInPvpMode()
- + {
- + return _pvpMode;
- + }
- +
- + public void setIsInPvpMode(boolean val)
- + {
- + _pvpMode = val;
- + }
- +
- + public L2PcInstance getMainAssister()
- + {
- + return _mainAssister;
- + }
- +
- + public void setMainAssister(L2PcInstance val)
- + {
- + _mainAssister = val;
- + }
- }
- Index: java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 5388)
- +++ java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy)
- @@ -18,6 +18,7 @@
- */
- package net.sf.l2j.gameserver.clientpackets;
- +import java.util.StringTokenizer;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- @@ -32,6 +33,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.entity.L2Event;
- +import net.sf.l2j.gameserver.model.entity.PartyControl;
- import net.sf.l2j.gameserver.serverpackets.ActionFailed;
- import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
- @@ -159,6 +161,19 @@
- else
- player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
- }
- + else if (_command.startsWith("partycontrol"))
- + {
- + if (!PartyControl.canContinue(activeChar))
- + {
- + return;
- + }
- +
- + StringTokenizer st = new StringTokenizer(_command.substring(13));
- + String action_string = st.nextToken();
- + int action = Integer.valueOf(action_string);
- +
- + PartyControl.handleBypassAction(activeChar, action, st);
- + }
- }
- catch (Exception e)
- {
- Index: java/net/sf/l2j/gameserver/clientpackets/Say2.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/clientpackets/Say2.java (revision 5388)
- +++ java/net/sf/l2j/gameserver/clientpackets/Say2.java (working copy)
- @@ -30,6 +30,7 @@
- import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
- import net.sf.l2j.gameserver.instancemanager.PetitionManager;
- import net.sf.l2j.gameserver.model.BlockList;
- +import net.sf.l2j.gameserver.model.L2Party;
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- @@ -233,6 +234,44 @@
- }
- break;
- case ALL:
- + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_LEADER_CHANNEL && _text.startsWith(Config.PARTY_LEADER_CHANNEL_PREFIX))
- + {
- + if (activeChar.getParty() == null)
- + {
- + activeChar.sendMessage("You are not in a party.");
- + return;
- + }
- + if (activeChar.getParty().getLeader() != activeChar)
- + {
- + activeChar.sendMessage("Only your party leader can talk on parties leaders' channel.");
- + return;
- + }
- + if (!activeChar.getParty().isInPvpMode())
- + {
- + activeChar.sendMessage("Your party is not in pvp mode.");
- + return;
- + }
- +
- + CreatureSay crs = new CreatureSay(activeChar.getObjectId(), Config.PARTY_LEADER_CHANNEL_TYPE, activeChar.getName(), _text.substring(1));
- +
- + for (L2Party party : L2Party._allParties)
- + {
- + if (Config.PARTY_LEADER_CHANNEL_VIEWABLE)
- + {
- + for (L2PcInstance p : party.getPartyMembers())
- + {
- + p.sendPacket(crs);
- + }
- + }
- + else
- + {
- + party.getLeader().sendPacket(crs);
- + }
- + }
- +
- + return;
- + }
- +
- if (_text.startsWith("."))
- {
- StringTokenizer st = new StringTokenizer(_text);
- Index: java/net/sf/l2j/gameserver/model/entity/PartyControl.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/entity/PartyControl.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/entity/PartyControl.java (revision 0)
- @@ -0,0 +1,351 @@
- +/*
- + * 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 net.sf.l2j.gameserver.model.entity;
- +
- +import java.util.StringTokenizer;
- +
- +import javolution.util.FastMap;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.datatables.MapRegionTable;
- +import net.sf.l2j.gameserver.model.L2Party;
- +import net.sf.l2j.gameserver.model.L2World;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
- +/**
- + * @author Anarchy
- + *
- + */
- +public class PartyControl
- +{
- + public static boolean canContinue(L2PcInstance p)
- + {
- + if (p.getParty() == null)
- + {
- + p.sendMessage("You are not in a party.");
- + return false;
- + }
- +
- + if (p.getParty().getLeader() != p)
- + {
- + p.sendMessage("Only your party leader can control your party.");
- + return false;
- + }
- +
- + return true;
- + }
- +
- + public static void handleBypassAction(L2PcInstance p, int action, StringTokenizer st)
- + {
- + switch (action)
- + {
- + case 0:
- + {
- + NpcHtmlMessage htm = new NpcHtmlMessage(0);
- + htm.setFile("./data/html/mods/partycontrol/"+st.nextToken());
- +
- + p.sendPacket(htm);
- +
- + break;
- + }
- + case 1:
- + {
- + if (!Config.ALLOW_PARTY_PVP_MODE)
- + {
- + p.sendMessage("This option is disabled by the admin.");
- + return;
- + }
- +
- + if (p.getParty().isInPvpMode())
- + {
- + p.sendMessage("Your party is already in pvp mode.");
- + return;
- + }
- +
- + p.getParty().setIsInPvpMode(true);
- + for (L2PcInstance pl : p.getParty().getPartyMembers())
- + {
- + if (Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
- + {
- + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
- + {
- + pl.getAppearance().setNameColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
- + }
- + else
- + {
- + pl.getAppearance().setTitleColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
- + }
- + pl.broadcastUserInfo();
- + }
- + pl.sendMessage("Your party is now in pvp mode.");
- + }
- +
- + break;
- + }
- + case 2:
- + {
- + if (!Config.ALLOW_PARTY_PVP_MODE)
- + {
- + p.sendMessage("This option is disabled by the admin.");
- + return;
- + }
- +
- + if (!p.getParty().isInPvpMode())
- + {
- + p.sendMessage("Your party is not in pvp mode.");
- + return;
- + }
- +
- + p.getParty().setIsInPvpMode(false);
- + for (L2PcInstance pl : p.getParty().getPartyMembers())
- + {
- + if (Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
- + {
- + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
- + {
- + pl.getAppearance().setNameColor(0xFFFFFF);
- + }
- + else
- + {
- + pl.getAppearance().setTitleColor(0xFFFFFF);
- + }
- + pl.broadcastUserInfo();
- + }
- + pl.sendMessage("Your party is now out of pvp mode.");
- + }
- +
- + break;
- + }
- + case 3:
- + {
- + if (!Config.ALLOW_RECALL_PARTY_MEMBERS)
- + {
- + p.sendMessage("This option is disabled by the admin.");
- + return;
- + }
- +
- + if (p.getKarma() > 0)
- + {
- + p.sendMessage("You can't recall your party members while you have karma.");
- + return;
- + }
- +
- + for (L2PcInstance pl : p.getParty().getPartyMembers())
- + {
- + if (pl == p || pl.isIn7sDungeon() || pl.isInOlympiadMode())
- + {
- + continue;
- + }
- + if (pl.getKarma() > 0)
- + {
- + p.sendMessage(pl.getName()+" has not been recalled because he has karma.");
- + continue;
- + }
- + if (pl.getPvpFlag() > 0)
- + {
- + p.sendMessage(pl.getName()+" has not been recalled because he is flagged.");
- + continue;
- + }
- +
- + pl.teleToLocation(p.getX(), p.getY(), p.getZ(), true);
- + if (pl != p)
- + {
- + pl.sendMessage("You have been recalled by your party leader.");
- + }
- + else
- + {
- + pl.sendMessage("You have recalled your party members.");
- + }
- + }
- +
- + break;
- + }
- + case 4:
- + {
- + if (!Config.ALLOW_TELEPORT_PARTY_MEMBERS)
- + {
- + p.sendMessage("This option is disabled by the admin.");
- + return;
- + }
- +
- + if (p.getKarma() > 0)
- + {
- + p.sendMessage("You can't teleport your party members while you have karma.");
- + return;
- + }
- + if (p.getPvpFlag() > 0)
- + {
- + p.sendMessage("You can't teleport your party members while you are flagged.");
- + return;
- + }
- + if (p.isIn7sDungeon() || p.isInOlympiadMode())
- + {
- + p.sendMessage("You can't teleport your party members while you are in an event.");
- + return;
- + }
- +
- + int[] xyz = new int[3];
- + xyz[0] = Integer.valueOf(st.nextToken());
- + xyz[1] = Integer.valueOf(st.nextToken());
- + xyz[2] = Integer.valueOf(st.nextToken());
- +
- + for (L2PcInstance pl : p.getParty().getPartyMembers())
- + {
- + if ((pl.isIn7sDungeon() || pl.isInOlympiadMode()) && pl != p)
- + {
- + continue;
- + }
- + if (pl.getKarma() > 0 && pl != p)
- + {
- + p.sendMessage(pl.getName()+" has not been teleported because he has karma.");
- + continue;
- + }
- + if (pl.getPvpFlag() > 0 && pl != p)
- + {
- + p.sendMessage(pl.getName()+" has not been teleported because he is flagged.");
- + continue;
- + }
- +
- + pl.teleToLocation(xyz[0], xyz[1], xyz[2], true);
- + if (pl != p)
- + {
- + pl.sendMessage("You have been teleported by your party leader.");
- + }
- + else
- + {
- + pl.sendMessage("You have teleported your party members.");
- + }
- + }
- +
- + break;
- + }
- + case 5:
- + {
- + if (!Config.ALLOW_PARTY_MAIN_ASSISTER)
- + {
- + p.sendMessage("This option is disabled by the admin.");
- + return;
- + }
- +
- + if (!p.getParty().isInPvpMode())
- + {
- + p.sendMessage("Your party needs to be in pvp mode to set the main assister.");
- + return;
- + }
- +
- + String plname = st.nextToken();
- + L2PcInstance pl = L2World.getInstance().getPlayer(plname);
- +
- + if (pl == null)
- + {
- + p.sendMessage("The character you have selected doesn't exist or isn't online.");
- + return;
- + }
- + if (!p.getParty().getPartyMembers().contains(pl))
- + {
- + p.sendMessage("The character you have selected isn't a party member of yours.");
- + return;
- + }
- +
- + p.getParty().setMainAssister(pl);
- + for (L2PcInstance pla : p.getParty().getPartyMembers())
- + {
- + if (pl == pla)
- + {
- + pl.sendMessage("You are now the party's main assister.");
- + continue;
- + }
- +
- + pla.sendMessage(plname+" is now the party's main assister.");
- + }
- +
- + break;
- + }
- + }
- + }
- +
- + public static void showPartyControlWindow(L2PcInstance p)
- + {
- + NpcHtmlMessage htm = new NpcHtmlMessage(0);
- + htm.setFile("./data/html/mods/partycontrol/main.htm");
- +
- + p.sendPacket(htm);
- + }
- +
- + public static void showPvpPartiesWindow(L2PcInstance p)
- + {
- + NpcHtmlMessage htm = new NpcHtmlMessage(0);
- + htm.setFile("./data/html/mods/partycontrol/pvpparties.htm");
- + htm.replace("%pvpparties%", getPvpParties(p));
- +
- + p.sendPacket(htm);
- + }
- +
- + private static String getPvpParties(L2PcInstance p)
- + {
- + String pvpparties = "";
- + int i = 0;
- + for (L2Party party : L2Party._allParties)
- + {
- + if (party.isInPvpMode())
- + {
- + pvpparties += "Leader: <font color=\"LEVEL\">"+party.getLeader().getName()+"</font> Members: <font color=\"LEVEL\">"+party.getMemberCount()+"</font> Near: <font color=\"LEVEL\">"+getNearestTown(p)+"</font><br1>";
- + i++;
- + }
- + }
- + if (i == 0)
- + {
- + pvpparties = "There are not pvp parties.";
- + }
- + else
- + {
- + pvpparties += "<br>A total of "+i+" pvp part"+(i == 1 ? "y." : "ies.");
- + }
- +
- + return pvpparties;
- + }
- +
- + private static String getNearestTown(L2PcInstance p)
- + {
- + FastMap<String, Integer> results = new FastMap<String, Integer>();
- + for (L2PcInstance pl : p.getParty().getPartyMembers())
- + {
- + String areaname = MapRegionTable.getInstance().getClosestTownName(pl);
- + if (results.containsKey(areaname))
- + {
- + int currvotes = results.get(areaname);
- + results.remove(areaname);
- + results.put(areaname, currvotes++);
- + }
- + else
- + {
- + results.put(areaname, 1);
- + }
- + }
- +
- + String result = null;
- + int resultnum = 0;
- + for (String s : results.keySet())
- + {
- + if (results.get(s) > resultnum)
- + {
- + result = s;
- + resultnum = results.get(s);
- + }
- + }
- +
- + return result;
- + }
- +}
- Index: java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/GameServer.java (revision 5388)
- +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -201,6 +201,7 @@
- import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
- import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
- import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
- +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.PartyControlVC;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
- import net.sf.l2j.gameserver.idfactory.IdFactory;
- @@ -595,6 +596,11 @@
- if(Config.L2JMOD_ALLOW_WEDDING)
- _voicedCommandHandler.registerVoicedCommandHandler(new Wedding());
- +
- + if (Config.ALLOW_PARTY_CONTROL)
- + {
- + _voicedCommandHandler.registerVoicedCommandHandler(new PartyControlVC());
- + }
- _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");
- Index: java/config/partycontrol.properties
- ===================================================================
- --- java/config/partycontrol.properties (revision 0)
- +++ java/config/partycontrol.properties (revision 0)
- @@ -0,0 +1,53 @@
- +# Party control configurations.
- +# By Anarchy.
- +# Note: Check readme.txt in data/html/mods/partycontrol/ for hints.
- +
- +# Enable party control.
- +AllowPartyControl = True
- +
- +# Enable parties pvp mode.
- +AllowPartyPvpMode = True
- +
- +# Enable .showpvpparties command.
- +# Note: If you disable it, you should remove the bypasses from the html too.
- +AllowPvpPartiesCommand = True
- +
- +# Enable recall party members option.
- +# Note: If you disable it, you should remove the bypasses from the html too.
- +AllowRecallPartyMembers = True
- +
- +# Enable teleport party members option.
- +# Note: If you disable it, you should remove the bypasses from the html too.
- +# Note: If you enable it, you need to set your locations in general_teleport.htm too.
- +AllowTeleportPartyMembers = True
- +
- +# Enable party members name/title color while in pvp mode.
- +AllowPartyMembersPvpModeColor = True
- +# Title/Name color.
- +# Options: NAME, TITLE.
- +PartyMembersPvpModeColorMode = NAME
- +# Color. Default: Light blue(FFFF00).
- +PartyMembersPvpModeColor = FFFF00
- +
- +# Enable .viewinventory command.
- +AllowViewInventoryCommand = True
- +
- +# Enable parties main assister.
- +AllowPartyMainAssister = True
- +# Enable automatically targeting the main assister's target, on main assister's attack.
- +AllowAutoTargetAssister = True
- +# Classes that will not target the main assister's target, on main assister's attack. Example: 92,93,94. Default: Cardinal(97).
- +AutoTargetDisallowedClasses = 97
- +# Enable message to all party members who is the assister's target.
- +AllowAssisterTargetMessage = True
- +
- +# Enable parties leaders' channel.
- +AllowPartyLeaderChannel = True
- +# Parties leaders' channel prefix. For example, they will type (prefix)blabla to talk.
- +# Note: Do not use existing ones(#,@,!,$ etc).
- +PartyLeaderChannelPrefix = ~
- +# Parties leaders' channel type.
- +# Note: If you don't know what this is, don't touch it.
- +PartyLeaderChannelType = 15
- +# Parties leaders' channel viewable by all party members.
- +PartyLeaderChannelViewable = True
- \ No newline at end of file
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 5388)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -712,6 +712,7 @@
- public static final String SEVENSIGNS_FILE = "./config/sevensigns.properties";
- public static final String CLANHALL_CONFIG_FILE = "./config/clanhall.properties";
- public static final String L2JMOD_CONFIG_FILE = "./config/l2jmods.properties";
- + public static final String PARTYCONTROL_CONFIG_FILE = "./config/partycontrol.properties";
- public static int MAX_ITEM_IN_PACKET;
- public static boolean CHECK_KNOWN;
- @@ -1163,7 +1164,27 @@
- /** Alt Settings for devs */
- public static boolean ALT_DEV_NO_QUESTS;
- public static boolean ALT_DEV_NO_SPAWNS;
- -
- +
- +
- + // .partycontrol configs.
- + public static boolean ALLOW_PARTY_CONTROL;
- + public static boolean ALLOW_PARTY_PVP_MODE;
- + public static boolean ALLOW_PVP_PARTIES_COMMAND;
- + public static boolean ALLOW_RECALL_PARTY_MEMBERS;
- + public static boolean ALLOW_TELEPORT_PARTY_MEMBERS;
- + public static boolean ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR;
- + public static String PARTY_MEMBERS_PVP_MODE_COLOR_MODE;
- + public static int PARTY_MEMBERS_PVP_MODE_COLOR;
- + public static boolean ALLOW_VIEW_INVENTORY_COMMAND;
- + public static boolean ALLOW_PARTY_MAIN_ASSISTER;
- + public static boolean ALLOW_AUTO_TARGET_ASSISTER;
- + public static FastList<Integer> AUTO_TARGET_DISALLOWED_CLASSES = new FastList<Integer>();
- + public static boolean ALLOW_ASSISTER_TARGET_MESSAGE;
- + public static boolean ALLOW_PARTY_LEADER_CHANNEL;
- + public static String PARTY_LEADER_CHANNEL_PREFIX;
- + public static int PARTY_LEADER_CHANNEL_TYPE;
- + public static boolean PARTY_LEADER_CHANNEL_VIEWABLE;
- +
- /**
- * This class initializes all global variables for configuration.<br>
- @@ -2084,6 +2105,45 @@
- {
- _log.warning("Could not load HexID file ("+HEXID_FILE+"). Hopefully login will give us one.");
- }
- +
- + try
- + {
- + Properties partycontrol = new Properties();
- + InputStream is = new FileInputStream(new File(PARTYCONTROL_CONFIG_FILE));
- + partycontrol.load(is);
- + is.close();
- +
- + ALLOW_PARTY_CONTROL = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyControl", "false"));
- + ALLOW_PARTY_PVP_MODE = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyPvpMode", "false"));
- + ALLOW_PVP_PARTIES_COMMAND = Boolean.parseBoolean(partycontrol.getProperty("AllowPvpPartiesCommand", "false"));
- + ALLOW_RECALL_PARTY_MEMBERS = Boolean.parseBoolean(partycontrol.getProperty("AllowRecallPartyMembers", "false"));
- + ALLOW_TELEPORT_PARTY_MEMBERS = Boolean.parseBoolean(partycontrol.getProperty("AllowTeleportPartyMembers", "false"));
- + ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyMembersPvpModeColor", "false"));
- + PARTY_MEMBERS_PVP_MODE_COLOR_MODE = partycontrol.getProperty("PartyMembersPvpModeColorMode", "NAME");
- + if (!PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME") && !PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("TITLE"))
- + {
- + PARTY_MEMBERS_PVP_MODE_COLOR_MODE = "NAME";
- + }
- + PARTY_MEMBERS_PVP_MODE_COLOR = Integer.decode("0x"+partycontrol.getProperty("PartyMembersPvpModeColor", "FFFF00"));
- + ALLOW_VIEW_INVENTORY_COMMAND = Boolean.parseBoolean(partycontrol.getProperty("AllowViewInventoryCommand", "false"));
- + ALLOW_PARTY_MAIN_ASSISTER = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyMainAssister", "false"));
- + ALLOW_AUTO_TARGET_ASSISTER = Boolean.parseBoolean(partycontrol.getProperty("AllowAutoTargetAssister", "false"));
- + String auto_target_disallowed_classes = partycontrol.getProperty("AutoTargetDisallowedClasses", "97");
- + String[] atdc_splitted = auto_target_disallowed_classes.split(",");
- + for (String s : atdc_splitted)
- + {
- + AUTO_TARGET_DISALLOWED_CLASSES.add(Integer.valueOf(s));
- + }
- + ALLOW_ASSISTER_TARGET_MESSAGE = Boolean.parseBoolean(partycontrol.getProperty("AllowAssisterTargetMessage", "false"));
- + ALLOW_PARTY_LEADER_CHANNEL = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyLeaderChannel", "false"));
- + PARTY_LEADER_CHANNEL_PREFIX = partycontrol.getProperty("PartyLeaderChannelPrefix", "~");
- + PARTY_LEADER_CHANNEL_TYPE = Integer.parseInt(partycontrol.getProperty("PartyLeaderChannelType", "15"));
- + PARTY_LEADER_CHANNEL_VIEWABLE = Boolean.parseBoolean(partycontrol.getProperty("PartyLeaderChannelViewable", "false"));
- + }
- + catch (Exception e)
- + {
- + _log.warning("Could not load HexID file ("+HEXID_FILE+"). Hopefully login will give us one.");
- + }
- }
- else if(Server.serverMode == Server.MODE_LOGINSERVER)
- {
Advertisement
Add Comment
Please, Sign In to add comment