No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.
### Eclipse Workspace Patch 1.0
#P L2j_Pirama
Index: config/players.properties
===================================================================
--- config/players.properties (revision 85)
+++ config/players.properties (working copy)
@@ -1,6 +1,7 @@
#=============================================================
# Misc
#=============================================================
+AnnounsPvp = true
#Amount of adenas that a new character is given, default is 100
StartingAdena = 100
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 85)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -449,6 +449,7 @@
// --------------------------------------------------
/** Misc */
+ public static boolean ANNOUNS_PVP;
public static int STARTING_ADENA;
public static boolean EFFECT_CANCELING;
public static double HP_REGEN_MULTIPLIER;
@@ -1102,6 +1103,7 @@
// players
ExProperties players = load(PLAYERS_FILE);
+ ANNOUNS_PVP = players.getProperty("AnnounsPvp", true);
STARTING_ADENA = players.getProperty("StartingAdena", 100);
EFFECT_CANCELING = players.getProperty("CancelLesserEffect", true);
HP_REGEN_MULTIPLIER = players.getProperty("HpRegenMultiplier", 1.);
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 85)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -37,6 +37,7 @@
import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.LoginServerThread;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.ai.CtrlEvent;
@@ -394,6 +395,8 @@
private byte _siegeState = 0;
private int _curWeightPenalty = 0;
+ private int _pvpKillsAnnoun;
+
private int _lastCompassZone; // the last compass zone update send to the client
private boolean _isInWater;
@@ -1797,6 +1800,16 @@
_pvpKills = pvpKills;
}
+ public int getPvpKillsAnnoun()
+ {
+ return _pvpKillsAnnoun;
+ }
+
+ public void setPvpKillsAnnoun(int pvpKillsAnnoun)
+ {
+ _pvpKillsAnnoun = pvpKillsAnnoun;
+ }
+
/**
* @return The ClassId object of the L2PcInstance contained in L2PcTemplate.
*/
@@ -4011,6 +4024,8 @@
// Clear resurrect xp calculation
setExpBeforeDeath(0);
+ setPvpKillsAnnoun(0);
+
if (isCursedWeaponEquipped())
CursedWeaponsManager.getInstance().drop(_cursedWeaponEquippedId, killer);
else
@@ -4212,6 +4227,16 @@
// Add PvP point to attacker.
setPvpKills(getPvpKills() + 1);
+ if (Config.ANNOUNS_PVP)
+ {
+ setPvpKillsAnnoun(getPvpKillsAnnoun() + 1);
+
+ if (getPvpKillsAnnoun() == 10 || getPvpKillsAnnoun() == 30 || getPvpKillsAnnoun() == 50)
+ {
+ Announcements.announceToAll(" " + getName() + " Killed consecutive " + getPvpKillsAnnoun() + " adversary's ");
+ }
+ }
// Send UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
}
diff --git a/src/main/java/com/l2jserver/gameserver/model/actor/L2Attackable.java b/src/main/java/com/l2jserver/gameserver/model/actor/L2Attackable.java
index c6bd29d..f38276f 100644
--- a/src/main/java/com/l2jserver/gameserver/model/actor/L2Attackable.java
+++ b/src/main/java/com/l2jserver/gameserver/model/actor/L2Attackable.java
@@ -468,7 +468,7 @@
// mob = 24, atk = 50, diff = 26 (no xp)
final int levelDiff = attacker.getLevel() - getLevel();
- final int[] expSp = calculateExpAndSp(levelDiff, damage, totalDamage);
+ final int[] expSp = calculateExpAndSp(attacker.getLevel(), levelDiff, damage, totalDamage);
long exp = expSp[0];
int sp = expSp[1];
@@ -574,7 +574,7 @@
final int levelDiff = partyLvl - getLevel();
// Calculate Exp and SP rewards
- final int[] expSp = calculateExpAndSp(levelDiff, partyDmg, totalDamage);
+ final int[] expSp = calculateExpAndSp(partyLvl, levelDiff, partyDmg, totalDamage);
long exp = expSp[0];
int sp = expSp[1];
@@ -1306,7 +1306,7 @@
* @param totalDamage The total damage done
* @return
*/
- private int[] calculateExpAndSp(int diff, int damage, long totalDamage)
+ private int[] calculateExpAndSp(int level, int diff, int damage, long totalDamage)
{
double xp;
double sp;
@@ -1316,13 +1316,13 @@
diff = -5; // makes possible to use ALT_GAME_EXPONENT configuration
}
- xp = ((double) getExpReward() * damage) / totalDamage;
+ xp = ((double) getExpReward(level) * damage) / totalDamage;
if (Config.ALT_GAME_EXPONENT_XP != 0)
{
xp *= Math.pow(2., -diff / Config.ALT_GAME_EXPONENT_XP);
}
- sp = ((double) getSpReward() * damage) / totalDamage;
+ sp = ((double) getSpReward(level) * damage) / totalDamage;
if (Config.ALT_GAME_EXPONENT_SP != 0)
{
sp *= Math.pow(2., -diff / Config.ALT_GAME_EXPONENT_SP);
@@ -1611,7 +1611,7 @@
return 0;
}
- final float divider = (getLevel() > 0) && (getExpReward() > 0) ? (getTemplate().getBaseHpMax() * 9 * getLevel() * getLevel()) / (100 * getExpReward()) : 0;
+ final float divider = (getLevel() > 0) && (getExpReward(0) > 0) ? (getTemplate().getBaseHpMax() * 9 * getLevel() * getLevel()) / (100 * getExpReward(0)) : 0;
if (divider == 0)
{
return 0;
diff --git a/src/main/java/com/l2jserver/gameserver/model/actor/L2Npc.java b/src/main/java/com/l2jserver/gameserver/model/actor/L2Npc.java
index 8c49792..4760fe9 100644
--- a/src/main/java/com/l2jserver/gameserver/model/actor/L2Npc.java
+++ b/src/main/java/com/l2jserver/gameserver/model/actor/L2Npc.java
@@ -1168,17 +1168,17 @@
/**
* @return the Exp Reward of this L2Npc (modified by RATE_XP).
*/
- public long getExpReward()
+ public long getExpReward(int level)
{
- return (long) (getLevel() * getLevel() * getTemplate().getExpRate() * Config.RATE_XP);
+ return (long) (getLevel() * getLevel() * getTemplate().getExpRate() * (Config.RATE_XP / ((level < 40) ? 2 : 1)));
}
/**
* @return the SP Reward of this L2Npc (modified by RATE_SP).
*/
- public int getSpReward()
+ public int getSpReward(int level)
{
- return (int) (getTemplate().getSP() * Config.RATE_SP);
+ return (int) (getTemplate().getSP() * (Config.RATE_SP / (level < 40 ? 2 : 1)));
}
/**
@@ -1499,7 +1499,7 @@
{
deleteMe();
}
- } , delay);
+ }, delay);
return this;
}
/*
* Copyright (C) 2004-2016 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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 cron;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.text.SimpleDateFormat;
import java.util.logging.Logger;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
/**
* @author Sacrifice
*/
public final class ScheduledAutoCleanCharacters
{
private static final short MAX_STORED_DAYS = 45; // By default is 45 days
private static final Logger _log = Logger.getLogger(ScheduledAutoCleanCharacters.class.getName());
public static void main(String[] args)
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM characters WHERE lastAccess <= ? AND accessLevel = 0 AND online = 0"))
{
ps.setLong(1, System.currentTimeMillis() - (MAX_STORED_DAYS * 24L * 60L * 60L * 1000L));
ps.executeUpdate();
ps.close();
}
catch (Exception e)
{
e.printStackTrace();
}
String sdf = new SimpleDateFormat("EEE MMM dd, yyyy' at 'HH:mm:ss").format(System.currentTimeMillis() - (MAX_STORED_DAYS * 24L * 60L * 60L * 1000L));
_log.info("Inactive players Deleted from: " + sdf);
}
}
INSERT INTO `global_tasks` VALUES ('101', 'script', 'TYPE_GLOBAL_TASK', '0', '1', '04:00:00', 'ScheduledAutoCleanCharacters.java');
CitarCORE:
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)
{
CitarDATA:
Index: C:/workspace/datapack_development/sql/characters.sql
===================================================================
--- C:/workspace/datapack_development/sql/characters.sql (revision 6451)
+++ C:/workspace/datapack_development/sql/characters.sql (working copy)
@@ -57,6 +57,8 @@
`clan_create_expiry_time` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`bookmarkslot` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
+ `ffaction` TINYINT UNSIGNED NOT NULL DEFAULT 0,
+ `sfaction` TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`charId`),
KEY `clanid` (`clanid`)
);
\ No newline at end of file
Index: C:/workspace/datapack_development/data/scripts/handlers/skillhandlers/SummonFriend.java
===================================================================
--- C:/workspace/datapack_development/data/scripts/handlers/skillhandlers/SummonFriend.java (revision 6451)
+++ C:/workspace/datapack_development/data/scripts/handlers/skillhandlers/SummonFriend.java (working copy)
@@ -28,6 +28,7 @@
import net.sf.l2j.gameserver.model.entity.Instance;
import net.sf.l2j.gameserver.model.entity.TvTEvent;
import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.ConfirmDlg;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.skills.L2SkillType;
@@ -66,7 +67,18 @@
summonerChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
return false;
}
-
+ if (summonerChar.isffaction())
+ {
+ summonerChar.sendMessage("You Cannot Use This Skill.");
+ summonerChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
+ return false;
+ }
+ if (summonerChar.issfaction())
+ {
+ summonerChar.sendMessage("You Cannot Use This Skill.");
+ summonerChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
+ return false;
+ }
if (summonerChar.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND) || summonerChar.isFlyingMounted())
{
summonerChar.sendPacket(new SystemMessage(SystemMessageId.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING));
Index: C:/workspace/datapack_development/data/scripts/handlers/usercommandhandlers/Escape.java
===================================================================
--- C:/workspace/datapack_development/data/scripts/handlers/usercommandhandlers/Escape.java (revision 6451)
+++ C:/workspace/datapack_development/data/scripts/handlers/usercommandhandlers/Escape.java (working copy)
@@ -56,6 +56,14 @@
return false;
}
+ if (Config.FACTION_SYSTEM_ENABLE)
+ {
+ if (activeChar.isffaction() || activeChar.issfaction())
+ {
+ activeChar.sendMessage("You Cannot Use This Command.");
+ return false;
+ }
+ }
int unstuckTimer = (activeChar.getAccessLevel().isGm() ? 1000 : Config.UNSTUCK_INTERVAL * 1000);
INSERT INTO `npc` VALUES(99996,31324,'Laura',1,'Faction Manager',1,'NPC.a_casino_FDarkElf',8,23,70,'female','L2Faction',40,2444,2444,0,0,10,10,10,10,10,10,0,0,500,500,500,500,278,0,333,9644,0,NULL,28,120,'',0,0,0,'LAST_HIT',0,0,0,'balanced','false');
<html><title>Faction Manager</title>
<body>
<center>
<font color="LEVEL">Delevel Services</font><br>
<br>
<a action="bypass -h npc_%objectId%_delevel">Delevel Me!</a><br>
<br>
</center>
</body>
</html>
<html><title>Faction Manager</title>
<body>
<center>
<font color="LEVEL">Choose Your Faction</font><br>
<br>
<a action="bypass -h npc_%objectId%_setffaction">Join The First Faction</a><br>
<br>
<a action="bypass -h npc_%objectId%_setsfaction">Join The Second Faction</a><br>
<br>
<br>
<font color="LEVEL">Other Services</font><br>
<br>
<a action="bypass -h npc_%objectId%_setnoblesse">Gain Noblesse Status</a><br>
<br>
<a action="bypass -h npc_%objectId%_Link Faction/levelup.htm">Level Up Services</a><br>
<br>
<a action="bypass -h npc_%objectId%_Link Faction/delevel.htm">DeLevel Services</a><br>
<br>
</center>
</body>
</html>
<html><title>Faction Manager</title>
<body>
<center>
<font color="LEVEL">Level Up Services</font><br>
<br>
<a action="bypass -h npc_%objectId%_levelup">Level Me Up!</a><br>
<br>
</center>
</body>
</html>
No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.Hola Amigo, creo que le faltaba esta parte al parche , seguro deberán adaptar algo; lo dejo por si alguno le interesa,/* * 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 2, 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package com.l2j.gameserver.model.actor.instance; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.StringTokenizer; import java.util.logging.Logger; import com.l2j.L2Config; import com.l2j.L2DatabaseFactory; import com.l2j.gameserver.ai.CtrlIntention; import com.l2j.gameserver.model.L2World; import com.l2j.gameserver.network.serverpackets.ActionFailed; import com.l2j.gameserver.network.serverpackets.MyTargetSelected; import com.l2j.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2j.gameserver.network.serverpackets.SocialAction; import com.l2j.gameserver.network.serverpackets.ValidateLocation; import com.l2j.gameserver.templates.actors.L2NpcTemplate; import com.l2j.tools.Rnd; /** * * @Last_Author Stefoulis15 * */ public class L2FactionInstance extends L2NpcInstance { public L2FactionInstance(int objectId, L2NpcTemplate template) { super(objectId, template); } private final static Logger _log = Logger.getLogger(L2FactionInstance.class.getName()); @Override public void onBypassFeedback(L2PcInstance player, String command) { player.sendPacket(ActionFailed.STATIC_PACKET); StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); @SuppressWarnings("unused") String val = ""; if (st.countTokens() >= 1) { val = st.nextToken(); } else if (actualCommand.equalsIgnoreCase("setnoblesse")) { if(!(player instanceof L2PcInstance)) return; L2PcInstance activeChar = player; if(activeChar.isNoble()) activeChar.sendMessage("You Are Already A Noblesse!"); else { activeChar.setNoble(true); activeChar.sendMessage("You Are Now a Noble,You Are Granted With Noblesse Status , And Noblesse Skills."); activeChar.broadcastUserInfo(); activeChar.getInventory().addItem("Tiara", 7694, 1, activeChar, null); } } else if (actualCommand.equalsIgnoreCase("setgood")) { setTarget(player); if (player.isGood()) { player.sendMessage("You Are Already a " + L2Config.ARCHID_GVE_NAME_TEAM_GOOD + " Faction Member"); player.sendPacket(ActionFailed.STATIC_PACKET); } else { if (player.isEvil()) { player.sendMessage("You Can't Change Faction."); player.sendPacket(ActionFailed.STATIC_PACKET); } else { int getevils = L2World.getInstance().getAllevilPlayers().size(); int getgoods = L2World.getInstance().getAllgoodPlayers().size(); if (getgoods > getevils) { player.sendMessage("You Can't Use "+ L2Config.ARCHID_GVE_NAME_TEAM_GOOD + " Faction, Because The Online Members of " + L2Config.ARCHID_GVE_NAME_TEAM_EVIL + " Faction , Is Smaller."); player.sendPacket(ActionFailed.STATIC_PACKET); } else { player.setGood(true); Connection connection = null; try { connection = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = connection.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) { connection.close(); return; } statement = connection.prepareStatement("UPDATE characters SET good=1 WHERE obj_Id=?"); statement.setInt(1, objId); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { _log.info("could not set good status of char:"); } finally { try { connection.close(); } catch (Exception e) { } } _log.info("Archid GvE System : Player " + player.getName() + " Chosen The " + L2Config.ARCHID_GVE_NAME_TEAM_GOOD + " Faction"); if (player.isGood() == true) { player.broadcastUserInfo(); player.sendMessage("You Are Now a Member of The " + L2Config.ARCHID_GVE_NAME_TEAM_GOOD + " Faction "); player.getAppearance().setNameColor(L2Config.ARCHID_GVE_COLOR_NAME_GOOD); player.teleToLocation(L2Config.ARCHID_GVE_GOOD_X, L2Config.ARCHID_GVE_GOOD_Y, L2Config.ARCHID_GVE_GOOD_Z); } } } } } else if (actualCommand.equalsIgnoreCase("setevil")) { setTarget(player); if (player.isEvil()) { player.sendMessage("You Are Already a " + L2Config.ARCHID_GVE_NAME_TEAM_EVIL + " Faction Member"); player.sendPacket(ActionFailed.STATIC_PACKET); } else { if (player.isGood()) { player.sendMessage("You Can't Change Faction."); player.sendPacket(ActionFailed.STATIC_PACKET); } else { int getevils = L2World.getInstance().getAllevilPlayers().size(); int getgoods = L2World.getInstance().getAllgoodPlayers().size(); if (getevils > getgoods) { player.sendMessage("You Can't Use " + L2Config.ARCHID_GVE_NAME_TEAM_EVIL + " Faction , Because The Online Members of " + L2Config.ARCHID_GVE_NAME_TEAM_EVIL + " Faction , Is Smaller"); player.sendPacket(ActionFailed.STATIC_PACKET); } else { player.setEvil(true); Connection connection = null; try { connection = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = connection.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) { connection.close(); return; } statement = connection.prepareStatement("UPDATE characters SET evil=1 WHERE obj_Id=?"); statement.setInt(1, objId); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { _log.info("could not set evil status of char:"); } finally { try { connection.close(); } catch (Exception e) { } } _log.info("Archid GvE System : Player " + player.getName() + " Chosen The " + L2Config.ARCHID_GVE_NAME_TEAM_EVIL + " Faction"); if (player.isEvil() == true) { player.broadcastUserInfo(); player.sendMessage("You Are Now a Member of The " + L2Config.ARCHID_GVE_NAME_TEAM_EVIL + " Faction "); player.getAppearance().setNameColor(L2Config.ARCHID_GVE_COLOR_NAME_EVIL); player.teleToLocation(L2Config.ARCHID_GVE_EVIL_X, L2Config.ARCHID_GVE_EVIL_Y, L2Config.ARCHID_GVE_EVIL_Z); } } } } } 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(getObjectId(), Rnd.get(8)); broadcastPacket(sa); player.setLastFolkNPC(this); showMessageWindow(player); player.sendPacket(ActionFailed.STATIC_PACKET); } else { player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); player.sendPacket(ActionFailed.STATIC_PACKET); } } private void showMessageWindow(L2PcInstance player) { NpcHtmlMessage html = new NpcHtmlMessage(1); html.setFile("data/html/mods/AvD_faction.htm"); html.replace("%objectId%", String.valueOf(getObjectId())); html.replace("%npcname%", getName()); player.sendPacket(html); } }
Un saludo.
### Eclipse Workspace Patch 1.0
#P Heroes
Index: aCis_gameserver/config/server.ini
===================================================================
--- aCis_gameserver/config/server.ini (revision 12)
+++ aCis_gameserver/config/server.ini (working copy)
@@ -64,6 +64,9 @@
# Allow delete chars after D days, 0 = feature disabled.
DeleteCharAfterDays = 3
+#Restricted names for characters
+RestrictedNames = fuck,dildo,admin
+
# Define how many players are allowed to play simultaneously on your server.
MaximumOnlineUsers = 500
Index: aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java
===================================================================
--- aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 7)
+++ aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (working copy)
@@ -83,6 +83,18 @@
return;
}
+ if(Config.FORBIDDEN_NAMES.length > 1)
+ {
+ for(String st : Config.FORBIDDEN_NAMES)
+ {
+ if(_name.toLowerCase().contains(st.toLowerCase()))
+ {
+ sendPacket(new CharCreateFail(CharCreateFail.REASON_INCORRECT_NAME));
+ return;
+ }
+ }
+ }
+
if (_face > 2 || _face < 0)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
Index: aCis_gameserver/java/net/sf/l2j/Config.java
===================================================================
--- aCis_gameserver/java/net/sf/l2j/Config.java (revision 12)
+++ aCis_gameserver/java/net/sf/l2j/Config.java (working copy)
@@ -538,6 +538,7 @@
/** clients related */
public static int DELETE_DAYS;
+ public static String[] FORBIDDEN_NAMES;
public static int MAXIMUM_ONLINE_USERS;
public static int MIN_PROTOCOL_REVISION;
public static int MAX_PROTOCOL_REVISION;
@@ -1385,6 +1386,7 @@
SERVER_LIST_TESTSERVER = server.getProperty("TestServer", false);
DELETE_DAYS = server.getProperty("DeleteCharAfterDays", 7);
+ FORBIDDEN_NAMES = server.getProperty("RestrictedNames", "").split(",");
MAXIMUM_ONLINE_USERS = server.getProperty("MaximumOnlineUsers", 100);
MIN_PROTOCOL_REVISION = server.getProperty("MinProtocolRevision", 730);
MAX_PROTOCOL_REVISION = server.getProperty("MaxProtocolRevision", 746);
by https://pastebin.com/raw/9JXurCeE
Index: dist/game/data/scripts/handlers/skillhandlers/Disablers.java
================================================== =================
--- dist/game/data/scripts/handlers/skillhandlers/Disablers.java (revision 176)
+++ dist/game/data/scripts/handlers/skillhandlers/Disablers.java (working copy)
@@ -15,11 +15,13 @@
package handlers.skillhandlers;
import java.util.logging.Logger;
+import javolution.util.FastList;
+import com.l2jhidden.game.ThreadPoolManager;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.ai.L2AttackableAI;
import com.l2jserver.gameserver.datatables.ExperienceTabl e;
+import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.handler.ISkillHandler;
import com.l2jserver.gameserver.handler.SkillHandler;
import com.l2jserver.gameserver.model.L2Effect;
@@ -70,7 +72,49 @@
protected static final Logger _log = Logger.getLogger(L2Skill.class.getName());
+ private int minutes = 2;
+ class ReturnEffects implements Runnable//wyatt
+ {
+ private int _time;
+ FastList _list;
+ L2Character _player;
+
+ public ReturnEffects (int time, L2Character player, FastListlist)
+ {
+ _time = time;
+ _list = list;
+ _player = player;
+ }
+
+ @Override
+ public void run()
+ {
+ if (_time > 0)
+ {
+ ThreadPoolManager.getInstance().scheduleGeneral(th is, 1000);
+ _time-=1000;
+ }
+
+ if (_time==0)
+ {
+ ((L2PcInstance)_player).stopAllEffectsExceptThoseT hatLastThroughDeath();
+
+ for (L2Effect e : _list)
+ {
+ L2Skill skill = SkillTable.getInstance().getInfo(e.getSkill().getI d(), e.getLevel());
+
+ if(skill != null)
+ {
+ skill.getEffects(_player, _player);
+ }
+ }
+ ((L2PcInstance)_player).clearcancelbuffs();
+ }
+ }
+ }
+
+
* @see com.l2jserver.gameserver.handler.ISkillHandler#use Skill(com.l2jserver.gameserver.model.actor.L2Chara cter, com.l2jserver.gameserver.model.L2Skill, com.l2jserver.gameserver.model.L2Object[])
@@ -566,7 +610,17 @@
landrate = (int) activeChar.calcStat(Stats.CANCEL_VULN, landrate, target, null);
if (Rnd.get(100) < landrate)
+ {
removedBuffs += negateEffect(target, L2SkillType.BUFF, -1, skill.getMaxNegatedEffects());
+ if (target instanceof L2PcInstance)
+ {
+ for (L2Effect effect : target.getAllEffects())
+ {
+ ((L2PcInstance)target).addcancelbuffs(effect);}
+ ThreadPoolManager.getInstance().executeTask(new ReturnEffects(minutes * 60000, target, ((L2PcInstance)target).getcancelbuffs()));
+
+ }
+ }
break;
case HEAL:
ISkillHandler Healhandler = SkillHandler.getInstance().getHandler(L2SkillType. HEAL);
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
================================================== =================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 167)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -372,7 +372,24 @@
private static final String RESTORE_TP_BOOKMARK = "SELECT Id,x,y,z,icon,tag,name FROM character_tpbookmark WHERE charId=?";
private static final String DELETE_TP_BOOKMARK = "DELETE FROM character_tpbookmark WHERE charId=? AND Id=?";
+ //Cancel return back buffs
+ private FastList cancelbuffs = new FastList();
+ public FastList getcancelbuffs()
+ {
+ return cancelbuffs;
+ }
+
+ public void addcancelbuffs(L2Effect effect)
+ {
+ cancelbuffs.add(effect);
+ }
+
+ public void clearcancelbuffs()
+ {
+ cancelbuffs.clear();
+ }
+
// Character Subclass SQL String Definitions:
private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE charId=? ORDER BY class_index ASC";
private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (charId,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
### Eclipse Workspace Patch 1.0
#P L2J_Server_BETA
Index: dist/game/config/l2jmods.properties
===================================================================
--- dist/game/config/l2jmods.properties (revision 5048)
+++ dist/game/config/l2jmods.properties (working copy)
@@ -461,4 +461,14 @@
# ---------------------------------------------------------------------------
# Enables .changepassword voiced command which allows the players to change their account's password ingame.
# Default: False
-AllowChangePassword = False
\ No newline at end of file
+AllowChangePassword = False
+
+# ---------------------------------------------------------------------------
+# Reward by level
+# ---------------------------------------------------------------------------
+# Default: False
+AllowRewardByLevel = False;
+
+# Usage: level1,itemid1,count1;level2,itemid2,count2;...
+# Example: 30,57,1000;48,57,1500;...
+# Default:
+RewardItems =
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5048)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -113,6 +113,7 @@
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.L2Party.messageType;
+import com.l2jserver.gameserver.model.ItemHolder;
import com.l2jserver.gameserver.model.L2PetData;
import com.l2jserver.gameserver.model.L2PetLevelData;
import com.l2jserver.gameserver.model.L2PremiumItem;
@@ -15377,4 +15378,13 @@
return bonus;
}
+
+ public void playerRewardByLevel()
+ {
+ if (Config.ALLOW_REWARD_BY_LEVEL && Config.REWARD_ITEMS.containsKey(getLevel()))
+ {
+ ItemHolder holder = Config.REWARD_ITEMS.get(getLevel());
+ addItem("Reward", holder.getId(), holder.getCount(), null, true);
+ }
+ }
}
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 5048)
+++ java/com/l2jserver/Config.java (working copy)
@@ -45,6 +45,7 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
+import com.l2jserver.gameserver.model.ItemHolder;
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.util.FloodProtectorConfig;
import com.l2jserver.util.L2Properties;
@@ -765,6 +766,8 @@
public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
+ public static boolean ALLOW_REWARD_BY_LEVEL;
+ public static TIntObjectHashMap<ItemHolder> REWARD_ITEMS;
//--------------------------------------------------
// NPC Settings
@@ -2660,6 +2663,29 @@
}
}
L2JMOD_ALLOW_CHANGE_PASSWORD = Boolean.parseBoolean(L2JModSettings.getProperty("AllowChangePassword", "False"));
+ ALLOW_REWARD_BY_LEVEL = Boolean.parseBoolean(L2JModSettings.getProperty("AllowRewardByLevel", "False"));
+ String[] rewardItems = L2JModSettings.getProperty("RewardItems", "").split(";");
+ REWARD_ITEMS = new TIntObjectHashMap<ItemHolder>(rewardItems.length);
+ if (!rewardItems[0].isEmpty())
+ {
+ for (String item : rewardItems)
+ {
+ String[] itemSplit = item.split(",");
+ if (itemSplit.length != 3)
+ _log.warning(StringUtil.concat("Config.load(): invalid config property -> RewardItems \"", item, "\""));
+ else
+ {
+ try
+ {
+ REWARD_ITEMS.put(Integer.parseInt(itemSplit[0]), new ItemHolder(Integer.parseInt(itemSplit[1]), Long.parseLong(itemSplit[2])));
+ }
+ catch (NumberFormatException nfe)
+ {
+ _log.warning(StringUtil.concat("Config.load(): invalid config property -> RewardItems \"", item, "\""));
+ }
+ }
+ }
+ }
}
catch (Exception e)
{
Index: java/com/l2jserver/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/stat/PcStat.java (revision 5048)
+++ java/com/l2jserver/gameserver/model/actor/stat/PcStat.java (working copy)
@@ -229,6 +229,8 @@
getActiveChar().broadcastPacket(new SocialAction(getActiveChar(), SocialAction.LEVEL_UP));
getActiveChar().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_INCREASED_YOUR_LEVEL));
+ getActiveChar().playerRewardByLevel();
+
L2ClassMasterInstance.showQuestionMark(getActiveChar());
}
package custom.BossRespawn;
import java.sql.Connection;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class BossRespawn extends Quest
{
private static final int NPC_ID = 50008;
private static final boolean GM_ONLY = true;
private static final boolean DEBUG = false;
@SuppressWarnings("unused")
static List<Grandboss> GRAND_BOSSES = new ArrayList<Grandboss>();
@SuppressWarnings("unused")
static List<Raidboss> RAID_BOSSES = new ArrayList<Raidboss>();
private static final long refreshTime = 5 * 60 * 1000;
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
@SuppressWarnings("synthetic-access")
public BossRespawn(int questid, String name, String descr)
{
super(questid, name, descr);
addFirstTalkId(NPC_ID);
addTalkId(NPC_ID);
addStartNpc(NPC_ID);
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new reloadBosses(), 1000, refreshTime);
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return "home.htm";
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
return "main.htm";
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equalsIgnoreCase("grandbosses"))
{
sendGrandBosses(player);
}
else if (event.equalsIgnoreCase("raidbosses"))
{
return "raidbosses.htm";
}
else if (event.startsWith("raidboss_"))
{
try
{
int level = Integer.parseInt(event.substring(9));
sendRaidBosses(player, level);
}
catch (NumberFormatException nfe)
{
}
}
return null;
}
private void sendRaidBosses(L2PcInstance player, int bosslevel)
{
StringBuilder tb = new StringBuilder();
tb.append("<html><title>레이드 보스 정보</title><body><br><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><table width=260>");
for (Raidboss rb : RAID_BOSSES)
{
String name = rb.getName();
int level = rb.getLevel();
int min = bosslevel;
int max = min + 9;
if ((level >= min) && (level <= max))
{
long delay = rb.getRespawn();
long currentTime = System.currentTimeMillis();
if (delay <= currentTime)
{
tb.append("<tr><td><font color=\"00C3FF\">" + name + " (" + level + ")</color>:</td><td><font color=\"32C332\">생존</color></td></tr>");
}
else
{
tb.append("<tr><td><font color=\"00C3FF\">" + name + " (" + level + ")</color>:</td><td><font color=\"9CC300\">" + (player.isGM() && GM_ONLY ? sdf.format(new Date(delay)) : "사망") + "</color></td></tr>");
}
}
}
tb.append("</table><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br></center></body></html>");
NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private void sendGrandBosses(L2PcInstance player)
{
StringBuilder tb = new StringBuilder();
tb.append("<html><title>그랜드 보스 정보</title><body><br><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><table width=260>");
for (Grandboss boss : GRAND_BOSSES)
{
String name = boss.getName();
StatsSet stats = GrandBossManager.getInstance().getStatsSet(boss.getId());
if (stats == null)
{
player.sendMessage("그랜드 보스 " + boss.getId() + " 에 대한 리스폰 정보가 없습니다!");
continue;
}
long delay = stats.getLong("respawn_time");
long currentTime = System.currentTimeMillis();
if (delay <= currentTime)
{
tb.append("<tr><td><font color=\"00C3FF\">" + name + "</color>:</td><td><font color=\"32C332\">생존</color></td></tr>");
}
else
{
tb.append("<tr><td><font color=\"00C3FF\">" + name + "</color>:</td><td><font color=\"9CC300\">" + (player.isGM() && GM_ONLY ? sdf.format(new Date(delay)) : "사망") + "</color></td></tr>");
}
}
tb.append("</table><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br></center></body></html>");
NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID);
msg.setHtml(tb.toString());
player.sendPacket(msg);
}
private class reloadBosses implements Runnable
{
@Override
public void run()
{
RAID_BOSSES.clear();
GRAND_BOSSES.clear();
try (Connection con = ConnectionFactory.getInstance().getConnection();
ResultSet rset = con.createStatement().executeQuery("SELECT `n`.`name`, `g`.`boss_id` FROM `npc` as `n` CROSS JOIN `grandboss_data` AS `g` ON `n`.`id` = `g`.`boss_id` GROUP BY `n`.`name` ORDER BY `g`.`respawn_time` DESC"))
{
while (rset.next())
{
Grandboss boss = new Grandboss();
boss.setGrandboss(rset.getInt("boss_id"), rset.getString("name"));
GRAND_BOSSES.add(boss);
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore grand bosses: " + e.getMessage(), e);
}
try (Connection con = ConnectionFactory.getInstance().getConnection();
ResultSet rset = con.createStatement().executeQuery("SELECT `n`.`level`, `n`.`name`, `r`.`respawn_time` FROM `npc` as `n` CROSS JOIN `raidboss_spawnlist` AS `r` ON `n`.`id` = `r`.`boss_id` ORDER BY `n`.`level`"))
{
while (rset.next())
{
Raidboss rb = new Raidboss();
rb.setRaidboss(rset.getString("name"), rset.getInt("level"), rset.getLong("respawn_time"));
RAID_BOSSES.add(rb);
}
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not restore raid bosses: " + e.getMessage(), e);
}
if (DEBUG)
{
_log.info("Boss Respawn last update: " + sdf.format(new Date(System.currentTimeMillis())));
_log.info("Boss Respawn Loaded: " + GRAND_BOSSES.size() + " Grand Bosses");
_log.info("Boss Respawn Loaded: " + RAID_BOSSES.size() + " Raid Bosses");
_log.info("Boss Respawn next update: " + sdf.format(new Date(System.currentTimeMillis() + refreshTime)));
}
}
}
private class Raidboss
{
private String bossName = null;
private long bossRespawn = 0;
private int bossLevel = 0;
/**
*
*/
public Raidboss()
{
// TODO Auto-generated constructor stub
}
void setRaidboss(String name, int level, long respawn)
{
bossName = name;
bossLevel = level;
bossRespawn = respawn;
}
String getName()
{
return bossName;
}
int getLevel()
{
return bossLevel;
}
long getRespawn()
{
return bossRespawn;
}
}
private class Grandboss
{
private int bossId = 0;
private String bossName = null;
/**
*
*/
public Grandboss()
{
// TODO Auto-generated constructor stub
}
void setGrandboss(int id, String name)
{
bossId = id;
bossName = name;
}
int getId()
{
return bossId;
}
String getName()
{
return bossName;
}
}
public static void main(String[] args)
{
new BossRespawn(-1, "BossRespawn", "custom");
}
}
diff --git a/dist/game/data/scripts/hellbound/HellboundEngine.java b/dist/game/data/scripts/hellbound/HellboundEngine.java
index 0a34ce4..d7b7ee2 100644
--- a/dist/game/data/scripts/hellbound/HellboundEngine.java
+++ b/dist/game/data/scripts/hellbound/HellboundEngine.java
@@ -18,8 +18,6 @@
*/
package hellbound;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.instancemanager.GlobalVariablesManager;
@@ -27,7 +25,15 @@
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.events.Containers;
+import com.l2jserver.gameserver.model.events.EventType;
+import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerLogin;
+import com.l2jserver.gameserver.model.events.listeners.ConsumerEventListener;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
+import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.util.Broadcast;
/**
* Hellbound Engine.
@@ -69,6 +75,8 @@
_log.info(HellboundEngine.class.getSimpleName() + ": Level: " + getLevel());
_log.info(HellboundEngine.class.getSimpleName() + ": Trust: " + getTrust());
_log.info(HellboundEngine.class.getSimpleName() + ": Status: " + (isLocked() ? "locked." : "unlocked."));
+
+ Containers.Global().addListener(new ConsumerEventListener(Containers.Players(), EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this));
}
@Override
@@ -361,6 +369,17 @@
}
}
+ private void onPlayerLogin(OnPlayerLogin event)
+ {
+ L2PcInstance player = event.getActiveChar();
+
+ if (!isLocked())
+ {
+ CreatureSay cs = new CreatureSay(0, Say2.ANNOUNCEMENT, player.getName(), ANNOUNCEMENT.replace("%lvl%", String.valueOf(getLevel())));
+ player.sendPacket(cs);
+ }
+ }
+
public static HellboundEngine getInstance()
{
return SingletonHolder.INSTANCE;