Ir para conteúdo
  • Cadastre-se
  • 0

Quero fazer um pedido ao pessoal do Java, e sobre a montaria Strider!


Kayrus

Pergunta

E o seguinte: estou montando meu projeto server. e vou usar como peça fundamental, o pet STRIDER como montaria para todos os player.!

mais, quando o player monta no STRIDER a arma sai da mão e vai pro inventory. como no original!

 

gostaria de modificar para que as armas não saia da mão! pra quando o player desça do Pet, ele já se encontrem com a sua arma na mão.!

 

agradeço muito a ajuda de quem poder ajudar!

LOCAL ----  com.l2jfrozen.gameserver.handler.usercommandhandlers.Mount.java --- 


/*
 * L2jFrozen Project - www.l2jfrozen.com 
 * 
 * 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 com.l2jfrozen.gameserver.handler.usercommandhandlers;

import com.l2jfrozen.gameserver.datatables.SkillTable;
import com.l2jfrozen.gameserver.geo.GeoData;
import com.l2jfrozen.gameserver.handler.IUserCommandHandler;
import com.l2jfrozen.gameserver.model.Inventory;
import com.l2jfrozen.gameserver.model.L2Summon;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.Ride;
import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
import com.l2jfrozen.gameserver.util.Broadcast;

/**
 * Support for /mount command.
 * @author Tempy
 */
public class Mount implements IUserCommandHandler
{
	private static final int[] COMMAND_IDS =
	{
		61
	};
	
	/*
	 * (non-Javadoc)
	 * @see com.l2jfrozen.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jfrozen.gameserver.model.L2PcInstance)
	 */
	@Override
	public synchronized boolean useUserCommand(final int id, final L2PcInstance activeChar)
	{
		if (id != COMMAND_IDS[0])
			return false;
		
		L2Summon pet = activeChar.getPet();
		
		if (pet != null && pet.isMountable() && !activeChar.isMounted())
		{
			if (activeChar.isDead())
			{
				// A strider cannot be ridden when player is dead.
				SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_DEAD);
				activeChar.sendPacket(msg);
				msg = null;
			}
			else if (pet.isDead())
			{
				// A dead strider cannot be ridden.
				SystemMessage msg = new SystemMessage(SystemMessageId.DEAD_STRIDER_CANT_BE_RIDDEN);
				activeChar.sendPacket(msg);
				msg = null;
			}
			else if (pet.isInCombat())
			{
				// A strider in battle cannot be ridden.
				SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_IN_BATLLE_CANT_BE_RIDDEN);
				activeChar.sendPacket(msg);
				msg = null;
			}
			else if (activeChar.isInCombat())
			{
				// A pet cannot be ridden while player is in battle.
				SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
				activeChar.sendPacket(msg);
				msg = null;
			}
			else if (!activeChar.isInsideRadius(pet, 60, true, false))
			{
				activeChar.sendMessage("Too far away from strider to mount.");
				return false;
			}
			else if (!GeoData.getInstance().canSeeTarget(activeChar, pet))
			{
				final SystemMessage msg = new SystemMessage(SystemMessageId.CANT_SEE_TARGET);
				activeChar.sendPacket(msg);
				return false;
			}
			else if (activeChar.isSitting() || activeChar.isMoving())
			{
				// A strider can be ridden only when player is standing.
				SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
				activeChar.sendPacket(msg);
				msg = null;
			}
			else if (!pet.isDead() && !activeChar.isMounted())
			{
				if (!activeChar.disarmWeapons())
					return false;
				
				Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().npcId);
				Broadcast.toSelfAndKnownPlayersInRadius(activeChar, mount, 810000/* 900 */);
				activeChar.setMountType(mount.getMountType());
				activeChar.setMountObjectID(pet.getControlItemId());
				pet.unSummon(activeChar);
				mount = null;
				
				if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
				{
					if (activeChar.setMountType(0))
					{
						if (activeChar.isFlying())
						{
							activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
						}
						
						Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
						Broadcast.toSelfAndKnownPlayers(activeChar, dismount);
						activeChar.setMountObjectID(0);
						dismount = null;
					}
				}
			}
		}
		else if (activeChar.isRentedPet())
		{
			activeChar.stopRentPet();
		}
		else if (activeChar.isMounted())
		{
			// Dismount
			if (activeChar.setMountType(0))
			{
				if (activeChar.isFlying())
				{
					activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
				}
				
				Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
				Broadcast.toSelfAndKnownPlayers(activeChar, dismount);
				activeChar.setMountObjectID(0);
				dismount = null;
			}
		}
		
		pet = null;
		return true;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.l2jfrozen.gameserver.handler.IUserCommandHandler#getUserCommandList()
	 */
	@Override
	public int[] getUserCommandList()
	{
		return COMMAND_IDS;
	}
}

Editado por Kayrus
Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts recomendados

  • 0

Não tenho como testar aqui mas tenta comentar as condições nas linhas 111 e 112:

 

  1. if (!activeChar.disarmWeapons())
  2. return false;

