Código:
Index: C:/workspace/L2_GameServer/java/config/l2jmods.properties===================================================================--- C:/workspace/L2_GameServer/java/config/l2jmods.properties (revision 3338)
+++ C:/workspace/L2_GameServer/java/config/l2jmods.properties (working copy)@@ -240,4 +240,87 @@ # This option will enable core support for: # Mana Drug (item ID 726), using skill ID 9007. # Mana Potion (item ID 728), using skill ID 9008.-EnableManaPotionSupport = False\ No newline at end of file
+EnableManaPotionSupport = False
+
+# ---------------------------------------------------------------------------+# Faction System By Stefoulis15
+# ---------------------------------------------------------------------------+# Faction System is Something Really Unique. You Must Have Full Knowledge of What You Are Doing When Activating It.
+# Faction System Cannot Work With TvT Events , CTF , DM , KOTH And Others.
+
+# Enable Stefoulis15 Faction System?+FactionSystemEnable = False
+
+# Annnounce Faction Players+# Values Are In Minutes+AnnouncePlayersDelay =
+
+# Set The Faction Name of The First Faction.
+FirstFactionName = Villagers
+
+# Set The Faction Name of The Second Faction.
+SecondFactionName = Pirates
+
+# Allow Alternative Spawn Place For New Created Characters+AllowAltSpawnForNewChars = False
+
+# Set The Spawn Location of New Created Characters
+NewCharSpawnX =
+NewCharSpawnY =
+NewCharSpawnZ =
+
+# Set The Base of The First Faction+FirstFactionBaseSpawnX =
+FirstFactionBaseSpawnY =+FirstFactionBaseSpawnZ =
+
+# Set The Base of The Second Faction
+SecondFactionBaseSpawnX =
+SecondFactionBaseSpawnY =
+SecondFactionBaseSpawnZ =
+
+# Set All The New Characters At the Selected Level On Their Creation?
+NewCharLevel75 = False
+NewCharLevel80 = False
+NewCharLevel85 = False
+
+# Allow Trade Between Two Factions?+AllowTradeBetweenFactions = False
+
+# Allow Buy Between Two Factions?
+AllowBuyBetweenFactions = False
+
+# Set All The New Characters Noblesse , On Their Creation?
+NewCharSetNoblesse = False
+
+# Set All The New Characters Heroes , On Their Creation?
+NewCharSetHero = False
+
+# Set The Name Color of The First Faction
+# Values Must Be In RGB
+FirstFactionNameColor =
+
+# Set The Name Color of The Second Creation
+# Values Must Be In RGB
+SecondFactionNameColor =
+
+# Set The Title Color of The First Faction
+# Values Must Be In RGB+FirstFactionTitleColor =
+
+# Set The Title Color of The Second Faction
+# Values Must Be In RGB+SecondFactionTitleColor =
+
+# Set The Alternative Warehouse Deposit Fee
+AltWarehouseDepositFee = 0
+
+# Allow Reward for Each PvP?
+AllowPvPReward = False
+
+# Set The Item You Want as a Reward+PvPRewardID = 57
+
+# Set The Amount of The Reward+PvPRewardAmount = 1+Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (revision 3338)+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (working copy)@@ -20,6 +20,7 @@ import java.util.logging.Level; import java.util.logging.Logger;
+import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;@@ -65,6 +66,22 @@ sm = null; return; }
+ if (friend.issfaction() && activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ // Target is wrong.
+ sm = new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT);
+ activeChar.sendPacket(sm);
+ sm = null;
+ return;
+ }
+ else if (friend.isffaction() && activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ // Target is wrong.
+ sm = new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT);
+ activeChar.sendPacket(sm);
+ sm = null;
+ return;
+ } else if (friend == activeChar) { //You cannot add yourself to your own friend list.Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (working copy)@@ -63,7 +63,16 @@ activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME)); return; }-
+ if (targetPlayer.issfaction() && activeChar.isffaction())
+ {
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
+ return;
+ }
+ if (targetPlayer.isffaction() && activeChar.issfaction())
+ {
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
+ return;
+ } if (Config.LOG_CHAT) { LogRecord record = new LogRecord(Level.INFO, _message);Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (working copy)@@ -75,7 +75,17 @@ player.sendMessage("You or your target cant request trade in Olympiad mode"); return; }-
+ L2PcInstance player2 = (L2PcInstance) target;
+ if (player2.issfaction() && player.isffaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
+ {
+ player.sendMessage("You Cant Trade with the Different Faction");
+ return;
+ }
+ if (player2.isffaction() && player.issfaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
+ {
+ player.sendMessage("You Cant Trade with the Different Faction");
+ return;
+ } // Alt game - Karma punishment if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || partner.getKarma() > 0)) {Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (working copy)@@ -14,6 +14,7 @@ */ package net.sf.l2j.gameserver.network.clientpackets;
+import net.sf.l2j.Config; import net.sf.l2j.gameserver.instancemanager.DuelManager; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.SystemMessageId;@@ -66,7 +67,11 @@ player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME)); return; }-
+ if ((Config.FACTION_SYSTEM_ENABLE && player.issfaction()) || player.isffaction())
+ {
+ player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME));
+ return;
+ } if (_partyDuel == 1) { msg1 = new SystemMessage(SystemMessageId.YOU_HAVE_ACCEPTED_C1_CHALLENGE_TO_A_PARTY_DUEL_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (revision 3338)+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (working copy)@@ -104,7 +104,17 @@ TradeList storeList = storePlayer.getSellList(); if (storeList == null) return;-
+
+ if (Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS)
+ {
+ if ((storePlayer.issfaction() && player.isffaction()) || (storePlayer.isffaction() && player.issfaction()))
+ {
+ player.sendMessage("You Cannot Buy From an Other Faction");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+ }
+ if (!player.getAccessLevel().allowTransaction()) { player.sendMessage("Transactions are disable for your Access Level");Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (revision 3338)+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (working copy)@@ -106,6 +106,17 @@ return; }
+ if (target.isffaction() && requestor.issfaction())
+ {
+ requestor.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
+ return;
+ }
+ if (target.issfaction() && requestor.isffaction())
+ {
+ requestor.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
+ return;
+ }
+ if (target.getClient().isDetached()) { requestor.sendMessage("Player is in offline mode.");Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/SendWareHouseDepositList.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/SendWareHouseDepositList.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/SendWareHouseDepositList.java (working copy)@@ -112,7 +112,7 @@ return; // Freight price from config or normal price per item slot (30)- final long fee = _items.length * 30;
+ final long fee = _items.length * Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE; long currentAdena = player.getAdena(); int slots = 0; @@ -142,7 +142,7 @@ } // Check if enough adena and charge the fee- if (currentAdena < fee || !player.reduceAdena(warehouse.getName(), fee, manager, false))
+ if (currentAdena < Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE || !player.reduceAdena(warehouse.getName(), Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE, manager, false)) { sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA)); return;Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (revision 3338)+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (working copy)@@ -69,6 +69,11 @@ activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME)); return; }
+ if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
+ {
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME));
+ return;
+ } else if (!targetChar.canDuel()) { activeChar.sendPacket(targetChar.getNoDuelReason());Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 3338)+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy)@@ -183,9 +183,30 @@ L2PcTemplate template = newChar.getTemplate(); + if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_75)
+ {
+ newChar.addExpAndSp(804219972L, 99999999);
+ }
+ else if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_80)
+ {
+ newChar.addExpAndSp(4200000000L, 99999999);
+ }
+ else if (Config.FACTION_SYSTEM_NEW_CHAR_LEVEL_85)
+ {
+ newChar.addExpAndSp(19827360000L, 99999999);
+ }
+ newChar.addAdena("Init", Config.STARTING_ADENA, null, false); - newChar.setXYZInvisible(template.spawnX, template.spawnY, template.spawnZ);
+ if (Config.FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN)
+ {
+ newChar.setXYZInvisible(Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_X, Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_Y , Config.FACTION_SYSTEM_NEW_CHAR_SPAWN_Z);
+ }
+ else
+ {
+ newChar.setXYZInvisible(template.spawnX, template.spawnY, template.spawnZ);
+ }
+ newChar.setTitle(""); L2ShortCut shortcut;Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)@@ -194,7 +194,19 @@ // Set Hero status if it applies if (Hero.getInstance().getHeroes() != null && Hero.getInstance().getHeroes().containsKey(activeChar.getObjectId())) activeChar.setHero(true);
+ + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE)
+ {
+ if(!activeChar.isNoble())
+ activeChar.setNoble(true);
+ }
+ if (Config.FACTION_SYSTEM_NEW_CHAR_SET_HERO)
+ {
+ if(!activeChar.isHero())
+ activeChar.setHero(true);
+ }
+ setPledgeClass(activeChar); boolean showClanNotice = false;@@ -324,6 +336,21 @@ notifyPartner(activeChar,activeChar.getPartnerId()); }
+ if (activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ activeChar.getAppearance().setNameColor(Config.FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR);
+ activeChar.sendMessage("Welcome "
+ activeChar.getName()
+ " You Are Fighting "
+ Config.FACTION_SYSTEM_FIRST_FACTION_NAME
+ " Faction");
+ activeChar.setTitle(Config.FACTION_SYSTEM_FIRST_FACTION_NAME);
+ activeChar.getAppearance().setTitleColor(Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR);+ }
+ if (activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
+ {+ activeChar.getAppearance().setNameColor(Config.FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR);
+ activeChar.sendMessage("Welcome "
+ activeChar.getName()
+ " You Are Fighting "
+ Config.FACTION_SYSTEM_SECOND_FACTION_NAME
+ " Faction");
+ activeChar.setTitle(Config.FACTION_SYSTEM_SECOND_FACTION_NAME);
+ activeChar.getAppearance().setTitleColor(Config.FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR);
+ }
+ if (activeChar.isCursedWeaponEquipped()) { CursedWeaponsManager.getInstance().getCursedWeapon(activeChar.getCursedWeaponEquippedId()).cursedOnLogin();Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (working copy)@@ -150,8 +150,17 @@ storePlayer.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE); storePlayer.broadcastUserInfo(); }
+
+ if (Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS)
+ {
+ if ((storePlayer.issfaction() && player.isffaction()) || (storePlayer.isffaction() && player.issfaction()))
+ {
+ player.sendMessage("You Cant Sell on a Different Faction");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ } }-
+} @Override public String getType() {Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (working copy)@@ -14,6 +14,7 @@ */ package net.sf.l2j.gameserver.network.clientpackets;
+import net.sf.l2j.Config; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.SystemMessageId;@@ -66,6 +67,18 @@ } else if (L2World.getInstance().findObject(partner.getObjectId()) == null) {
+ L2PcInstance player2 = player.getActiveRequester();
+ if (player2.issfaction() && player.isffaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
+ {
+ player.sendMessage("You Cant Trade With The Other Faction");
+ return;
+ }
+ if (player2.isffaction() && player.issfaction() && Config.FACTION_SYSTEM_ENABLE && Config.FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS)
+ {
+ player.sendMessage("You Cant Trade With The Other Faction");
+ return;
+ }
+ // Trade partner not found, cancel trade player.sendPacket(new TradeDone(0)); SystemMessage msg = new SystemMessage(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (working copy)@@ -49,6 +49,14 @@ if(player != null) { L2PcInstance requestor = player.getActiveRequester();
+ if (player.issfaction() && requestor.isffaction())
+ {
+ return;
+ }
+ if (player.isffaction() && requestor.issfaction())
+ {
+ return;
+ } if (requestor == null) return; Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)@@ -524,6 +524,9 @@ private boolean _noble = false; private boolean _hero = false;
+ private boolean _isffaction = false;
+ private boolean _issfaction = false;
+ /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */ private L2Npc _lastFolkNpc = null; @@ -5469,6 +5472,27 @@ // sendPacket(msg); return; }
+ if (Config.FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP && Config.FACTION_SYSTEM_ENABLE)
+ {
+ if ((issfaction() && targetPlayer.issfaction()) || (isffaction() && targetPlayer.isffaction()))
+ {
+ sendMessage("Cannot Get PvP Reward From The Same Faction.");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ } else
+ {
+ int itemReward = Config.FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
+ int idReward = Config.FACTION_SYSTEM_PVP_ITEM_REWARD_ID;
+ addItem("Loot", idReward, itemReward, this, true);
+ sendMessage("You Won "
+ itemReward
+ " "
+ idReward
+ " From Your Kill.");
+ }
+ }
+ // pvp?
+ if (checkIfPvP(target) || (isffaction() && targetPlayer.issfaction()) || (issfaction() && targetPlayer.isffaction()))
+ {
+ increasePvpKills();
+ return;
+ } // If in duel and you kill (only can kill l2summon), do nothing if (isInDuel() && targetPlayer.isInDuel()) return;@@ -5558,6 +5582,11 @@ */ public void increasePkKillsAndKarma(int targLVL) {
+ if (Config.FACTION_SYSTEM_ENABLE)+ {+ return;+ }+ int baseKarma = Config.KARMA_MIN_KARMA; int newKarma = baseKarma; int karmaLimit = Config.KARMA_MAX_KARMA;@@ -5629,11 +5658,19 @@ public void updatePvPStatus() {
+
+ if (!issfaction() || !isffaction())
+ {
+ return;
+ }
+ if (isInsideZone(ZONE_PVP)) return; setPvpFlagLasts(System.currentTimeMillis()
+ Config.PVP_NORMAL_TIME); if (getPvpFlag() == 0) startPvPFlag();
+
+ } public void updatePvPStatus(L2Character target)@@ -5643,6 +5680,14 @@ if (player_target == null) return;
+ if (target instanceof L2PcInstance)
+ {
+ player_target = (L2PcInstance) target;
+ }
+ if (player_target.issfaction() || player_target.isffaction())
+ {
+ return;
+ } if ((isInDuel() && player_target.getDuelId() == getDuelId())) return; if ((!isInsideZone(ZONE_PVP) || !player_target.isInsideZone(ZONE_PVP)) && player_target.getKarma() == 0) {@@ -5655,6 +5700,7 @@ } } + /** * Restore the specified % of experience this L2PcInstance has * lost and sends a Server->Client StatusUpdate packet.<BR><BR>@@ -7018,6 +7064,8 @@ player.setOnlineTime(rset.getLong("onlinetime")); player.setNewbie(rset.getInt("newbie")); player.setNoble(rset.getInt("nobless")==1);
+ player.setffaction(rset.getInt("ffaction") == 1 ? true : false);
+ player.setsfaction(rset.getInt("sfaction") == 1 ? true : false); player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time")); if (player.getClanJoinExpiryTime() < System.currentTimeMillis())@@ -7450,7 +7498,9 @@ statement.setString(50, getName()); statement.setLong(51, getDeathPenaltyBuffLevel()); statement.setInt(52, getBookMarkSlot());- statement.setInt(53, getObjectId());
+ statement.setInt(53, isffaction() ? 1 : 0);
+ statement.setInt(54, issfaction() ? 1 : 0);
+ statement.setInt(55, getObjectId()); statement.execute(); statement.close();@@ -8254,6 +8304,16 @@ @Override public boolean isAutoAttackable(L2Character attacker) {
+
+ if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).isffaction())
+ {
+ return true;
+ }
+ if ((attacker instanceof L2PcInstance) && ((L2PcInstance) attacker).issfaction())
+ {
+ return true;+ }
+ // Check if the attacker isn't the L2PcInstance Pet if (attacker == this || attacker == getPet()) return false;@@ -8651,7 +8711,7 @@ // Check if this is offensive magic skill if (skill.isOffensive()) {- if ((isInsidePeaceZone(this, target)) && !getAccessLevel().allowPeaceAttack())
+ if ((isInsidePeaceZone(this, target)) && !getAccessLevel().allowPeaceAttack() && (Config.FACTION_SYSTEM_ENABLE == false)) { // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));@@ -9056,6 +9116,12 @@ */ public boolean checkPvpSkill(L2Object target, L2Skill skill, boolean srcIsSummon) {
+
+ if (issfaction() || isffaction())
+ {
+ return true;
+ }
+ // check for PC->PC Pvp status if ( target != null && // target not null and@@ -10010,6 +10076,27 @@ sendPacket(sl); }
+ public boolean isffaction()
+ {
+ return _isffaction;
+ }
+
+ public boolean issfaction()
+ {
+ return _issfaction;
+ }
+
+ public void setffaction(boolean value)
+ {
+ _isffaction = value;
+ }
+
+ public void setsfaction(boolean value)
+ {
+ _issfaction = value;
+ }
+
+ /** * 1. Add the specified class ID as a subclass (up to the maximum number of <b>three</b>) * for this character.<BR>Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)@@ -759,6 +759,18 @@ return; } }
+ if (((L2PcInstance) this).isffaction() && ((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ ((L2PcInstance) this).sendMessage("Cant attack a player from your faction");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+ if (((L2PcInstance) this).issfaction() && ((L2PcInstance) target).issfaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ ((L2PcInstance) this).sendMessage("Cant attack a player from your faction");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ } // Checking if target has moved to peace zone if (target.isInsidePeaceZone((L2PcInstance)this)) {@@ -866,7 +878,7 @@ { // Checking if target has moved to peace zone - only for player-crossbow attacks at the moment // Other melee is checked in movement code and for offensive spells a check is done every time- if (target.isInsidePeaceZone((L2PcInstance)this))
+ if (target.isInsidePeaceZone((L2PcInstance)this)&& !Config.FACTION_SYSTEM_ENABLE) { getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); sendPacket(ActionFailed.STATIC_PACKET);@@ -1468,7 +1480,31 @@ L2Object[] targets = skill.getTargetList(this); boolean doit = false;-
+
+ if ((target instanceof L2PcInstance) && (this instanceof L2PcInstance))
+ {
+ if (((L2PcInstance) this).isffaction() && (((L2PcInstance) target).isffaction() && Config.FACTION_SYSTEM_ENABLE))
+ {
+ ((L2PcInstance) this).sendMessage("You Cannot Attack a Player From Your Faction!");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+ 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)))
+ {
+ return;
+ }
+ if (((L2PcInstance) this).issfaction() && ((L2PcInstance) target).issfaction())
+ {
+ ((L2PcInstance) this).sendMessage("You Cannot Attack a Player From Your Faction!");
+ sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+ 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)))
+ {
+ return;
+ }
+ }
+ // AURA skills should always be using caster as target switch (skill.getTargetType()) {@@ -2164,6 +2200,16 @@ if (!isTeleporting()) { setIsPendingRevive(false);
+ if ((this instanceof L2PcInstance) && (((L2PcInstance) this).isffaction() && Config.FACTION_SYSTEM_ENABLE))
+ {
+ 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);
+ } else
+ {
+ if ((this instanceof L2PcInstance) && (((L2PcInstance) this).issfaction() && Config.FACTION_SYSTEM_ENABLE))
+ {
+ 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);
+ }
+ } setIsDead(false); boolean restorefull = false; Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2World.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2World.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2World.java (working copy)@@ -64,6 +64,9 @@ /** HashMap(String Player name, L2PcInstance) containing all the players in game */ private Map<String, L2PcInstance> _allPlayers;
+ private Map<String, L2PcInstance> _allkoofPlayers;
+ private Map<String, L2PcInstance> _allnoobPlayers;
+ /** L2ObjectHashMap(L2Object) containing all visible objects */ private Map<Integer, L2Object> _allObjects; @@ -79,6 +82,8 @@ { //_allGms = new FastMap<String, L2PcInstance>(); _allPlayers = new FastMap<String, L2PcInstance>().setShared(true);
+ _allkoofPlayers = new FastMap<String, L2PcInstance>().setShared(true);
+ _allnoobPlayers = new FastMap<String, L2PcInstance>().setShared(true); _petsInstance = new FastMap<Integer, L2PetInstance>().setShared(true); _allObjects = new FastMap<Integer, L2Object>().setShared(true); @@ -224,6 +229,16 @@ return _allPlayers; }
+ public Collection<L2PcInstance> getAllkoofPlayers()
+ {
+ return _allkoofPlayers.values();
+ }
+
+ public Collection<L2PcInstance> getAllnoobPlayers()
+ {
+ return _allnoobPlayers.values();
+ }
+ /** * Return how many players are online.<BR><BR> *@@ -234,6 +249,16 @@ return _allPlayers.size(); }
+ public int getAllkoofPlayersCount()
+ {
+ return _allkoofPlayers.size();
+ }
+
+ public int getAllnoobPlayersCount()
+ {
+ return _allnoobPlayers.size();
+ }
+ /** * Return the player instance corresponding to the given name.<BR><BR> *@@ -335,6 +360,14 @@ tmp.closeNetConnection(); return; }
+ if (((L2PcInstance) object).isffaction())
+ {
+ _allkoofPlayers.put(player.getName().toLowerCase(), player);
+ }
+ else if (((L2PcInstance) object).issfaction())
+ {
+ _allnoobPlayers.put(player.getName().toLowerCase(), player);
+ } _allPlayers.put(player.getName().toLowerCase(), player); } }Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2Clan.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2Clan.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2Clan.java (working copy)@@ -1,5 +1,4 @@ /*- * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version.@@ -1896,6 +1895,17 @@ activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET)); return false; }
+
+ if (activeChar.isffaction() && target.issfaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET));
+ return false;
+ }
+ if (activeChar.issfaction() && target.isffaction() && Config.FACTION_SYSTEM_ENABLE)
+ {
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET));
+ return false;
+ } if (activeChar.getObjectId() == target.getObjectId()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_INVITE_YOURSELF));Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/lib/Log.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/lib/Log.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/lib/Log.java (working copy)@@ -126,4 +126,13 @@ _log.warning("Assertion error [" + cmt + "]"); Thread.dumpStack(); }
+
+ /**
+ * @param string
+ */
+ public void warn(String string)
+ {
+ // TODO Auto-generated method stub
+
+ } }Index: C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/GameServer.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/GameServer.java (revision 3338)+++ C:/workspace/L2_GameServer/java/net/sf/l2j/gameserver/GameServer.java (working copy)@@ -524,6 +524,7 @@ _log.config("Maximum Numbers of Connected Players: "
+ Config.MAXIMUM_ONLINE_USERS); long serverLoadEnd = System.currentTimeMillis(); _log.info("Server Loaded in "
+ ((serverLoadEnd - serverLoadStart) / 1000)
+ " seconds");
+ } public static void main(String[] args) throws Exception@@ -557,5 +558,18 @@ { _log.info("Telnet server is currently disabled."); }
+ if (Config.FACTION_SYSTEM_ENABLE)
+ {
+ System.out.println("####################################");
+ System.out.println("## Faction System is Activated. ##");
+ System.out.println("####################################");
+ }
+ else
+ {
+ System.out.println("###################################");
+ System.out.println("## Faction System is Disabled. ##");
+ System.out.println("###################################");
+ }
+ } }Index: C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java===================================================================--- C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java (revision 3338)
+++ C:/workspace/L2_GameServer/java/net/sf/l2j/Config.java (working copy)@@ -585,8 +585,37 @@ public static boolean OFFLINE_SET_NAME_COLOR; public static int OFFLINE_NAME_COLOR; public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
+ public static boolean FACTION_SYSTEM_ENABLE;
+ public static int FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR;
+ public static int FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR;
+ public static String FACTION_SYSTEM_FIRST_FACTION_NAME;
+ public static String FACTION_SYSTEM_SECOND_FACTION_NAME;
+ public static boolean FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN;+ public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_X;+ public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_Y;
+ public static int FACTION_SYSTEM_NEW_CHAR_SPAWN_Z;
+ public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X;
+ public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y;
+ public static int FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z;
+ public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X;
+ public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y;
+ public static int FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z;
+ public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_75;
+ public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_80;
+ public static boolean FACTION_SYSTEM_NEW_CHAR_LEVEL_85;
+ public static boolean FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS;
+ public static boolean FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE;
+ public static boolean FACTION_SYSTEM_NEW_CHAR_SET_HERO;
+ public static int FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR;
+ public static int FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR;
+ public static int FACTION_SYSTEM_ALT_WAREHOUSE_FEE;
+ public static boolean FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP;
+ public static int FACTION_SYSTEM_PVP_ITEM_REWARD_ID;
+ public static int FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT;
+ public static int FACTION_SYSTEM_ANNOUNCE_DELAY;
+ public static boolean FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS;
+ public static boolean FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN; - //-------------------------------------------------- // NPC Settings //--------------------------------------------------@@ -1932,6 +1961,36 @@ OFFLINE_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("OfflineNameColor", "808080")); L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(L2JModSettings.getProperty("EnableManaPotionSupport", "false"));
+ FACTION_SYSTEM_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("FactionSystemEnable", "False"));
+ FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("FirstFactionTitleColor", ""));
+ FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("SecondFactionTitleColor", ""));
+ FACTION_SYSTEM_FIRST_FACTION_NAME = L2JModSettings.getProperty("FirstFactionName", "Villagers");+ FACTION_SYSTEM_SECOND_FACTION_NAME = L2JModSettings.getProperty("SecondFactionName", "Pirates");
+ FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharAltSpawn", "False"));
+ FACTION_SYSTEM_NEW_CHAR_SPAWN_X = Integer.parseInt(L2JModSettings.getProperty("NewCharSpawnX", "0"));
+ FACTION_SYSTEM_NEW_CHAR_SPAWN_Y = Integer.parseInt(L2JModSettings.getProperty("NewCharSpawnY", "0"));
+ FACTION_SYSTEM_NEW_CHAR_SPAWN_Z = Integer.parseInt(L2JModSettings.getProperty("NewCharSpawnZ", "0"));
+ FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X = Integer.parseInt(L2JModSettings.getProperty("FirstFactionBaseSpawnX", "0"));
+ FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y = Integer.parseInt(L2JModSettings.getProperty("FirstFactionBaseSpawnY", "0"));
+ FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z = Integer.parseInt(L2JModSettings.getProperty("FirstFactionBaseSpawnZ", "0"));
+ FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X = Integer.parseInt(L2JModSettings.getProperty("SecondFactionBaseSpawnX", "0"));
+ FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y = Integer.parseInt(L2JModSettings.getProperty("SecondFactionBaseSpawnY", "0"));
+ FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z = Integer.parseInt(L2JModSettings.getProperty("SecondFactionBaseSpawnZ", "0"));
+ FACTION_SYSTEM_NEW_CHAR_LEVEL_75 = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharLevel75", "False"));
+ FACTION_SYSTEM_NEW_CHAR_LEVEL_80 = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharLevel80", "False"));
+ FACTION_SYSTEM_NEW_CHAR_LEVEL_85 = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharLevel85", "False"));
+ FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS = Boolean.parseBoolean(L2JModSettings.getProperty("AllowTradeBetweenFactions", "False"));
+ FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharSetNoblesse", "False"));
+ FACTION_SYSTEM_NEW_CHAR_SET_HERO = Boolean.parseBoolean(L2JModSettings.getProperty("NewCharSetHero", "False"));
+ FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("FirstFactionNameColor", ""));
+ FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR = Integer.decode("0x" + L2JModSettings.getProperty("SecondFactionNameColor", ""));
+ FACTION_SYSTEM_ALT_WAREHOUSE_FEE = Integer.parseInt(L2JModSettings.getProperty("AltWarehouseDepositFee", "0"));
+ FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP = Boolean.parseBoolean(L2JModSettings.getProperty("AllowPvPReward", "False"));
+ FACTION_SYSTEM_PVP_ITEM_REWARD_ID = Integer.parseInt(L2JModSettings.getProperty("PvPRewardID", "57"));
+ FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT = Integer.parseInt(L2JModSettings.getProperty("PvPRewardAmount", "1"));
+ FACTION_SYSTEM_ANNOUNCE_DELAY = Integer.parseInt(L2JModSettings.getProperty("AnnouncePlayersDelay", ""));
+ FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS = Boolean.parseBoolean(L2JModSettings.getProperty("AllowBuyBetweenFactions", "False"));
+ FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN = Boolean.parseBoolean(L2JModSettings.getProperty("AllowAltSpawnForNewChars", "False")); } catch (Exception e) {