Boorinio Posted February 1, 2011 Posted February 1, 2011 Epidi dn to brika pouthena to kanw share, Protector npc to npc ayto apagoreyei to pvp i pk i kai ta dio analoga me to ti thelete eseis,se sigkekrimeno range kai bgazei kai ena minima tis epiloghs sas [*]Ftiakste sto model.actor.instance ena L2ProtectorInstance /* This program is free software; you can redistribute it and/or modify 2 * it under the terms of the GNU General Public License as published by 3 * the Free Software Foundation; either version 2, or (at your option) 4 * any later version. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * GNU General Public License for more details. 10 * 11 * You should have received a copy of the GNU General Public License 12 * along with this program; if not, write to the Free Software 13 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 * 02111-1307, USA. 15 * 16 * http://www.gnu.org/copyleft/gpl.html 17 */ package com.l2jrox.gameserver.model.actor.instance; import java.util.concurrent.ScheduledFuture; import com.l2jrox.Config; import com.l2jrox.gameserver.ThreadPoolManager; import com.l2jrox.gameserver.datatables.SkillTable; import com.l2jrox.gameserver.model.L2Character; import com.l2jrox.gameserver.model.L2Object; import com.l2jrox.gameserver.model.L2Skill; import com.l2jrox.gameserver.network.serverpackets.CreatureSay; import com.l2jrox.gameserver.network.serverpackets.MagicSkillUse; import com.l2jrox.gameserver.templates.L2NpcTemplate; /** * @author Ederik * */ public class L2ProtectorInstance extends L2NpcInstance { private ScheduledFuture<?> _aiTask; private class ProtectorAI implements Runnable { private L2ProtectorInstance _caster; protected ProtectorAI(L2ProtectorInstance caster) { _caster = caster; } public void run() { /** * For each known player in range, cast sleep if pvpFlag != 0 or Karma >0 * Skill use is just for buff animation */ for (L2PcInstance player : getKnownList().getKnownPlayers().values()) { if ((player.getKarma() > 0 && Config.PROTECTOR_PLAYER_PK) || (player.getPvpFlag() != 0 && Config.PROTECTOR_PLAYER_PVP)) { handleCast(player, Config.PROTECTOR_SKILLID, Config.PROTECTOR_SKILLLEVEL); } } } private boolean handleCast(L2PcInstance player, int skillId, int skillLevel) { if (player.isGM() || player.isDead() || !player.isVisible() || !isInsideRadius(player, getDistanceToWatchObject(player), false, false)) return false; L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel); if (player.getFirstEffect(skill) == null) { int objId = _caster.getObjectId(); skill.getEffects(_caster, player); broadcastPacket(new MagicSkillUse(_caster, player, skillId, skillLevel, Config.PROTECTOR_SKILLTIME, 0)); broadcastPacket(new CreatureSay(objId,0,String.valueOf(getName()),Config.PROTECTOR_MESSAGE)); return true; } return false; } } public L2ProtectorInstance(int objectId, L2NpcTemplate template) { super(objectId, template); if (_aiTask != null) _aiTask.cancel(true); _aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new ProtectorAI(this), 3000, 3000); } @Override public void deleteMe() { if (_aiTask != null) { _aiTask.cancel(true); _aiTask = null; } super.deleteMe(); } @Override public int getDistanceToWatchObject(L2Object object) { return Config.PROTECTOR_RADIUS_ACTION; } @Override public boolean isAutoAttackable(L2Character attacker) { return false; } } [*]meta pate sto net.sf.l2j.config kai prostheste ta parakatw.... public static boolean PROTECTOR_PLAYER_PK; public static boolean PROTECTOR_PLAYER_PVP; public static int PROTECTOR_RADIUS_ACTION; public static int PROTECTOR_SKILLID; public static int PROTECTOR_SKILLLEVEL; public static int PROTECTOR_SKILLTIME; public static String PROTECTOR_MESSAGE; PROTECTOR_PLAYER_PK = Boolean.parseBoolean(L2jModsSettings.getProperty("ProtectorPlayerPK", "false")); PROTECTOR_PLAYER_PVP = Boolean.parseBoolean(L2jModsSettings.getProperty("ProtectorPlayerPVP", "false")); PROTECTOR_RADIUS_ACTION = Integer.parseInt(L2jModsSettings.getProperty("ProtectorRadiusAction", "500")); PROTECTOR_SKILLID = Integer.parseInt(L2jModsSettings.getProperty("ProtectorSkillId", "1069")); PROTECTOR_SKILLLEVEL = Integer.parseInt(L2jModsSettings.getProperty("ProtectorSkillLevel", "42")); PROTECTOR_SKILLTIME = Integer.parseInt(L2jModsSettings.getProperty("ProtectorSkillTime", "800")); PROTECTOR_MESSAGE = L2jModsSettings.getProperty("ProtectorMessage", "Protector, not spawnkilling here, go read the rules !!!"); [*] Meta prostheste tis parakatw rithtmiseis sto mods.properties # -------------------- # Protector Npc Config # -------------------- # Enable Protector npc action to player with karma or/and pvpFlag # default = true ProtectorPlayerPK = true ProtectorPlayerPVP = true # Skill use by protector for player # defaut protector use sleep level 42 time 800 check on radius 500 ProtectorRadiusAction = 1500 ProtectorSkillId = 1069 ProtectorSkillLevel = 42 ProtectorSkillTime = 800 # Protector message ProtectorMessage = "No killing here, go read the rules !!!" [*]Telos peraste ayto to npc sthn database sas (50017, 31854, 'Protector', '1', 'PVP/PK Manager', '1', 'NPC.a_maidA_FHuman', '8.00', '20.50', '80', 'female', 'L2Protector', '40', '99999', '9999', null, null, '40', '43', '30', '21', '20', '10', '0', '0', '1314', '470', '10000', '382', '278', '0', '3000', '0', '0', '0', '55', '132', null, '0', '0', '0', 'LAST_HIT') [*]kante spawn to npc ingame kai eiste etimoi!
Red-Hair-Shanks Posted February 1, 2011 Posted February 1, 2011 wreos file...xrisimo einai afto to code. nomizw exei 3anagini kati paromio.
l22expert Posted February 1, 2011 Posted February 1, 2011 afto edo * meta pate sto net.sf.l2j.config kai prostheste ta parakatw.... Code: public static boolean PROTECTOR_PLAYER_PK; public static boolean PROTECTOR_PLAYER_PVP; public static int PROTECTOR_RADIUS_ACTION; public static int PROTECTOR_SKILLID; public static int PROTECTOR_SKILLLEVEL; public static int PROTECTOR_SKILLTIME; public static String PROTECTOR_MESSAGE; kai ta alla episis pes kato apo pou ta pername gia na gini ena kalos guide fix
Boorinio Posted February 3, 2011 Author Posted February 3, 2011 afto edo * meta pate sto net.sf.l2j.config kai prostheste ta parakatw.... Code: public static boolean PROTECTOR_PLAYER_PK; public static boolean PROTECTOR_PLAYER_PVP; public static int PROTECTOR_RADIUS_ACTION; public static int PROTECTOR_SKILLID; public static int PROTECTOR_SKILLLEVEL; public static int PROTECTOR_SKILLTIME; public static String PROTECTOR_MESSAGE; kai ta alla episis pes kato apo pou ta pername gia na gini ena kalos guide fix kai ekeina gia to config einai.... Eyxaristw pedes a ksexasa credits l2jnet
Boorinio Posted February 3, 2011 Author Posted February 3, 2011 A moderator move it please in greek section thanks!
icshiba Posted February 3, 2011 Posted February 3, 2011 πολυ καλο share αυτος ο Protector συνηθιζεται στα ρωσσικα pack πολυ καλο share :) GG
WhiteAttack© Posted July 4, 2011 Posted July 4, 2011 Τι εννοεις L2jfrozen? Logika enooei ean to pire apo ekei.. To share sou einai polu xrisimo thanks.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now