Index: java/net/sf/l2j/gameserver/ai/L2CharacterAI.java
===================================================================
--- java/net/sf/l2j/gameserver/ai/L2CharacterAI.java (revision 1280)
+++ java/net/sf/l2j/gameserver/ai/L2CharacterAI.java (working copy)
@@ -194,7 +194,15 @@
clientActionFailed();
return;
}
-
+
+ if (((L2PcInstance) _actor).getKarma() > 0 && (_actor.getLevel() - target.getLevel()) >=10 && ((L2PlayableInstance) target).getProtectionBlessing())
+ {
+ // If attacker have karma and have level >= 10 than his target and target have Newbie Protection Buff,
+ // cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor.
+ clientActionFailed();
+ return;
+ }
+
// Check if the Intention is already AI_INTENTION_ATTACK
if (getIntention() == AI_INTENTION_ATTACK)
{
@@ -264,6 +272,14 @@
return;
}
+ if (((L2PcInstance) _actor).getKarma() > 0 && (_actor.getLevel() - ((L2Character) target).getLevel()) >=10 && ((L2PlayableInstance) target).getProtectionBlessing())
+ {
+ // If attacker have karma and have level >= 10 than his target and target have Newbie Protection Buff,
+ // cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor.
+ clientActionFailed();
+ return;
+ }
+
// Set the AI cast target
setCastTarget((L2Character) target);
Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java (revision 1266)
+++ java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java (working copy)
@@ -457,7 +457,7 @@
int maxfive = 5;
for (L2Effect e : effects)
{
- if (e.getSkill().getId() != 4082 && e.getSkill().getId() != 4215 &&
+ if (e.getSkill().getId() != 4082 && e.getSkill().getId() != 4215 && e.getSkill().getId() != 5182 &&
e.getSkill().getId() != 4515 && e.getSkill().getId() != 110 && e.getSkill().getId() != 111) // Cannot cancel skills 4082, 4215, 4515
{
if(e.getSkill().getSkillType() != SkillType.BUFF) //sleep, slow, surrenders etc
Index: java/net/sf/l2j/gameserver/model/L2Effect.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Effect.java (revision 1266)
+++ java/net/sf/l2j/gameserver/model/L2Effect.java (working copy)
@@ -81,7 +81,8 @@
PETRIFICATION,
BLUFF,
BATTLE_FORCE,
- SPELL_FORCE
+ SPELL_FORCE,
+ PROTECTION_BLESSING
}
private static final Func[] _emptyFunctionSet = new Func[0];
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (revision 1240)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (working copy)
@@ -966,6 +966,10 @@
{
makeSupportMagic(player);
}
+ else if (command.startsWith("GiveBlessing"))
+ {
+ giveBlessingSupport(player);
+ }
else if (command.startsWith("multisell"))
{
L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(command.substring(9).trim()), player, false, getCastle().getTaxRate());
@@ -1036,7 +1040,30 @@
}
}
- /**
+ public void giveBlessingSupport(L2PcInstance player)
+ {
+ if (player == null)
+ return;
+
+ // Prevent a cursed weapon weilder of being buffed
+ if (player.isCursedWeaponEquiped())
+ return;
+
+ int player_level = player.getLevel();
+ // Select the player
+ setTarget(player);
+ // If the player is too high level, display a message and return
+ if (player_level > 39 || !player.isNewbie())
+ {
+ String content = "
Newbie Guide:
Only a novice character of level 39 or less can receive my support magic.
Your novice character is the first one that you created and raised in this world.";
+ insertObjectIdAndShowChatWindow(player, content);
+ return;
+ }
+ L2Skill skill = SkillTable.getInstance().getInfo(5182,1);
+ doCast(skill);
+ }
+
+ /**
* Return null (regular NPCs don't have weapons instancies).
*/
@Override
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PlayableInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PlayableInstance.java (revision 1240)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PlayableInstance.java (working copy)
@@ -39,6 +39,7 @@
{
private boolean _isNoblesseBlessed = false; // for Noblesse Blessing skill, restores buffs after death
+ private boolean _ProtectionBlessing = false; // for Newbie Protection Blessing skill, keeps you safe from an attack by a chaotic character >= 10 levels apart from you
/**
* Constructor of L2PlayableInstance (use L2Character constructor).
*
@@ -178,4 +179,30 @@
public abstract boolean destroyItemByItemId(String process, int itemId, int count, L2Object reference, boolean sendMessage);
public abstract boolean destroyItem(String process, int objectId, int count, L2Object reference, boolean sendMessage);
+
+ // for Newbie Protection Blessing skill, keeps you safe from an attack by a chaotic character >= 10 levels apart from you
+ public final boolean getProtectionBlessing() { return _ProtectionBlessing; }
+ public final void setProtectionBlessing(boolean value) { _ProtectionBlessing = value; }
+ /**
+ *
+ */
+ public void startProtectionBlessing()
+ {
+ setProtectionBlessing(true);
+ updateAbnormalEffect();
+ }
+
+ /**
+ * @param blessing
+ */
+ public void stopProtectionBlessing(L2Effect effect)
+ {
+ if (effect == null)
+ stopEffects(L2Effect.EffectType.PROTECTION_BLESSING);
+ else
+ removeEffect(effect);
+
+ setProtectionBlessing(false);
+ updateAbnormalEffect();
+ }
}
Index: java/net/sf/l2j/gameserver/skills/effects/EffectProtectionBlessing.java
===================================================================
--- java/net/sf/l2j/gameserver/skills/effects/EffectProtectionBlessing.java (revision 0)
+++ java/net/sf/l2j/gameserver/skills/effects/EffectProtectionBlessing.java (revision 0)
@@ -0,0 +1,61 @@
+/* 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 net.sf.l2j.gameserver.skills.effects;
+
+import net.sf.l2j.gameserver.model.L2Effect;
+import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
+import net.sf.l2j.gameserver.skills.Env;
+
+/**
+ * @author kerberos_20
+ *
+ */
+public class EffectProtectionBlessing extends L2Effect
+{
+ public EffectProtectionBlessing(Env env, EffectTemplate template)
+ {
+ super(env, template);
+ }
+
+ @Override
+ public EffectType getEffectType()
+ {
+ return EffectType.PROTECTION_BLESSING;
+ }
+
+ /** Notify started */
+ @Override
+ public void onStart() {
+ if (getEffected() instanceof L2PlayableInstance)
+ ((L2PlayableInstance)getEffected()).startProtectionBlessing();
+ }
+
+ /** Notify exited */
+ @Override
+ public void onExit() {
+ if (getEffected() instanceof L2PlayableInstance)
+ ((L2PlayableInstance)getEffected()).stopProtectionBlessing (this);
+ }
+
+ @Override
+ public boolean onActionTime()
+ {
+ // just stop this effect
+ return false;
+ }
+}
\ No newline at end of file