All pastes #28143 Raw Edit

Anonymous

public text v1 · immutable
#28143 ·published 2005-11-09 15:40 UTC
rendered paste body
Index: C:/eclipse/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2PcInstance.java
===================================================================
--- C:/eclipse/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2PcInstance.java	(revision 1479)
+++ C:/eclipse/workspace/L2_GameServer/java/net/sf/l2j/gameserver/model/L2PcInstance.java	(working copy)
@@ -58,7 +58,6 @@
 import net.sf.l2j.gameserver.ai.L2PlayerAI;
 import net.sf.l2j.gameserver.handler.IItemHandler;
 import net.sf.l2j.gameserver.handler.ItemHandler;
-import net.sf.l2j.gameserver.lib.JBForth;
 import net.sf.l2j.gameserver.model.L2Skill.SkillTargetType;
 import net.sf.l2j.gameserver.model.L2Skill.SkillType;
 import net.sf.l2j.gameserver.model.quest.Quest;
@@ -221,7 +220,7 @@
 
     /** JBForth instance associated to this L2Character */
 
-   	public JBForth jbf;
+   	//public JBForth jbf;
 
 	/** True if the L2PcInstance is sitting */
 	private boolean _waitTypeSitting;
@@ -3839,16 +3838,16 @@
 
 //				jbf.setPlayer(this);
 
-				jbf = new JBForth(this);
+				//jbf = new JBForth(this);
 
 				SystemMessage sm = new SystemMessage(614);
-			    sm.addString(jbf.exec("on-player-start"));
+			    //sm.addString(jbf.exec("on-player-start"));
 	    	    sendPacket(sm);
 	        }
     	    else
         	{
 				SystemMessage sm = new SystemMessage(614);
-			    sm.addString(jbf.exec("on-player-exit"));
+			    //sm.addString(jbf.exec("on-player-exit"));
 		        sendPacket(sm);
 	    	
         	    GmListTable.getInstance().deleteGm(this);
@@ -5956,4 +5955,27 @@
     {
        return _wantsPeace;
     }
+    
+    public void doAttack(L2Character target)
+    {
+        if ( 
+                target != null
+                && !(target instanceof L2MonsterInstance)   // Target is not a monster
+                && (getAccessLevel() < Config.GM_PEACEATTACK)    // Player cannot attack in peace
+                && (withinZones(L2World.zonePeace) || target.withinZones(L2World.zonePeace)) // Target or player is in peace zone
+                && (
+                        !(target instanceof L2PcInstance)   // Target is not a player
+                        || (!Config.ALT_GAME_KARMAPLAYERCANBEKILLEDINPEACEZONE) // Or Target is a player and killable in peace zone is false
+                        || (((L2PcInstance)target).getKarma() < Config.KARMA_MAX_KARMA) // Or Target is a player, killable in peace zone is true, and has karma
+                    )
+           )
+        {
+            sendPacket(new SystemMessage(SystemMessage.TARGET_IN_PEACEZONE));
+            ActionFailed af = new ActionFailed();
+            sendPacket(af);
+            return;
+        }
+        
+        super.doAttack(target);
+    }
 }