e nas linhas 121 e 122 não esqueça de comentar a chave na linha 135

  1. if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
  2. {

Só comenta e testa e veh se dar certo , se pudesse eu faria aqui :(

Link para o comentário
Compartilhar em outros sites


  • 0

Não tenho como testar aqui mas tenta comentar as condições nas linhas 111 e 112:

 

  1. if (!activeChar.disarmWeapons())
  2. return false;

e nas linhas 121 e 122 não esqueça de comentar a chave na linha 135

  1. if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
  2. {

Só comenta e testa e veh se dar certo , se pudesse eu faria aqui :(

o mano! nao sei como fazer isso!

voce poderia fazer as alterações, e mandar aqui? ela completa, que eu testo

Link para o comentário
Compartilhar em outros sites

  • 0

comentar é soh colocar o // na frente das linhas ( vai ficar com a cor verde rsrs) :

 

  1. //if (!activeChar.disarmWeapons())
  2. //return false;

  1. //if (activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null || activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND) != null)
  2. //{

na linha 135 tem uma chave fechando :

  1. //}

é isso, aew vc salva e compila e #PartiuTestar

Link para o comentário
Compartilhar em outros sites

  • 0

O que vc ta pedindo é uma espécie de mod inevitavelmente vc vai ter que acessar o source pra adaptar as alterações então é mais facil vc fazer pq é pouca coisa, veja os tutoriais sobre como compilar ou adaptar mod que são muito faceis de fazer basta ter um eclipse, por exemplo, instalado no pc e vai ser de grande ajuda pra vc msm no futuro , grande abraço.

Link para o comentário
Compartilhar em outros sites

  • 0

O que vc ta pedindo é uma espécie de mod inevitavelmente vc vai ter que acessar o source pra adaptar as alterações então é mais facil vc fazer pq é pouca coisa, veja os tutoriais sobre como compilar ou adaptar mod que são muito faceis de fazer basta ter um eclipse, por exemplo, instalado no pc e vai ser de grande ajuda pra vc msm no futuro , grande abraço.

Comentei o que voce pediu pra mim fazer la, mais nao funcionou.. esse assunto deixa pra la mano!. vou deixa no original.

 

agora mano! apareceu um problema no meu projeto que ta me deixando maluco,. Em party, não ta dando XP nem SP, idepentente da diferença lvl. so distribui os Drops ! Ja verifiquei na Config Rates. other. na party de distribuição de party. mais nada soluciona. creio que algum Mod que adcionei no meu projeto tenha Bugado ou desativado upar em party.

esse erro ta no core, se vc poder me ajudar eu dou uma gratificação.!

Editado por Kayrus
Link para o comentário
Compartilhar em outros sites

  • 0
essa eh minha configuração do meu other.properties
# PARTY XP DISTRIBUTION
# The first option can be set to auto, percentage, level, none.
# When is "auto" member of the party receives less Exp / SP, where its level is low
# If the party received a bonus for him (30% for 2 members of the party)
# In this case, he will not get Exp / SP of the party, and will not receive a bonus party
# Not used quite too high values of the parameter "percentage"!
# Not used quite too low values of the parameter "level"!
# If you do not want to be the distribution of XP for the members of the Party
# Just put "none". Default:, 3.0, 30
PartyXpCutoffMethod = auto
PartyXpCutoffPercent = 3.0
PartyXpCutoffLevel = 30
essa eh minha configuração do meu config.java

PARTY_XP_CUTOFF_METHOD = otherSettings.getProperty("PartyXpCutoffMethod", "percentage");
PARTY_XP_CUTOFF_PERCENT = Double.parseDouble(otherSettings.getProperty("PartyXpCutoffPercent", "3."));
PARTY_XP_CUTOFF_LEVEL = Integer.parseInt(otherSettings.getProperty("PartyXpCutoffLevel", "30"));

 

 

essa eh minha configuração para adicionar o xp/sp :

 



private static List<L2PlayableInstance> getValidMembers(final List<L2PlayableInstance> members, final int topLvl)
{
final List<L2PlayableInstance> validMembers = new FastList<>();
// Fixed LevelDiff cutoff point
if (Config.PARTY_XP_CUTOFF_METHOD.equalsIgnoreCase("level"))
{
for (final L2PlayableInstance member : members)
{
if (topLvl - member.getLevel() <= Config.PARTY_XP_CUTOFF_LEVEL)
{
validMembers.add(member);
}
}
}
// Fixed MinPercentage cutoff point
else if (Config.PARTY_XP_CUTOFF_METHOD.equalsIgnoreCase("percentage"))
{
int sqLevelSum = 0;
for (final L2PlayableInstance member : members)
{
sqLevelSum += member.getLevel() * member.getLevel();
}
for (final L2PlayableInstance member : members)
{
final int sqLevel = member.getLevel() * member.getLevel();
if (sqLevel * 100 >= sqLevelSum * Config.PARTY_XP_CUTOFF_PERCENT)
{
validMembers.add(member);
}
}
}
// Automatic cutoff method
else if (Config.PARTY_XP_CUTOFF_METHOD.equalsIgnoreCase("auto"))
{
int sqLevelSum = 0;
for (final L2PlayableInstance member : members)
{
sqLevelSum += member.getLevel() * member.getLevel();
}
int i = members.size() - 1;
if (i < 1)
return members;
if (i >= BONUS_EXP_SP.length)
{
i = BONUS_EXP_SP.length - 1;
}
for (final L2PlayableInstance member : members)
{
final int sqLevel = member.getLevel() * member.getLevel();
if (sqLevel >= sqLevelSum * (1 - 1 / (1 + BONUS_EXP_SP - BONUS_EXP_SP[i - 1])))
{
validMembers.add(member);
}
}
}
return validMembers;
}

 

 

 

 

Sem o Party.java fica dificil de eu te ajudar mas tenta comparar o que estou enviando acima pra encontrar o problema no core

Editado por dragaonegroalp
Link para o comentário
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...
  • Registre-se

    Faça parte da maior e  mais antigas comunidades sobre Lineage2 da América Latina.





×
×
  • Criar Novo...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.