Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: config/npcs.properties
- ===================================================================
- --- config/npcs.properties (revision 48)
- +++ config/npcs.properties (working copy)
- @@ -89,6 +89,13 @@
- # Show clan && alliance crests on summons, default: False
- ShowSummonCrest = False
- +# 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,Minion,Monster,Pet,RaidBoss,SiegeGuard,SiegeNpc,ControlTower,Artefact,PenaltyMonster,FeedableBeast,SiegeFlag,RiftInvader,Guard,GuardNoHTML
- +
- #=============================================================
- # Wyvern Manager
- #=============================================================
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 48)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -402,6 +402,10 @@
- public static boolean SHOW_NPC_LVL;
- public static boolean SHOW_NPC_CREST;
- public static boolean SHOW_SUMMON_CREST;
- + public static boolean NPC_ATTACKABLE;
- + public static boolean DISABLE_ATTACK_NPC_TYPE;
- + public static String ALLOWED_NPC_TYPES;
- + public static List<String> LIST_ALLOWED_NPC_TYPES;
- /** Wyvern Manager */
- public static boolean WYVERN_ALLOW_UPGRADER;
- @@ -1784,6 +1788,12 @@
- SHOW_NPC_LVL = npcs.getProperty("ShowNpcLevel", false);
- SHOW_NPC_CREST = npcs.getProperty("ShowNpcCrest", false);
- SHOW_SUMMON_CREST = npcs.getProperty("ShowSummonCrest", false);
- + 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);
- + NPC_ATTACKABLE = npcs.getProperty("NpcAttackable", false);
- WYVERN_ALLOW_UPGRADER = npcs.getProperty("AllowWyvernUpgrader", true);
- WYVERN_REQUIRED_LEVEL = npcs.getProperty("RequiredStriderLevel", 55);
- Index: java/net/sf/l2j/gameserver/model/actor/Creature.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/Creature.java (revision 49)
- +++ java/net/sf/l2j/gameserver/model/actor/Creature.java (working copy)
- @@ -542,6 +542,19 @@
- 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))
- + {
- + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2);
- + sm.addString("Npc Type " + mobtype + " has Protection - No Attack Allowed!");
- + ((Player) this).sendPacket(sm);
- + ((Player) this).sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- stopEffectsOnAction();
- @@ -1123,7 +1136,19 @@
- }
- return;
- }
- -
- +
- + if (target instanceof Player && target instanceof Npc && Config.DISABLE_ATTACK_NPC_TYPE)
- + {
- + final String mobtype = ((Npc) target).getTemplate().getType();
- + if (!Config.LIST_ALLOWED_NPC_TYPES.contains(mobtype))
- + {
- + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2);
- + sm.addString("Npc Type " + mobtype + " has Protection - No Attack Allowed!");
- + ((Player) target).sendPacket(sm);
- + ((Player) target).sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- // Get the casting time of the skill (base)
- int hitTime = skill.getHitTime();
- int coolTime = skill.getCoolTime();
- @@ -3982,7 +4007,14 @@
- {
- if (target == null)
- 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))
- + return false;
- + }
- +
- if (target instanceof Npc || attacker instanceof Npc)
- return false;
- Index: java/net/sf/l2j/gameserver/model/actor/Npc.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/Npc.java (revision 49)
- +++ java/net/sf/l2j/gameserver/model/actor/Npc.java (working copy)
- @@ -210,7 +210,10 @@
- @Override
- public boolean isAttackable()
- {
- - return true;
- + if (Config.NPC_ATTACKABLE || this instanceof Attackable)
- + return true;
- +
- + return false;
- }
- /**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement