Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: net.sf.l2j;Config.java
- ===================================================================
- --- net.sf.l2j;Config.java (revision 84)
- +++ net.sf.l2j;Config.java (working copy)
- + /** Disable attack Npcs */
- + public static boolean DISABLE_ATTACK_NPC_TYPE;
- + public static String ALLOWED_NPC_TYPES;
- + public static ArrayList<String> LIST_ALLOWED_NPC_TYPES = new ArrayList<>();
- + DISABLE_ATTACK_NPC_TYPE = npcs.getProperty("DisableAttackToNpcs", false);
- + ALLOWED_NPC_TYPES = npcs.getProperty("AllowedNPCTypes");
- + LIST_ALLOWED_NPC_TYPES = new ArrayList<>();
- + for (String npc_type : ALLOWED_NPC_TYPES.split(","))
- + LIST_ALLOWED_NPC_TYPES.add(npc_type);
- Index: net.sf.l2j.gameserver.model.actor.instance;player.java
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor.instance;player.java (revision 84)
- +++ net.sf.l2j.gameserver.model.actor.instance;player.java (working copy)
- if (target instanceof Door)
- if (!((Door) target).isAutoAttackable(this) // Siege doors only hittable during siege
- || ((Door) target).isUnlockable() && skill.getSkillType() != L2SkillType.UNLOCK) // unlockable doors
- {
- sendPacket(SystemMessageId.INCORRECT_TARGET);
- sendPacket(ActionFailed.STATIC_PACKET);
- return false;
- }
- + if (target instanceof Npc && Config.DISABLE_ATTACK_NPC_TYPE)
- + {
- + String mobtype = ((Npc) target).getTemplate().getType();
- + if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype) && skill.isOffensive())
- + {
- + sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- + }
- Index: net.sf.l2j.gameserver.model.actor;Creature.java
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor;Creature.java (revision 84)
- +++ net.sf.l2j.gameserver.model.actor;Creature.java (working copy)
- final Player player = getActingPlayer();
- if (player != null && player.inObserverMode())
- {
- sendPacket(SystemMessage.getSystemMessage(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE));
- sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- + if (target instanceof Npc && Config.DISABLE_ATTACK_NPC_TYPE)
- + {
- + String mobtype = ((Npc) target).getTemplate().getType();
- + if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
- + return;
- + }
- Index: net.sf.l2j.gameserver.model.actor;Summon.java
- ===================================================================
- --- net.sf.l2j.gameserver.model.actor;Summon.java (revision 84)
- +++ net.sf.l2j.gameserver.model.actor;Summon.java (working copy)
- // ************************************* Check Summon State *******************************************
- // Check if this is offensive magic skill
- if (skill.isOffensive())
- {
- if (isInsidePeaceZone(this, target))
- {
- // If summon or target is in a peace zone, send a system message TARGET_IN_PEACEZONE
- sendPacket(SystemMessage.getSystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- return false;
- }
- if (getOwner() != null && getOwner().isInOlympiadMode() && !getOwner().isOlympiadStart())
- {
- // if Player is in Olympia and the match isn't already start, send ActionFailed
- sendPacket(ActionFailed.STATIC_PACKET);
- return false;
- }
- + if (target instanceof Npc && Config.DISABLE_ATTACK_NPC_TYPE)
- + {
- + String mobtype = ((Npc) target).getTemplate().getType();
- + if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
- + {
- + sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INCORRECT_TARGET));
- + return false;
- + }
- + }
- Index: config/npcs.propertis
- ===================================================================
- --- config/npcs.propertis (revision 84)
- +++ config/npcs.propertis (working copy)
- + #=====================================================
- + # DISABLE ATTACK TO NPC LIST
- + #=====================================================
- + # If True ActiveChar will not be able to Attack the Listed Npc Types.
- + DisableAttackToNpcs = True
- +
- + # List of NPC's that allow casting skills on them
- + # Any other type will not allow casting
- + AllowedNPCTypes = GrandBoss,Chest,FestivalMonster,Monster,Pet,RaidBoss,SiegeGuard,SiegeNpc,ControlTower,FlameTower,Artefact,PenaltyMonster,FeedableBeast,RiftInvader,Guard,SiegeFlag
Add Comment
Please, Sign In to add comment