CaFi

Untitled

Aug 20th, 2016
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.03 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  4. ===================================================================
  5. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5)
  6. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  7. @@ -313,8 +313,8 @@
  8. private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  9.  
  10. 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  11. - 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=?";
  12. - 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=?";
  13. + 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=?";
  14. + 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=?";
  15.  
  16. 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";
  17. private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
  18. @@ -446,6 +446,9 @@
  19. private boolean _noble = false;
  20. private boolean _hero = false;
  21.  
  22. + private boolean _isffaction = false;
  23. + private boolean _issfaction = false;
  24. +
  25. private L2Npc _currentFolkNpc = null;
  26.  
  27. private int _questNpcObject = 0;
  28. @@ -4203,6 +4206,34 @@
  29. return;
  30. }
  31.  
  32. + if (Config.FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP && Config.FACTION_SYSTEM_ENABLE)
  33. + {
  34. + if ((issfaction() && targetPlayer.issfaction()) || (isffaction() && targetPlayer.isffaction()))
  35. + {
  36. + sendMessage("Cannot Get PvP Reward From The Same Faction.");
  37. + sendPacket(ActionFailed.STATIC_PACKET);
  38. + return;
  39. + }
  40. + else
  41. + {
  42. + int itemReward = Config.FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
  43. + int idReward = Config.FACTION_SYSTEM_PVP_ITEM_REWARD_ID;
  44. + addItem("Loot", idReward, itemReward, this, true);
  45. + sendMessage("You Won " + itemReward + " " + idReward + " From Your Kill.");
  46. + }
  47. + }
  48. + // pvp?
  49. + if (checkIfPvP(target) || (isffaction() && targetPlayer.issfaction()) || (issfaction() && targetPlayer.isffaction()))
  50. + {
  51. + getPvpKills();
  52. + return;
  53. + }
  54. +
  55. + if (targetPlayer.issfaction() || targetPlayer.isffaction())
  56. + {
  57. + return;
  58. + }
  59. +
  60. // If in duel and you kill (only can kill l2summon), do nothing
  61. if (isInDuel() && targetPlayer.isInDuel())
  62. return;
  63. @@ -4237,6 +4268,11 @@
  64. sendPacket(new UserInfo(this));
  65. }
  66. }
  67. +
  68. + if (Config.FACTION_SYSTEM_ENABLE)
  69. + {
  70. + return;
  71. + }
  72. // Otherwise, killer is considered as a PKer.
  73. else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
  74. {
  75. @@ -4254,6 +4290,10 @@
  76.  
  77. public void updatePvPStatus()
  78. {
  79. + if (!issfaction() || !isffaction())
  80. + {
  81. + return;
  82. + }
  83. if (isInsideZone(ZoneId.PVP))
  84. return;
  85.  
  86. @@ -5493,6 +5533,8 @@
  87. player.setPkKills(rset.getInt("pkkills"));
  88. player.setOnlineTime(rset.getLong("onlinetime"));
  89. player.setNoble(rset.getInt("nobless") == 1, false);
  90. + player.setffaction(rset.getInt("ffaction") == 1 ? true : false);
  91. + player.setsfaction(rset.getInt("sfaction") == 1 ? true : false);
  92.  
  93. player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
  94. if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
  95. @@ -5922,7 +5964,9 @@
  96. statement.setLong(47, getClanCreateExpiryTime());
  97. statement.setString(48, getName());
  98. statement.setLong(49, getDeathPenaltyBuffLevel());
  99. - statement.setInt(50, getObjectId());
  100. + statement.setInt(50, isffaction() ? 1 : 0);
  101. + statement.setInt(51, issfaction() ? 1 : 0);
  102. + statement.setInt(52, getObjectId());
  103.  
  104. statement.execute();
  105. statement.close();
  106. @@ -6612,6 +6656,12 @@
  107. @Override
  108. public boolean isAutoAttackable(L2Character attacker)
  109. {
  110. + if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).isffaction())
  111. + return true;
  112. +
  113. + if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).issfaction())
  114. + return true;
  115. +
  116. // Check if the attacker isn't the L2PcInstance Pet
  117. if (attacker == this || attacker == getPet())
  118. return false;
  119. @@ -6991,7 +7041,7 @@
  120. }
  121.  
  122. // Check if the target is attackable
  123. - if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack())
  124. + if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack() && (Config.FACTION_SYSTEM_ENABLE == false))
  125. {
  126. // If target is not attackable, send ActionFailed
  127. sendPacket(ActionFailed.STATIC_PACKET);
  128. @@ -7270,6 +7320,9 @@
  129. */
  130. public boolean checkPvpSkill(L2Object target, L2Skill skill)
  131. {
  132. + if (issfaction() || isffaction())
  133. + return true;
  134. +
  135. if (skill == null || target == null)
  136. return false;
  137.  
  138. @@ -8272,6 +8325,26 @@
  139. sendPacket(sl);
  140. }
  141.  
  142. + public boolean isffaction()
  143. + {
  144. + return _isffaction;
  145. + }
  146. +
  147. + public boolean issfaction()
  148. + {
  149. + return _issfaction;
  150. + }
  151. +
  152. + public void setffaction(boolean value)
  153. + {
  154. + _isffaction = value;
  155. + }
  156. +
  157. + public void setsfaction(boolean value)
  158. + {
  159. + _issfaction = value;
  160. + }
  161. +
  162. /**
  163. * 1. Add the specified class ID as a subclass (up to the maximum number of <b>three</b>) for this character.<BR>
  164. * 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.
  165. Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
  166. ===================================================================
  167. --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 5)
  168. +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
  169. @@ -571,8 +571,21 @@
  170. return;
  171. }
  172.  
  173. + if (((L2PcInstance) this).isffaction() && ((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE)
  174. + {
  175. + ((L2PcInstance) this).sendMessage("Cant attack a player from your faction");
  176. + sendPacket(ActionFailed.STATIC_PACKET);
  177. + return;
  178. + }
  179. + if (((L2PcInstance) this).issfaction() && ((L2PcInstance) target).issfaction() && Config.FACTION_SYSTEM_ENABLE)
  180. + {
  181. + ((L2PcInstance) this).sendMessage("Cant attack a player from your faction");
  182. + sendPacket(ActionFailed.STATIC_PACKET);
  183. + return;
  184. + }
  185. +
  186. // Checking if target has moved to peace zone
  187. - if (isInsidePeaceZone(this, target))
  188. + if (isInsidePeaceZone(this, target) && !Config.FACTION_SYSTEM_ENABLE)
  189. {
  190. getAI().setIntention(CtrlIntention.ACTIVE);
  191. sendPacket(ActionFailed.STATIC_PACKET);
  192. @@ -1091,6 +1104,30 @@
  193.  
  194. boolean doit = false;
  195.  
  196. + if ((target instanceof L2PcInstance) && (this instanceof L2PcInstance))
  197. + {
  198. + if (((L2PcInstance) this).isffaction() && (((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE))
  199. + {
  200. + ((L2PcInstance) this).sendMessage("You Cannot Attack a Player From Your Faction!");
  201. + sendPacket(ActionFailed.STATIC_PACKET);
  202. + return;
  203. + }
  204. + 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)))
  205. + {
  206. + return;
  207. + }
  208. + if (((L2PcInstance) this).issfaction() && ((L2PcInstance) target).issfaction())
  209. + {
  210. + ((L2PcInstance) this).sendMessage("You Cannot Attack a Player From Your Faction!");
  211. + sendPacket(ActionFailed.STATIC_PACKET);
  212. + return;
  213. + }
  214. + 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)))
  215. + {
  216. + return;
  217. + }
  218. + }
  219. +
  220. // AURA skills should always be using caster as target
  221. switch (skill.getTargetType())
  222. {
  223. @@ -1579,7 +1616,17 @@
  224. {
  225. if (!isDead() || isTeleporting())
  226. return;
  227. -
  228. + if ((this instanceof L2PcInstance) && (((L2PcInstance) this).isffaction() && Config.FACTION_SYSTEM_ENABLE))
  229. + {
  230. + 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);
  231. + }
  232. + else
  233. + {
  234. + if ((this instanceof L2PcInstance) && (((L2PcInstance) this).issfaction() && Config.FACTION_SYSTEM_ENABLE))
  235. + {
  236. + 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);
  237. + }
  238. + }
  239. setIsDead(false);
  240.  
  241. _status.setCurrentHp(getMaxHp() * Config.RESPAWN_RESTORE_HP);
  242. Index: java/net/sf/l2j/gameserver/model/L2World.java
  243. ===================================================================
  244. --- java/net/sf/l2j/gameserver/model/L2World.java (revision 5)
  245. +++ java/net/sf/l2j/gameserver/model/L2World.java (working copy)
  246. @@ -52,6 +52,8 @@
  247. private final Map<Integer, L2Object> _objects = new ConcurrentHashMap<>();
  248. private final Map<Integer, L2PetInstance> _pets = new ConcurrentHashMap<>();
  249. private final Map<Integer, L2PcInstance> _players = new ConcurrentHashMap<>();
  250. + private Map<String, L2PcInstance> _allkoofPlayers = new ConcurrentHashMap<>();
  251. + private Map<String, L2PcInstance> _allnoobPlayers = new ConcurrentHashMap<>();
  252.  
  253. private final L2WorldRegion[][] _worldRegions = new L2WorldRegion[REGIONS_X + 1][REGIONS_Y + 1];
  254.  
  255. @@ -115,6 +117,16 @@
  256. return _players.values();
  257. }
  258.  
  259. + public Collection<L2PcInstance> getAllkoofPlayers()
  260. + {
  261. + return _allkoofPlayers.values();
  262. + }
  263. +
  264. + public Collection<L2PcInstance> getAllnoobPlayers()
  265. + {
  266. + return _allnoobPlayers.values();
  267. + }
  268. +
  269. public L2PcInstance getPlayer(String name)
  270. {
  271. return getPlayer(CharNameTable.getInstance().getIdByName(name));
  272. @@ -140,6 +152,16 @@
  273. return _pets.get(ownerId);
  274. }
  275.  
  276. + public int getAllkoofPlayersCount()
  277. + {
  278. + return _allkoofPlayers.size();
  279. + }
  280. +
  281. + public int getAllnoobPlayersCount()
  282. + {
  283. + return _allnoobPlayers.size();
  284. + }
  285. +
  286. /**
  287. * Add a L2Object in the world.<BR>
  288. * <BR>
  289. @@ -181,6 +203,14 @@
  290. tmp.logout();
  291. return;
  292. }
  293. + if (((L2PcInstance) object).isffaction())
  294. + {
  295. + _allkoofPlayers.put(player.getName().toLowerCase(), player);
  296. + }
  297. + else if (((L2PcInstance) object).issfaction())
  298. + {
  299. + _allnoobPlayers.put(player.getName().toLowerCase(), player);
  300. + }
  301. _players.putIfAbsent(player.getObjectId(), player);
  302. }
  303. }
  304. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java
  305. ===================================================================
  306. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (revision 5)
  307. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (working copy)
  308. @@ -14,6 +14,7 @@
  309. */
  310. package net.sf.l2j.gameserver.network.clientpackets;
  311.  
  312. +import net.sf.l2j.Config;
  313. import net.sf.l2j.gameserver.instancemanager.DuelManager;
  314. import net.sf.l2j.gameserver.model.L2CommandChannel;
  315. import net.sf.l2j.gameserver.model.L2Party;
  316. @@ -69,6 +70,12 @@
  317. return;
  318. }
  319.  
  320. + if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
  321. + {
  322. + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
  323. + return;
  324. + }
  325. +
  326. if (_partyDuel == 1)
  327. {
  328. // Player must be a party leader, the target can't be of the same party.
  329. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java
  330. ===================================================================
  331. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (revision 5)
  332. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (working copy)
  333. @@ -59,6 +59,17 @@
  334. return;
  335. }
  336.  
  337. + if (targetPlayer.issfaction() && activeChar.isffaction())
  338. + {
  339. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  340. + return;
  341. + }
  342. + if (targetPlayer.isffaction() && activeChar.issfaction())
  343. + {
  344. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  345. + return;
  346. + }
  347. +
  348. if (Config.LOG_CHAT)
  349. {
  350. LogRecord record = new LogRecord(Level.INFO, _message);
  351. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java
  352. ===================================================================
  353. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (revision 5)
  354. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (working copy)
  355. @@ -14,6 +14,7 @@
  356. */
  357. package net.sf.l2j.gameserver.network.clientpackets;
  358.  
  359. +import net.sf.l2j.Config;
  360. import net.sf.l2j.gameserver.model.BlockList;
  361. import net.sf.l2j.gameserver.model.L2World;
  362. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  363. @@ -48,6 +49,18 @@
  364. return;
  365. }
  366.  
  367. + if (friend.issfaction() && activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
  368. + {
  369. + // Target is wrong.
  370. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  371. + return;
  372. + }
  373. + else if (friend.isffaction() && activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
  374. + {
  375. + // Target is wrong.
  376. + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
  377. + return;
  378. + }
  379. if (friend == activeChar)
  380. {
  381. // You cannot add yourself to your own friend list.
  382. Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
  383. ===================================================================
  384. --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (revision 5)
  385. +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (working copy)
  386. @@ -14,6 +14,7 @@
  387. */
  388. package net.sf.l2j.gameserver.handler.usercommandhandlers;
  389.  
  390. +import net.sf.l2j.Config;
  391. import net.sf.l2j.gameserver.datatables.SkillTable;
  392. import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  393. import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
  394. @@ -31,6 +32,15 @@
  395. @Override
  396. public boolean useUserCommand(int id, L2PcInstance activeChar)
  397. {
  398. + if (Config.FACTION_SYSTEM_ENABLE)
  399. + {
  400. + if (activeChar.isffaction() || activeChar.issfaction())
  401. + {
  402. + activeChar.sendMessage("You Cannot Use This Command.");
  403. + return false;
  404. + }
  405. + }
  406. +
  407. if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || GrandBossManager.getInstance().isInBossZone(activeChar))
  408. {
  409. activeChar.sendMessage("Your current state doesn't allow you to use the /unstuck command.");
  410. Index: java/net/sf/l2j/gameserver/model/L2Clan.java
  411. ===================================================================
  412. --- java/net/sf/l2j/gameserver/model/L2Clan.java (revision 5)
  413. +++ java/net/sf/l2j/gameserver/model/L2Clan.java (working copy)
  414. @@ -1656,6 +1656,17 @@
  415. return false;
  416. }
  417.  
  418. + if (activeChar.isffaction() && target.issfaction() && Config.FACTION_SYSTEM_ENABLE)
  419. + {
  420. + activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
  421. + return false;
  422. + }
  423. + if (activeChar.issfaction() && target.isffaction() && Config.FACTION_SYSTEM_ENABLE)
  424. + {
  425. + activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
  426. + return false;
  427. + }
  428. +
  429. if (activeChar.getObjectId() == target.getObjectId())
  430. {
  431. activeChar.sendPacket(SystemMessageId.CANNOT_INVITE_YOURSELF);
  432. Index: config/players.properties
  433. ===================================================================
  434. --- config/players.properties (revision 5)
  435. +++ config/players.properties (working copy)
  436. @@ -294,4 +294,88 @@
  437. MaxBuffsAmount = 20
  438.  
  439. # Store buffs/debuffs on user logout?
  440. -StoreSkillCooltime = True
  441. \ No newline at end of file
  442. +StoreSkillCooltime = True
  443. +
  444. +EnableManaPotionSupport = False
  445. +
  446. +# ---------------------------------------------------------------------------
  447. +# Faction System By Stefoulis15
  448. +# ---------------------------------------------------------------------------
  449. +# Faction System is Something Really Unique. You Must Have Full Knowledge of What You Are Doing When Activating It.
  450. +# Faction System Cannot Work With TvT Events , CTF , DM , KOTH And Others.
  451. +
  452. +# Enable Stefoulis15 Faction System?
  453. +FactionSystemEnable = False
  454. +
  455. +# Annnounce Faction Players
  456. +# Values Are In Minutes
  457. +AnnouncePlayersDelay =
  458. +
  459. +# Set The Faction Name of The First Faction.
  460. +FirstFactionName = Villagers
  461. +
  462. +# Set The Faction Name of The Second Faction.
  463. +SecondFactionName = Pirates
  464. +
  465. +# Allow Alternative Spawn Place For New Created Characters
  466. +AllowAltSpawnForNewChars = False
  467. +
  468. +# Set The Spawn Location of New Created Characters
  469. +NewCharSpawnX =
  470. +NewCharSpawnY =
  471. +NewCharSpawnZ =
  472. +
  473. +# Set The Base of The First Faction
  474. +FirstFactionBaseSpawnX =
  475. +FirstFactionBaseSpawnY =
  476. +FirstFactionBaseSpawnZ =
  477. +
  478. +# Set The Base of The Second Faction
  479. +SecondFactionBaseSpawnX =
  480. +SecondFactionBaseSpawnY =
  481. +SecondFactionBaseSpawnZ =
  482. +
  483. +# Set All The New Characters At the Selected Level On Their Creation?
  484. +NewCharLevel75 = False
  485. +NewCharLevel80 = False
  486. +NewCharLevel85 = False
  487. +
  488. +# Allow Trade Between Two Factions?
  489. +AllowTradeBetweenFactions = False
  490. +
  491. +# Allow Buy Between Two Factions?
  492. +AllowBuyBetweenFactions = False
  493. +
  494. +# Set All The New Characters Noblesse , On Their Creation?
  495. +NewCharSetNoblesse = False
  496. +
  497. +# Set All The New Characters Heroes , On Their Creation?
  498. +NewCharSetHero = False
  499. +
  500. +# Set The Name Color of The First Faction
  501. +# Values Must Be In RGB
  502. +FirstFactionNameColor =
  503. +
  504. +# Set The Name Color of The Second Creation
  505. +# Values Must Be In RGB
  506. +SecondFactionNameColor =
  507. +
  508. +# Set The Title Color of The First Faction
  509. +# Values Must Be In RGB
  510. +FirstFactionTitleColor =
  511. +
  512. +# Set The Title Color of The Second Faction
  513. +# Values Must Be In RGB
  514. +SecondFactionTitleColor =
  515. +
  516. +# Set The Alternative Warehouse Deposit Fee
  517. +AltWarehouseDepositFee = 0
  518. +
  519. +# Allow Reward for Each PvP?
  520. +AllowPvPReward = False
  521. +
  522. +# Set The Item You Want as a Reward
  523. +PvPRewardID = 57
  524. +
  525. +# Set The Amount of The Reward
  526. +PvPRewardAmount = 1
  527. \ No newline at end of file
  528. Index: java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java
  529. ===================================================================
  530. --- java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 5)
  531. +++ java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy)
  532. @@ -142,9 +142,27 @@
  533. sendPacket(CharCreateOk.STATIC_PACKET);
  534.  
  535. L2World.getInstance().addObject(newChar);
  536. -
  537. + if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_75)
  538. + {
  539. + newChar.addExpAndSp(804219972L, 99999999);
  540. + }
  541. + else if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_80)
  542. + {
  543. + newChar.addExpAndSp(4200000000L, 99999999);
  544. + }
  545. + else if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_85)
  546. + {
  547. + newChar.addExpAndSp(19827360000L, 99999999);
  548. + }
  549. newChar.addAdena("Init", Config.STARTING_ADENA, null, false);
  550. - newChar.setXYZInvisible(template.getSpawnX(), template.getSpawnY(), template.getSpawnZ());
  551. + if (Config.FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN)
  552. + {
  553. + newChar.setXYZInvisible(Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_X, Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_Y, Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_Z);
  554. + }
  555. + else
  556. + {
  557. + newChar.setXYZInvisible(template.getSpawnX(), template.getSpawnY(), template.getSpawnZ());
  558. + }
  559. newChar.setTitle("");
  560.  
  561. newChar.registerShortCut(new L2ShortCut(0, 0, 3, 2, -1, 1)); // attack shortcut
  562. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java
  563. ===================================================================
  564. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (revision 5)
  565. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (working copy)
  566. @@ -44,6 +44,14 @@
  567. return;
  568.  
  569. final L2PcInstance requestor = player.getActiveRequester();
  570. + if (player.issfaction() && requestor.isffaction())
  571. + {
  572. + return;
  573. + }
  574. + if (player.isffaction() && requestor.issfaction())
  575. + {
  576. + return;
  577. + }
  578. if (requestor == null)
  579. return;
  580.  
  581. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  582. ===================================================================
  583. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 5)
  584. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
  585. @@ -80,6 +80,18 @@
  586. return;
  587. }
  588.  
  589. + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE)
  590. + {
  591. + if (!activeChar.isNoble())
  592. + activeChar.setNoble(true, false);
  593. + }
  594. +
  595. + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_HERO)
  596. + {
  597. + if (!activeChar.isHero())
  598. + activeChar.setHero(true);
  599. + }
  600. +
  601. if (activeChar.isGM())
  602. {
  603. if (Config.GM_STARTUP_INVULNERABLE && AdminCommandAccessRights.getInstance().hasAccess("admin_invul", activeChar.getAccessLevel()))
  604. @@ -97,6 +109,21 @@
  605. GmListTable.getInstance().addGm(activeChar, true);
  606. }
  607.  
  608. + if (activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
  609. + {
  610. + activeChar.getAppearance().setNameColor(Config.FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR);
  611. + activeChar.sendMessage("Welcome " + activeChar.getName() + " You Are Fighting " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " Faction");
  612. + activeChar.setTitle(Config.FACTION_SYSTEM_FIRST_FACTION_NAME);
  613. + activeChar.getAppearance().setTitleColor(Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR);
  614. + }
  615. + if (activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
  616. + {
  617. + activeChar.getAppearance().setNameColor(Config.FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR);
  618. + activeChar.sendMessage("Welcome " + activeChar.getName() + " You Are Fighting " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " Faction");
  619. + activeChar.setTitle(Config.FACTION_SYSTEM_SECOND_FACTION_NAME);
  620. + activeChar.getAppearance().setTitleColor(Config.FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR);
  621. + }
  622. +
  623. // Set dead status if applies
  624. if (activeChar.getCurrentHp() < 0.5)
  625. activeChar.setIsDead(true);
  626. Index: java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java
  627. ===================================================================
  628. --- java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java (revision 5)
  629. +++ java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java (working copy)
  630. @@ -101,7 +101,7 @@
  631. return;
  632.  
  633. // Freight price from config or normal price per item slot (30)
  634. - final int fee = _items.length * 30;
  635. + final int fee = _items.length * Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE;
  636. int currentAdena = player.getAdena();
  637. int slots = 0;
  638.  
  639. @@ -132,7 +132,7 @@
  640. }
  641.  
  642. // Check if enough adena and charge the fee
  643. - if (currentAdena < fee || !player.reduceAdena(warehouse.getName(), fee, manager, false))
  644. + if (currentAdena < Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE || !player.reduceAdena(warehouse.getName(), fee, manager, false))
  645. {
  646. sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
  647. return;
  648. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
  649. ===================================================================
  650. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (revision 5)
  651. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (working copy)
  652. @@ -70,6 +70,17 @@
  653. return;
  654. }
  655.  
  656. + if (target.isffaction() && requestor.issfaction())
  657. + {
  658. + requestor.sendPacket(SystemMessageId.INCORRECT_TARGET);
  659. + return;
  660. + }
  661. + if (target.issfaction() && requestor.isffaction())
  662. + {
  663. + requestor.sendPacket(SystemMessageId.INCORRECT_TARGET);
  664. + return;
  665. + }
  666. +
  667. if (target.getClient().isDetached())
  668. {
  669. requestor.sendMessage("The player you tried to invite is in offline mode.");
  670. Index: java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java
  671. ===================================================================
  672. --- java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (revision 5)
  673. +++ java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (working copy)
  674. @@ -73,6 +73,19 @@
  675. continue;
  676. }
  677.  
  678. + if (player.isffaction())
  679. + {
  680. + player.sendMessage("You Cannot Use This Skill.");
  681. + player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
  682. + return;
  683. + }
  684. + if (player.issfaction())
  685. + {
  686. + player.sendMessage("You Cannot Use This Skill.");
  687. + player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
  688. + return;
  689. + }
  690. +
  691. // Send a request for Summon Friend skill.
  692. if (skill.getId() == 1403)
  693. {
  694. Index: java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java
  695. ===================================================================
  696. --- java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (revision 5)
  697. +++ java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (working copy)
  698. @@ -59,6 +59,18 @@
  699. return;
  700. }
  701.  
  702. + L2PcInstance player2 = (L2PcInstance) target;
  703. + if (player2.issfaction() && player.isffaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  704. + {
  705. + player.sendMessage("You Cant Trade with the Different Faction");
  706. + return;
  707. + }
  708. + if (player2.isffaction() && player.issfaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  709. + {
  710. + player.sendMessage("You Cant Trade with the Different Faction");
  711. + return;
  712. + }
  713. +
  714. // Alt game - Karma punishment
  715. if (!Config.KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || target.getKarma() > 0))
  716. {
  717. Index: java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java
  718. ===================================================================
  719. --- java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (revision 5)
  720. +++ java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (working copy)
  721. @@ -14,6 +14,7 @@
  722. */
  723. package net.sf.l2j.gameserver.network.clientpackets;
  724.  
  725. +import net.sf.l2j.Config;
  726. import net.sf.l2j.gameserver.model.L2World;
  727. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  728. import net.sf.l2j.gameserver.network.SystemMessageId;
  729. @@ -46,6 +47,17 @@
  730. final L2PcInstance partner = player.getActiveRequester();
  731. if (partner == null || L2World.getInstance().getPlayer(partner.getObjectId()) == null)
  732. {
  733. + L2PcInstance player2 = player.getActiveRequester();
  734. + if (player2.issfaction() && player.isffaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  735. + {
  736. + player.sendMessage("You Cant Trade With The Other Faction");
  737. + return;
  738. + }
  739. + if (player2.isffaction() && player.issfaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
  740. + {
  741. + player.sendMessage("You Cant Trade With The Other Faction");
  742. + return;
  743. + }
  744. // Trade partner not found, cancel trade
  745. player.sendPacket(new SendTradeDone(0));
  746. player.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
  747. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java
  748. ===================================================================
  749. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (revision 5)
  750. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (working copy)
  751. @@ -24,6 +24,7 @@
  752. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.PrivateStoreType;
  753. import net.sf.l2j.gameserver.model.tradelist.TradeList;
  754. import net.sf.l2j.gameserver.network.SystemMessageId;
  755. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  756. import net.sf.l2j.gameserver.util.Util;
  757.  
  758. public final class RequestPrivateStoreBuy extends L2GameClientPacket
  759. @@ -86,6 +87,16 @@
  760. if (storeList == null)
  761. return;
  762.  
  763. + if (Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS)
  764. + {
  765. + if ((storePlayer.issfaction() && player.isffaction()) || (storePlayer.isffaction() && player.issfaction()))
  766. + {
  767. + player.sendMessage("You Cannot Buy From an Other Faction");
  768. + sendPacket(ActionFailed.STATIC_PACKET);
  769. + return;
  770. + }
  771. + }
  772. +
  773. if (!player.getAccessLevel().allowTransaction())
  774. {
  775. player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
  776. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java
  777. ===================================================================
  778. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (revision 5)
  779. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (working copy)
  780. @@ -21,6 +21,7 @@
  781. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.PrivateStoreType;
  782. import net.sf.l2j.gameserver.model.tradelist.TradeList;
  783. import net.sf.l2j.gameserver.network.SystemMessageId;
  784. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  785.  
  786. public final class RequestPrivateStoreSell extends L2GameClientPacket
  787. {
  788. @@ -77,6 +78,16 @@
  789. if (storePlayer.getPrivateStoreType() != PrivateStoreType.BUY)
  790. return;
  791.  
  792. + if (Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS)
  793. + {
  794. + if ((storePlayer.issfaction() && player.isffaction()) || (storePlayer.isffaction() && player.issfaction()))
  795. + {
  796. + player.sendMessage("You Cant Sell on a Different Faction");
  797. + sendPacket(ActionFailed.STATIC_PACKET);
  798. + return;
  799. + }
  800. + }
  801. +
  802. if (player.isCursedWeaponEquipped())
  803. return;
  804.  
  805. Index: java/net/sf/l2j/gameserver/GameServer.java
  806. ===================================================================
  807. --- java/net/sf/l2j/gameserver/GameServer.java (revision 5)
  808. +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
  809. @@ -274,7 +274,19 @@
  810.  
  811. StringUtil.printSection("Quests & Scripts");
  812. ScriptManager.getInstance();
  813. -
  814. + if (Config.FACTION_SYSTEM_ENABLE)
  815. + {
  816. + System.out.println("####################################");
  817. + System.out.println("## Faction System is Activated. ##");
  818. + System.out.println("####################################");
  819. + }
  820. + else
  821. + {
  822. + System.out.println("###################################");
  823. + System.out.println("## Faction System is Disabled. ##");
  824. + System.out.println("###################################");
  825. + }
  826. +
  827. if (Config.ALLOW_BOAT)
  828. {
  829. BoatManager.getInstance();
  830. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java
  831. ===================================================================
  832. --- java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java (revision 0)
  833. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java (working copy)
  834. @@ -0,0 +1,331 @@
  835. +/*
  836. + * This program is free software: you can redistribute it and/or modify it under
  837. + * the terms of the GNU General Public License as published by the Free Software
  838. + * Foundation, either version 3 of the License, or (at your option) any later
  839. + * version.
  840. + *
  841. + * This program is distributed in the hope that it will be useful, but WITHOUT
  842. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  843. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  844. + * details.
  845. + *
  846. + * You should have received a copy of the GNU General Public License along with
  847. + * this program. If not, see <http://www.gnu.org/licenses/>.
  848. + */
  849. +package net.sf.l2j.gameserver.model.actor.instance;
  850. +
  851. +import java.sql.Connection;
  852. +import java.sql.PreparedStatement;
  853. +import java.sql.ResultSet;
  854. +import java.util.StringTokenizer;
  855. +
  856. +import net.sf.l2j.Config;
  857. +import net.sf.l2j.L2DatabaseFactory;
  858. +import net.sf.l2j.commons.random.Rnd;
  859. +import net.sf.l2j.gameserver.ai.CtrlIntention;
  860. +import net.sf.l2j.gameserver.model.L2World;
  861. +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  862. +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
  863. +import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
  864. +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  865. +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
  866. +import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
  867. +
  868. +/**
  869. + * @author CaFi
  870. + */
  871. +public class L2FactionInstance extends L2NpcInstance
  872. +{
  873. + public L2FactionInstance(int objectId, NpcTemplate template)
  874. + {
  875. + super(objectId, template);
  876. + }
  877. +
  878. + @Override
  879. + public void onBypassFeedback(L2PcInstance player, String command)
  880. + {
  881. + player.sendPacket(ActionFailed.STATIC_PACKET);
  882. + StringTokenizer st = new StringTokenizer(command, " ");
  883. + String actualCommand = st.nextToken();
  884. + String val = "";
  885. + if (st.countTokens() >= 1)
  886. + {
  887. + val = st.nextToken();
  888. + }
  889. + if (actualCommand.equalsIgnoreCase("delevel"))
  890. + {
  891. + setTarget(player);
  892. + int lvl = player.getLevel();
  893. + if (lvl > 40)
  894. + {
  895. + if (val.equalsIgnoreCase("1"))
  896. + {
  897. + long delexp = 0;
  898. + delexp = player.getStat().getExp() - player.getStat().getExpForLevel(lvl - 1);
  899. + player.getStat().addExp(-delexp);
  900. + player.broadcastKarma();
  901. + player.sendMessage("Delevel was Successfull.");
  902. + }
  903. + else
  904. + {
  905. + NpcHtmlMessage html = new NpcHtmlMessage(1);
  906. + html.setFile("data/html/mods/Faction/delevel.htm");
  907. + html.replace("%lvl%", String.valueOf(player.getLevel()));
  908. + sendHtmlMessage(player, html);
  909. + }
  910. + }
  911. + else
  912. + {
  913. + player.sendMessage("You have to be at least level 40 to use the delevel faction.");
  914. + }
  915. + return;
  916. + }
  917. + else if (actualCommand.equalsIgnoreCase("levelup"))
  918. + {
  919. + setTarget(player);
  920. + int lvl = player.getLevel();
  921. + if (val.equalsIgnoreCase("1"))
  922. + {
  923. + long addexp = 0;
  924. + addexp = player.getStat().getExpForLevel(lvl + 1) - player.getStat().getExp();
  925. + player.getStat().addExp(addexp);
  926. + player.broadcastKarma();
  927. + player.sendMessage("Level Up was Successfull.");
  928. + }
  929. + else
  930. + {
  931. + NpcHtmlMessage html = new NpcHtmlMessage(1);
  932. + html.setFile("data/html/mods/Faction/levelup.htm");
  933. + html.replace("%lvl%", String.valueOf(player.getLevel()));
  934. + sendHtmlMessage(player, html);
  935. + }
  936. + }
  937. + else if (actualCommand.equalsIgnoreCase("setnobless"))
  938. + {
  939. + setTarget(player);
  940. + if (player.isNoble())
  941. + {
  942. + player.sendMessage("You have allready nobless status.");
  943. + player.sendPacket(ActionFailed.STATIC_PACKET);
  944. + }
  945. + else
  946. + {
  947. + player.setNoble(true, true);
  948. + Connection connection = null;
  949. + try
  950. + {
  951. + connection = L2DatabaseFactory.getInstance().getConnection();
  952. + PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  953. + statement.setString(1, player.getName());
  954. + ResultSet rset = statement.executeQuery();
  955. + int objId = 0;
  956. + if (rset.next())
  957. + {
  958. + objId = rset.getInt(1);
  959. + }
  960. + rset.close();
  961. + statement.close();
  962. + if (objId == 0)
  963. + {
  964. + connection.close();
  965. + return;
  966. + }
  967. + statement = connection.prepareStatement("UPDATE characters SET nobless=1 WHERE obj_id=?");
  968. + statement.setInt(1, objId);
  969. + statement.execute();
  970. + statement.close();
  971. + connection.close();
  972. + }
  973. + catch (Exception e)
  974. + {
  975. + _log.warning("Could not set Nobless status of char.");
  976. + }
  977. + System.out.println("##KvN Engine## : Player " + player.getName() + " has gain noble status");
  978. + player.sendMessage("You Gaine Nobless Status.");
  979. + }
  980. + }
  981. + else if (actualCommand.equalsIgnoreCase("setffaction"))
  982. + {
  983. + setTarget(player);
  984. + if (player.isffaction())
  985. + {
  986. + player.sendMessage("You are allready a " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction.");
  987. + player.sendPacket(ActionFailed.STATIC_PACKET);
  988. + }
  989. + else
  990. + {
  991. + if (player.issfaction())
  992. + {
  993. + player.sendMessage("You Cant Change Faction.");
  994. + player.sendPacket(ActionFailed.STATIC_PACKET);
  995. + }
  996. + else
  997. + {
  998. + // int getnoobs = L2World.getInstance().getAllnoobPlayers().size();
  999. + // int getkoofs = L2World.getInstance().getAllkoofPlayers().size();
  1000. + // if (getkoofs > getnoobs)
  1001. + {
  1002. + // player.sendMessage("It is more " + Config.KOOF_NAME_TEAM + " members online.");
  1003. + // player.sendPacket(ActionFailed.STATIC_PACKET);
  1004. + // } else
  1005. + // {
  1006. + player.setffaction(true);
  1007. + Connection connection = null;
  1008. + try
  1009. + {
  1010. + connection = L2DatabaseFactory.getInstance().getConnection();
  1011. + PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  1012. + statement.setString(1, player.getName());
  1013. + ResultSet rset = statement.executeQuery();
  1014. + int objId = 0;
  1015. + if (rset.next())
  1016. + {
  1017. + objId = rset.getInt(1);
  1018. + }
  1019. + rset.close();
  1020. + statement.close();
  1021. + if (objId == 0)
  1022. + {
  1023. + connection.close();
  1024. + return;
  1025. + }
  1026. + statement = connection.prepareStatement("UPDATE characters SET koof=1 WHERE obj_id=?");
  1027. + statement.setInt(1, objId);
  1028. + statement.execute();
  1029. + statement.close();
  1030. + connection.close();
  1031. + }
  1032. + catch (Exception e)
  1033. + {
  1034. + _log.warning("Could not set koof status of char:");
  1035. + }
  1036. + System.out.println("##KvN Engine## : Player " + player.getName() + " has choose " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction");
  1037. + if (player.isffaction() == true)
  1038. + {
  1039. + player.broadcastUserInfo();
  1040. + player.sendMessage("You are fighiting now for " + Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR + " faction ");
  1041. + player.getAppearance().setNameColor(Config.FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR);
  1042. + player.getAppearance().setTitleColor(Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR);
  1043. + player.teleToLocation(146334, 25767, -2013, 0);
  1044. + }
  1045. + }
  1046. + }
  1047. + }
  1048. + }
  1049. + else if (actualCommand.equalsIgnoreCase("setsfaction"))
  1050. + {
  1051. + setTarget(player);
  1052. + if (player.issfaction())
  1053. + {
  1054. + player.sendMessage("You are allready a " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " faction.");
  1055. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1056. + }
  1057. + else
  1058. + {
  1059. + if (player.isffaction())
  1060. + {
  1061. + player.sendMessage("You cant change faction.");
  1062. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1063. + }
  1064. + else
  1065. + {
  1066. + @SuppressWarnings("unused")
  1067. + int getnoobs = L2World.getInstance().getAllnoobPlayers().size();
  1068. + @SuppressWarnings("unused")
  1069. + int getkoofs = L2World.getInstance().getAllkoofPlayers().size();
  1070. + // if (getnoobs > getkoofs)
  1071. + {
  1072. + // player.sendMessage("It is more " + Config.NOOB_NAME_TEAM + " members online.");
  1073. + // player.sendPacket(ActionFailed.STATIC_PACKET);
  1074. + // } else
  1075. + // {
  1076. + player.setsfaction(true);
  1077. + Connection connection = null;
  1078. + try
  1079. + {
  1080. + connection = L2DatabaseFactory.getInstance().getConnection();
  1081. + PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?");
  1082. + statement.setString(1, player.getName());
  1083. + ResultSet rset = statement.executeQuery();
  1084. + int objId = 0;
  1085. + if (rset.next())
  1086. + {
  1087. + objId = rset.getInt(1);
  1088. + }
  1089. + rset.close();
  1090. + statement.close();
  1091. + if (objId == 0)
  1092. + {
  1093. + connection.close();
  1094. + return;
  1095. + }
  1096. + statement = connection.prepareStatement("UPDATE characters SET noob=1 WHERE obj_id=?");
  1097. + statement.setInt(1, objId);
  1098. + statement.execute();
  1099. + statement.close();
  1100. + connection.close();
  1101. + }
  1102. + catch (Exception e)
  1103. + {
  1104. + _log.warning("Could not set noob status of char:");
  1105. + }
  1106. + System.out.println("##KvN Engine## : player " + player.getName() + " Has choose " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " Faction");
  1107. + if (player.issfaction() == true)
  1108. + {
  1109. + player.broadcastUserInfo();
  1110. + player.sendMessage("You are fighiting now for " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " faction ");
  1111. + player.getAppearance().setNameColor(Config.FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR);
  1112. + player.getAppearance().setTitleColor(Config.FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR);
  1113. + player.teleToLocation(59669, -42221, -2992, 0);
  1114. + }
  1115. + }
  1116. + }
  1117. + }
  1118. + }
  1119. + else
  1120. + {
  1121. + super.onBypassFeedback(player, command);
  1122. + }
  1123. + }
  1124. +
  1125. + @Override
  1126. + public void onAction(L2PcInstance player)
  1127. + {
  1128. + if (this != player.getTarget())
  1129. + {
  1130. + player.setTarget(this);
  1131. + player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
  1132. + player.sendPacket(new ValidateLocation(this));
  1133. + }
  1134. + else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false))
  1135. + {
  1136. + SocialAction sa = new SocialAction(player, Rnd.get(8));
  1137. + broadcastPacket(sa);
  1138. + player.setCurrentFolkNPC(this);
  1139. + showMessageWindow(player);
  1140. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1141. + }
  1142. + else
  1143. + {
  1144. + player.getAI().setIntention(CtrlIntention.INTERACT, this);
  1145. + player.sendPacket(ActionFailed.STATIC_PACKET);
  1146. + }
  1147. + }
  1148. +
  1149. + private void showMessageWindow(L2PcInstance player)
  1150. + {
  1151. + NpcHtmlMessage html = new NpcHtmlMessage(1);
  1152. + html.setFile("data/html/mods/Faction/faction.htm");
  1153. + html.replace("%objectId%", String.valueOf(getObjectId()));
  1154. + html.replace("%npcname%", getName());
  1155. + player.sendPacket(html);
  1156. + }
  1157. +
  1158. + private void sendHtmlMessage(L2PcInstance player, NpcHtmlMessage html)
  1159. + {
  1160. + html.replace("%objectId%", String.valueOf(getObjectId()));
  1161. + html.replace("%npcname%", getName());
  1162. + html.replace("%npcId%", String.valueOf(getNpcId()));
  1163. + player.sendPacket(html);
  1164. + }
  1165. +}
  1166. \ No newline at end of file
  1167. Index: java/net/sf/l2j/gameserver/scripting/scripts/custom/RandomPvpZone.java
  1168. ===================================================================
  1169. --- java/net/sf/l2j/gameserver/scripting/scripts/custom/RandomPvpZone.java (revision 0)
  1170. +++ java/net/sf/l2j/gameserver/scripting/scripts/custom/RandomPvpZone.java (working copy)
  1171. @@ -0,0 +1,145 @@
  1172. +/*
  1173. + * Copyright (C) 2004-2015 L2J DataPack
  1174. + *
  1175. + * This file is part of L2J DataPack.
  1176. + *
  1177. + * L2J DataPack is free software: you can redistribute it and/or modify
  1178. + * it under the terms of the GNU General Public License as published by
  1179. + * the Free Software Foundation, either version 3 of the License, or
  1180. + * (at your option) any later version.
  1181. + *
  1182. + * L2J DataPack is distributed in the hope that it will be useful,
  1183. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1184. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  1185. + * General Public License for more details.
  1186. + *
  1187. + * You should have received a copy of the GNU General Public License
  1188. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  1189. + */
  1190. +package net.sf.l2j.gameserver.scripting.scripts.custom;
  1191. +
  1192. +import java.util.List;
  1193. +import java.util.Timer;
  1194. +import java.util.TimerTask;
  1195. +
  1196. +import net.sf.l2j.commons.random.Rnd;
  1197. +import net.sf.l2j.gameserver.instancemanager.ZoneManager;
  1198. +import net.sf.l2j.gameserver.model.actor.L2Character;
  1199. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  1200. +import net.sf.l2j.gameserver.model.zone.L2ZoneType;
  1201. +import net.sf.l2j.gameserver.scripting.Quest;
  1202. +
  1203. +/**
  1204. + * fix cuando se cambie de zona se les vaya el flag a las personas flagueadas(ya que esto no pasa si no restartean) y asi mismo si una zona se vuelve zona flag y ya hay alguien en la zona, esta persona se flaguee(esto tmp ocurre si no restartean). /**
  1205. + * @author Ezequiel
  1206. + */
  1207. +public class RandomPvpZone extends Quest
  1208. +{
  1209. + // zonas id
  1210. + private final int zoneid1 = 100000;
  1211. + private final int zoneid2 = 100001;
  1212. + private final int zoneid3 = 100002;
  1213. + private final int zoneid4 = 100003;
  1214. +
  1215. + // tiempo de cada zone 30 min
  1216. + public final long tiempocadazona = 1 * 30 * 60000;
  1217. + public int zonechoose = 0;
  1218. +
  1219. + // timer for change zone
  1220. + public Timer timeZoneChange;
  1221. +
  1222. + public RandomPvpZone()
  1223. + {
  1224. + super(-1, "custom");
  1225. +
  1226. + // agregamos las zonas
  1227. + addEnterZoneId(zoneid1, zoneid2, zoneid3, zoneid4);
  1228. + addExitZoneId(zoneid1, zoneid2, zoneid3, zoneid4);
  1229. +
  1230. + timeZoneChange = new Timer();
  1231. +
  1232. + timeZoneChange.schedule(new TimeForChangeZone(), 1 * 1000);
  1233. + }
  1234. +
  1235. + @Override
  1236. + public String onEnterZone(L2Character character, L2ZoneType zone)
  1237. + {
  1238. + if (zone.getId() == zonechoose)
  1239. + {
  1240. + L2PcInstance player = (L2PcInstance) character;
  1241. + if (player == null)
  1242. + return null;
  1243. + player.sendMessage("Estas en una zona pvp");
  1244. + player.updatePvPFlag(1);
  1245. + }
  1246. + return super.onEnterZone(character, zone);
  1247. + }
  1248. +
  1249. + @Override
  1250. + public String onExitZone(L2Character character, L2ZoneType zone)
  1251. + {
  1252. + if (zone.getId() == zonechoose)
  1253. + {
  1254. + L2PcInstance player = (L2PcInstance) character;
  1255. + if (player == null)
  1256. + return null;
  1257. + player.sendMessage("Has salido de la zona Pvp");
  1258. + player.updatePvPFlag(0);
  1259. + }
  1260. + return super.onExitZone(character, zone);
  1261. + }
  1262. +
  1263. + public class TimeForChangeZone extends TimerTask
  1264. + {
  1265. + @Override
  1266. + public void run()
  1267. + {
  1268. + if (zonechoose != 0)
  1269. + {
  1270. + // remove flag
  1271. + UpdatePvpFlagZone(true);
  1272. + }
  1273. + // elije una zona random
  1274. + zonechoose = Rnd.get(zoneid1, zoneid4);
  1275. + // update flag
  1276. + UpdatePvpFlagZone(false);
  1277. + // change zone flag
  1278. + timeZoneChange.schedule(new TimeForChangeZone(), tiempocadazona);
  1279. + }
  1280. +
  1281. + private void UpdatePvpFlagZone(boolean removePvpFlag)
  1282. + {
  1283. + // zona por id
  1284. + L2ZoneType zoneOut = ZoneManager.getInstance().getZoneById(zonechoose);
  1285. +
  1286. + List<L2Character> zoneOutPlayersInside = zoneOut.getCharactersInside();
  1287. +
  1288. + if (zoneOutPlayersInside == null)
  1289. + return;
  1290. +
  1291. + for (L2Character playerInsideZoneOut : zoneOutPlayersInside)
  1292. + {
  1293. + if (playerInsideZoneOut == null)
  1294. + break;
  1295. + // update flag
  1296. + if (!removePvpFlag)
  1297. + {
  1298. + if (((L2PcInstance) playerInsideZoneOut).getPvpFlag() > 0)
  1299. + break;
  1300. + ((L2PcInstance) playerInsideZoneOut).updatePvPFlag(1);
  1301. + // send messaje zone pvp enter
  1302. + playerInsideZoneOut.sendMessage("Has entrado a una zona pvp.");
  1303. + }
  1304. + else
  1305. + {
  1306. + if (((L2PcInstance) playerInsideZoneOut).getPvpFlag() <= 0)
  1307. + break;
  1308. + // remove flag
  1309. + ((L2PcInstance) playerInsideZoneOut).updatePvPFlag(0);
  1310. + // send messaje zone pvp out
  1311. + playerInsideZoneOut.sendMessage("Has salido de una zona pvp.");
  1312. + }
  1313. + }
  1314. + }
  1315. + }
  1316. +}
  1317. Index: java/net/sf/l2j/Config.java
  1318. ===================================================================
  1319. --- java/net/sf/l2j/Config.java (revision 5)
  1320. +++ java/net/sf/l2j/Config.java (working copy)
  1321. @@ -495,6 +495,38 @@
  1322. public static boolean STORE_SKILL_COOLTIME;
  1323. public static int BUFFS_MAX_AMOUNT;
  1324.  
  1325. + /** faction */
  1326. + public static boolean FACTION_SYSTEM_ENABLE;
  1327. + public static int FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR;
  1328. + public static int FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR;
  1329. + public static String FACTION_SYSTEM_FIRST_FACTION_NAME;
  1330. + public static String FACTION_SYSTEM_SECOND_FACTION_NAME;
  1331. + public static boolean FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN;
  1332. + public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_X;
  1333. + public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_Y;
  1334. + public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_Z;
  1335. + public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X;
  1336. + public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y;
  1337. + public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z;
  1338. + public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X;
  1339. + public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y;
  1340. + public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z;
  1341. + public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_75;
  1342. + public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_80;
  1343. + public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_85;
  1344. + public static boolean FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS;
  1345. + public static boolean FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE;
  1346. + public static boolean FACTION_SYSTEM_NEW_CHAR_SET_HERO;
  1347. + public static int FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR;
  1348. + public static int FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR;
  1349. + public static int FACTION_SYSTEM_ALT_WAREHOUSE_FEE;
  1350. + public static boolean FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP;
  1351. + public static int FACTION_SYSTEM_PVP_ITEM_REWARD_ID;
  1352. + public static int FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
  1353. + public static int FACTION_SYSTEM_ANNOUNCE_DELAY;
  1354. + public static boolean FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS;
  1355. + public static boolean FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN;
  1356. +
  1357. // --------------------------------------------------
  1358. // Server
  1359. // --------------------------------------------------
  1360. @@ -1080,6 +1112,36 @@
  1361.  
  1362. BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
  1363. STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
  1364. + FACTION_SYSTEM_ENABLE = players.getProperty("FactionSystemEnable", false);
  1365. + FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR = Integer.decode("0x" + players.getProperty("FirstFactionTitleColor", ""));
  1366. + FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR = Integer.decode("0x" + players.getProperty("SecondFactionTitleColor", ""));
  1367. + FACTION_SYSTEM_FIRST_FACTION_NAME = players.getProperty("FirstFactionName", "Villagers");
  1368. + FACTION_SYSTEM_SECOND_FACTION_NAME = players.getProperty("SecondFactionName", "Pirates");
  1369. + FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN = players.getProperty("NewCharAltSpawn", false);
  1370. + FACTION_SYSTEM_NEW_CHAR_SPAWN_X = players.getProperty("NewCharSpawnX", 0);
  1371. + FACTION_SYSTEM_NEW_CHAR_SPAWN_Y = players.getProperty("NewCharSpawnY", 0);
  1372. + FACTION_SYSTEM_NEW_CHAR_SPAWN_Z = players.getProperty("NewCharSpawnZ", 0);
  1373. + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X = players.getProperty("FirstFactionBaseSpawnX", 0);
  1374. + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y = players.getProperty("FirstFactionBaseSpawnY", 0);
  1375. + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z = players.getProperty("FirstFactionBaseSpawnZ", 0);
  1376. + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X = players.getProperty("SecondFactionBaseSpawnX", 0);
  1377. + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y = players.getProperty("SecondFactionBaseSpawnY", 0);
  1378. + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z = players.getProperty("SecondFactionBaseSpawnZ", 0);
  1379. + FACTION_SYSTEM_NEW_CHAR_LEVEL_75 = players.getProperty("NewCharLevel75", false);
  1380. + FACTION_SYSTEM_NEW_CHAR_LEVEL_80 = players.getProperty("NewCharLevel80", false);
  1381. + FACTION_SYSTEM_NEW_CHAR_LEVEL_85 = players.getProperty("NewCharLevel85", false);
  1382. + FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS = players.getProperty("AllowTradeBetweenFactions", false);
  1383. + FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE = players.getProperty("NewCharSetNoblesse", false);
  1384. + FACTION_SYSTEM_NEW_CHAR_SET_HERO = Boolean.parseBoolean(players.getProperty("NewCharSetHero", "False"));
  1385. + FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR = Integer.decode("0x" + players.getProperty("FirstFactionNameColor", ""));
  1386. + FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR = Integer.decode("0x" + players.getProperty("SecondFactionNameColor", ""));
  1387. + FACTION_SYSTEM_ALT_WAREHOUSE_FEE = players.getProperty("AltWarehouseDepositFee", 0);
  1388. + FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP = players.getProperty("AllowPvPReward", false);
  1389. + FACTION_SYSTEM_PVP_ITEM_REWARD_ID = players.getProperty("PvPRewardID", 57);
  1390. + FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT = players.getProperty("PvPRewardAmount", 1);
  1391. + FACTION_SYSTEM_ANNOUNCE_DELAY = Integer.parseInt(players.getProperty("AnnouncePlayersDelay", ""));
  1392. + FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS = players.getProperty("AllowBuyBetweenFactions", false);
  1393. + FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN = players.getProperty("AllowAltSpawnForNewChars", false);
  1394.  
  1395. // server
  1396. ExProperties server = load(SERVER_FILE);
  1397. Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java
  1398. ===================================================================
  1399. --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (revision 5)
  1400. +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (working copy)
  1401. @@ -14,6 +14,7 @@
  1402. */
  1403. package net.sf.l2j.gameserver.network.clientpackets;
  1404.  
  1405. +import net.sf.l2j.Config;
  1406. import net.sf.l2j.gameserver.model.L2CommandChannel;
  1407. import net.sf.l2j.gameserver.model.L2Party;
  1408. import net.sf.l2j.gameserver.model.L2World;
  1409. @@ -48,6 +49,12 @@
  1410. return;
  1411. }
  1412.  
  1413. + if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
  1414. + {
  1415. + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
  1416. + return;
  1417. + }
  1418. +
  1419. // Check if duel is possible.
  1420. if (!activeChar.canDuel())
  1421. {
  1422. ### Eclipse Workspace Patch 1.0
  1423. #P aCis_datapack
  1424. Index: data/html/mods/Faction/delevel.htm
  1425. ===================================================================
  1426. --- data/html/mods/Faction/delevel.htm (revision 0)
  1427. +++ data/html/mods/Faction/delevel.htm (working copy)
  1428. @@ -0,0 +1,15 @@
  1429. +<html><title>Faction Manager</title>
  1430. +<body>
  1431. +
  1432. +<center>
  1433. +
  1434. +<font color="LEVEL">Delevel Services</font><br>
  1435. +<br>
  1436. +
  1437. +<a action="bypass -h npc_%objectId%_delevel">Delevel Me!</a><br>
  1438. +<br>
  1439. +</center>
  1440. +
  1441. +</body>
  1442. +
  1443. +</html>
  1444. Index: data/html/mods/Faction/faction.htm
  1445. ===================================================================
  1446. --- data/html/mods/Faction/faction.htm (revision 0)
  1447. +++ data/html/mods/Faction/faction.htm (working copy)
  1448. @@ -0,0 +1,26 @@
  1449. +<html><title>Faction Manager</title>
  1450. +<body>
  1451. +
  1452. +<center>
  1453. +
  1454. +<font color="LEVEL">Choose Your Faction</font><br>
  1455. +<br>
  1456. +
  1457. +<a action="bypass -h npc_%objectId%_setffaction">Join The First Faction</a><br>
  1458. +<br>
  1459. +<a action="bypass -h npc_%objectId%_setsfaction">Join The Second Faction</a><br>
  1460. +<br>
  1461. +<br>
  1462. +<font color="LEVEL">Other Services</font><br>
  1463. +<br>
  1464. +<a action="bypass -h npc_%objectId%_setnoblesse">Gain Noblesse Status</a><br>
  1465. +<br>
  1466. +<a action="bypass -h npc_%objectId%_Link Faction/levelup.htm">Level Up Services</a><br>
  1467. +<br>
  1468. +<a action="bypass -h npc_%objectId%_Link Faction/delevel.htm">DeLevel Services</a><br>
  1469. +<br>
  1470. +</center>
  1471. +
  1472. +</body>
  1473. +
  1474. +</html>
  1475. Index: data/xml/npcs/50000-50999.xml
  1476. ===================================================================
  1477. --- data/xml/npcs/50000-50999.xml (revision 5)
  1478. +++ data/xml/npcs/50000-50999.xml (working copy)
  1479. @@ -108,4 +108,40 @@
  1480. <skill id="4416" level="18"/>
  1481. </skills>
  1482. </npc>
  1483. + <npc id="50009" idTemplate="31228" name="Faction Manager" title="By CaFi">
  1484. + <set name="level" val="70"/>
  1485. + <set name="radius" val="9"/>
  1486. + <set name="height" val="16"/>
  1487. + <set name="rHand" val="0"/>
  1488. + <set name="lHand" val="0"/>
  1489. + <set name="type" val="L2Faction"/>
  1490. + <set name="exp" val="0"/>
  1491. + <set name="sp" val="10"/>
  1492. + <set name="hp" val="2444.46819"/>
  1493. + <set name="mp" val="1345.8"/>
  1494. + <set name="hpRegen" val="7.5"/>
  1495. + <set name="mpRegen" val="2.7"/>
  1496. + <set name="pAtk" val="688.86373"/>
  1497. + <set name="pDef" val="295.91597"/>
  1498. + <set name="mAtk" val="470.40463"/>
  1499. + <set name="mDef" val="216.53847"/>
  1500. + <set name="crit" val="4"/>
  1501. + <set name="atkSpd" val="253"/>
  1502. + <set name="str" val="40"/>
  1503. + <set name="int" val="21"/>
  1504. + <set name="dex" val="30"/>
  1505. + <set name="wit" val="20"/>
  1506. + <set name="con" val="43"/>
  1507. + <set name="men" val="20"/>
  1508. + <set name="corpseTime" val="7"/>
  1509. + <set name="walkSpd" val="80"/>
  1510. + <set name="runSpd" val="120"/>
  1511. + <set name="dropHerbGroup" val="0"/>
  1512. + <set name="attackRange" val="40"/>
  1513. + <ai type="default" ssCount="0" ssRate="0" spsCount="0" spsRate="0" aggro="0" canMove="true" seedable="false"/>
  1514. + <skills>
  1515. + <skill id="4045" level="1"/>
  1516. + <skill id="4416" level="7"/>
  1517. + </skills>
  1518. + </npc>
  1519. </list>
  1520. \ No newline at end of file
  1521. Index: data/html/mods/Faction/delevel.htm
  1522. ===================================================================
  1523. --- data/html/mods/Faction/delevel.htm (revision 0)
  1524. +++ data/html/mods/Faction/delevel.htm (working copy)
  1525. @@ -0,0 +1,15 @@
  1526. +<html><title>Faction Manager</title>
  1527. +<body>
  1528. +
  1529. +<center>
  1530. +
  1531. +<font color="LEVEL">Delevel Services</font><br>
  1532. +<br>
  1533. +
  1534. +<a action="bypass -h npc_%objectId%_delevel">Delevel Me!</a><br>
  1535. +<br>
  1536. +</center>
  1537. +
  1538. +</body>
  1539. +
  1540. +</html>
  1541. Index: data/html/mods/Faction/faction.htm
  1542. ===================================================================
  1543. --- data/html/mods/Faction/faction.htm (revision 0)
  1544. +++ data/html/mods/Faction/faction.htm (working copy)
  1545. @@ -0,0 +1,26 @@
  1546. +<html><title>Faction Manager</title>
  1547. +<body>
  1548. +
  1549. +<center>
  1550. +
  1551. +<font color="LEVEL">Choose Your Faction</font><br>
  1552. +<br>
  1553. +
  1554. +<a action="bypass -h npc_%objectId%_setffaction">Join The First Faction</a><br>
  1555. +<br>
  1556. +<a action="bypass -h npc_%objectId%_setsfaction">Join The Second Faction</a><br>
  1557. +<br>
  1558. +<br>
  1559. +<font color="LEVEL">Other Services</font><br>
  1560. +<br>
  1561. +<a action="bypass -h npc_%objectId%_setnoblesse">Gain Noblesse Status</a><br>
  1562. +<br>
  1563. +<a action="bypass -h npc_%objectId%_Link Faction/levelup.htm">Level Up Services</a><br>
  1564. +<br>
  1565. +<a action="bypass -h npc_%objectId%_Link Faction/delevel.htm">DeLevel Services</a><br>
  1566. +<br>
  1567. +</center>
  1568. +
  1569. +</body>
  1570. +
  1571. +</html>
  1572. Index: data/html/mods/Faction/levelup.htm
  1573. ===================================================================
  1574. --- data/html/mods/Faction/levelup.htm (revision 0)
  1575. +++ data/html/mods/Faction/levelup.htm (working copy)
  1576. @@ -0,0 +1,15 @@
  1577. +<html><title>Faction Manager</title>
  1578. +<body>
  1579. +
  1580. +<center>
  1581. +
  1582. +<font color="LEVEL">Level Up Services</font><br>
  1583. +<br>
  1584. +
  1585. +<a action="bypass -h npc_%objectId%_levelup">Level Me Up!</a><br>
  1586. +<br>
  1587. +</center>
  1588. +
  1589. +</body>
  1590. +
  1591. +</html>
  1592. Index: data/html/mods/Faction/levelup.htm
  1593. ===================================================================
  1594. --- data/html/mods/Faction/levelup.htm (revision 0)
  1595. +++ data/html/mods/Faction/levelup.htm (working copy)
  1596. @@ -0,0 +1,15 @@
  1597. +<html><title>Faction Manager</title>
  1598. +<body>
  1599. +
  1600. +<center>
  1601. +
  1602. +<font color="LEVEL">Level Up Services</font><br>
  1603. +<br>
  1604. +
  1605. +<a action="bypass -h npc_%objectId%_levelup">Level Me Up!</a><br>
  1606. +<br>
  1607. +</center>
  1608. +
  1609. +</body>
  1610. +
  1611. +</html>
  1612. Index: sql/characters.sql
  1613. ===================================================================
  1614. --- sql/characters.sql (revision 5)
  1615. +++ sql/characters.sql (working copy)
  1616. @@ -54,6 +54,8 @@
  1617. `clan_join_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
  1618. `clan_create_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
  1619. `death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
  1620. + `ffaction` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  1621. + `sfaction` TINYINT UNSIGNED NOT NULL DEFAULT 0,
  1622. PRIMARY KEY (obj_Id),
  1623. KEY `clanid` (`clanid`)
  1624. );
  1625. \ No newline at end of file
Add Comment
Please, Sign In to add comment