CaFi

Untitled

Feb 5th, 2017
1,511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.51 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/GameServer.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/GameServer.java (revision 24)
  6. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  7. @@ -256,7 +256,19 @@
  8.  
  9. StringUtil.printSection("Quests & Scripts");
  10. ScriptManager.getInstance();
  11. -
  12. + if (Config.FACTION_SYSTEM_ENABLE)
  13. + {
  14. + System.out.println("####################################");
  15. + System.out.println("## Faction System is Activated. ##");
  16. + System.out.println("####################################");
  17. + }
  18. + else
  19. + {
  20. + System.out.println("###################################");
  21. + System.out.println("## Faction System is Disabled. ##");
  22. + System.out.println("###################################");
  23. + }
  24. +
  25. if (Config.ALLOW_BOAT)
  26. {
  27. BoatManager.getInstance();
  28. Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
  29. ===================================================================
  30. --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (revision 24)
  31. +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (working copy)
  32. @@ -14,6 +14,7 @@
  33. */
  34. package net.sf.l2j.gameserver.handler.usercommandhandlers;
  35.  
  36. +import net.sf.l2j.Config;
  37. import net.sf.l2j.gameserver.datatables.SkillTable;
  38. import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  39. import net.sf.l2j.gameserver.instancemanager.ZoneManager;
  40. @@ -32,6 +33,14 @@
  41. @Override
  42. public boolean useUserCommand(int id, L2PcInstance activeChar)
  43. {
  44. + if (Config.FACTION_SYSTEM_ENABLE)
  45. + {
  46. + if (activeChar.isffaction() || activeChar.issfaction())
  47. + {
  48. + activeChar.sendMessage("You Cannot Use This Command.");
  49. + return false;
  50. + }
  51. + }
  52. if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.isInObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || ZoneManager.getInstance().getZone(activeChar, L2BossZone.class) != null)
  53. {
  54. activeChar.sendPacket(SystemMessageId.NO_UNSTUCK_PLEASE_SEND_PETITION);
  55. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java
  56. ===================================================================
  57. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (revision 24)
  58. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (working copy)
  59. @@ -14,6 +14,7 @@
  60. */
  61. package net.sf.l2j.gameserver.network.clientpackets;
  62.  
  63. +import net.sf.l2j.Config;
  64. import net.sf.l2j.gameserver.model.World;
  65. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  66. import net.sf.l2j.gameserver.model.group.CommandChannel;
  67. @@ -48,6 +49,12 @@
  68. return;
  69. }
  70.  
  71. + if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
  72. + {
  73. + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
  74. + return;
  75. + }
  76. +
  77. // Check if duel is possible.
  78. if (!activeChar.canDuel())
  79. {
  80. Index: java/net/sf/l2j/gameserver/model/L2Clan.java
  81. ===================================================================
  82. --- java/net/sf/l2j/gameserver/model/L2Clan.java (revision 24)
  83. +++ java/net/sf/l2j/gameserver/model/L2Clan.java (working copy)
  84. @@ -1659,6 +1659,17 @@
  85. return false;
  86. }
  87.  
  88. + if (activeChar.isffaction() && target.issfaction() && Config.FACTION_SYSTEM_ENABLE)
  89. + {
  90. + activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
  91. + return false;
  92. + }
  93. + if (activeChar.issfaction() && target.isffaction() && Config.FACTION_SYSTEM_ENABLE)
  94. + {
  95. + activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
  96. + return false;
  97. + }
  98. +
  99. if (activeChar.getObjectId() == target.getObjectId())
  100. {
  101. activeChar.sendPacket(SystemMessageId.CANNOT_INVITE_YOURSELF);
  102. Index: java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java
  103. ===================================================================
  104. --- java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java (revision 24)
  105. +++ java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java (working copy)
  106. @@ -101,7 +101,7 @@
  107. return;
  108.  
  109. // Freight price from config or normal price per item slot (30)
  110. - final int fee = _items.length * 30;
  111. + final int fee = _items.length * Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE;
  112. int currentAdena = player.getAdena();
  113. int slots = 0;
  114.  
  115. @@ -132,7 +132,7 @@
  116. }
  117.  
  118. // Check if enough adena and charge the fee
  119. - if (currentAdena < fee || !player.reduceAdena(warehouse.getName(), fee, manager, false))
  120. + if (currentAdena < Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE || !player.reduceAdena(warehouse.getName(), fee, manager, false))
  121. {
  122. sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
  123. return;
  124. Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
  125. ===================================================================
  126. --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 24)
  127. +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
  128. @@ -517,6 +517,7 @@
  129. */
  130. public void doAttack(L2Character target)
  131. {
  132. +
  133. if (target == null || isAttackingDisabled())
  134. {
  135. sendPacket(ActionFailed.STATIC_PACKET);
  136. @@ -549,8 +550,22 @@
  137. return;
  138. }
  139.  
  140. + boolean isL2PcInstance = this instanceof L2PcInstance && target instanceof L2PcInstance;
  141. + if (isL2PcInstance && ((L2PcInstance) this).isffaction() && ((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE)
  142. + {
  143. + ((L2PcInstance) this).sendMessage("Cant attack a player from your faction");
  144. + sendPacket(ActionFailed.STATIC_PACKET);
  145. + return;
  146. + }
  147. + if (isL2PcInstance && ((L2PcInstance) this).issfaction() && ((L2PcInstance) target).issfaction() && Config.FACTION_SYSTEM_ENABLE)
  148. + {
  149. + ((L2PcInstance) this).sendMessage("Cant attack a player from your faction");
  150. + sendPacket(ActionFailed.STATIC_PACKET);
  151. + return;
  152. + }
  153. +
  154. // Checking if target has moved to peace zone
  155. - if (isInsidePeaceZone(this, target))
  156. + if (isInsidePeaceZone(this, target) && !Config.FACTION_SYSTEM_ENABLE)
  157. {
  158. getAI().setIntention(CtrlIntention.ACTIVE);
  159. sendPacket(ActionFailed.STATIC_PACKET);
  160. @@ -1066,6 +1081,29 @@
  161.  
  162. boolean doit = false;
  163.  
  164. + target = (L2Character) getTarget();
  165. + if ((target instanceof L2PcInstance) && (this instanceof L2PcInstance))
  166. + {
  167. + if (((L2PcInstance) this).isffaction() && (((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE))
  168. + {
  169. + ((L2PcInstance) this).sendMessage("You Cannot Attack a Player From Your Faction!");
  170. + return;
  171. + }
  172. + else if (((L2PcInstance) this).isffaction() && ((((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE && (skill.getSkillType() == L2SkillType.BUFF)) || (skill.getSkillType() == L2SkillType.HOT) || (skill.getSkillType() == L2SkillType.HEAL) || (skill.getSkillType() == L2SkillType.COMBATPOINTHEAL) || (skill.getSkillType() == L2SkillType.HEAL_PERCENT) || (skill.getSkillType() == L2SkillType.MANAHEAL) || (skill.getSkillType() == L2SkillType.MANAHEAL_PERCENT) || (skill.getSkillType() == L2SkillType.BALANCE_LIFE) || (skill.getSkillType() == L2SkillType.CONT)))
  173. + {
  174. + return;
  175. + }
  176. + if (((L2PcInstance) this).issfaction() && ((L2PcInstance) target).issfaction())
  177. + {
  178. + ((L2PcInstance) this).sendMessage("You Cannot Attack a Player From Your Faction!");
  179. + return;
  180. + }
  181. + else if (((L2PcInstance) this).issfaction() && ((((L2PcInstance) target).issfaction() && Config.FACTION_SYSTEM_ENABLE && (skill.getSkillType() == L2SkillType.BUFF)) || (skill.getSkillType() == L2SkillType.HOT) || (skill.getSkillType() == L2SkillType.HEAL) || (skill.getSkillType() == L2SkillType.COMBATPOINTHEAL) || (skill.getSkillType() == L2SkillType.HEAL_PERCENT) || (skill.getSkillType() == L2SkillType.MANAHEAL) || (skill.getSkillType() == L2SkillType.MANAHEAL_PERCENT) || (skill.getSkillType() == L2SkillType.BALANCE_LIFE) || (skill.getSkillType() == L2SkillType.CONT)))
  182. + {
  183. + return;
  184. + }
  185. + }
  186. +
  187. // AURA skills should always be using caster as target
  188. switch (skill.getTargetType())
  189. {
  190. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  191. ===================================================================
  192. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 24)
  193. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
  194. @@ -94,6 +94,18 @@
  195.  
  196. final int objectId = activeChar.getObjectId();
  197.  
  198. + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE)
  199. + {
  200. + if (!activeChar.isNoble())
  201. + activeChar.setNoble(true, false);
  202. + }
  203. +
  204. + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_HERO)
  205. + {
  206. + if (!activeChar.isHero())
  207. + activeChar.setHero(true);
  208. + }
  209. +
  210. if (activeChar.isGM())
  211. {
  212. if (Config.GM_STARTUP_INVULNERABLE && AdminCommandAccessRights.getInstance().hasAccess("admin_invul", activeChar.getAccessLevel()))
  213. @@ -111,6 +123,21 @@
  214. GmListTable.getInstance().addGm(activeChar, true);
  215. }
  216.  
  217. + if (activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
  218. + {
  219. + activeChar.getAppearance().setNameColor(Config.FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR);
  220. + activeChar.sendMessage("Welcome " + activeChar.getName() + " You Are Fighting " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " Faction");
  221. + activeChar.setTitle(Config.FACTION_SYSTEM_FIRST_FACTION_NAME);
  222. + activeChar.getAppearance().setTitleColor(Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR);
  223. + }
  224. + if (activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
  225. + {
  226. + activeChar.getAppearance().setNameColor(Config.FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR);
  227. + activeChar.sendMessage("Welcome " + activeChar.getName() + " You Are Fighting " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " Faction");
  228. + activeChar.setTitle(Config.FACTION_SYSTEM_SECOND_FACTION_NAME);
  229. + activeChar.getAppearance().setTitleColor(Config.FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR);
  230. + }
  231. +
  232. // Set dead status if applies
  233. if (activeChar.getCurrentHp() < 0.5)
  234. activeChar.setIsDead(true);
  235. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java
  236. ===================================================================
  237. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (revision 24)
  238. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (working copy)
  239. @@ -39,6 +39,14 @@
  240. return;
  241.  
  242. final L2PcInstance requestor = player.getActiveRequester();
  243. + if (player.issfaction() && requestor.isffaction())
  244. + {
  245. + return;
  246. + }
  247. + if (player.isffaction() && requestor.issfaction())
  248. + {
  249. + return;
  250. + }
  251. if (requestor == null)
  252. return;
  253.  
  254. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java
  255. ===================================================================
  256. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (revision 24)
  257. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (working copy)
  258. @@ -14,6 +14,7 @@
  259. */
  260. package net.sf.l2j.gameserver.network.clientpackets;
  261.  
  262. +import net.sf.l2j.Config;
  263. import net.sf.l2j.gameserver.instancemanager.DuelManager;
  264. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  265. import net.sf.l2j.gameserver.model.group.CommandChannel;
  266. @@ -72,6 +73,12 @@
  267. return;
  268. }
  269.  
  270. + if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
  271. + {
  272. + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
  273. + return;
  274. + }
  275. +
  276. if (_partyDuel == 1)
  277. {
  278. // Player must be a party leader, the target can't be of the same party.
  279. Index: java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java
  280. ===================================================================
  281. --- java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 24)
  282. +++ java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy)
  283. @@ -133,8 +133,27 @@
  284. sendPacket(CharCreateOk.STATIC_PACKET);
  285.  
  286. World.getInstance().addObject(newChar);
  287. -
  288. + if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_75)
  289. + {
  290. + newChar.addExpAndSp(804219972L, 99999999);
  291. + }
  292. + else if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_80)
  293. + {
  294. + newChar.addExpAndSp(4200000000L, 99999999);
  295. + }
  296. + else if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_85)
  297. + {
  298. + newChar.addExpAndSp(19827360000L, 99999999);
  299. + }
  300. newChar.getPosition().set(template.getSpawn());
  301. + if (Config.FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN)
  302. + {
  303. + newChar.setXYZInvisible(Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_X, Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_Y, Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_Z);
  304. + }
  305. + else
  306. + {
  307. + newChar.getPosition().set(template.getSpawn());
  308. + }
  309. newChar.setTitle("");
  310.  
  311. newChar.registerShortCut(new L2ShortCut(0, 0, 3, 2, -1, 1)); // attack shortcut
  312. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
  313. ===================================================================
  314. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (revision 24)
  315. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (working copy)
  316. @@ -67,6 +67,17 @@
  317. return;
  318. }
  319.  
  320. + if (target.isffaction() && requestor.issfaction())
  321. + {
  322. + requestor.sendPacket(SystemMessageId.INCORRECT_TARGET);
  323. + return;
  324. + }
  325. + if (target.issfaction() && requestor.isffaction())
  326. + {
  327. + requestor.sendPacket(SystemMessageId.INCORRECT_TARGET);
  328. + return;
  329. + }
  330. +
  331. if (target.getClient().isDetached())
  332. {
  333. requestor.sendMessage("The player you tried to invite is in offline mode.");
  334. Index: java/net/sf/l2j/gameserver/model/World.java
  335. ===================================================================
  336. --- java/net/sf/l2j/gameserver/model/World.java (revision 24)
  337. +++ java/net/sf/l2j/gameserver/model/World.java (working copy)
  338. @@ -52,6 +52,8 @@
  339. private final Map<Integer, L2Object> _objects = new ConcurrentHashMap<>();
  340. private final Map<Integer, L2PetInstance> _pets = new ConcurrentHashMap<>();
  341. private final Map<Integer, L2PcInstance> _players = new ConcurrentHashMap<>();
  342. + private final Map<Integer, L2PcInstance> _allkoofPlayers = new ConcurrentHashMap<>();
  343. + private final Map<Integer, L2PcInstance> _allnoobPlayers = new ConcurrentHashMap<>();
  344.  
  345. private final WorldRegion[][] _worldRegions = new WorldRegion[REGIONS_X + 1][REGIONS_Y + 1];
  346.  
  347. @@ -115,6 +117,16 @@
  348. return _players.values();
  349. }
  350.  
  351. + public Collection<L2PcInstance> getAllkoofPlayers()
  352. + {
  353. + return _allkoofPlayers.values();
  354. + }
  355. +
  356. + public Collection<L2PcInstance> getAllnoobPlayers()
  357. + {
  358. + return _allnoobPlayers.values();
  359. + }
  360. +
  361. public L2PcInstance getPlayer(String name)
  362. {
  363. return _players.get(CharNameTable.getInstance().getPlayerObjectId(name));
  364. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java
  365. ===================================================================
  366. --- java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java (nonexistent)
  367. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java (working copy)
  368. @@ -0,0 +1,316 @@
  369. +/*
  370. + * This program is free software: you can redistribute it and/or modify it under
  371. + * the terms of the GNU General Public License as published by the Free Software
  372. + * Foundation, either version 3 of the License, or (at your option) any later
  373. + * version.
  374. + *
  375. + * This program is distributed in the hope that it will be useful, but WITHOUT
  376. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  377. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  378. + * details.
  379. + *
  380. + * You should have received a copy of the GNU General Public License along with
  381. + * this program. If not, see <http://www.gnu.org/licenses/>.
  382. + */
  383. +package net.sf.l2j.gameserver.model.actor.instance;
  384. +
  385. +import java.sql.Connection;
  386. +import java.sql.PreparedStatement;
  387. +import java.sql.ResultSet;
  388. +import java.util.StringTokenizer;
  389. +
  390. +import net.sf.l2j.commons.random.Rnd;
  391. +
  392. +import net.sf.l2j.Config;
  393. +import net.sf.l2j.L2DatabaseFactory;
  394. +import net.sf.l2j.gameserver.ai.CtrlIntention;
  395. +import net.sf.l2j.gameserver.model.World;
  396. +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  397. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  398. +import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
  399. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  400. +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
  401. +import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
  402. +
  403. +/**
  404. + * @author DaRkRaGe [L2JOneo]
  405. + */
  406. +public class L2FactionInstance extends L2NpcInstance
  407. +{
  408. + public L2FactionInstance(int objectId, NpcTemplate template)
  409. + {
  410. + super(objectId, template);
  411. + }
  412. +
  413. + @Override
  414. + public void onBypassFeedback(L2PcInstance player, String command)
  415. + {
  416. + player.sendPacket(ActionFailed.STATIC_PACKET);
  417. + StringTokenizer st = new StringTokenizer(command, " ");
  418. + String actualCommand = st.nextToken();
  419. + String val = "";
  420. + if (st.countTokens() >= 1)
  421. + {
  422. + val = st.nextToken();
  423. + }
  424. + if (actualCommand.equalsIgnoreCase("delevel"))
  425. + {
  426. + setTarget(player);
  427. + int lvl = player.getLevel();
  428. + if (lvl > 40)
  429. + {
  430. + if (val.equalsIgnoreCase("1"))
  431. + {
  432. + long delexp = 0;
  433. + delexp = player.getStat().getExp() - player.getStat().getExpForLevel(lvl - 1);
  434. + player.getStat().addExp(-delexp);
  435. + player.broadcastKarma();
  436. + player.sendMessage("Delevel was Successfull.");
  437. + }
  438. + else
  439. + {
  440. + NpcHtmlMessage html = new NpcHtmlMessage(1);
  441. + html.setFile("data/html/mods/Faction/delevel.htm");
  442. + html.replace("%lvl%", String.valueOf(player.getLevel()));
  443. + sendHtmlMessage(player, html);
  444. + }
  445. + }
  446. + else
  447. + {
  448. + player.sendMessage("You have to be at least level 40 to use the delevel faction.");
  449. + }
  450. + return;
  451. + }
  452. + else if (actualCommand.equalsIgnoreCase("levelup"))
  453. + {
  454. + setTarget(player);
  455. + int lvl = player.getLevel();
  456. + if (val.equalsIgnoreCase("1"))
  457. + {
  458. + long addexp = 0;
  459. + addexp = player.getStat().getExpForLevel(lvl + 1) - player.getStat().getExp();
  460. + player.getStat().addExp(addexp);
  461. + player.broadcastKarma();
  462. + player.sendMessage("Level Up was Successfull.");
  463. + }
  464. + else
  465. + {
  466. + NpcHtmlMessage html = new NpcHtmlMessage(1);
  467. + html.setFile("data/html/mods/Faction/levelup.htm");
  468. + html.replace("%lvl%", String.valueOf(player.getLevel()));
  469. + sendHtmlMessage(player, html);
  470. + }
  471. + }
  472. + else if (actualCommand.equalsIgnoreCase("setnobless"))
  473. + {
  474. + setTarget(player);
  475. + if (player.isNoble())
  476. + {
  477. + player.sendMessage("You have allready nobless status.");
  478. + player.sendPacket(ActionFailed.STATIC_PACKET);
  479. + }
  480. + else
  481. + {
  482. + player.setNoble(true, true);
  483. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  484. + {
  485. + PreparedStatement statement = con.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  486. + statement.setString(1, player.getName());
  487. + ResultSet rset = statement.executeQuery();
  488. + int objId = 0;
  489. + if (rset.next())
  490. + {
  491. + objId = rset.getInt(1);
  492. + }
  493. + rset.close();
  494. + statement.close();
  495. + if (objId == 0)
  496. + {
  497. + con.close();
  498. + return;
  499. + }
  500. + statement = con.prepareStatement("UPDATE characters SET nobless=1 WHERE obj_id=?");
  501. + statement.setInt(1, objId);
  502. + statement.execute();
  503. + statement.close();
  504. + con.close();
  505. + }
  506. + catch (Exception e)
  507. + {
  508. + _log.warning("Could not set Nobless status of char.");
  509. + }
  510. + System.out.println("##KvN Engine## : Player " + player.getName() + " has gain noble status");
  511. + player.sendMessage("You Gaine Nobless Status.");
  512. + }
  513. + }
  514. + else if (actualCommand.equalsIgnoreCase("setffaction"))
  515. + {
  516. + setTarget(player);
  517. + if (player.isffaction())
  518. + {
  519. + player.sendMessage("You are allready a " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction.");
  520. + player.sendPacket(ActionFailed.STATIC_PACKET);
  521. + }
  522. + else
  523. + {
  524. + if (player.issfaction())
  525. + {
  526. + player.sendMessage("You Cant Change Faction.");
  527. + player.sendPacket(ActionFailed.STATIC_PACKET);
  528. + }
  529. + else
  530. + {
  531. + {
  532. + player.setffaction(true);
  533. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  534. + {
  535. + PreparedStatement statement = con.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  536. + statement.setString(1, player.getName());
  537. + ResultSet rset = statement.executeQuery();
  538. + int objId = 0;
  539. + if (rset.next())
  540. + {
  541. + objId = rset.getInt(1);
  542. + }
  543. + rset.close();
  544. + statement.close();
  545. + if (objId == 0)
  546. + {
  547. + con.close();
  548. + return;
  549. + }
  550. + statement = con.prepareStatement("UPDATE characters SET ffaction=1 WHERE obj_id=?");
  551. + statement.setInt(1, objId);
  552. + statement.execute();
  553. + statement.close();
  554. + con.close();
  555. + }
  556. + catch (Exception e)
  557. + {
  558. + _log.warning("Could not set ffaction status of char:");
  559. + }
  560. + System.out.println("Faction Engine : Player " + player.getName() + " has choose " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction");
  561. + if (player.isffaction() == true)
  562. + {
  563. + player.broadcastUserInfo();
  564. + player.sendMessage("You are fighiting now for " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction ");
  565. + player.getAppearance().setNameColor(Config.FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR);
  566. + player.setTitle(Config.FACTION_SYSTEM_FIRST_FACTION_NAME);
  567. + player.getAppearance().setTitleColor(Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR);
  568. + player.teleToLocation(Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z, 0);
  569. + }
  570. + }
  571. + }
  572. + }
  573. + }
  574. + else if (actualCommand.equalsIgnoreCase("setsfaction"))
  575. + {
  576. + setTarget(player);
  577. + if (player.issfaction())
  578. + {
  579. + player.sendMessage("You are allready a " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " faction.");
  580. + player.sendPacket(ActionFailed.STATIC_PACKET);
  581. + }
  582. + else
  583. + {
  584. + if (player.isffaction())
  585. + {
  586. + player.sendMessage("You cant change faction.");
  587. + player.sendPacket(ActionFailed.STATIC_PACKET);
  588. + }
  589. + else
  590. + {
  591. + @SuppressWarnings("unused")
  592. + int getnoobs = World.getInstance().getAllnoobPlayers().size();
  593. + @SuppressWarnings("unused")
  594. + int getkoofs = World.getInstance().getAllkoofPlayers().size();
  595. + {
  596. + player.setsfaction(true);
  597. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  598. + {
  599. + PreparedStatement statement = con.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  600. + statement.setString(1, player.getName());
  601. + ResultSet rset = statement.executeQuery();
  602. + int objId = 0;
  603. + if (rset.next())
  604. + {
  605. + objId = rset.getInt(1);
  606. + }
  607. + rset.close();
  608. + statement.close();
  609. + if (objId == 0)
  610. + {
  611. + con.close();
  612. + return;
  613. + }
  614. + statement = con.prepareStatement("UPDATE characters SET sfaction=1 WHERE obj_id=?");
  615. + statement.setInt(1, objId);
  616. + statement.execute();
  617. + statement.close();
  618. + con.close();
  619. + }
  620. + catch (Exception e)
  621. + {
  622. + _log.warning("Could not set sfaction status of char:");
  623. + }
  624. + System.out.println("Faction Engine : player " + player.getName() + " Has choose " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " Faction");
  625. + if (player.issfaction() == true)
  626. + {
  627. + player.broadcastUserInfo();
  628. + player.sendMessage("You are fighiting now for " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " faction ");
  629. + player.getAppearance().setNameColor(Config.FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR);
  630. + player.setTitle(Config.FACTION_SYSTEM_SECOND_FACTION_NAME);
  631. + player.getAppearance().setTitleColor(Config.FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR);
  632. + player.teleToLocation(Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z, 0);
  633. + }
  634. + }
  635. + }
  636. + }
  637. + }
  638. + else
  639. + {
  640. + super.onBypassFeedback(player, command);
  641. + }
  642. + }
  643. +
  644. + @Override
  645. + public void onAction(L2PcInstance player)
  646. + {
  647. + if (this != player.getTarget())
  648. + {
  649. + player.setTarget(this);
  650. + player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
  651. + player.sendPacket(new ValidateLocation(this));
  652. + }
  653. + else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false))
  654. + {
  655. + SocialAction sa = new SocialAction(player, Rnd.get(8));
  656. + broadcastPacket(sa);
  657. + player.setCurrentFolkNPC(this);
  658. + showMessageWindow(player);
  659. + player.sendPacket(ActionFailed.STATIC_PACKET);
  660. + }
  661. + else
  662. + {
  663. + player.getAI().setIntention(CtrlIntention.INTERACT, this);
  664. + player.sendPacket(ActionFailed.STATIC_PACKET);
  665. + }
  666. + }
  667. +
  668. + private void showMessageWindow(L2PcInstance player)
  669. + {
  670. + NpcHtmlMessage html = new NpcHtmlMessage(1);
  671. + html.setFile("data/html/mods/Faction/faction.htm");
  672. + html.replace("%objectId%", String.valueOf(getObjectId()));
  673. + html.replace("%npcname%", getName());
  674. + player.sendPacket(html);
  675. + }
  676. +
  677. + private void sendHtmlMessage(L2PcInstance player, NpcHtmlMessage html)
  678. + {
  679. + html.replace("%objectId%", String.valueOf(getObjectId()));
  680. + html.replace("%npcname%", getName());
  681. + html.replace("%npcId%", String.valueOf(getNpcId()));
  682. + player.sendPacket(html);
  683. + }
  684. +}
  685. \ No newline at end of file
  686. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java
  687. ===================================================================
  688. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (revision 24)
  689. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (working copy)
  690. @@ -59,6 +59,17 @@
  691. return;
  692. }
  693.  
  694. + if (targetPlayer.issfaction() && activeChar.isffaction())
  695. + {
  696. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  697. + return;
  698. + }
  699. + if (targetPlayer.isffaction() && activeChar.issfaction())
  700. + {
  701. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  702. + return;
  703. + }
  704. +
  705. if (Config.LOG_CHAT)
  706. {
  707. LogRecord record = new LogRecord(Level.INFO, _message);
  708. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java
  709. ===================================================================
  710. --- java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (revision 24)
  711. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (working copy)
  712. @@ -73,6 +73,19 @@
  713. continue;
  714. }
  715.  
  716. + if (player.isffaction())
  717. + {
  718. + player.sendMessage("You Cannot Use This Skill.");
  719. + player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
  720. + return;
  721. + }
  722. + if (player.issfaction())
  723. + {
  724. + player.sendMessage("You Cannot Use This Skill.");
  725. + player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
  726. + return;
  727. + }
  728. +
  729. // Send a request for Summon Friend skill.
  730. if (skill.getId() == 1403)
  731. {
  732. Index: java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java
  733. ===================================================================
  734. --- java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (revision 24)
  735. +++ java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (working copy)
  736. @@ -60,6 +60,18 @@
  737. return;
  738. }
  739.  
  740. + L2PcInstance player2 = target;
  741. + if (player2.issfaction() && player.isffaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  742. + {
  743. + player.sendMessage("You Cant Trade with the Different Faction");
  744. + return;
  745. + }
  746. + if (player2.isffaction() && player.issfaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  747. + {
  748. + player.sendMessage("You Cant Trade with the Different Faction");
  749. + return;
  750. + }
  751. +
  752. // Alt game - Karma punishment
  753. if (!Config.KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || target.getKarma() > 0))
  754. {
  755. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java
  756. ===================================================================
  757. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (revision 24)
  758. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (working copy)
  759. @@ -21,6 +21,7 @@
  760. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.StoreType;
  761. import net.sf.l2j.gameserver.model.tradelist.TradeList;
  762. import net.sf.l2j.gameserver.network.SystemMessageId;
  763. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  764.  
  765. public final class RequestPrivateStoreSell extends L2GameClientPacket
  766. {
  767. @@ -76,6 +77,15 @@
  768.  
  769. if (storePlayer.getStoreType() != StoreType.BUY)
  770. return;
  771. + if (Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS)
  772. + {
  773. + if ((storePlayer.issfaction() && player.isffaction()) || (storePlayer.isffaction() && player.issfaction()))
  774. + {
  775. + player.sendMessage("You Cant Sell on a Different Faction");
  776. + sendPacket(ActionFailed.STATIC_PACKET);
  777. + return;
  778. + }
  779. + }
  780.  
  781. if (player.isCursedWeaponEquipped())
  782. return;
  783. Index: java/net/sf/l2j/Config.java
  784. ===================================================================
  785. --- java/net/sf/l2j/Config.java (revision 24)
  786. +++ java/net/sf/l2j/Config.java (working copy)
  787. @@ -482,6 +482,38 @@
  788. /** Buffs */
  789. public static boolean STORE_SKILL_COOLTIME;
  790. public static int BUFFS_MAX_AMOUNT;
  791. + /** faction */
  792. + public static boolean FACTION_SYSTEM_ENABLE;
  793. + public static boolean REVIVE_BASE_FACTION;
  794. + public static int FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR;
  795. + public static int FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR;
  796. + public static String FACTION_SYSTEM_FIRST_FACTION_NAME;
  797. + public static String FACTION_SYSTEM_SECOND_FACTION_NAME;
  798. + public static boolean FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN;
  799. + public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_X;
  800. + public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_Y;
  801. + public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_Z;
  802. + public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X;
  803. + public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y;
  804. + public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z;
  805. + public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X;
  806. + public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y;
  807. + public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z;
  808. + public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_75;
  809. + public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_80;
  810. + public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_85;
  811. + public static boolean FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS;
  812. + public static boolean FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE;
  813. + public static boolean FACTION_SYSTEM_NEW_CHAR_SET_HERO;
  814. + public static int FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR;
  815. + public static int FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR;
  816. + public static int FACTION_SYSTEM_ALT_WAREHOUSE_FEE;
  817. + public static boolean FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP;
  818. + public static int FACTION_SYSTEM_PVP_ITEM_REWARD_ID;
  819. + public static int FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
  820. + public static int FACTION_SYSTEM_ANNOUNCE_DELAY;
  821. + public static boolean FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS;
  822. + public static boolean FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN;
  823.  
  824. // --------------------------------------------------
  825. // Sieges
  826. @@ -1184,6 +1216,37 @@
  827.  
  828. BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
  829. STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
  830. + FACTION_SYSTEM_ENABLE = players.getProperty("FactionSystemEnable", false);
  831. + REVIVE_BASE_FACTION = players.getProperty("FactionReviveEnable", false);
  832. + FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR = Integer.decode("0x" + players.getProperty("FirstFactionTitleColor", ""));
  833. + FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR = Integer.decode("0x" + players.getProperty("SecondFactionTitleColor", ""));
  834. + FACTION_SYSTEM_FIRST_FACTION_NAME = players.getProperty("FirstFactionName", "Villagers");
  835. + FACTION_SYSTEM_SECOND_FACTION_NAME = players.getProperty("SecondFactionName", "Pirates");
  836. + FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN = players.getProperty("NewCharAltSpawn", false);
  837. + FACTION_SYSTEM_NEW_CHAR_SPAWN_X = players.getProperty("NewCharSpawnX", 0);
  838. + FACTION_SYSTEM_NEW_CHAR_SPAWN_Y = players.getProperty("NewCharSpawnY", 0);
  839. + FACTION_SYSTEM_NEW_CHAR_SPAWN_Z = players.getProperty("NewCharSpawnZ", 0);
  840. + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X = players.getProperty("FirstFactionBaseSpawnX", 0);
  841. + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y = players.getProperty("FirstFactionBaseSpawnY", 0);
  842. + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z = players.getProperty("FirstFactionBaseSpawnZ", 0);
  843. + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X = players.getProperty("SecondFactionBaseSpawnX", 0);
  844. + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y = players.getProperty("SecondFactionBaseSpawnY", 0);
  845. + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z = players.getProperty("SecondFactionBaseSpawnZ", 0);
  846. + FACTION_SYSTEM_NEW_CHAR_LEVEL_75 = players.getProperty("NewCharLevel75", false);
  847. + FACTION_SYSTEM_NEW_CHAR_LEVEL_80 = players.getProperty("NewCharLevel80", false);
  848. + FACTION_SYSTEM_NEW_CHAR_LEVEL_85 = players.getProperty("NewCharLevel85", false);
  849. + FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS = players.getProperty("AllowTradeBetweenFactions", false);
  850. + FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE = players.getProperty("NewCharSetNoblesse", false);
  851. + FACTION_SYSTEM_NEW_CHAR_SET_HERO = Boolean.parseBoolean(players.getProperty("NewCharSetHero", "False"));
  852. + FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR = Integer.decode("0x" + players.getProperty("FirstFactionNameColor", ""));
  853. + FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR = Integer.decode("0x" + players.getProperty("SecondFactionNameColor", ""));
  854. + FACTION_SYSTEM_ALT_WAREHOUSE_FEE = players.getProperty("AltWarehouseDepositFee", 0);
  855. + FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP = players.getProperty("AllowPvPReward", false);
  856. + FACTION_SYSTEM_PVP_ITEM_REWARD_ID = players.getProperty("PvPRewardID", 57);
  857. + FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT = players.getProperty("PvPRewardAmount", 1);
  858. + FACTION_SYSTEM_ANNOUNCE_DELAY = Integer.parseInt(players.getProperty("AnnouncePlayersDelay", ""));
  859. + FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS = players.getProperty("AllowBuyBetweenFactions", false);
  860. + FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN = players.getProperty("AllowAltSpawnForNewChars", false);
  861. }
  862.  
  863. /**
  864. Index: config/players.properties
  865. ===================================================================
  866. --- config/players.properties (revision 24)
  867. +++ config/players.properties (working copy)
  868. @@ -286,4 +286,91 @@
  869. MaxBuffsAmount = 20
  870.  
  871. # Store buffs/debuffs on user logout?
  872. -StoreSkillCooltime = True
  873. \ No newline at end of file
  874. +StoreSkillCooltime = True
  875. +
  876. +EnableManaPotionSupport = False
  877. +
  878. +# ---------------------------------------------------------------------------
  879. +# Faction System By Stefoulis15
  880. +# ---------------------------------------------------------------------------
  881. +# Faction System is Something Really Unique. You Must Have Full Knowledge of What You Are Doing When Activating It.
  882. +# Faction System Cannot Work With TvT Events , CTF , DM , KOTH And Others.
  883. +
  884. +# Enable Stefoulis15 Faction System?
  885. +FactionSystemEnable = True
  886. +
  887. +# Enable Revive Faction System?
  888. +FactionReviveEnable = True
  889. +
  890. +# Annnounce Faction Players
  891. +# Values Are In Minutes
  892. +AnnouncePlayersDelay =
  893. +
  894. +# Set The Faction Name of The First Faction.
  895. +FirstFactionName = Horda
  896. +
  897. +# Set The Faction Name of The Second Faction.
  898. +SecondFactionName = Alianza
  899. +
  900. +# Allow Alternative Spawn Place For New Created Characters
  901. +AllowAltSpawnForNewChars = True
  902. +
  903. +# Set The Spawn Location of New Created Characters
  904. +NewCharSpawnX = 139990
  905. +NewCharSpawnY = -124423
  906. +NewCharSpawnZ = -1903
  907. +
  908. +# Set The Base of The First Faction
  909. +FirstFactionBaseSpawnX = -84318
  910. +FirstFactionBaseSpawnY = 244579
  911. +FirstFactionBaseSpawnZ = -3730
  912. +
  913. +# Set The Base of The Second Faction
  914. +SecondFactionBaseSpawnX = -44836
  915. +SecondFactionBaseSpawnY = -112524
  916. +SecondFactionBaseSpawnZ = -235
  917. +
  918. +# Set All The New Characters At the Selected Level On Their Creation?
  919. +NewCharLevel75 = True
  920. +NewCharLevel80 = False
  921. +NewCharLevel85 = False
  922. +
  923. +# Allow Trade Between Two Factions?
  924. +AllowTradeBetweenFactions = True
  925. +
  926. +# Allow Buy Between Two Factions?
  927. +AllowBuyBetweenFactions = True
  928. +
  929. +# Set All The New Characters Noblesse , On Their Creation?
  930. +NewCharSetNoblesse = True
  931. +
  932. +# Set All The New Characters Heroes , On Their Creation?
  933. +NewCharSetHero = True
  934. +
  935. +# Set The Name Color of The First Faction
  936. +# Values Must Be In RGB
  937. +FirstFactionNameColor = 0000FF
  938. +
  939. +# Set The Name Color of The Second Creation
  940. +# Values Must Be In RGB
  941. +SecondFactionNameColor = FF0000
  942. +
  943. +# Set The Title Color of The First Faction
  944. +# Values Must Be In RGB
  945. +FirstFactionTitleColor = 0000FF
  946. +
  947. +# Set The Title Color of The Second Faction
  948. +# Values Must Be In RGB
  949. +SecondFactionTitleColor = FF0000
  950. +
  951. +# Set The Alternative Warehouse Deposit Fee
  952. +AltWarehouseDepositFee = 10000
  953. +
  954. +# Allow Reward for Each PvP?
  955. +AllowPvPReward = True
  956. +
  957. +# Set The Item You Want as a Reward
  958. +PvPRewardID = 57
  959. +
  960. +# Set The Amount of The Reward
  961. +PvPRewardAmount = 1
  962. \ No newline at end of file
  963. Index: java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java
  964. ===================================================================
  965. --- java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (revision 24)
  966. +++ java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (working copy)
  967. @@ -14,6 +14,7 @@
  968. */
  969. package net.sf.l2j.gameserver.network.clientpackets;
  970.  
  971. +import net.sf.l2j.Config;
  972. import net.sf.l2j.gameserver.model.World;
  973. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  974. import net.sf.l2j.gameserver.network.SystemMessageId;
  975. @@ -46,6 +47,17 @@
  976. final L2PcInstance partner = player.getActiveRequester();
  977. if (partner == null || World.getInstance().getPlayer(partner.getObjectId()) == null)
  978. {
  979. + L2PcInstance player2 = player.getActiveRequester();
  980. + if (player2.issfaction() && player.isffaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  981. + {
  982. + player.sendMessage("You Cant Trade With The Other Faction");
  983. + return;
  984. + }
  985. + if (player2.isffaction() && player.issfaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  986. + {
  987. + player.sendMessage("You Cant Trade With The Other Faction");
  988. + return;
  989. + }
  990. // Trade partner not found, cancel trade
  991. player.sendPacket(new SendTradeDone(0));
  992. player.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
  993. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java
  994. ===================================================================
  995. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (revision 24)
  996. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (working copy)
  997. @@ -24,6 +24,7 @@
  998. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.StoreType;
  999. import net.sf.l2j.gameserver.model.tradelist.TradeList;
  1000. import net.sf.l2j.gameserver.network.SystemMessageId;
  1001. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  1002. import net.sf.l2j.gameserver.util.Util;
  1003.  
  1004. public final class RequestPrivateStoreBuy extends L2GameClientPacket
  1005. @@ -86,6 +87,16 @@
  1006. if (storeList == null)
  1007. return;
  1008.  
  1009. + if (Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS)
  1010. + {
  1011. + if ((storePlayer.issfaction() && player.isffaction()) || (storePlayer.isffaction() && player.issfaction()))
  1012. + {
  1013. + player.sendMessage("You Cannot Buy From an Other Faction");
  1014. + sendPacket(ActionFailed.STATIC_PACKET);
  1015. + return;
  1016. + }
  1017. + }
  1018. +
  1019. if (!player.getAccessLevel().allowTransaction())
  1020. {
  1021. player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
  1022. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java
  1023. ===================================================================
  1024. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java (revision 24)
  1025. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
  1026. @@ -140,7 +140,20 @@
  1027. break;
  1028.  
  1029. default:
  1030. - loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN);
  1031. + if (Config.REVIVE_BASE_FACTION)
  1032. + {
  1033. + if (activeChar.isffaction())
  1034. + {
  1035. + loc = new Location(Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z);// coordenada 1
  1036. + }
  1037. + if (activeChar.issfaction())
  1038. + {
  1039. + loc = new Location(Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z);// coordenada2
  1040. + break;
  1041. + }
  1042. + }
  1043. + else
  1044. + loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN);
  1045. break;
  1046. }
  1047.  
  1048. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java
  1049. ===================================================================
  1050. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (revision 24)
  1051. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (working copy)
  1052. @@ -14,6 +14,7 @@
  1053. */
  1054. package net.sf.l2j.gameserver.network.clientpackets;
  1055.  
  1056. +import net.sf.l2j.Config;
  1057. import net.sf.l2j.gameserver.model.BlockList;
  1058. import net.sf.l2j.gameserver.model.World;
  1059. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1060. @@ -48,6 +49,18 @@
  1061. return;
  1062. }
  1063.  
  1064. + if (friend.issfaction() && activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
  1065. + {
  1066. + // Target is wrong.
  1067. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  1068. + return;
  1069. + }
  1070. + else if (friend.isffaction() && activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
  1071. + {
  1072. + // Target is wrong.
  1073. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  1074. + return;
  1075. + }
  1076. if (friend == activeChar)
  1077. {
  1078. // You cannot add yourself to your own friend list.
  1079. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  1080. ===================================================================
  1081. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 24)
  1082. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  1083. @@ -324,8 +324,8 @@
  1084. private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  1085.  
  1086. private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade,last_recom_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  1087. - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
  1088. - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
  1089. + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,ffaction=?,sfaction=? WHERE obj_id=?";
  1090. + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,ffaction,sfaction FROM characters WHERE obj_id=?";
  1091.  
  1092. private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
  1093. private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
  1094. @@ -467,6 +467,8 @@
  1095.  
  1096. private boolean _isNoble;
  1097. private boolean _isHero;
  1098. + private boolean _isffaction = false;
  1099. + private boolean _issfaction = false;
  1100.  
  1101. private L2Npc _currentFolkNpc;
  1102.  
  1103. @@ -4127,6 +4129,16 @@
  1104. return;
  1105. }
  1106.  
  1107. + if (Config.FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP && Config.FACTION_SYSTEM_ENABLE)
  1108. + {
  1109. + if ((issfaction() && targetPlayer.issfaction()) || (isffaction() && targetPlayer.isffaction()))
  1110. + {
  1111. + sendMessage("Cannot Get PvP Reward From The Same Faction.");
  1112. + sendPacket(ActionFailed.STATIC_PACKET);
  1113. + return;
  1114. + }
  1115. + }
  1116. +
  1117. // If in duel and you kill (only can kill l2summon), do nothing
  1118. if (isInDuel() && targetPlayer.isInDuel())
  1119. return;
  1120. @@ -4150,7 +4162,7 @@
  1121. }
  1122.  
  1123. // Check if it's pvp (cases : regular, wars, victim is PKer)
  1124. - if (checkIfPvP(target) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY && getPledgeType() != L2Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
  1125. + if (checkIfPvP(target) || (isffaction() && targetPlayer.issfaction()) || (issfaction() && targetPlayer.isffaction()) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY && getPledgeType() != L2Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
  1126. {
  1127. if (target instanceof L2PcInstance)
  1128. {
  1129. @@ -4161,6 +4173,13 @@
  1130. sendPacket(new UserInfo(this));
  1131. }
  1132. }
  1133. + if (Config.FACTION_SYSTEM_ENABLE)
  1134. + {
  1135. + int itemReward = Config.FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
  1136. + int idReward = Config.FACTION_SYSTEM_PVP_ITEM_REWARD_ID;
  1137. + addItem("Loot", idReward, itemReward, this, true);
  1138. + sendMessage("You Won " + itemReward + " " + idReward + " From Your Kill.");
  1139. + }
  1140. // Otherwise, killer is considered as a PKer.
  1141. else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
  1142. {
  1143. @@ -4178,6 +4197,11 @@
  1144.  
  1145. public void updatePvPStatus()
  1146. {
  1147. + if (!issfaction() || !isffaction())
  1148. + {
  1149. + return;
  1150. + }
  1151. +
  1152. if (isInsideZone(ZoneId.PVP))
  1153. return;
  1154.  
  1155. @@ -4189,6 +4213,7 @@
  1156.  
  1157. public void updatePvPStatus(L2Character target)
  1158. {
  1159. +
  1160. final L2PcInstance player = target.getActingPlayer();
  1161. if (player == null)
  1162. return;
  1163. @@ -4196,6 +4221,11 @@
  1164. if (isInDuel() && player.getDuelId() == getDuelId())
  1165. return;
  1166.  
  1167. + if (player.issfaction() || player.isffaction())
  1168. + {
  1169. + return;
  1170. + }
  1171. +
  1172. if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0)
  1173. {
  1174. PvpFlagTaskManager.getInstance().add(this, checkIfPvP(player) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME);
  1175. @@ -5330,6 +5360,8 @@
  1176. player.setPkKills(rset.getInt("pkkills"));
  1177. player.setOnlineTime(rset.getLong("onlinetime"));
  1178. player.setNoble(rset.getInt("nobless") == 1, false);
  1179. + player.setffaction(rset.getInt("ffaction") == 1 ? true : false);
  1180. + player.setsfaction(rset.getInt("sfaction") == 1 ? true : false);
  1181.  
  1182. player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
  1183. if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
  1184. @@ -5763,7 +5795,9 @@
  1185. statement.setLong(47, getClanCreateExpiryTime());
  1186. statement.setString(48, getName());
  1187. statement.setLong(49, getDeathPenaltyBuffLevel());
  1188. - statement.setInt(50, getObjectId());
  1189. + statement.setInt(50, isffaction() ? 1 : 0);
  1190. + statement.setInt(51, issfaction() ? 1 : 0);
  1191. + statement.setInt(52, getObjectId());
  1192.  
  1193. statement.execute();
  1194. statement.close();
  1195. @@ -6452,6 +6486,12 @@
  1196. @Override
  1197. public boolean isAutoAttackable(L2Character attacker)
  1198. {
  1199. + if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).isffaction())
  1200. + return true;
  1201. +
  1202. + if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).issfaction())
  1203. + return true;
  1204. +
  1205. // Check if the attacker isn't the L2PcInstance Pet
  1206. if (attacker == this || attacker == getPet())
  1207. return false;
  1208. @@ -6837,7 +6877,7 @@
  1209. }
  1210.  
  1211. // Check if the target is attackable
  1212. - if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack())
  1213. + if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack() && (Config.FACTION_SYSTEM_ENABLE == false))
  1214. {
  1215. // If target is not attackable, send ActionFailed
  1216. sendPacket(ActionFailed.STATIC_PACKET);
  1217. @@ -7123,6 +7163,9 @@
  1218. */
  1219. public boolean checkPvpSkill(L2Object target, L2Skill skill)
  1220. {
  1221. + if (issfaction() || isffaction())
  1222. + return true;
  1223. +
  1224. if (skill == null || target == null)
  1225. return false;
  1226.  
  1227. @@ -8114,6 +8157,26 @@
  1228. sendPacket(sl);
  1229. }
  1230.  
  1231. + public boolean isffaction()
  1232. + {
  1233. + return _isffaction;
  1234. + }
  1235. +
  1236. + public boolean issfaction()
  1237. + {
  1238. + return _issfaction;
  1239. + }
  1240. +
  1241. + public void setffaction(boolean value)
  1242. + {
  1243. + _isffaction = value;
  1244. + }
  1245. +
  1246. + public void setsfaction(boolean value)
  1247. + {
  1248. + _issfaction = value;
  1249. + }
  1250. +
  1251. /**
  1252. * 1. Add the specified class ID as a subclass (up to the maximum number of <b>three</b>) for this character.<BR>
  1253. * 2. This method no longer changes the active _classIndex of the player. This is only done by the calling of setActiveClass() method as that should be the only way to do so.
  1254. @@ -10091,6 +10154,11 @@
  1255.  
  1256. final L2PcInstance target = cha.getActingPlayer();
  1257.  
  1258. + if (target.issfaction() || target.isffaction())
  1259. + {
  1260. + return true;
  1261. + }
  1262. +
  1263. if (isInDuel() && target.isInDuel() && target.getDuelId() == getDuelId())
  1264. return true;
Add Comment
Please, Sign In to add comment