Guest User

Party control V3

a guest
Jun 2nd, 2012
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.22 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P datapack_development
  3. Index: data/html/mods/partycontrol/general.htm
  4. ===================================================================
  5. --- data/html/mods/partycontrol/general.htm (revision 0)
  6. +++ data/html/mods/partycontrol/general.htm (revision 0)
  7. @@ -0,0 +1,8 @@
  8. +<html><body>
  9. +<center>
  10. +Party control general options.<br>
  11. +<a action="bypass -h partycontrol 3">Recall party members.</a><br1>
  12. +<a action="bypass -h partycontrol 0 general_teleport.htm">Teleport party members.</a><br>
  13. +<a action="bypass -h partycontrol 0 main.htm">Back.</a>
  14. +</center>
  15. +</body></html>
  16. \ No newline at end of file
  17. Index: data/html/mods/partycontrol/general_teleport.htm
  18. ===================================================================
  19. --- data/html/mods/partycontrol/general_teleport.htm (revision 0)
  20. +++ data/html/mods/partycontrol/general_teleport.htm (revision 0)
  21. @@ -0,0 +1,7 @@
  22. +<html><body>
  23. +<center>
  24. +Party control general options. Teleport.<br>
  25. +<a action="bypass -h partycontrol 4 -71602 258087 -3128">Humans' starting location.</a><br>
  26. +<a action="bypass -h partycontrol 0 general.htm">Back.</a>
  27. +</center>
  28. +</body></html>
  29. \ No newline at end of file
  30. Index: data/html/mods/partycontrol/pvpparties.htm
  31. ===================================================================
  32. --- data/html/mods/partycontrol/pvpparties.htm (revision 0)
  33. +++ data/html/mods/partycontrol/pvpparties.htm (revision 0)
  34. @@ -0,0 +1,6 @@
  35. +<html><body>
  36. +<center>
  37. +Pvp parties:<br>
  38. +%pvpparties%
  39. +</center>
  40. +</body></html>
  41. \ No newline at end of file
  42. Index: data/html/mods/partycontrol/pvpmode.htm
  43. ===================================================================
  44. --- data/html/mods/partycontrol/pvpmode.htm (revision 0)
  45. +++ data/html/mods/partycontrol/pvpmode.htm (revision 0)
  46. @@ -0,0 +1,10 @@
  47. +<html><body>
  48. +<center>
  49. +Party control pvp mode options.<br>
  50. +<a action="bypass -h partycontrol 1">Set party in pvp mode.</a><br1>
  51. +<a action="bypass -h partycontrol 2">Remove party from pvp mode.</a><br>
  52. +<edit var="box" width=80 height=15><br1>
  53. +<a action="bypass -h partycontrol 5 $box">Set party main assister.</a>
  54. +<a action="bypass -h partycontrol 0 main.htm">Back.</a>
  55. +</center>
  56. +</body></html>
  57. \ No newline at end of file
  58. Index: data/html/mods/partycontrol/readme.txt
  59. ===================================================================
  60. --- data/html/mods/partycontrol/readme.txt (revision 0)
  61. +++ data/html/mods/partycontrol/readme.txt (revision 0)
  62. @@ -0,0 +1,13 @@
  63. +These are the following actions which you can use on bypasses:
  64. +
  65. +- 0. It is followed by a html, it just redirects the player to the specified html. Example: bypass -h partycontrol 0 main.htm.
  66. +- 1. It sets the party in pvp mode. Example: bypass -h partycontrol 1.
  67. +- 2. It removes the party from pvp mode. Example: bypass -h partycontrol 2.
  68. +- 3. It teleports all the party members to the clan leader. Example: bypass -h partycontrol 3.
  69. +- 4. It teleports all the party members to the selection location. Example: bypass -h partycontrol 4 -71602 258087 -3128.
  70. +- 5. It sets the party's main assister. Example: bypass -h partycontrol 5 Anarchy.
  71. +
  72. +Please note that if you disable a feature from the configs, you have to remove the bypass from htmls too because they are not
  73. +hard-coded.
  74. +
  75. +By Anarchy.
  76. \ No newline at end of file
  77. Index: data/html/mods/partycontrol/main.htm
  78. ===================================================================
  79. --- data/html/mods/partycontrol/main.htm (revision 0)
  80. +++ data/html/mods/partycontrol/main.htm (revision 0)
  81. @@ -0,0 +1,7 @@
  82. +<html><body>
  83. +<center>
  84. +Party control options.<br>
  85. +<a action="bypass -h partycontrol 0 pvpmode.htm">Pvp mode options.</a><br1>
  86. +<a action="bypass -h partycontrol 0 general.htm">General options.</a>
  87. +</center>
  88. +</body></html>
  89. \ No newline at end of file
  90. #P L2_GameServer_It
  91. Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/PartyControlVC.java
  92. ===================================================================
  93. --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/PartyControlVC.java (revision 0)
  94. +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/PartyControlVC.java (revision 0)
  95. @@ -0,0 +1,101 @@
  96. +/*
  97. + * This program is free software: you can redistribute it and/or modify it under
  98. + * the terms of the GNU General Public License as published by the Free Software
  99. + * Foundation, either version 3 of the License, or (at your option) any later
  100. + * version.
  101. + *
  102. + * This program is distributed in the hope that it will be useful, but WITHOUT
  103. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  104. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  105. + * details.
  106. + *
  107. + * You should have received a copy of the GNU General Public License along with
  108. + * this program. If not, see <http://www.gnu.org/licenses/>.
  109. + */
  110. +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
  111. +
  112. +import net.sf.l2j.Config;
  113. +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
  114. +import net.sf.l2j.gameserver.model.L2Object;
  115. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  116. +import net.sf.l2j.gameserver.model.entity.PartyControl;
  117. +import net.sf.l2j.gameserver.serverpackets.GMViewItemList;
  118. +/**
  119. + * @author Anarchy
  120. + *
  121. + */
  122. +public class PartyControlVC implements IVoicedCommandHandler
  123. +{
  124. + private static final String[] VOICED_COMMANDS = { "partycontrol", "showpvpparties", "viewinventory" };
  125. +
  126. + @Override
  127. + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
  128. + {
  129. + if (command.equals("partycontrol"))
  130. + {
  131. + if (activeChar.getParty() == null)
  132. + {
  133. + activeChar.sendMessage("You are not in a party.");
  134. + return false;
  135. + }
  136. +
  137. + if (activeChar.getParty().getLeader() != activeChar)
  138. + {
  139. + activeChar.sendMessage("Only your party leader can control your party.");
  140. + return false;
  141. + }
  142. +
  143. + PartyControl.showPartyControlWindow(activeChar);
  144. + }
  145. +
  146. + if (command.equals("showpvpparties"))
  147. + {
  148. + if (Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PVP_PARTIES_COMMAND)
  149. + {
  150. + PartyControl.showPvpPartiesWindow(activeChar);
  151. + }
  152. + }
  153. +
  154. + if (command.equals("viewinventory"))
  155. + {
  156. + if (!Config.ALLOW_VIEW_INVENTORY_COMMAND)
  157. + {
  158. + return false;
  159. + }
  160. +
  161. + L2Object obj = activeChar.getTarget();
  162. + if (obj == null)
  163. + {
  164. + activeChar.sendMessage("You need to target a party member to use this.");
  165. + return false;
  166. + }
  167. + if (!(obj instanceof L2PcInstance))
  168. + {
  169. + activeChar.sendMessage("You need to target a party member to use this.");
  170. + return false;
  171. + }
  172. +
  173. + L2PcInstance trg = (L2PcInstance)obj;
  174. + if (activeChar.getParty() == null)
  175. + {
  176. + activeChar.sendMessage("You need to target a party member to use this.");
  177. + return false;
  178. + }
  179. + if (!activeChar.getParty().getPartyMembers().contains(trg))
  180. + {
  181. + activeChar.sendMessage("You need to target a party member to use this.");
  182. + return false;
  183. + }
  184. +
  185. + activeChar.sendPacket(new GMViewItemList(trg));
  186. + }
  187. +
  188. + return true;
  189. + }
  190. +
  191. + @Override
  192. + public String[] getVoicedCommandList()
  193. + {
  194. + return VOICED_COMMANDS;
  195. + }
  196. +}
  197. \ No newline at end of file
  198. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  199. ===================================================================
  200. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5388)
  201. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  202. @@ -52,6 +52,7 @@
  203. import net.sf.l2j.gameserver.ai.L2PlayerAI;
  204. import net.sf.l2j.gameserver.cache.HtmCache;
  205. import net.sf.l2j.gameserver.cache.WarehouseCacheManager;
  206. +import net.sf.l2j.gameserver.clientpackets.Say2;
  207. import net.sf.l2j.gameserver.communitybbs.BB.Forum;
  208. import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
  209. import net.sf.l2j.gameserver.datatables.CharTemplateTable;
  210. @@ -138,6 +139,7 @@
  211. import net.sf.l2j.gameserver.serverpackets.ChangeWaitType;
  212. import net.sf.l2j.gameserver.serverpackets.CharInfo;
  213. import net.sf.l2j.gameserver.serverpackets.ConfirmDlg;
  214. +import net.sf.l2j.gameserver.serverpackets.CreatureSay;
  215. import net.sf.l2j.gameserver.serverpackets.EtcStatusUpdate;
  216. import net.sf.l2j.gameserver.serverpackets.ExAutoSoulShot;
  217. import net.sf.l2j.gameserver.serverpackets.ExDuelUpdateUserInfo;
  218. @@ -310,6 +312,42 @@
  219. cubic.doAction(target);
  220. }
  221. }
  222. +
  223. + if (target instanceof L2PcInstance)
  224. + {
  225. + 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))
  226. + {
  227. + if (Config.ALLOW_AUTO_TARGET_ASSISTER)
  228. + {
  229. + for (L2PcInstance p : getPlayer().getParty().getPartyMembers())
  230. + {
  231. + if (Config.AUTO_TARGET_DISALLOWED_CLASSES.contains(p.getClassId().getId()))
  232. + {
  233. + continue;
  234. + }
  235. +
  236. + if (p.isInsideRadius(getPlayer().getX(), getPlayer().getY(), 5000, false) && p.getTarget() != target)
  237. + {
  238. + p.setTarget(target);
  239. + p.sendPacket(new ActionFailed());
  240. + }
  241. + }
  242. + }
  243. +
  244. + if (Config.ALLOW_ASSISTER_TARGET_MESSAGE)
  245. + {
  246. + CreatureSay cs = new CreatureSay(getPlayer().getObjectId(), Say2.TELL, getPlayer().getName(), "ASSIST ME > "+target.getName());
  247. +
  248. + for (L2PcInstance p : getPlayer().getParty().getPartyMembers())
  249. + {
  250. + if (p != getPlayer() && p.getTarget() != target)
  251. + {
  252. + p.sendPacket(cs);
  253. + }
  254. + }
  255. + }
  256. + }
  257. + }
  258. }
  259.  
  260. @Override
  261. Index: java/net/sf/l2j/gameserver/model/L2Party.java
  262. ===================================================================
  263. --- java/net/sf/l2j/gameserver/model/L2Party.java (revision 5388)
  264. +++ java/net/sf/l2j/gameserver/model/L2Party.java (working copy)
  265. @@ -51,6 +51,7 @@
  266. */
  267. public class L2Party
  268. {
  269. + public static FastList<L2Party> _allParties = new FastList<L2Party>();
  270. private static final double[] BONUS_EXP_SP = {1, 1.30, 1.39, 1.50, 1.54, 1.58, 1.63, 1.67, 1.71};
  271. private List<L2PcInstance> _members = null;
  272. private int _pendingInvitation = 0; // Number of players that already have been invited (but not replied yet)
  273. @@ -58,6 +59,8 @@
  274. private int _itemDistribution = 0;
  275. private int _itemLastLoot = 0;
  276. private L2CommandChannel _commandChannel = null;
  277. + private boolean _pvpMode = false;
  278. + private L2PcInstance _mainAssister = null;
  279.  
  280. private DimensionalRift _dr;
  281.  
  282. @@ -77,6 +80,10 @@
  283. _itemDistribution = itemDistribution;
  284. getPartyMembers().add(leader);
  285. _partyLvl = leader.getLevel();
  286. + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE)
  287. + {
  288. + _allParties.add(this);
  289. + }
  290. }
  291.  
  292. /**
  293. @@ -250,6 +257,19 @@
  294. {
  295. _partyLvl = player.getLevel();
  296. }
  297. +
  298. + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
  299. + {
  300. + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
  301. + {
  302. + player.getAppearance().setNameColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
  303. + }
  304. + else
  305. + {
  306. + player.getAppearance().setTitleColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
  307. + }
  308. + player.broadcastUserInfo();
  309. + }
  310.  
  311. // update partySpelled
  312. for(L2PcInstance member : getPartyMembers())
  313. @@ -269,7 +289,25 @@
  314. {
  315. getPartyMembers().remove(player);
  316. recalculatePartyLevel();
  317. +
  318. + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
  319. + {
  320. + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
  321. + {
  322. + player.getAppearance().setNameColor(0xFFFFFF);
  323. + }
  324. + else
  325. + {
  326. + player.getAppearance().setTitleColor(0xFFFFFF);
  327. + }
  328. + player.broadcastUserInfo();
  329. + }
  330.  
  331. + if (getMainAssister() == player)
  332. + {
  333. + setMainAssister(null);
  334. + }
  335. +
  336. if (player.isFestivalParticipant())
  337. SevenSignsFestival.getInstance().updateParticipants(player, this);
  338.  
  339. @@ -292,6 +330,10 @@
  340. if (getPartyMembers().size() == 1)
  341. {
  342. getLeader().setParty(null);
  343. + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE)
  344. + {
  345. + _allParties.remove(this);
  346. + }
  347. if (getLeader().isInDuel())
  348. DuelManager.getInstance().onRemoveFromParty(getLeader());
  349. }
  350. @@ -757,4 +799,24 @@
  351. public DimensionalRift getDimensionalRift() { return _dr; }
  352.  
  353. public L2PcInstance getLeader() { return getPartyMembers().get(0); }
  354. +
  355. + public boolean isInPvpMode()
  356. + {
  357. + return _pvpMode;
  358. + }
  359. +
  360. + public void setIsInPvpMode(boolean val)
  361. + {
  362. + _pvpMode = val;
  363. + }
  364. +
  365. + public L2PcInstance getMainAssister()
  366. + {
  367. + return _mainAssister;
  368. + }
  369. +
  370. + public void setMainAssister(L2PcInstance val)
  371. + {
  372. + _mainAssister = val;
  373. + }
  374. }
  375. Index: java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java
  376. ===================================================================
  377. --- java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (revision 5388)
  378. +++ java/net/sf/l2j/gameserver/clientpackets/RequestBypassToServer.java (working copy)
  379. @@ -18,6 +18,7 @@
  380. */
  381. package net.sf.l2j.gameserver.clientpackets;
  382.  
  383. +import java.util.StringTokenizer;
  384. import java.util.logging.Level;
  385. import java.util.logging.Logger;
  386.  
  387. @@ -32,6 +33,7 @@
  388. import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  389. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  390. import net.sf.l2j.gameserver.model.entity.L2Event;
  391. +import net.sf.l2j.gameserver.model.entity.PartyControl;
  392. import net.sf.l2j.gameserver.serverpackets.ActionFailed;
  393. import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
  394.  
  395. @@ -159,6 +161,19 @@
  396. else
  397. player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
  398. }
  399. + else if (_command.startsWith("partycontrol"))
  400. + {
  401. + if (!PartyControl.canContinue(activeChar))
  402. + {
  403. + return;
  404. + }
  405. +
  406. + StringTokenizer st = new StringTokenizer(_command.substring(13));
  407. + String action_string = st.nextToken();
  408. + int action = Integer.valueOf(action_string);
  409. +
  410. + PartyControl.handleBypassAction(activeChar, action, st);
  411. + }
  412. }
  413. catch (Exception e)
  414. {
  415. Index: java/net/sf/l2j/gameserver/clientpackets/Say2.java
  416. ===================================================================
  417. --- java/net/sf/l2j/gameserver/clientpackets/Say2.java (revision 5388)
  418. +++ java/net/sf/l2j/gameserver/clientpackets/Say2.java (working copy)
  419. @@ -30,6 +30,7 @@
  420. import net.sf.l2j.gameserver.handler.VoicedCommandHandler;
  421. import net.sf.l2j.gameserver.instancemanager.PetitionManager;
  422. import net.sf.l2j.gameserver.model.BlockList;
  423. +import net.sf.l2j.gameserver.model.L2Party;
  424. import net.sf.l2j.gameserver.model.L2World;
  425. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  426. import net.sf.l2j.gameserver.network.SystemMessageId;
  427. @@ -233,6 +234,44 @@
  428. }
  429. break;
  430. case ALL:
  431. + if (Config.ALLOW_PARTY_CONTROL && Config.ALLOW_PARTY_PVP_MODE && Config.ALLOW_PARTY_LEADER_CHANNEL && _text.startsWith(Config.PARTY_LEADER_CHANNEL_PREFIX))
  432. + {
  433. + if (activeChar.getParty() == null)
  434. + {
  435. + activeChar.sendMessage("You are not in a party.");
  436. + return;
  437. + }
  438. + if (activeChar.getParty().getLeader() != activeChar)
  439. + {
  440. + activeChar.sendMessage("Only your party leader can talk on parties leaders' channel.");
  441. + return;
  442. + }
  443. + if (!activeChar.getParty().isInPvpMode())
  444. + {
  445. + activeChar.sendMessage("Your party is not in pvp mode.");
  446. + return;
  447. + }
  448. +
  449. + CreatureSay crs = new CreatureSay(activeChar.getObjectId(), Config.PARTY_LEADER_CHANNEL_TYPE, activeChar.getName(), _text.substring(1));
  450. +
  451. + for (L2Party party : L2Party._allParties)
  452. + {
  453. + if (Config.PARTY_LEADER_CHANNEL_VIEWABLE)
  454. + {
  455. + for (L2PcInstance p : party.getPartyMembers())
  456. + {
  457. + p.sendPacket(crs);
  458. + }
  459. + }
  460. + else
  461. + {
  462. + party.getLeader().sendPacket(crs);
  463. + }
  464. + }
  465. +
  466. + return;
  467. + }
  468. +
  469. if (_text.startsWith("."))
  470. {
  471. StringTokenizer st = new StringTokenizer(_text);
  472. Index: java/net/sf/l2j/gameserver/model/entity/PartyControl.java
  473. ===================================================================
  474. --- java/net/sf/l2j/gameserver/model/entity/PartyControl.java (revision 0)
  475. +++ java/net/sf/l2j/gameserver/model/entity/PartyControl.java (revision 0)
  476. @@ -0,0 +1,351 @@
  477. +/*
  478. + * This program is free software: you can redistribute it and/or modify it under
  479. + * the terms of the GNU General Public License as published by the Free Software
  480. + * Foundation, either version 3 of the License, or (at your option) any later
  481. + * version.
  482. + *
  483. + * This program is distributed in the hope that it will be useful, but WITHOUT
  484. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  485. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  486. + * details.
  487. + *
  488. + * You should have received a copy of the GNU General Public License along with
  489. + * this program. If not, see <http://www.gnu.org/licenses/>.
  490. + */
  491. +package net.sf.l2j.gameserver.model.entity;
  492. +
  493. +import java.util.StringTokenizer;
  494. +
  495. +import javolution.util.FastMap;
  496. +
  497. +import net.sf.l2j.Config;
  498. +import net.sf.l2j.gameserver.datatables.MapRegionTable;
  499. +import net.sf.l2j.gameserver.model.L2Party;
  500. +import net.sf.l2j.gameserver.model.L2World;
  501. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  502. +import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
  503. +/**
  504. + * @author Anarchy
  505. + *
  506. + */
  507. +public class PartyControl
  508. +{
  509. + public static boolean canContinue(L2PcInstance p)
  510. + {
  511. + if (p.getParty() == null)
  512. + {
  513. + p.sendMessage("You are not in a party.");
  514. + return false;
  515. + }
  516. +
  517. + if (p.getParty().getLeader() != p)
  518. + {
  519. + p.sendMessage("Only your party leader can control your party.");
  520. + return false;
  521. + }
  522. +
  523. + return true;
  524. + }
  525. +
  526. + public static void handleBypassAction(L2PcInstance p, int action, StringTokenizer st)
  527. + {
  528. + switch (action)
  529. + {
  530. + case 0:
  531. + {
  532. + NpcHtmlMessage htm = new NpcHtmlMessage(0);
  533. + htm.setFile("./data/html/mods/partycontrol/"+st.nextToken());
  534. +
  535. + p.sendPacket(htm);
  536. +
  537. + break;
  538. + }
  539. + case 1:
  540. + {
  541. + if (!Config.ALLOW_PARTY_PVP_MODE)
  542. + {
  543. + p.sendMessage("This option is disabled by the admin.");
  544. + return;
  545. + }
  546. +
  547. + if (p.getParty().isInPvpMode())
  548. + {
  549. + p.sendMessage("Your party is already in pvp mode.");
  550. + return;
  551. + }
  552. +
  553. + p.getParty().setIsInPvpMode(true);
  554. + for (L2PcInstance pl : p.getParty().getPartyMembers())
  555. + {
  556. + if (Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
  557. + {
  558. + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
  559. + {
  560. + pl.getAppearance().setNameColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
  561. + }
  562. + else
  563. + {
  564. + pl.getAppearance().setTitleColor(Config.PARTY_MEMBERS_PVP_MODE_COLOR);
  565. + }
  566. + pl.broadcastUserInfo();
  567. + }
  568. + pl.sendMessage("Your party is now in pvp mode.");
  569. + }
  570. +
  571. + break;
  572. + }
  573. + case 2:
  574. + {
  575. + if (!Config.ALLOW_PARTY_PVP_MODE)
  576. + {
  577. + p.sendMessage("This option is disabled by the admin.");
  578. + return;
  579. + }
  580. +
  581. + if (!p.getParty().isInPvpMode())
  582. + {
  583. + p.sendMessage("Your party is not in pvp mode.");
  584. + return;
  585. + }
  586. +
  587. + p.getParty().setIsInPvpMode(false);
  588. + for (L2PcInstance pl : p.getParty().getPartyMembers())
  589. + {
  590. + if (Config.ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR)
  591. + {
  592. + if (Config.PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME"))
  593. + {
  594. + pl.getAppearance().setNameColor(0xFFFFFF);
  595. + }
  596. + else
  597. + {
  598. + pl.getAppearance().setTitleColor(0xFFFFFF);
  599. + }
  600. + pl.broadcastUserInfo();
  601. + }
  602. + pl.sendMessage("Your party is now out of pvp mode.");
  603. + }
  604. +
  605. + break;
  606. + }
  607. + case 3:
  608. + {
  609. + if (!Config.ALLOW_RECALL_PARTY_MEMBERS)
  610. + {
  611. + p.sendMessage("This option is disabled by the admin.");
  612. + return;
  613. + }
  614. +
  615. + if (p.getKarma() > 0)
  616. + {
  617. + p.sendMessage("You can't recall your party members while you have karma.");
  618. + return;
  619. + }
  620. +
  621. + for (L2PcInstance pl : p.getParty().getPartyMembers())
  622. + {
  623. + if (pl == p || pl.isIn7sDungeon() || pl.isInOlympiadMode())
  624. + {
  625. + continue;
  626. + }
  627. + if (pl.getKarma() > 0)
  628. + {
  629. + p.sendMessage(pl.getName()+" has not been recalled because he has karma.");
  630. + continue;
  631. + }
  632. + if (pl.getPvpFlag() > 0)
  633. + {
  634. + p.sendMessage(pl.getName()+" has not been recalled because he is flagged.");
  635. + continue;
  636. + }
  637. +
  638. + pl.teleToLocation(p.getX(), p.getY(), p.getZ(), true);
  639. + if (pl != p)
  640. + {
  641. + pl.sendMessage("You have been recalled by your party leader.");
  642. + }
  643. + else
  644. + {
  645. + pl.sendMessage("You have recalled your party members.");
  646. + }
  647. + }
  648. +
  649. + break;
  650. + }
  651. + case 4:
  652. + {
  653. + if (!Config.ALLOW_TELEPORT_PARTY_MEMBERS)
  654. + {
  655. + p.sendMessage("This option is disabled by the admin.");
  656. + return;
  657. + }
  658. +
  659. + if (p.getKarma() > 0)
  660. + {
  661. + p.sendMessage("You can't teleport your party members while you have karma.");
  662. + return;
  663. + }
  664. + if (p.getPvpFlag() > 0)
  665. + {
  666. + p.sendMessage("You can't teleport your party members while you are flagged.");
  667. + return;
  668. + }
  669. + if (p.isIn7sDungeon() || p.isInOlympiadMode())
  670. + {
  671. + p.sendMessage("You can't teleport your party members while you are in an event.");
  672. + return;
  673. + }
  674. +
  675. + int[] xyz = new int[3];
  676. + xyz[0] = Integer.valueOf(st.nextToken());
  677. + xyz[1] = Integer.valueOf(st.nextToken());
  678. + xyz[2] = Integer.valueOf(st.nextToken());
  679. +
  680. + for (L2PcInstance pl : p.getParty().getPartyMembers())
  681. + {
  682. + if ((pl.isIn7sDungeon() || pl.isInOlympiadMode()) && pl != p)
  683. + {
  684. + continue;
  685. + }
  686. + if (pl.getKarma() > 0 && pl != p)
  687. + {
  688. + p.sendMessage(pl.getName()+" has not been teleported because he has karma.");
  689. + continue;
  690. + }
  691. + if (pl.getPvpFlag() > 0 && pl != p)
  692. + {
  693. + p.sendMessage(pl.getName()+" has not been teleported because he is flagged.");
  694. + continue;
  695. + }
  696. +
  697. + pl.teleToLocation(xyz[0], xyz[1], xyz[2], true);
  698. + if (pl != p)
  699. + {
  700. + pl.sendMessage("You have been teleported by your party leader.");
  701. + }
  702. + else
  703. + {
  704. + pl.sendMessage("You have teleported your party members.");
  705. + }
  706. + }
  707. +
  708. + break;
  709. + }
  710. + case 5:
  711. + {
  712. + if (!Config.ALLOW_PARTY_MAIN_ASSISTER)
  713. + {
  714. + p.sendMessage("This option is disabled by the admin.");
  715. + return;
  716. + }
  717. +
  718. + if (!p.getParty().isInPvpMode())
  719. + {
  720. + p.sendMessage("Your party needs to be in pvp mode to set the main assister.");
  721. + return;
  722. + }
  723. +
  724. + String plname = st.nextToken();
  725. + L2PcInstance pl = L2World.getInstance().getPlayer(plname);
  726. +
  727. + if (pl == null)
  728. + {
  729. + p.sendMessage("The character you have selected doesn't exist or isn't online.");
  730. + return;
  731. + }
  732. + if (!p.getParty().getPartyMembers().contains(pl))
  733. + {
  734. + p.sendMessage("The character you have selected isn't a party member of yours.");
  735. + return;
  736. + }
  737. +
  738. + p.getParty().setMainAssister(pl);
  739. + for (L2PcInstance pla : p.getParty().getPartyMembers())
  740. + {
  741. + if (pl == pla)
  742. + {
  743. + pl.sendMessage("You are now the party's main assister.");
  744. + continue;
  745. + }
  746. +
  747. + pla.sendMessage(plname+" is now the party's main assister.");
  748. + }
  749. +
  750. + break;
  751. + }
  752. + }
  753. + }
  754. +
  755. + public static void showPartyControlWindow(L2PcInstance p)
  756. + {
  757. + NpcHtmlMessage htm = new NpcHtmlMessage(0);
  758. + htm.setFile("./data/html/mods/partycontrol/main.htm");
  759. +
  760. + p.sendPacket(htm);
  761. + }
  762. +
  763. + public static void showPvpPartiesWindow(L2PcInstance p)
  764. + {
  765. + NpcHtmlMessage htm = new NpcHtmlMessage(0);
  766. + htm.setFile("./data/html/mods/partycontrol/pvpparties.htm");
  767. + htm.replace("%pvpparties%", getPvpParties(p));
  768. +
  769. + p.sendPacket(htm);
  770. + }
  771. +
  772. + private static String getPvpParties(L2PcInstance p)
  773. + {
  774. + String pvpparties = "";
  775. + int i = 0;
  776. + for (L2Party party : L2Party._allParties)
  777. + {
  778. + if (party.isInPvpMode())
  779. + {
  780. + pvpparties += "Leader: <font color=\"LEVEL\">"+party.getLeader().getName()+"</font> Members: <font color=\"LEVEL\">"+party.getMemberCount()+"</font> Near: <font color=\"LEVEL\">"+getNearestTown(p)+"</font><br1>";
  781. + i++;
  782. + }
  783. + }
  784. + if (i == 0)
  785. + {
  786. + pvpparties = "There are not pvp parties.";
  787. + }
  788. + else
  789. + {
  790. + pvpparties += "<br>A total of "+i+" pvp part"+(i == 1 ? "y." : "ies.");
  791. + }
  792. +
  793. + return pvpparties;
  794. + }
  795. +
  796. + private static String getNearestTown(L2PcInstance p)
  797. + {
  798. + FastMap<String, Integer> results = new FastMap<String, Integer>();
  799. + for (L2PcInstance pl : p.getParty().getPartyMembers())
  800. + {
  801. + String areaname = MapRegionTable.getInstance().getClosestTownName(pl);
  802. + if (results.containsKey(areaname))
  803. + {
  804. + int currvotes = results.get(areaname);
  805. + results.remove(areaname);
  806. + results.put(areaname, currvotes++);
  807. + }
  808. + else
  809. + {
  810. + results.put(areaname, 1);
  811. + }
  812. + }
  813. +
  814. + String result = null;
  815. + int resultnum = 0;
  816. + for (String s : results.keySet())
  817. + {
  818. + if (results.get(s) > resultnum)
  819. + {
  820. + result = s;
  821. + resultnum = results.get(s);
  822. + }
  823. + }
  824. +
  825. + return result;
  826. + }
  827. +}
  828. Index: java/net/sf/l2j/gameserver/GameServer.java
  829. ===================================================================
  830. --- java/net/sf/l2j/gameserver/GameServer.java (revision 5388)
  831. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  832. @@ -201,6 +201,7 @@
  833. import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
  834. import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
  835. import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
  836. +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.PartyControlVC;
  837. import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
  838. import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
  839. import net.sf.l2j.gameserver.idfactory.IdFactory;
  840. @@ -595,6 +596,11 @@
  841.  
  842. if(Config.L2JMOD_ALLOW_WEDDING)
  843. _voicedCommandHandler.registerVoicedCommandHandler(new Wedding());
  844. +
  845. + if (Config.ALLOW_PARTY_CONTROL)
  846. + {
  847. + _voicedCommandHandler.registerVoicedCommandHandler(new PartyControlVC());
  848. + }
  849.  
  850. _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");
  851.  
  852. Index: java/config/partycontrol.properties
  853. ===================================================================
  854. --- java/config/partycontrol.properties (revision 0)
  855. +++ java/config/partycontrol.properties (revision 0)
  856. @@ -0,0 +1,53 @@
  857. +# Party control configurations.
  858. +# By Anarchy.
  859. +# Note: Check readme.txt in data/html/mods/partycontrol/ for hints.
  860. +
  861. +# Enable party control.
  862. +AllowPartyControl = True
  863. +
  864. +# Enable parties pvp mode.
  865. +AllowPartyPvpMode = True
  866. +
  867. +# Enable .showpvpparties command.
  868. +# Note: If you disable it, you should remove the bypasses from the html too.
  869. +AllowPvpPartiesCommand = True
  870. +
  871. +# Enable recall party members option.
  872. +# Note: If you disable it, you should remove the bypasses from the html too.
  873. +AllowRecallPartyMembers = True
  874. +
  875. +# Enable teleport party members option.
  876. +# Note: If you disable it, you should remove the bypasses from the html too.
  877. +# Note: If you enable it, you need to set your locations in general_teleport.htm too.
  878. +AllowTeleportPartyMembers = True
  879. +
  880. +# Enable party members name/title color while in pvp mode.
  881. +AllowPartyMembersPvpModeColor = True
  882. +# Title/Name color.
  883. +# Options: NAME, TITLE.
  884. +PartyMembersPvpModeColorMode = NAME
  885. +# Color. Default: Light blue(FFFF00).
  886. +PartyMembersPvpModeColor = FFFF00
  887. +
  888. +# Enable .viewinventory command.
  889. +AllowViewInventoryCommand = True
  890. +
  891. +# Enable parties main assister.
  892. +AllowPartyMainAssister = True
  893. +# Enable automatically targeting the main assister's target, on main assister's attack.
  894. +AllowAutoTargetAssister = True
  895. +# Classes that will not target the main assister's target, on main assister's attack. Example: 92,93,94. Default: Cardinal(97).
  896. +AutoTargetDisallowedClasses = 97
  897. +# Enable message to all party members who is the assister's target.
  898. +AllowAssisterTargetMessage = True
  899. +
  900. +# Enable parties leaders' channel.
  901. +AllowPartyLeaderChannel = True
  902. +# Parties leaders' channel prefix. For example, they will type (prefix)blabla to talk.
  903. +# Note: Do not use existing ones(#,@,!,$ etc).
  904. +PartyLeaderChannelPrefix = ~
  905. +# Parties leaders' channel type.
  906. +# Note: If you don't know what this is, don't touch it.
  907. +PartyLeaderChannelType = 15
  908. +# Parties leaders' channel viewable by all party members.
  909. +PartyLeaderChannelViewable = True
  910. \ No newline at end of file
  911. Index: java/net/sf/l2j/Config.java
  912. ===================================================================
  913. --- java/net/sf/l2j/Config.java (revision 5388)
  914. +++ java/net/sf/l2j/Config.java (working copy)
  915. @@ -712,6 +712,7 @@
  916. public static final String SEVENSIGNS_FILE = "./config/sevensigns.properties";
  917. public static final String CLANHALL_CONFIG_FILE = "./config/clanhall.properties";
  918. public static final String L2JMOD_CONFIG_FILE = "./config/l2jmods.properties";
  919. + public static final String PARTYCONTROL_CONFIG_FILE = "./config/partycontrol.properties";
  920. public static int MAX_ITEM_IN_PACKET;
  921.  
  922. public static boolean CHECK_KNOWN;
  923. @@ -1163,7 +1164,27 @@
  924. /** Alt Settings for devs */
  925. public static boolean ALT_DEV_NO_QUESTS;
  926. public static boolean ALT_DEV_NO_SPAWNS;
  927. -
  928. +
  929. +
  930. + // .partycontrol configs.
  931. + public static boolean ALLOW_PARTY_CONTROL;
  932. + public static boolean ALLOW_PARTY_PVP_MODE;
  933. + public static boolean ALLOW_PVP_PARTIES_COMMAND;
  934. + public static boolean ALLOW_RECALL_PARTY_MEMBERS;
  935. + public static boolean ALLOW_TELEPORT_PARTY_MEMBERS;
  936. + public static boolean ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR;
  937. + public static String PARTY_MEMBERS_PVP_MODE_COLOR_MODE;
  938. + public static int PARTY_MEMBERS_PVP_MODE_COLOR;
  939. + public static boolean ALLOW_VIEW_INVENTORY_COMMAND;
  940. + public static boolean ALLOW_PARTY_MAIN_ASSISTER;
  941. + public static boolean ALLOW_AUTO_TARGET_ASSISTER;
  942. + public static FastList<Integer> AUTO_TARGET_DISALLOWED_CLASSES = new FastList<Integer>();
  943. + public static boolean ALLOW_ASSISTER_TARGET_MESSAGE;
  944. + public static boolean ALLOW_PARTY_LEADER_CHANNEL;
  945. + public static String PARTY_LEADER_CHANNEL_PREFIX;
  946. + public static int PARTY_LEADER_CHANNEL_TYPE;
  947. + public static boolean PARTY_LEADER_CHANNEL_VIEWABLE;
  948. +
  949.  
  950. /**
  951. * This class initializes all global variables for configuration.<br>
  952. @@ -2084,6 +2105,45 @@
  953. {
  954. _log.warning("Could not load HexID file ("+HEXID_FILE+"). Hopefully login will give us one.");
  955. }
  956. +
  957. + try
  958. + {
  959. + Properties partycontrol = new Properties();
  960. + InputStream is = new FileInputStream(new File(PARTYCONTROL_CONFIG_FILE));
  961. + partycontrol.load(is);
  962. + is.close();
  963. +
  964. + ALLOW_PARTY_CONTROL = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyControl", "false"));
  965. + ALLOW_PARTY_PVP_MODE = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyPvpMode", "false"));
  966. + ALLOW_PVP_PARTIES_COMMAND = Boolean.parseBoolean(partycontrol.getProperty("AllowPvpPartiesCommand", "false"));
  967. + ALLOW_RECALL_PARTY_MEMBERS = Boolean.parseBoolean(partycontrol.getProperty("AllowRecallPartyMembers", "false"));
  968. + ALLOW_TELEPORT_PARTY_MEMBERS = Boolean.parseBoolean(partycontrol.getProperty("AllowTeleportPartyMembers", "false"));
  969. + ALLOW_PARTY_MEMBERS_PVP_MODE_COLOR = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyMembersPvpModeColor", "false"));
  970. + PARTY_MEMBERS_PVP_MODE_COLOR_MODE = partycontrol.getProperty("PartyMembersPvpModeColorMode", "NAME");
  971. + if (!PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("NAME") && !PARTY_MEMBERS_PVP_MODE_COLOR_MODE.equals("TITLE"))
  972. + {
  973. + PARTY_MEMBERS_PVP_MODE_COLOR_MODE = "NAME";
  974. + }
  975. + PARTY_MEMBERS_PVP_MODE_COLOR = Integer.decode("0x"+partycontrol.getProperty("PartyMembersPvpModeColor", "FFFF00"));
  976. + ALLOW_VIEW_INVENTORY_COMMAND = Boolean.parseBoolean(partycontrol.getProperty("AllowViewInventoryCommand", "false"));
  977. + ALLOW_PARTY_MAIN_ASSISTER = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyMainAssister", "false"));
  978. + ALLOW_AUTO_TARGET_ASSISTER = Boolean.parseBoolean(partycontrol.getProperty("AllowAutoTargetAssister", "false"));
  979. + String auto_target_disallowed_classes = partycontrol.getProperty("AutoTargetDisallowedClasses", "97");
  980. + String[] atdc_splitted = auto_target_disallowed_classes.split(",");
  981. + for (String s : atdc_splitted)
  982. + {
  983. + AUTO_TARGET_DISALLOWED_CLASSES.add(Integer.valueOf(s));
  984. + }
  985. + ALLOW_ASSISTER_TARGET_MESSAGE = Boolean.parseBoolean(partycontrol.getProperty("AllowAssisterTargetMessage", "false"));
  986. + ALLOW_PARTY_LEADER_CHANNEL = Boolean.parseBoolean(partycontrol.getProperty("AllowPartyLeaderChannel", "false"));
  987. + PARTY_LEADER_CHANNEL_PREFIX = partycontrol.getProperty("PartyLeaderChannelPrefix", "~");
  988. + PARTY_LEADER_CHANNEL_TYPE = Integer.parseInt(partycontrol.getProperty("PartyLeaderChannelType", "15"));
  989. + PARTY_LEADER_CHANNEL_VIEWABLE = Boolean.parseBoolean(partycontrol.getProperty("PartyLeaderChannelViewable", "false"));
  990. + }
  991. + catch (Exception e)
  992. + {
  993. + _log.warning("Could not load HexID file ("+HEXID_FILE+"). Hopefully login will give us one.");
  994. + }
  995. }
  996. else if(Server.serverMode == Server.MODE_LOGINSERVER)
  997. {
Advertisement
Add Comment
Please, Sign In to add comment