Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/GameServer.java (revision 24)
- +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -256,7 +256,19 @@
- StringUtil.printSection("Quests & Scripts");
- ScriptManager.getInstance();
- -
- + 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("###################################");
- + }
- +
- if (Config.ALLOW_BOAT)
- {
- BoatManager.getInstance();
- Index: java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (revision 24)
- +++ java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java (working copy)
- @@ -14,6 +14,7 @@
- */
- package net.sf.l2j.gameserver.handler.usercommandhandlers;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.datatables.SkillTable;
- import net.sf.l2j.gameserver.handler.IUserCommandHandler;
- import net.sf.l2j.gameserver.instancemanager.ZoneManager;
- @@ -32,6 +33,14 @@
- @Override
- public boolean useUserCommand(int id, L2PcInstance activeChar)
- {
- + if (Config.FACTION_SYSTEM_ENABLE)
- + {
- + if (activeChar.isffaction() || activeChar.issfaction())
- + {
- + activeChar.sendMessage("You Cannot Use This Command.");
- + return false;
- + }
- + }
- if (activeChar.isCastingNow() || activeChar.isSitting() || activeChar.isMovementDisabled() || activeChar.isOutOfControl() || activeChar.isInOlympiadMode() || activeChar.isInObserverMode() || activeChar.isFestivalParticipant() || activeChar.isInJail() || ZoneManager.getInstance().getZone(activeChar, L2BossZone.class) != null)
- {
- activeChar.sendPacket(SystemMessageId.NO_UNSTUCK_PLEASE_SEND_PETITION);
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelStart.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.World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.group.CommandChannel;
- @@ -48,6 +49,12 @@
- return;
- }
- + if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
- + {
- + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
- + return;
- + }
- +
- // Check if duel is possible.
- if (!activeChar.canDuel())
- {
- Index: java/net/sf/l2j/gameserver/model/L2Clan.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Clan.java (revision 24)
- +++ java/net/sf/l2j/gameserver/model/L2Clan.java (working copy)
- @@ -1659,6 +1659,17 @@
- return false;
- }
- + if (activeChar.isffaction() && target.issfaction() && Config.FACTION_SYSTEM_ENABLE)
- + {
- + activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
- + return false;
- + }
- + if (activeChar.issfaction() && target.isffaction() && Config.FACTION_SYSTEM_ENABLE)
- + {
- + activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
- + return false;
- + }
- +
- if (activeChar.getObjectId() == target.getObjectId())
- {
- activeChar.sendPacket(SystemMessageId.CANNOT_INVITE_YOURSELF);
- Index: java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/SendWarehouseDepositList.java (working copy)
- @@ -101,7 +101,7 @@
- return;
- // Freight price from config or normal price per item slot (30)
- - final int fee = _items.length * 30;
- + final int fee = _items.length * Config.FACTION_SYSTEM_ALT_WAREHOUSE_FEE;
- int currentAdena = player.getAdena();
- int slots = 0;
- @@ -132,7 +132,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(), fee, manager, false))
- {
- sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
- return;
- Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 24)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
- @@ -517,6 +517,7 @@
- */
- public void doAttack(L2Character target)
- {
- +
- if (target == null || isAttackingDisabled())
- {
- sendPacket(ActionFailed.STATIC_PACKET);
- @@ -549,8 +550,22 @@
- return;
- }
- + boolean isL2PcInstance = this instanceof L2PcInstance && target instanceof L2PcInstance;
- + if (isL2PcInstance && ((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 (isL2PcInstance && ((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 (isInsidePeaceZone(this, target))
- + if (isInsidePeaceZone(this, target) && !Config.FACTION_SYSTEM_ENABLE)
- {
- getAI().setIntention(CtrlIntention.ACTIVE);
- sendPacket(ActionFailed.STATIC_PACKET);
- @@ -1066,6 +1081,29 @@
- boolean doit = false;
- + target = (L2Character) getTarget();
- + 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!");
- + 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!");
- + 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())
- {
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -94,6 +94,18 @@
- final int objectId = activeChar.getObjectId();
- + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE)
- + {
- + if (!activeChar.isNoble())
- + activeChar.setNoble(true, false);
- + }
- +
- + if (Config.FACTION_SYSTEM_NEW_CHAR_SET_HERO)
- + {
- + if (!activeChar.isHero())
- + activeChar.setHero(true);
- + }
- +
- if (activeChar.isGM())
- {
- if (Config.GM_STARTUP_INVULNERABLE && AdminCommandAccessRights.getInstance().hasAccess("admin_invul", activeChar.getAccessLevel()))
- @@ -111,6 +123,21 @@
- GmListTable.getInstance().addGm(activeChar, true);
- }
- + 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);
- + }
- +
- // Set dead status if applies
- if (activeChar.getCurrentHp() < 0.5)
- activeChar.setIsDead(true);
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java (working copy)
- @@ -39,6 +39,14 @@
- return;
- final L2PcInstance requestor = player.getActiveRequester();
- + if (player.issfaction() && requestor.isffaction())
- + {
- + return;
- + }
- + if (player.isffaction() && requestor.issfaction())
- + {
- + return;
- + }
- if (requestor == null)
- return;
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestDuelAnswerStart.java (revision 24)
- +++ 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.model.group.CommandChannel;
- @@ -72,6 +73,12 @@
- return;
- }
- + if ((Config.FACTION_SYSTEM_ENABLE && activeChar.issfaction()) || activeChar.isffaction())
- + {
- + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME);
- + return;
- + }
- +
- if (_partyDuel == 1)
- {
- // Player must be a party leader, the target can't be of the same party.
- Index: java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy)
- @@ -133,8 +133,27 @@
- sendPacket(CharCreateOk.STATIC_PACKET);
- World.getInstance().addObject(newChar);
- -
- + 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.getPosition().set(template.getSpawn());
- + 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.getPosition().set(template.getSpawn());
- + }
- newChar.setTitle("");
- newChar.registerShortCut(new L2ShortCut(0, 0, 3, 2, -1, 1)); // attack shortcut
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java (working copy)
- @@ -67,6 +67,17 @@
- return;
- }
- + if (target.isffaction() && requestor.issfaction())
- + {
- + requestor.sendPacket(SystemMessageId.INCORRECT_TARGET);
- + return;
- + }
- + if (target.issfaction() && requestor.isffaction())
- + {
- + requestor.sendPacket(SystemMessageId.INCORRECT_TARGET);
- + return;
- + }
- +
- if (target.getClient().isDetached())
- {
- requestor.sendMessage("The player you tried to invite is in offline mode.");
- Index: java/net/sf/l2j/gameserver/model/World.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/World.java (revision 24)
- +++ java/net/sf/l2j/gameserver/model/World.java (working copy)
- @@ -52,6 +52,8 @@
- private final Map<Integer, L2Object> _objects = new ConcurrentHashMap<>();
- private final Map<Integer, L2PetInstance> _pets = new ConcurrentHashMap<>();
- private final Map<Integer, L2PcInstance> _players = new ConcurrentHashMap<>();
- + private final Map<Integer, L2PcInstance> _allkoofPlayers = new ConcurrentHashMap<>();
- + private final Map<Integer, L2PcInstance> _allnoobPlayers = new ConcurrentHashMap<>();
- private final WorldRegion[][] _worldRegions = new WorldRegion[REGIONS_X + 1][REGIONS_Y + 1];
- @@ -115,6 +117,16 @@
- return _players.values();
- }
- + public Collection<L2PcInstance> getAllkoofPlayers()
- + {
- + return _allkoofPlayers.values();
- + }
- +
- + public Collection<L2PcInstance> getAllnoobPlayers()
- + {
- + return _allnoobPlayers.values();
- + }
- +
- public L2PcInstance getPlayer(String name)
- {
- return _players.get(CharNameTable.getInstance().getPlayerObjectId(name));
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2FactionInstance.java (working copy)
- @@ -0,0 +1,316 @@
- +/*
- + * This program is free software: you can redistribute it and/or modify it under
- + * the terms of the GNU General Public License as published by the Free Software
- + * Foundation, either version 3 of the License, or (at your option) any later
- + * version.
- + *
- + * This program is distributed in the hope that it will be useful, but WITHOUT
- + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- + * details.
- + *
- + * You should have received a copy of the GNU General Public License along with
- + * this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.util.StringTokenizer;
- +
- +import net.sf.l2j.commons.random.Rnd;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.L2DatabaseFactory;
- +import net.sf.l2j.gameserver.ai.CtrlIntention;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
- +import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
- +
- +/**
- + * @author DaRkRaGe [L2JOneo]
- + */
- +public class L2FactionInstance extends L2NpcInstance
- +{
- + public L2FactionInstance(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance player, String command)
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + StringTokenizer st = new StringTokenizer(command, " ");
- + String actualCommand = st.nextToken();
- + String val = "";
- + if (st.countTokens() >= 1)
- + {
- + val = st.nextToken();
- + }
- + if (actualCommand.equalsIgnoreCase("delevel"))
- + {
- + setTarget(player);
- + int lvl = player.getLevel();
- + if (lvl > 40)
- + {
- + if (val.equalsIgnoreCase("1"))
- + {
- + long delexp = 0;
- + delexp = player.getStat().getExp() - player.getStat().getExpForLevel(lvl - 1);
- + player.getStat().addExp(-delexp);
- + player.broadcastKarma();
- + player.sendMessage("Delevel was Successfull.");
- + }
- + else
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(1);
- + html.setFile("data/html/mods/Faction/delevel.htm");
- + html.replace("%lvl%", String.valueOf(player.getLevel()));
- + sendHtmlMessage(player, html);
- + }
- + }
- + else
- + {
- + player.sendMessage("You have to be at least level 40 to use the delevel faction.");
- + }
- + return;
- + }
- + else if (actualCommand.equalsIgnoreCase("levelup"))
- + {
- + setTarget(player);
- + int lvl = player.getLevel();
- + if (val.equalsIgnoreCase("1"))
- + {
- + long addexp = 0;
- + addexp = player.getStat().getExpForLevel(lvl + 1) - player.getStat().getExp();
- + player.getStat().addExp(addexp);
- + player.broadcastKarma();
- + player.sendMessage("Level Up was Successfull.");
- + }
- + else
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(1);
- + html.setFile("data/html/mods/Faction/levelup.htm");
- + html.replace("%lvl%", String.valueOf(player.getLevel()));
- + sendHtmlMessage(player, html);
- + }
- + }
- + else if (actualCommand.equalsIgnoreCase("setnobless"))
- + {
- + setTarget(player);
- + if (player.isNoble())
- + {
- + player.sendMessage("You have allready nobless status.");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else
- + {
- + player.setNoble(true, true);
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("SELECT obj_id FROM characters where char_name=?");
- + statement.setString(1, player.getName());
- + ResultSet rset = statement.executeQuery();
- + int objId = 0;
- + if (rset.next())
- + {
- + objId = rset.getInt(1);
- + }
- + rset.close();
- + statement.close();
- + if (objId == 0)
- + {
- + con.close();
- + return;
- + }
- + statement = con.prepareStatement("UPDATE characters SET nobless=1 WHERE obj_id=?");
- + statement.setInt(1, objId);
- + statement.execute();
- + statement.close();
- + con.close();
- + }
- + catch (Exception e)
- + {
- + _log.warning("Could not set Nobless status of char.");
- + }
- + System.out.println("##KvN Engine## : Player " + player.getName() + " has gain noble status");
- + player.sendMessage("You Gaine Nobless Status.");
- + }
- + }
- + else if (actualCommand.equalsIgnoreCase("setffaction"))
- + {
- + setTarget(player);
- + if (player.isffaction())
- + {
- + player.sendMessage("You are allready a " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction.");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else
- + {
- + if (player.issfaction())
- + {
- + player.sendMessage("You Cant Change Faction.");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else
- + {
- + {
- + player.setffaction(true);
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("SELECT obj_id FROM characters where char_name=?");
- + statement.setString(1, player.getName());
- + ResultSet rset = statement.executeQuery();
- + int objId = 0;
- + if (rset.next())
- + {
- + objId = rset.getInt(1);
- + }
- + rset.close();
- + statement.close();
- + if (objId == 0)
- + {
- + con.close();
- + return;
- + }
- + statement = con.prepareStatement("UPDATE characters SET ffaction=1 WHERE obj_id=?");
- + statement.setInt(1, objId);
- + statement.execute();
- + statement.close();
- + con.close();
- + }
- + catch (Exception e)
- + {
- + _log.warning("Could not set ffaction status of char:");
- + }
- + System.out.println("Faction Engine : Player " + player.getName() + " has choose " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction");
- + if (player.isffaction() == true)
- + {
- + player.broadcastUserInfo();
- + player.sendMessage("You are fighiting now for " + Config.FACTION_SYSTEM_FIRST_FACTION_NAME + " faction ");
- + player.getAppearance().setNameColor(Config.FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR);
- + player.setTitle(Config.FACTION_SYSTEM_FIRST_FACTION_NAME);
- + player.getAppearance().setTitleColor(Config.FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR);
- + player.teleToLocation(Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z, 0);
- + }
- + }
- + }
- + }
- + }
- + else if (actualCommand.equalsIgnoreCase("setsfaction"))
- + {
- + setTarget(player);
- + if (player.issfaction())
- + {
- + player.sendMessage("You are allready a " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " faction.");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else
- + {
- + if (player.isffaction())
- + {
- + player.sendMessage("You cant change faction.");
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else
- + {
- + @SuppressWarnings("unused")
- + int getnoobs = World.getInstance().getAllnoobPlayers().size();
- + @SuppressWarnings("unused")
- + int getkoofs = World.getInstance().getAllkoofPlayers().size();
- + {
- + player.setsfaction(true);
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("SELECT obj_id FROM characters where char_name=?");
- + statement.setString(1, player.getName());
- + ResultSet rset = statement.executeQuery();
- + int objId = 0;
- + if (rset.next())
- + {
- + objId = rset.getInt(1);
- + }
- + rset.close();
- + statement.close();
- + if (objId == 0)
- + {
- + con.close();
- + return;
- + }
- + statement = con.prepareStatement("UPDATE characters SET sfaction=1 WHERE obj_id=?");
- + statement.setInt(1, objId);
- + statement.execute();
- + statement.close();
- + con.close();
- + }
- + catch (Exception e)
- + {
- + _log.warning("Could not set sfaction status of char:");
- + }
- + System.out.println("Faction Engine : player " + player.getName() + " Has choose " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " Faction");
- + if (player.issfaction() == true)
- + {
- + player.broadcastUserInfo();
- + player.sendMessage("You are fighiting now for " + Config.FACTION_SYSTEM_SECOND_FACTION_NAME + " faction ");
- + player.getAppearance().setNameColor(Config.FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR);
- + player.setTitle(Config.FACTION_SYSTEM_SECOND_FACTION_NAME);
- + player.getAppearance().setTitleColor(Config.FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR);
- + player.teleToLocation(Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z, 0);
- + }
- + }
- + }
- + }
- + }
- + else
- + {
- + super.onBypassFeedback(player, command);
- + }
- + }
- +
- + @Override
- + public void onAction(L2PcInstance player)
- + {
- + if (this != player.getTarget())
- + {
- + player.setTarget(this);
- + player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
- + player.sendPacket(new ValidateLocation(this));
- + }
- + else if (isInsideRadius(player, INTERACTION_DISTANCE, false, false))
- + {
- + SocialAction sa = new SocialAction(player, Rnd.get(8));
- + broadcastPacket(sa);
- + player.setCurrentFolkNPC(this);
- + showMessageWindow(player);
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else
- + {
- + player.getAI().setIntention(CtrlIntention.INTERACT, this);
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + }
- +
- + private void showMessageWindow(L2PcInstance player)
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(1);
- + html.setFile("data/html/mods/Faction/faction.htm");
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%npcname%", getName());
- + player.sendPacket(html);
- + }
- +
- + private void sendHtmlMessage(L2PcInstance player, NpcHtmlMessage html)
- + {
- + html.replace("%objectId%", String.valueOf(getObjectId()));
- + html.replace("%npcname%", getName());
- + html.replace("%npcId%", String.valueOf(getNpcId()));
- + player.sendPacket(html);
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestSendFriendMsg.java (working copy)
- @@ -59,6 +59,17 @@
- return;
- }
- + if (targetPlayer.issfaction() && activeChar.isffaction())
- + {
- + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
- + return;
- + }
- + if (targetPlayer.isffaction() && activeChar.issfaction())
- + {
- + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
- + return;
- + }
- +
- if (Config.LOG_CHAT)
- {
- LogRecord record = new LogRecord(Level.INFO, _message);
- Index: java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (revision 24)
- +++ java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java (working copy)
- @@ -73,6 +73,19 @@
- continue;
- }
- + if (player.isffaction())
- + {
- + player.sendMessage("You Cannot Use This Skill.");
- + player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
- + return;
- + }
- + if (player.issfaction())
- + {
- + player.sendMessage("You Cannot Use This Skill.");
- + player.sendPacket(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
- + return;
- + }
- +
- // Send a request for Summon Friend skill.
- if (skill.getId() == 1403)
- {
- Index: java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/TradeRequest.java (working copy)
- @@ -60,6 +60,18 @@
- return;
- }
- + L2PcInstance player2 = 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.KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || target.getKarma() > 0))
- {
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreSell.java (working copy)
- @@ -21,6 +21,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.StoreType;
- import net.sf.l2j.gameserver.model.tradelist.TradeList;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- public final class RequestPrivateStoreSell extends L2GameClientPacket
- {
- @@ -76,6 +77,15 @@
- if (storePlayer.getStoreType() != StoreType.BUY)
- 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 Cant Sell on a Different Faction");
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- if (player.isCursedWeaponEquipped())
- return;
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 24)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -482,6 +482,38 @@
- /** Buffs */
- public static boolean STORE_SKILL_COOLTIME;
- public static int BUFFS_MAX_AMOUNT;
- + /** faction */
- + public static boolean FACTION_SYSTEM_ENABLE;
- + public static boolean REVIVE_BASE_FACTION;
- + 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;
- // --------------------------------------------------
- // Sieges
- @@ -1184,6 +1216,37 @@
- BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
- STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
- + FACTION_SYSTEM_ENABLE = players.getProperty("FactionSystemEnable", false);
- + REVIVE_BASE_FACTION = players.getProperty("FactionReviveEnable", false);
- + FACTION_SYSTEM_FIRST_FACTION_TITLE_COLOR = Integer.decode("0x" + players.getProperty("FirstFactionTitleColor", ""));
- + FACTION_SYSTEM_SECOND_FACTION_TITLE_COLOR = Integer.decode("0x" + players.getProperty("SecondFactionTitleColor", ""));
- + FACTION_SYSTEM_FIRST_FACTION_NAME = players.getProperty("FirstFactionName", "Villagers");
- + FACTION_SYSTEM_SECOND_FACTION_NAME = players.getProperty("SecondFactionName", "Pirates");
- + FACTION_SYSTEM_NEW_CHAR_ALLOW_ALT_SPAWN = players.getProperty("NewCharAltSpawn", false);
- + FACTION_SYSTEM_NEW_CHAR_SPAWN_X = players.getProperty("NewCharSpawnX", 0);
- + FACTION_SYSTEM_NEW_CHAR_SPAWN_Y = players.getProperty("NewCharSpawnY", 0);
- + FACTION_SYSTEM_NEW_CHAR_SPAWN_Z = players.getProperty("NewCharSpawnZ", 0);
- + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X = players.getProperty("FirstFactionBaseSpawnX", 0);
- + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y = players.getProperty("FirstFactionBaseSpawnY", 0);
- + FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z = players.getProperty("FirstFactionBaseSpawnZ", 0);
- + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X = players.getProperty("SecondFactionBaseSpawnX", 0);
- + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y = players.getProperty("SecondFactionBaseSpawnY", 0);
- + FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z = players.getProperty("SecondFactionBaseSpawnZ", 0);
- + FACTION_SYSTEM_NEW_CHAR_LEVEL_75 = players.getProperty("NewCharLevel75", false);
- + FACTION_SYSTEM_NEW_CHAR_LEVEL_80 = players.getProperty("NewCharLevel80", false);
- + FACTION_SYSTEM_NEW_CHAR_LEVEL_85 = players.getProperty("NewCharLevel85", false);
- + FACTION_SYSTEM_ALLOW_TRADE_BETWEEN_FACTIONS = players.getProperty("AllowTradeBetweenFactions", false);
- + FACTION_SYSTEM_NEW_CHAR_SET_NOBLESSE = players.getProperty("NewCharSetNoblesse", false);
- + FACTION_SYSTEM_NEW_CHAR_SET_HERO = Boolean.parseBoolean(players.getProperty("NewCharSetHero", "False"));
- + FACTION_SYSTEM_FIRST_FACTION_NAME_COLOR = Integer.decode("0x" + players.getProperty("FirstFactionNameColor", ""));
- + FACTION_SYSTEM_SECOND_FACTION_NAME_COLOR = Integer.decode("0x" + players.getProperty("SecondFactionNameColor", ""));
- + FACTION_SYSTEM_ALT_WAREHOUSE_FEE = players.getProperty("AltWarehouseDepositFee", 0);
- + FACTION_SYSTEM_ALLOW_REWARD_FOR_EACH_PVP = players.getProperty("AllowPvPReward", false);
- + FACTION_SYSTEM_PVP_ITEM_REWARD_ID = players.getProperty("PvPRewardID", 57);
- + FACTION_SYSTEM_PVP_ITEM_REWARD_AMOUNT = players.getProperty("PvPRewardAmount", 1);
- + FACTION_SYSTEM_ANNOUNCE_DELAY = Integer.parseInt(players.getProperty("AnnouncePlayersDelay", ""));
- + FACTION_SYSTEM_ALLOW_BUY_BETWEEN_FACTIONS = players.getProperty("AllowBuyBetweenFactions", false);
- + FACTION_SYSTEM_ALLOW_ALT_NEW_CHAR_SPAWN = players.getProperty("AllowAltSpawnForNewChars", false);
- }
- /**
- Index: config/players.properties
- ===================================================================
- --- config/players.properties (revision 24)
- +++ config/players.properties (working copy)
- @@ -286,4 +286,91 @@
- MaxBuffsAmount = 20
- # Store buffs/debuffs on user logout?
- -StoreSkillCooltime = True
- \ No newline at end of file
- +StoreSkillCooltime = True
- +
- +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 = True
- +
- +# Enable Revive Faction System?
- +FactionReviveEnable = True
- +
- +# Annnounce Faction Players
- +# Values Are In Minutes
- +AnnouncePlayersDelay =
- +
- +# Set The Faction Name of The First Faction.
- +FirstFactionName = Horda
- +
- +# Set The Faction Name of The Second Faction.
- +SecondFactionName = Alianza
- +
- +# Allow Alternative Spawn Place For New Created Characters
- +AllowAltSpawnForNewChars = True
- +
- +# Set The Spawn Location of New Created Characters
- +NewCharSpawnX = 139990
- +NewCharSpawnY = -124423
- +NewCharSpawnZ = -1903
- +
- +# Set The Base of The First Faction
- +FirstFactionBaseSpawnX = -84318
- +FirstFactionBaseSpawnY = 244579
- +FirstFactionBaseSpawnZ = -3730
- +
- +# Set The Base of The Second Faction
- +SecondFactionBaseSpawnX = -44836
- +SecondFactionBaseSpawnY = -112524
- +SecondFactionBaseSpawnZ = -235
- +
- +# Set All The New Characters At the Selected Level On Their Creation?
- +NewCharLevel75 = True
- +NewCharLevel80 = False
- +NewCharLevel85 = False
- +
- +# Allow Trade Between Two Factions?
- +AllowTradeBetweenFactions = True
- +
- +# Allow Buy Between Two Factions?
- +AllowBuyBetweenFactions = True
- +
- +# Set All The New Characters Noblesse , On Their Creation?
- +NewCharSetNoblesse = True
- +
- +# Set All The New Characters Heroes , On Their Creation?
- +NewCharSetHero = True
- +
- +# Set The Name Color of The First Faction
- +# Values Must Be In RGB
- +FirstFactionNameColor = 0000FF
- +
- +# Set The Name Color of The Second Creation
- +# Values Must Be In RGB
- +SecondFactionNameColor = FF0000
- +
- +# Set The Title Color of The First Faction
- +# Values Must Be In RGB
- +FirstFactionTitleColor = 0000FF
- +
- +# Set The Title Color of The Second Faction
- +# Values Must Be In RGB
- +SecondFactionTitleColor = FF0000
- +
- +# Set The Alternative Warehouse Deposit Fee
- +AltWarehouseDepositFee = 10000
- +
- +# Allow Reward for Each PvP?
- +AllowPvPReward = True
- +
- +# Set The Item You Want as a Reward
- +PvPRewardID = 57
- +
- +# Set The Amount of The Reward
- +PvPRewardAmount = 1
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/AnswerTradeRequest.java (revision 24)
- +++ 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.World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- @@ -46,6 +47,17 @@
- final L2PcInstance partner = player.getActiveRequester();
- if (partner == null || World.getInstance().getPlayer(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 SendTradeDone(0));
- player.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestPrivateStoreBuy.java (working copy)
- @@ -24,6 +24,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance.StoreType;
- import net.sf.l2j.gameserver.model.tradelist.TradeList;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- import net.sf.l2j.gameserver.util.Util;
- public final class RequestPrivateStoreBuy extends L2GameClientPacket
- @@ -86,6 +87,16 @@
- 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.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
- @@ -140,7 +140,20 @@
- break;
- default:
- - loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN);
- + if (Config.REVIVE_BASE_FACTION)
- + {
- + if (activeChar.isffaction())
- + {
- + loc = new Location(Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_FIRST_FACTION_BASE_SPAWN_Z);// coordenada 1
- + }
- + if (activeChar.issfaction())
- + {
- + loc = new Location(Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_X, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Y, Config.FACTION_SYSTEM_SECOND_FACTION_BASE_SPAWN_Z);// coordenada2
- + break;
- + }
- + }
- + else
- + loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN);
- break;
- }
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.java (revision 24)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestFriendInvite.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.BlockList;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- @@ -48,6 +49,18 @@
- return;
- }
- + if (friend.issfaction() && activeChar.isffaction() && Config.FACTION_SYSTEM_ENABLE)
- + {
- + // Target is wrong.
- + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
- + return;
- + }
- + else if (friend.isffaction() && activeChar.issfaction() && Config.FACTION_SYSTEM_ENABLE)
- + {
- + // Target is wrong.
- + activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
- + return;
- + }
- if (friend == activeChar)
- {
- // You cannot add yourself to your own friend list.
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 24)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -324,8 +324,8 @@
- private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
- 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- - 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=?";
- - 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=?";
- + 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=?";
- + 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=?";
- 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";
- private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
- @@ -467,6 +467,8 @@
- private boolean _isNoble;
- private boolean _isHero;
- + private boolean _isffaction = false;
- + private boolean _issfaction = false;
- private L2Npc _currentFolkNpc;
- @@ -4127,6 +4129,16 @@
- 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;
- + }
- + }
- +
- // If in duel and you kill (only can kill l2summon), do nothing
- if (isInDuel() && targetPlayer.isInDuel())
- return;
- @@ -4150,7 +4162,7 @@
- }
- // Check if it's pvp (cases : regular, wars, victim is PKer)
- - if (checkIfPvP(target) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY && getPledgeType() != L2Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
- + if (checkIfPvP(target) || (isffaction() && targetPlayer.issfaction()) || (issfaction() && targetPlayer.isffaction()) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY && getPledgeType() != L2Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
- {
- if (target instanceof L2PcInstance)
- {
- @@ -4161,6 +4173,13 @@
- sendPacket(new UserInfo(this));
- }
- }
- + if (Config.FACTION_SYSTEM_ENABLE)
- + {
- + 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.");
- + }
- // Otherwise, killer is considered as a PKer.
- else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
- {
- @@ -4178,6 +4197,11 @@
- public void updatePvPStatus()
- {
- + if (!issfaction() || !isffaction())
- + {
- + return;
- + }
- +
- if (isInsideZone(ZoneId.PVP))
- return;
- @@ -4189,6 +4213,7 @@
- public void updatePvPStatus(L2Character target)
- {
- +
- final L2PcInstance player = target.getActingPlayer();
- if (player == null)
- return;
- @@ -4196,6 +4221,11 @@
- if (isInDuel() && player.getDuelId() == getDuelId())
- return;
- + if (player.issfaction() || player.isffaction())
- + {
- + return;
- + }
- +
- if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0)
- {
- PvpFlagTaskManager.getInstance().add(this, checkIfPvP(player) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME);
- @@ -5330,6 +5360,8 @@
- player.setPkKills(rset.getInt("pkkills"));
- player.setOnlineTime(rset.getLong("onlinetime"));
- player.setNoble(rset.getInt("nobless") == 1, false);
- + 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())
- @@ -5763,7 +5795,9 @@
- statement.setLong(47, getClanCreateExpiryTime());
- statement.setString(48, getName());
- statement.setLong(49, getDeathPenaltyBuffLevel());
- - statement.setInt(50, getObjectId());
- + statement.setInt(50, isffaction() ? 1 : 0);
- + statement.setInt(51, issfaction() ? 1 : 0);
- + statement.setInt(52, getObjectId());
- statement.execute();
- statement.close();
- @@ -6452,6 +6486,12 @@
- @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;
- @@ -6837,7 +6877,7 @@
- }
- // Check if the target is attackable
- - if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack())
- + if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack() && (Config.FACTION_SYSTEM_ENABLE == false))
- {
- // If target is not attackable, send ActionFailed
- sendPacket(ActionFailed.STATIC_PACKET);
- @@ -7123,6 +7163,9 @@
- */
- public boolean checkPvpSkill(L2Object target, L2Skill skill)
- {
- + if (issfaction() || isffaction())
- + return true;
- +
- if (skill == null || target == null)
- return false;
- @@ -8114,6 +8157,26 @@
- 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>
- * 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.
- @@ -10091,6 +10154,11 @@
- final L2PcInstance target = cha.getActingPlayer();
- + if (target.issfaction() || target.isffaction())
- + {
- + return true;
- + }
- +
- if (isInDuel() && target.isInDuel() && target.getDuelId() == getDuelId())
- return true;
Add Comment
Please, Sign In to add comment