Tópico: [L2JServer] .delevel command
Ver um Único Post
Antigo 09-12-2010, 07:21 PM   #3 (permalink)
Lanterna-Verde
Membro - Tenente
 
Avatar de Lanterna-Verde
 
Registrado em: Mar 2010
Posts: 106
Agradeceu: 43
Agradecido 140 Vezes em 45 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:

Inventório de Lanterna-Verde

Padrão

@UchihaItachi
Comando: .allow_xp_sp

Crie um documento em java/com/l2jserver/gameserver/handler/voicedcommandhandlers chamado AllowExpAndSp.java
e coloque isto nele:
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
package handlers.voicedcommandhandlers;

import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
import com.l2jserver.gameserver.network.clientpackets.Say2;

/**
 * Allow player to enable or disable Experience and SP Gain.
 */
public class AllowExpAndSp implements IVoicedCommandHandler
{
	private static final String[] VOICED_COMMANDS =
	{ 
		"allow_xp_sp" 
	};

	public boolean useVoicedCommand(String command, L2PcInstance player, String params)
	{
		if (command.equalsIgnoreCase("allow_xp_sp"))
		{
			if (player != null)
			{
				if (player.canGetExp() == true)
				{
					player.setCanGetExp(false);
					player.sendPacket(new CreatureSay(0, Say2.PARTY, "Server", "Exp and Sp Disabled."));
				}
				else
				{
					player.setCanGetExp(true);
					player.sendPacket(new CreatureSay(0, Say2.PARTY, "Server", "Exp and Sp Enabled."));
				}
			}
		}
		return true;
	}
	
	public String[] getVoicedCommandList()
	{
		return VOICED_COMMANDS;
	}
}
Finalização do Código:

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 4422)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -828,6 +828,9 @@
 	
 	private long _pvpFlagLasts;
 	
+	/** Allow Player to receive Exp and Sp */
+	private boolean _canGetExpAndSp = true;
+	
 	public void setPvpFlagLasts(long time)
 	{
 		_pvpFlagLasts = time;
@@ -15162,4 +15165,14 @@
 			L2DatabaseFactory.close(con);
 		}
 	}
-}
+	
+    public final boolean canGetExpAndSp()
+	{
+		return _canGetExpAndSp;
+	}
+	
+	public final void setCanGetExpAndSp(boolean b)
+	{
+		_canGetExpAndSp = b;
+	}
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/actor/L2Attackable.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Attackable.java	(revision 4422)
+++ java/com/l2jserver/gameserver/model/actor/L2Attackable.java	(working copy)
@@ -681,6 +681,15 @@
 								sp *= Config.L2JMOD_CHAMPION_REWARDS;
 							}
 							
+							if (attacker instanceof L2PcInstance)
+							{
+								if (((L2PcInstance) attacker).canGetExpAndSp() == false)
+								{
+									exp = 0;
+									sp = 0;
+								}
+							}
+							
 							// Check for an over-hit enabled strike
 							if (attacker instanceof L2PcInstance)
 							{
Index: java/com/l2jserver/gameserver/model/L2Party.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Party.java	(revision 4422)
+++ java/com/l2jserver/gameserver/model/L2Party.java	(working copy)
@@ -694,7 +694,8 @@
 		{
 			for (L2Character member : rewardedMembers)
 			{
-				if(member.isDead()) continue;
+				if(member.isDead() || !((L2PcInstance) member).canGetExpAndSp()) 
+					continue;
 				
 				penalty = 0;

Lanterna-Verde está offline   Responder com Citação
O seguinte membro ao lado disse Obrigado(a) a : Lanterna-Verde por gostar deste Post :
ManoeL-ADM (09-12-2010)