Merged with released L2J-Unity files.
This commit is contained in:
@ -1,94 +1,95 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.itemhandlers;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.ShotType;
|
||||
import com.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.ActionType;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FishShots implements IItemHandler
|
||||
{
|
||||
@Override
|
||||
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
|
||||
{
|
||||
if (!playable.isPlayer())
|
||||
{
|
||||
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = playable.getActingPlayer();
|
||||
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
|
||||
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
|
||||
|
||||
if ((weaponInst == null) || (weaponItem.getItemType() != WeaponType.FISHINGROD))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final long count = item.getCount();
|
||||
final SkillHolder[] skills = item.getItem().getSkills();
|
||||
|
||||
if (skills == null)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": is missing skills!");
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
|
||||
|
||||
if (!gradeCheck)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THAT_IS_THE_WRONG_GRADE_OF_SOULSHOT_FOR_THAT_FISHING_POLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
activeChar.setChargedShot(ShotType.FISH_SOULSHOTS, true);
|
||||
activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false);
|
||||
final L2Object oldTarget = activeChar.getTarget();
|
||||
activeChar.setTarget(activeChar);
|
||||
|
||||
Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUse(activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0));
|
||||
activeChar.setTarget(oldTarget);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.itemhandlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.ItemSkillType;
|
||||
import com.l2jmobius.gameserver.enums.ShotType;
|
||||
import com.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.ActionType;
|
||||
import com.l2jmobius.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author -Nemesiss-
|
||||
*/
|
||||
public class FishShots implements IItemHandler
|
||||
{
|
||||
@Override
|
||||
public boolean useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)
|
||||
{
|
||||
if (!playable.isPlayer())
|
||||
{
|
||||
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = playable.getActingPlayer();
|
||||
final L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
|
||||
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
|
||||
|
||||
if ((weaponInst == null) || (weaponItem.getItemType() != WeaponType.FISHINGROD))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isChargedShot(ShotType.FISH_SOULSHOTS))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final long count = item.getCount();
|
||||
final boolean gradeCheck = item.isEtcItem() && (item.getEtcItem().getDefaultAction() == ActionType.FISHINGSHOT) && (weaponInst.getItem().getCrystalTypePlus() == item.getItem().getCrystalTypePlus());
|
||||
|
||||
if (!gradeCheck)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THAT_IS_THE_WRONG_GRADE_OF_SOULSHOT_FOR_THAT_FISHING_POLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
activeChar.setChargedShot(ShotType.FISH_SOULSHOTS, true);
|
||||
activeChar.destroyItemWithoutTrace("Consume", item.getObjectId(), 1, null, false);
|
||||
final L2Object oldTarget = activeChar.getTarget();
|
||||
activeChar.setTarget(activeChar);
|
||||
|
||||
final List<ItemSkillHolder> skills = item.getItem().getSkills(ItemSkillType.NORMAL);
|
||||
|
||||
if (skills == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": is missing skills!");
|
||||
return false;
|
||||
}
|
||||
|
||||
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLvl(), 0, 0), 600));
|
||||
activeChar.setTarget(oldTarget);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user