-
Posts
94 -
Credits
0 -
Joined
-
Last visited
-
Days Won
2 -
Feedback
100%
BAN_L2JDev last won the day on May 28 2022
BAN_L2JDev had the most liked content!
About BAN_L2JDev

Contact Methods
-
Website URL
http://l2jdev.com.br
Profile Information
-
Current Mood
Nerdy
-
Gender
Male
-
Country
Brazil
BAN_L2JDev's Achievements
-
BAN_L2JDev started following dievas
-
dievas started following BAN_L2JDev
-
Help How can I make a custom quest? (HF)
BAN_L2JDev replied to 77upup's question in Request Server Development Help [L2J]
tente com um ID menor se possivel 5 casa E.p 65535 -
Help How can I make a custom quest? (HF)
BAN_L2JDev replied to 77upup's question in Request Server Development Help [L2J]
onTalk the id of the Npc that will take the quest must be there in the list it has to be registered together addTalkId(ZIGGURATS); in the scrpits.xml file you also have to register the quest -
Help How can I make a custom quest? (HF)
BAN_L2JDev replied to 77upup's question in Request Server Development Help [L2J]
now look in the quest for the ID of the Npc that registers the mission, you have to link it together with the script, registering it with the monsters -
Help How can I make a custom quest? (HF)
BAN_L2JDev replied to 77upup's question in Request Server Development Help [L2J]
cade o ID do NPC onde pega a quest pra falar no chat ele tem que estar com Bypass -h quest name -
Help Set up server before live.
BAN_L2JDev replied to ๖ۣۜG๖ۣۜL๖ۣۜO๖ۣۜR๖ۣۜY's question in Request Server Development Help [L2J]
java -server -Xmx1536m -Xms1024m -Xmn512m bro can you tell me how this would behave -
Help Set up server before live.
BAN_L2JDev replied to ๖ۣۜG๖ۣۜL๖ۣۜO๖ۣۜR๖ۣۜY's question in Request Server Development Help [L2J]
Server.proprierts # Maximum database connections. MaximumDbConnections = 1000 # Define how many players are allowed to play simultaneously on your server. MaximumOnlineUsers = 1000 # ================================================================= # Threadpool # ================================================================= # Determines the amount of scheduled thread pools. If set to -1, the server will decide the amount depending on the available processors. ScheduledThreadPoolCount = -1 # Specifies how many threads will be in a single scheduled pool. ThreadsPerScheduledThreadPool = 750 # Determines the amount of instant thread pools. If set to -1, the server will decide the amount depending on the available processors. InstantThreadPoolCount = -1 # Specifies how many threads will be in a single instant pool. ThreadsPerInstantThreadPool = 8 LoguinServer # Maximum database connections. MaximumDbConnections = 1000 Can you make your question clearer now? -
Help Set up server before live.
BAN_L2JDev replied to ๖ۣۜG๖ۣۜL๖ۣۜO๖ۣۜR๖ۣۜY's question in Request Server Development Help [L2J]
with a machine like that it depends on java and it is important if you are going to use a java8 that is very light you will support so many players that you will never bog down the server only thing you should look at in Task of the task manager what is the consumption that the JDK is consuming -
BAN_L2JDev started following ShadowNetwork
-
demzyraggaa left Positive feedback for BAN_L2JDev
-
Celestine left Positive feedback for BAN_L2JDev
-
BAN_L2JDev started following L2RAPTOR
-
Ready message sent! Doubts look for me
-
https://imgur.com/a/kPUExbq https://imgur.com/a/3ICPGSz https://imgur.com/a/DD5NmOq Decide if you've already found what you're looking for ♥
-
Help Carrier System
BAN_L2JDev replied to Williams's question in Request Server Development Help [L2J]
o que ele mando a voce faz exatamente o que voce quer so que voce nao quer aceitar o codigo dele! -
BAN_L2JDev changed their profile photo
-
Request Java Object Intancia
BAN_L2JDev replied to BAN_L2JDev's question in Request Server Development Help [L2J]
okay. I want Monsters and Play to be Invisible inside the Instance -
My doubt and how can I remove the visibility of an object I already left the Instance ready but even so it continues to see all NPCs Player Objects Class WorldObject.java package net.sf.l2j.gameserver.model; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Predicate; import net.sf.l2j.commons.logging.CLogger; import net.sf.l2j.commons.math.MathUtil; import net.sf.l2j.Instancia.Instance; import net.sf.l2j.Instancia.InstanceManager; import net.sf.l2j.gameserver.enums.ZoneId; import net.sf.l2j.gameserver.enums.items.ShotType; import net.sf.l2j.gameserver.idfactory.IdFactory; import net.sf.l2j.gameserver.model.actor.Creature; import net.sf.l2j.gameserver.model.actor.Playable; import net.sf.l2j.gameserver.model.actor.Player; import net.sf.l2j.gameserver.model.actor.instance.Door; import net.sf.l2j.gameserver.model.actor.instance.Fence; import net.sf.l2j.gameserver.model.location.Location; import net.sf.l2j.gameserver.model.location.SpawnLocation; import net.sf.l2j.gameserver.model.zone.type.subtype.ZoneType; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; /** * Mother class of all interactive objects in the world (PC, NPC, Item...) */ public abstract class WorldObject { public static final CLogger LOGGER = new CLogger(WorldObject.class.getName()); private String _name; private int _objectId; private final SpawnLocation _position = new SpawnLocation(0, 0, 0, 0); private WorldRegion _region; private boolean _isVisible; public WorldObject(int objectId) { _objectId = objectId; } private int _instanceId; /** * @param instanceId Specify the instance id * @param silent If silent is true, it will just set the instance id, and await a knowlist change(like teleport), if false it will force instance teleportation */ public void setInstanceId(int instanceId, boolean silent) { int oldInstance = _instanceId; _instanceId = instanceId; if (instanceId != 0) { if (oldInstance != 0 && this instanceof Player) { Instance ins = InstanceManager.getInstance().getInstanceId(oldInstance); if (ins != null) // Destroyed already. ins.remove((Player) this, false, false); } Instance ins = InstanceManager.getInstance().getInstanceId(instanceId); if (ins == null) { LOGGER.info("Cannot find instance with id[" + instanceId + "]. Aborting!"); _instanceId = 0; return; } ins.addObject(this); } if (!silent) { decayMe(); spawnMe(); } } public int getInstanceId() { return _instanceId; } public boolean isAttackableBy(Creature attacker) { return false; } public boolean isAttackableWithoutForceBy(Playable attacker) { return false; } @Override public String toString() { return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); } public void onAction(Player player, boolean isCtrlPressed, boolean isShiftPressed) { player.sendPacket(ActionFailed.STATIC_PACKET); } public void onSpawn() { } /** * Remove this {@link WorldObject} from the world. */ public void decayMe() { setRegion(null); World.getInstance().removeObject(this); } public void refreshID() { World.getInstance().removeObject(this); IdFactory.getInstance().releaseId(getObjectId()); _objectId = IdFactory.getInstance().getNextId(); } /** * Spawn this {@link WorldObject} and add it in the world as a visible object. */ public final void spawnMe() { _isVisible = true; setRegion(World.getInstance().getRegion(_position)); World.getInstance().addObject(this); onSpawn(); } /** * Initialize the position of this {@link WorldObject} and add it in the world as a visible object. * @param loc : The location used as reference X/Y/Z. */ public final void spawnMe(Location loc) { spawnMe(loc.getX(), loc.getY(), loc.getZ()); } /** * Initialize the position of this {@link WorldObject} and add it in the world as a visible object. * @param loc : The location used as reference X/Y/Z. * @param heading : The heading position to set. */ public final void spawnMe(Location loc, int heading) { spawnMe(loc.getX(), loc.getY(), loc.getZ(), heading); } /** * Initialize the position of this {@link WorldObject} and add it in the world as a visible object. * @param loc : The location used as reference X/Y/Z. */ public final void spawnMe(SpawnLocation loc) { spawnMe(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading()); } /** * Initialize the position of this {@link WorldObject} and add it in the world as a visible object. * @param x : The X position to set. * @param y : The Y position to set. * @param z : The Z position to set. */ public final void spawnMe(int x, int y, int z) { _position.set(MathUtil.limit(x, World.WORLD_X_MIN, World.WORLD_X_MAX), MathUtil.limit(y, World.WORLD_Y_MIN, World.WORLD_Y_MAX), z); spawnMe(); } /** * Initialize the position of this {@link WorldObject} and add it in the world as a visible object. * @param x : The X position to set. * @param y : The Y position to set. * @param z : The Z position to set. * @param heading : The heading position to set. */ public final void spawnMe(int x, int y, int z, int heading) { _position.set(MathUtil.limit(x, World.WORLD_X_MIN, World.WORLD_X_MAX), MathUtil.limit(y, World.WORLD_Y_MIN, World.WORLD_Y_MAX), z, heading); spawnMe(); } /** * @return the visibilty state of this {@link WorldObject}. */ public final boolean isVisible() { return _region != null && _isVisible; } public final void setIsVisible(boolean value) { _isVisible = value; if (!_isVisible) setRegion(null); } public final String getName() { return _name; } public void setName(String value) { _name = value; } public final int getObjectId() { return _objectId; } public Player getActingPlayer() { return null; } /** * Sends the Server->Client info packet for this {@link WorldObject}. * @param player : The packet receiver. */ public void sendInfo(Player player) { } /** * Check if this {@link WorldObject} has charged shot. * @param type : The type of the shot to be checked. * @return true if the object has charged shot. */ public boolean isChargedShot(ShotType type) { return false; } /** * Charging shot into this {@link WorldObject}. * @param type : The type of the shot to be (un)charged. * @param charged : true if we charge, false if we uncharge. */ public void setChargedShot(ShotType type, boolean charged) { } /** * Try to recharge a shot. * @param physical : The skill is using Soulshots. * @param magical : The skill is using Spiritshots. */ public void rechargeShots(boolean physical, boolean magical) { } /** * Check if this {@link WorldObject} is in the given {@link ZoneId}. * @param zone : The ZoneId to check. * @return true if the object is in that ZoneId. */ public boolean isInsideZone(ZoneId zone) { return false; } /** * Set the position of this {@link WorldObject} and if necessary modify its _region. * @param x : The X position to set. * @param y : The Y position to set. * @param z : The Z position to set. */ public final void setXYZ(int x, int y, int z) { _position.set(x, y, z); if (!isVisible()) return; final WorldRegion region = World.getInstance().getRegion(_position); if (region != _region) setRegion(region); } /** * Set the position of this {@link WorldObject} and if necessary modify its _region. * @param loc : The SpawnLocation used as reference. */ public final void setXYZ(SpawnLocation loc) { _position.set(loc); if (!isVisible()) return; final WorldRegion region = World.getInstance().getRegion(_position); if (region != _region) setRegion(region); } /** * Set the position of this {@link WorldObject} using a WorldObject reference position, and if necessary modify its _region. * @param object : The WorldObject used as reference. */ public final void setXYZ(WorldObject object) { setXYZ(object.getPosition()); } /** * Set the position of this {@link WorldObject} and make it invisible. * @param x : The X position to set. * @param y : The Y position to set. * @param z : The Z position to set. */ public final void setXYZInvisible(int x, int y, int z) { _position.set(MathUtil.limit(x, World.WORLD_X_MIN, World.WORLD_X_MAX), MathUtil.limit(y, World.WORLD_Y_MIN, World.WORLD_Y_MAX), z); setIsVisible(false); } public final void setXYZInvisible(Location loc) { setXYZInvisible(loc.getX(), loc.getY(), loc.getZ()); } public final int getX() { return _position.getX(); } public final int getY() { return _position.getY(); } public final int getZ() { return _position.getZ(); } public final int getHeading() { return _position.getHeading(); } public final SpawnLocation getPosition() { return _position; } public final WorldRegion getRegion() { return _region; } /** * Update current and surrounding {@link WorldRegion}s, based on both current region and region set as parameter. * @param newRegion : null to remove the {@link WorldObject}, or the new region. */ public void setRegion(WorldRegion newRegion) { List<WorldRegion> oldAreas = Collections.emptyList(); if (_region != null) { _region.removeVisibleObject(this); oldAreas = _region.getSurroundingRegions(); } List<WorldRegion> newAreas = Collections.emptyList(); if (newRegion != null) { newRegion.addVisibleObject(this); newAreas = newRegion.getSurroundingRegions(); } // For every old surrounding area NOT SHARED with new surrounding areas. for (WorldRegion region : oldAreas) { if (!newAreas.contains(region)) { // Refresh infos related to zones. for (ZoneType zone : region.getZones()) zone.removeKnownObject(this); // Update all objects. for (WorldObject obj : region.getObjects()) { if (obj == this) continue; // if not same instance don't add to knownlist if (obj.getInstanceId() != getInstanceId()) continue; obj.removeKnownObject(this); removeKnownObject(obj); } // Desactivate the old neighbor region. if (this instanceof Player && region.isEmptyNeighborhood()) region.setActive(false); } } // For every new surrounding area NOT SHARED with old surrounding areas. for (WorldRegion region : newAreas) { if (!oldAreas.contains(region)) { // Refresh infos related to zones. for (ZoneType zone : region.getZones()) zone.addKnownObject(this); // Update all objects. for (WorldObject obj : region.getObjects()) { if (obj == this) continue; // if not same instance don't add to knownlist if (obj.getInstanceId() != getInstanceId()) continue; obj.addKnownObject(this); addKnownObject(obj); } // Activate the new neighbor region. if (this instanceof Player) region.setActive(true); } } _region = newRegion; for (WorldObject obj : getDifferentInstanceObjects()) { if (obj == this) continue; obj.removeKnownObject(this); removeKnownObject(obj); } } /** * Add a {@link WorldObject} to knownlist. * @param object : An object to be added. */ public void addKnownObject(WorldObject object) { } /** * Remove a {@link WorldObject} from knownlist. * @param object : An object to be removed. */ public void removeKnownObject(WorldObject object) { } /** * @param target : The WorldObject to check. * @return true if the {@link WorldObject} set as parameter is registered in same grid of regions than this WorldObject. */ public final boolean knows(WorldObject target) { // Object doesn't exist, return false. if (target == null) return false; // No region set for the current WorldObject, return false. final WorldRegion region = _region; if (region == null) return false; // No region set for the target, return false. final WorldRegion targetRegion = target.getRegion(); if (targetRegion == null) return false; // Return instantly true if one surrounding WorldRegions of this WorldObject matches with target WorldRegion. for (WorldRegion reg : region.getSurroundingRegions()) { if (reg == targetRegion) return true; } return false; } /** * Return the knownlist of this {@link WorldObject} for a given object type. * @param <A> : The object type must be an instance of WorldObject. * @param type : The class specifying object type. * @return List<A> : The knownlist of given object type. */ @SuppressWarnings("unchecked") public final <A> List<A> getKnownType(Class<A> type) { final WorldRegion region = _region; if (region == null) return Collections.emptyList(); final List<A> result = new ArrayList<>(); for (WorldRegion reg : region.getSurroundingRegions()) { for (WorldObject obj : reg.getObjects()) { if (obj == this || !type.isAssignableFrom(obj.getClass())) continue; if (obj.getInstanceId() != getInstanceId() && !(obj instanceof Fence)) continue; result.add((A) obj); } } return result; } /** * Return the knownlist of this {@link WorldObject} for a given object type. * @param <A> : The object type must be an instance of WorldObject. * @param type : The class specifying object type. * @param predicate : The predicate to match. * @return List<A> : The knownlist of given object type. */ @SuppressWarnings("unchecked") public final <A> List<A> getKnownType(Class<A> type, Predicate<A> predicate) { final WorldRegion region = _region; if (region == null) return Collections.emptyList(); final List<A> result = new ArrayList<>(); for (WorldRegion reg : region.getSurroundingRegions()) { for (WorldObject obj : reg.getObjects()) { if (obj == this || !type.isAssignableFrom(obj.getClass()) || !predicate.test((A) obj)) continue; result.add((A) obj); } } return result; } private final List<WorldObject> getDifferentInstanceObjects() { final WorldRegion region = _region; if (region == null) return Collections.emptyList(); final List<WorldObject> result = new ArrayList<>(); for (WorldRegion reg : region.getSurroundingRegions()) { for (WorldObject obj : reg.getObjects()) { if (obj == this || obj.getInstanceId() == getInstanceId() || obj instanceof Door || obj instanceof Fence) continue; result.add(obj); } } return result; } /** * Return the knownlist of this {@link WorldObject} for a given object type within specified radius. * @param <A> : The object type must be an instance of WorldObject. * @param type : The class specifying object type. * @param radius : The radius to check in which object must be located. * @return List<A> : The knownlist of given object type. */ @SuppressWarnings("unchecked") public final <A> List<A> getKnownTypeInRadius(Class<A> type, int radius) { final WorldRegion region = _region; if (region == null) return Collections.emptyList(); final List<A> result = new ArrayList<>(); for (WorldRegion reg : region.getSurroundingRegions()) { for (WorldObject obj : reg.getObjects()) { if (obj == this || !type.isAssignableFrom(obj.getClass()) || !MathUtil.checkIfInRange(radius, this, obj, true)) continue; if (obj.getInstanceId() != getInstanceId() && !(obj instanceof Fence)) continue; result.add((A) obj); } } return result; } /** * Return the knownlist of this {@link WorldObject} for a given object type within specified radius. * @param <A> : The object type must be an instance of WorldObject. * @param type : The class specifying object type. * @param radius : The radius to check in which object must be located. * @param predicate : The predicate to match. * @return List<A> : The knownlist of given object type. */ @SuppressWarnings("unchecked") public final <A> List<A> getKnownTypeInRadius(Class<A> type, int radius, Predicate<A> predicate) { final WorldRegion region = _region; if (region == null) return Collections.emptyList(); final List<A> result = new ArrayList<>(); for (WorldRegion reg : region.getSurroundingRegions()) { for (WorldObject obj : reg.getObjects()) { if (obj == this || !type.isAssignableFrom(obj.getClass()) || !MathUtil.checkIfInRange(radius, this, obj, true) || !predicate.test((A) obj)) continue; if (obj.getInstanceId() != getInstanceId() && !(obj instanceof Fence)) continue; result.add((A) obj); } } return result; } /** * Refresh the knownlist for this {@link WorldObject}. Only used by teleport process. */ public final void refreshKnownlist() { final WorldRegion region = _region; if (region == null) return; for (WorldRegion reg : region.getSurroundingRegions()) { for (WorldObject obj : reg.getObjects()) { if (obj == this) continue; if (obj.getInstanceId() != getInstanceId()) continue; obj.addKnownObject(this); addKnownObject(obj); } } } /** * Fire actions related to region activation.<br> * <br> * A region activation occurs when one {@link Player} enters for the first time in this {@link WorldObject}'s {@link WorldRegion} surroundings (self region included).<br> * <br> * Additional Player entrances don't activate it. This state is verified by {@link WorldRegion#isActive()}. */ public void onActiveRegion() { } /** * Fire actions related to region desactivation.<br> * <br> * A region desactivation occurs when the last {@link Player} left this {@link WorldObject}'s {@link WorldRegion} surroundings (self region included).<br> * <br> * This state is verified by {@link WorldRegion#isActive()}. */ public void onInactiveRegion() { } /** * @param object : The {@link WorldObject} to test. * @param radius : The radius to test. * @return True is this {@link WorldObject} is inside the given radius around the {@link WorldObject} set as parameter. */ public final boolean isIn3DRadius(WorldObject object, int radius) { return _position.isIn3DRadius(object.getPosition(), radius); } /** * @param loc : The {@link Location} to test. * @param radius : The radius to test. * @return True is this {@link WorldObject} is inside the given radius around the {@link Location} set as parameter. */ public final boolean isIn3DRadius(Location loc, int radius) { return _position.isIn3DRadius(loc, radius); } /** * @param x : The X coord to test. * @param y : The Y coord to test. * @param z : The Z coord to test. * @param radius : The radius to test. * @return True is this {@link WorldObject} is inside the given radius around the {@link Location} set as parameter. */ public final boolean isIn3DRadius(int x, int y, int z, int radius) { return _position.isIn3DRadius(x, y, z, radius); } /** * @param object : The {@link WorldObject} to test. * @return The distance between this {WorldObject} and the {@link WorldObject} set as parameter. */ public final double distance3D(WorldObject object) { return _position.distance3D(object.getPosition()); } /** * @param loc : The {@link Location} to test. * @return The distance between this {WorldObject} and the {@link Location} set as parameter. */ public final double distance3D(Location loc) { return _position.distance3D(loc); } /** * @param object : The {@link WorldObject} to test. * @param radius : The radius to test. * @return True is this {@link WorldObject} is inside the given radius around the {@link WorldObject} set as parameter. */ public final boolean isIn2DRadius(WorldObject object, int radius) { return _position.isIn2DRadius(object.getPosition(), radius); } /** * @param loc : The {@link Location} to test. * @param radius : The radius to test. * @return True is this {@link WorldObject} is inside the given radius around the {@link Location} set as parameter. */ public final boolean isIn2DRadius(Location loc, int radius) { return _position.isIn2DRadius(loc, radius); } /** * @param x : The X coord to test. * @param y : The Y coord to test. * @param radius : The radius to test. * @return True is this {@link WorldObject} is inside the given radius around the {@link Location} set as parameter. */ public final boolean isIn2DRadius(int x, int y, int radius) { return _position.isIn2DRadius(x, y, radius); } /** * @param object : The {@link WorldObject} to test. * @return The distance - without counting Z - between this {WorldObject} and the {@link WorldObject} set as parameter. */ public final double distance2D(WorldObject object) { return _position.distance2D(object.getPosition()); } /** * @param loc : The {@link Location} to test. * @return The distance - without counting Z - between this {WorldObject} and the {@link Location} set as parameter. */ public final double distance2D(Location loc) { return _position.distance2D(loc); } /** * @param target : The {@link WorldObject} target to check. * @return True if this {@link WorldObject} is behind the {@link WorldObject} target. */ public final boolean isBehind(WorldObject target) { return _position.isBehind(target); } /** * @param target : The {@link WorldObject} target to check. * @return True if this {@link WorldObject} is in front of the {@link WorldObject} target. */ public final boolean isInFrontOf(WorldObject target) { return _position.isInFrontOf(target); } /** * @param target : The {@link WorldObject} target to check. * @param maxAngle : The angle to check. * @return True if this {@link WorldObject} is facing the {@link WorldObject} target. */ public final boolean isFacing(WorldObject target, int maxAngle) { return _position.isFacing(target, maxAngle); } /** * @param player */ public void onInteract(Player player) { } }
-
Help Help with seven signs
BAN_L2JDev replied to Kotegaeshi92's question in Request Server Development Help [L2J]
1º delete table spawnlist 2º left click Execute Beth FIle ... execute sql file https://mega.nz/file/Zcw23LQY#vP0YOXXM_dUa3NYoF17P3TdhWedHCsUSEATObutYudk -
====================================================== Index config.java ======================================================= /** Auto-loot */ public static boolean AUTO_LOOT; public static boolean AUTO_LOOT_HERBS; public static boolean AUTO_LOOT_RAID; + public static boolean ENABLE_KETRA_VARKAS_DROP; + public static List<RewardHolder> KETRA_ORC_DROP_MANAGER = new ArrayList<>(); + public static List<RewardHolder> KETRA_ORC_DROP_VIP_MANAGER = new ArrayList<>(); AUTO_LOOT = server.getProperty("AutoLoot", false); AUTO_LOOT_HERBS = server.getProperty("AutoLootHerbs", false); AUTO_LOOT_RAID = server.getProperty("AutoLootRaid", false); + ENABLE_KETRA_VARKAS_DROP = server.getProperty("EnableSettingsDROP", true); + KETRA_ORC_DROP_MANAGER = parseReward(server, "KETRA_VARKA_DROP_LIST"); + KETRA_ORC_DROP_VIP_MANAGER = parseReward(server, "KETRA_VARKA_DROP_LIST_VIP"); public List<IntIntHolder> getRequiredItems(int job) { return _claimItems.get(job); } } + private static List<RewardHolder> parseReward(ExProperties propertie, String configName) + { + List<RewardHolder> auxReturn = new ArrayList<>(); + + String aux = propertie.getProperty(configName).trim(); + for (String randomReward : aux.split(";")) + { + final String[] infos = randomReward.split(","); + if (infos.length > 2) + auxReturn.add(new RewardHolder(Integer.valueOf(infos[0]), Integer.valueOf(infos[1]), Integer.valueOf(infos[2]))); + else + auxReturn.add(new RewardHolder(Integer.valueOf(infos[0]), Integer.valueOf(infos[1]))); + } + return auxReturn; + } ======================================================================== Index RewardHolder.java ======================================================================== +package net.sf.l2j.gameserver.model.holder; + +public class RewardHolder +{ + private int _id; + private int _count; + private int _chance; + + /** + * @param rewardId + * @param rewardCount + */ + public RewardHolder(int rewardId, int rewardCount) + { + _id = rewardId; + _count = rewardCount; + _chance = 100; + } + + /** + * @param rewardId + * @param rewardCount + * @param rewardChance + */ + public RewardHolder(int rewardId, int rewardCount, int rewardChance) + { + _id = rewardId; + _count = rewardCount; + _chance = rewardChance; + } + + public int getRewardId() + { + return _id; + } + + public int getRewardCount() + { + return _count; + } + + public int getRewardChance() + { + return _chance; + } + + public void setId(int id) + { + _id = id; + } + + public void setCount(int count) + { + _count = count; + } + + public void setChance(int chance) + { + _chance = chance; + } +} ======================================================================================================================== Index: Attackable.java ======================================================================================================================== private boolean _isReturningToSpawnPoint; private boolean _seeThroughSilentMove; private boolean _isNoRndWalk; + private static boolean _canReward = false; + private static HashMap<String, Integer> _playerHwids = new HashMap<>(); @Override public boolean doDie(Creature killer) { if (!super.doDie(killer)) return false; // Test the ON_KILL ScriptEventType. for (Quest quest : getTemplate().getEventQuests(ScriptEventType.ON_KILL)) ThreadPool.schedule(() -> quest.notifyKill(this, killer), 3000); + if (Config.ENABLE_KETRA_VARKAS_DROP) + { + // Check if player is an allied Varka. Reward + if (ArraysUtil.contains(getTemplate().getClans(), "varka_silenos_clan")) + addReward(killer); + + // Check if player is an allied Ketra. Reward + if (ArraysUtil.contains(getTemplate().getClans(), "ketra_orc_clan")) + addReward(killer); + } /** * @param target : The targeted {@link Creature}. * @param range : The range to check. * @param allowPeaceful : If true, peaceful {@link Attackable}s are able to auto-attack. * @return True if the {@link Creature} used as target is autoattackable, or false otherwise. */ public boolean canAutoAttack(Creature target, int range, boolean allowPeaceful) { if (target instanceof Attackable && isConfused()) return GeoEngine.getInstance().canSeeTarget(this, target); if (target instanceof Npc) return false; // Depending on Config, do not allow mobs to attack players in PEACE zones, unless they are already following those players outside. if (!Config.MOB_AGGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE)) return false; // Check if the actor is Aggressive return ((allowPeaceful || isAggressive()) && GeoEngine.getInstance().canSeeTarget(this, target)); } } + public final static void addReward(Creature killer) + { + if (killer instanceof Playable) + { + Player player = killer.getActingPlayer(); + + if (player.isInParty()) + { + List<Player> party = player.getParty().getMembers(); + + for (Player member : party) + { + final String pIp = member.getClient().getConnection().getInetAddress().getHostAddress(); + + if (!_playerHwids.containsKey(pIp)) + { + _playerHwids.put(pIp, 1); + _canReward = true; + } + else + { + int count = _playerHwids.get(pIp); + + if (count < 1) + { + _playerHwids.remove(pIp); + _playerHwids.put(pIp, count + 1); + _canReward = true; + } + else + { + member.sendMessage("Already 1 member of your PC have been rewarded, so this character won't be rewarded."); + _canReward = false; + + } + } + if (_canReward) + { + if (member.isIn3DRadius(killer, 1000)) + RandomReward(member); + else + member.sendMessage("You are too far from your party to be rewarded."); + } + } + _playerHwids.clear(); + } + else + { + RandomReward(player); + } + } + } + public static void RandomReward(Player player) + { + if (player.isVip()) + { + for (RewardHolder reward : Config.KETRA_ORC_DROP_VIP_MANAGER) + { + if (Rnd.get(100) <= reward.getRewardChance()) + { + if (player.isVip()) + { + player.getInventory().addItem("Cube Reward", reward.getRewardId(), reward.getRewardCount(), player, null); + + if (reward.getRewardCount() > 1) + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S).addItemName(reward.getRewardId()).addItemNumber(reward.getRewardCount())); + else + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1).addItemName(reward.getRewardId())); + } + } + } + } + else + for (RewardHolder reward : Config.KETRA_ORC_DROP_MANAGER) + { + if (Rnd.get(100) <= reward.getRewardChance()) + { + + player.getInventory().addItem("Cube Reward", reward.getRewardId(), reward.getRewardCount(), player, null); + + if (reward.getRewardCount() > 1) + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S).addItemName(reward.getRewardId()).addItemNumber(reward.getRewardCount())); + else + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1).addItemName(reward.getRewardId())); + + } + } + } ======================================================================================================================== Index: server.properties ======================================================================================================================== # AutoLoot, don't lead herbs behavior. False by default. AutoLoot = False # AutoLoot from raid boss. False by default. AutoLootRaid = False # If False, herbs will drop on ground even if AutoLoot is enabled. False by default. AutoLootHerbs = False +#============================================================= +# VARKAS/KETRA +# Monster Clan template = varka_silenos_clan | ketra_orc_clan +# Default = False +EnableSettingsDROP = True +#============================================================= +# for Memeber Party Reward all Items give reward Check Hwid Block Reward same/ip +# Format: itemId,count,chance(%);itemId,count,(chance(%)(optional));.... +KETRA_VARKA_DROP_LIST = 57,1000000,20;9311,75,80; +KETRA_VARKA_DROP_LIST_VIP = 57,3000000,40;9311,150,80;