Merged with released L2J-Unity files.
This commit is contained in:
86
trunk/dist/game/data/scripts/handlers/playeractions/AirshipAction.java
vendored
Normal file
86
trunk/dist/game/data/scripts/handlers/playeractions/AirshipAction.java
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.instancemanager.AirShipManager;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Airship Action player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class AirshipAction implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (!activeChar.isInAirShip())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (data.getOptionId())
|
||||
{
|
||||
case 1: // Steer
|
||||
{
|
||||
if (activeChar.getAirShip().setCaptain(activeChar))
|
||||
{
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Cancel Control
|
||||
{
|
||||
if (activeChar.getAirShip().isCaptain(activeChar))
|
||||
{
|
||||
if (activeChar.getAirShip().setCaptain(null))
|
||||
{
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // Destination Map
|
||||
{
|
||||
AirShipManager.getInstance().sendAirShipTeleportList(activeChar);
|
||||
break;
|
||||
}
|
||||
case 4: // Exit Airship
|
||||
{
|
||||
if (activeChar.getAirShip().isCaptain(activeChar))
|
||||
{
|
||||
if (activeChar.getAirShip().setCaptain(null))
|
||||
{
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
else if (activeChar.getAirShip().isInDock())
|
||||
{
|
||||
activeChar.getAirShip().oustPlayer(activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new AirshipAction());
|
||||
}
|
||||
}
|
||||
49
trunk/dist/game/data/scripts/handlers/playeractions/BotReport.java
vendored
Normal file
49
trunk/dist/game/data/scripts/handlers/playeractions/BotReport.java
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.datatables.BotReportTable;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Bot Report button player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class BotReport implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (Config.BOTREPORT_ENABLE)
|
||||
{
|
||||
BotReportTable.getInstance().reportBot(activeChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("This feature is disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new BotReport());
|
||||
}
|
||||
}
|
||||
41
trunk/dist/game/data/scripts/handlers/playeractions/InstanceZoneInfo.java
vendored
Normal file
41
trunk/dist/game/data/scripts/handlers/playeractions/InstanceZoneInfo.java
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExInzoneWaiting;
|
||||
|
||||
/**
|
||||
* Instance Zone Info player action handler.
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class InstanceZoneInfo implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
activeChar.sendPacket(new ExInzoneWaiting(activeChar));
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new InstanceZoneInfo());
|
||||
}
|
||||
}
|
||||
61
trunk/dist/game/data/scripts/handlers/playeractions/PetAttack.java
vendored
Normal file
61
trunk/dist/game/data/scripts/handlers/playeractions/PetAttack.java
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Pet attack player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class PetAttack implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if ((activeChar.getPet() == null) || !activeChar.getPet().isPet())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = activeChar.getPet();
|
||||
if (pet.isUncontrollable())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
}
|
||||
else if (pet.canAttack(activeChar.getTarget(), ctrlPressed))
|
||||
{
|
||||
pet.doAttack(activeChar.getTarget());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new PetAttack());
|
||||
}
|
||||
}
|
||||
61
trunk/dist/game/data/scripts/handlers/playeractions/PetHold.java
vendored
Normal file
61
trunk/dist/game/data/scripts/handlers/playeractions/PetHold.java
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.L2SummonAI;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Pet hold position player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class PetHold implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if ((activeChar.getPet() == null) || !activeChar.getPet().isPet())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = activeChar.getPet();
|
||||
if (pet.isUncontrollable())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
}
|
||||
else
|
||||
{
|
||||
((L2SummonAI) pet.getAI()).notifyFollowStatusChange();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new PetHold());
|
||||
}
|
||||
}
|
||||
62
trunk/dist/game/data/scripts/handlers/playeractions/PetMove.java
vendored
Normal file
62
trunk/dist/game/data/scripts/handlers/playeractions/PetMove.java
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Pet move to target player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class PetMove implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if ((activeChar.getPet() == null) || !activeChar.getPet().isPet())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = activeChar.getPet();
|
||||
if (pet.isUncontrollable())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
}
|
||||
else if ((activeChar.getTarget() != null) && (pet != activeChar.getTarget()) && !pet.isMovementDisabled())
|
||||
{
|
||||
pet.setFollowStatus(false);
|
||||
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, activeChar.getTarget().getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new PetMove());
|
||||
}
|
||||
}
|
||||
80
trunk/dist/game/data/scripts/handlers/playeractions/PetSkillUse.java
vendored
Normal file
80
trunk/dist/game/data/scripts/handlers/playeractions/PetSkillUse.java
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.PetDataTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.CommonSkill;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Pet skill use player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class PetSkillUse implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (activeChar.getTarget() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = activeChar.getPet();
|
||||
if (pet == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
}
|
||||
else if (pet.isUncontrollable())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
}
|
||||
else if ((pet.getLevel() - activeChar.getLevel()) > 20)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL);
|
||||
}
|
||||
else
|
||||
{
|
||||
final int skillLevel = PetDataTable.getInstance().getPetData(pet.getId()).getAvailableLevel(data.getOptionId(), pet.getLevel());
|
||||
if (skillLevel > 0)
|
||||
{
|
||||
pet.setTarget(activeChar.getTarget());
|
||||
pet.useMagic(SkillData.getInstance().getSkill(data.getOptionId(), skillLevel), null, ctrlPressed, shiftPressed);
|
||||
}
|
||||
|
||||
if (data.getOptionId() == CommonSkill.PET_SWITCH_STANCE.getId())
|
||||
{
|
||||
pet.switchMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new PetSkillUse());
|
||||
}
|
||||
}
|
||||
60
trunk/dist/game/data/scripts/handlers/playeractions/PetStop.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/playeractions/PetStop.java
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Pet stop action player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class PetStop implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if ((activeChar.getPet() == null) || !activeChar.getPet().isPet())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PetInstance pet = activeChar.getPet();
|
||||
if (pet.isUncontrollable())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
}
|
||||
else
|
||||
{
|
||||
pet.cancelAction();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new PetStop());
|
||||
}
|
||||
}
|
||||
127
trunk/dist/game/data/scripts/handlers/playeractions/PrivateStore.java
vendored
Normal file
127
trunk/dist/game/data/scripts/handlers/playeractions/PrivateStore.java
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PrivateStoreManageListBuy;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PrivateStoreManageListSell;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.RecipeShopManageList;
|
||||
|
||||
/**
|
||||
* Open/Close private store player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class PrivateStore implements IPlayerActionHandler
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(PrivateStore.class.getName());
|
||||
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
final PrivateStoreType type = PrivateStoreType.findById(data.getOptionId());
|
||||
if (type == null)
|
||||
{
|
||||
LOGGER.warning("Incorrect private store type: " + data.getOptionId());
|
||||
return;
|
||||
}
|
||||
|
||||
// Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
|
||||
if (!activeChar.canOpenPrivateStore())
|
||||
{
|
||||
if (activeChar.isInsideZone(ZoneId.NO_STORE))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_OPEN_A_PRIVATE_STORE_HERE);
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SELL:
|
||||
case SELL_MANAGE:
|
||||
case PACKAGE_SELL:
|
||||
{
|
||||
if ((activeChar.getPrivateStoreType() == PrivateStoreType.SELL) || (activeChar.getPrivateStoreType() == PrivateStoreType.SELL_MANAGE) || (activeChar.getPrivateStoreType() == PrivateStoreType.PACKAGE_SELL))
|
||||
{
|
||||
activeChar.setPrivateStoreType(PrivateStoreType.NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BUY:
|
||||
case BUY_MANAGE:
|
||||
{
|
||||
if ((activeChar.getPrivateStoreType() == PrivateStoreType.BUY) || (activeChar.getPrivateStoreType() == PrivateStoreType.BUY_MANAGE))
|
||||
{
|
||||
activeChar.setPrivateStoreType(PrivateStoreType.NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MANUFACTURE:
|
||||
{
|
||||
activeChar.setPrivateStoreType(PrivateStoreType.NONE);
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
if (activeChar.getPrivateStoreType() == PrivateStoreType.NONE)
|
||||
{
|
||||
if (activeChar.isSitting())
|
||||
{
|
||||
activeChar.standUp();
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SELL:
|
||||
case SELL_MANAGE:
|
||||
case PACKAGE_SELL:
|
||||
{
|
||||
activeChar.setPrivateStoreType(PrivateStoreType.SELL_MANAGE);
|
||||
activeChar.sendPacket(new PrivateStoreManageListSell(activeChar, type == PrivateStoreType.PACKAGE_SELL));
|
||||
break;
|
||||
}
|
||||
case BUY:
|
||||
case BUY_MANAGE:
|
||||
{
|
||||
activeChar.setPrivateStoreType(PrivateStoreType.BUY_MANAGE);
|
||||
activeChar.sendPacket(new PrivateStoreManageListBuy(activeChar));
|
||||
break;
|
||||
}
|
||||
case MANUFACTURE:
|
||||
{
|
||||
activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new PrivateStore());
|
||||
}
|
||||
}
|
||||
40
trunk/dist/game/data/scripts/handlers/playeractions/Ride.java
vendored
Normal file
40
trunk/dist/game/data/scripts/handlers/playeractions/Ride.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Mount/Dismount player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class Ride implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
activeChar.mountPlayer(activeChar.getPet());
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new Ride());
|
||||
}
|
||||
}
|
||||
40
trunk/dist/game/data/scripts/handlers/playeractions/RunWalk.java
vendored
Normal file
40
trunk/dist/game/data/scripts/handlers/playeractions/RunWalk.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Run/Walk player action handler.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RunWalk implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
activeChar.setIsRunning(!activeChar.isRunning());
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new RunWalk());
|
||||
}
|
||||
}
|
||||
51
trunk/dist/game/data/scripts/handlers/playeractions/ServitorAttack.java
vendored
Normal file
51
trunk/dist/game/data/scripts/handlers/playeractions/ServitorAttack.java
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Servitor Attack player action handler.
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class ServitorAttack implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (activeChar.hasServitors())
|
||||
{
|
||||
activeChar.getServitors().values().stream().filter(s -> s.canAttack(activeChar.getTarget(), ctrlPressed)).forEach(s ->
|
||||
{
|
||||
s.doAttack(activeChar.getTarget());
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new ServitorAttack());
|
||||
}
|
||||
}
|
||||
57
trunk/dist/game/data/scripts/handlers/playeractions/ServitorHold.java
vendored
Normal file
57
trunk/dist/game/data/scripts/handlers/playeractions/ServitorHold.java
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.L2SummonAI;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Servitor hold position player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class ServitorHold implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (!activeChar.hasServitors())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.getServitors().values().forEach(s ->
|
||||
{
|
||||
if (s.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
return;
|
||||
}
|
||||
|
||||
((L2SummonAI) s.getAI()).notifyFollowStatusChange();
|
||||
});
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new ServitorHold());
|
||||
}
|
||||
}
|
||||
77
trunk/dist/game/data/scripts/handlers/playeractions/ServitorMode.java
vendored
Normal file
77
trunk/dist/game/data/scripts/handlers/playeractions/ServitorMode.java
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.L2SummonAI;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Servitor passive/defend mode player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class ServitorMode implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (!activeChar.hasServitors())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (data.getOptionId())
|
||||
{
|
||||
case 1: // Passive mode
|
||||
{
|
||||
activeChar.getServitors().values().forEach(s ->
|
||||
{
|
||||
if (s.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
return;
|
||||
}
|
||||
|
||||
((L2SummonAI) s.getAI()).setDefending(false);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 2: // Defending mode
|
||||
{
|
||||
activeChar.getServitors().values().forEach(s ->
|
||||
{
|
||||
if (s.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
return;
|
||||
}
|
||||
|
||||
((L2SummonAI) s.getAI()).setDefending(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new ServitorMode());
|
||||
}
|
||||
}
|
||||
61
trunk/dist/game/data/scripts/handlers/playeractions/ServitorMove.java
vendored
Normal file
61
trunk/dist/game/data/scripts/handlers/playeractions/ServitorMove.java
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Servitor move to target player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class ServitorMove implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (!activeChar.hasServitors())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.getTarget() != null)
|
||||
{
|
||||
activeChar.getServitors().values().stream().filter(s -> (s != activeChar.getTarget()) && !s.isMovementDisabled()).forEach(s ->
|
||||
{
|
||||
if (s.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
return;
|
||||
}
|
||||
|
||||
s.setFollowStatus(false);
|
||||
s.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, activeChar.getTarget().getLocation());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new ServitorMove());
|
||||
}
|
||||
}
|
||||
70
trunk/dist/game/data/scripts/handlers/playeractions/ServitorSkillUse.java
vendored
Normal file
70
trunk/dist/game/data/scripts/handlers/playeractions/ServitorSkillUse.java
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.SummonSkillsTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SkillData;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Summon skill use player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class ServitorSkillUse implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (activeChar.getTarget() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Summon summon = activeChar.getAnyServitor();
|
||||
if ((summon == null) || !summon.isServitor())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.getServitors().values().forEach(servitor ->
|
||||
{
|
||||
if (summon.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
return;
|
||||
}
|
||||
|
||||
final int skillLevel = SummonSkillsTable.getInstance().getAvailableLevel(servitor, data.getOptionId());
|
||||
if (skillLevel > 0)
|
||||
{
|
||||
servitor.setTarget(activeChar.getTarget());
|
||||
servitor.useMagic(SkillData.getInstance().getSkill(data.getOptionId(), skillLevel), null, ctrlPressed, shiftPressed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new ServitorSkillUse());
|
||||
}
|
||||
}
|
||||
56
trunk/dist/game/data/scripts/handlers/playeractions/ServitorStop.java
vendored
Normal file
56
trunk/dist/game/data/scripts/handlers/playeractions/ServitorStop.java
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Servitor stop action player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class ServitorStop implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (!activeChar.hasServitors())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.getServitors().values().forEach(s ->
|
||||
{
|
||||
if (s.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
return;
|
||||
}
|
||||
|
||||
s.cancelAction();
|
||||
});
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new ServitorStop());
|
||||
}
|
||||
}
|
||||
97
trunk/dist/game/data/scripts/handlers/playeractions/SitStand.java
vendored
Normal file
97
trunk/dist/game/data/scripts/handlers/playeractions/SitStand.java
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.ai.NextAction;
|
||||
import com.l2jmobius.gameserver.enums.MountType;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2StaticObjectInstance;
|
||||
import com.l2jmobius.gameserver.model.effects.EffectFlag;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ChairSit;
|
||||
|
||||
/**
|
||||
* Sit/Stand player action handler.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class SitStand implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (activeChar.isSitting() || !activeChar.isMoving() || activeChar.isFakeDeath())
|
||||
{
|
||||
useSit(activeChar, activeChar.getTarget());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sit when arrive using next action.
|
||||
// Creating next action class.
|
||||
final NextAction nextAction = new NextAction(CtrlEvent.EVT_ARRIVED, CtrlIntention.AI_INTENTION_MOVE_TO, () -> useSit(activeChar, activeChar.getTarget()));
|
||||
|
||||
// Binding next action to AI.
|
||||
activeChar.getAI().setNextAction(nextAction);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the sit action.
|
||||
* @param activeChar the player trying to sit
|
||||
* @param target the target to sit, throne, bench or chair
|
||||
* @return {@code true} if the player can sit, {@code false} otherwise
|
||||
*/
|
||||
protected boolean useSit(L2PcInstance activeChar, L2Object target)
|
||||
{
|
||||
if (activeChar.getMountType() != MountType.NONE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!activeChar.isSitting() && (target instanceof L2StaticObjectInstance) && (((L2StaticObjectInstance) target).getType() == 1) && activeChar.isInsideRadius(target, L2StaticObjectInstance.INTERACTION_DISTANCE, false, false))
|
||||
{
|
||||
final ChairSit cs = new ChairSit(activeChar, target.getId());
|
||||
activeChar.sendPacket(cs);
|
||||
activeChar.sitDown();
|
||||
activeChar.broadcastPacket(cs);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (activeChar.isFakeDeath())
|
||||
{
|
||||
activeChar.stopEffects(EffectFlag.FAKE_DEATH);
|
||||
}
|
||||
else if (activeChar.isSitting())
|
||||
{
|
||||
activeChar.standUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sitDown();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new SitStand());
|
||||
}
|
||||
}
|
||||
324
trunk/dist/game/data/scripts/handlers/playeractions/SocialAction.java
vendored
Normal file
324
trunk/dist/game/data/scripts/handlers/playeractions/SocialAction.java
vendored
Normal file
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.ai.NextAction;
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerSocialAction;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExAskCoupleAction;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* Social Action player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class SocialAction implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
switch (data.getOptionId())
|
||||
{
|
||||
case 2: // Greeting
|
||||
case 3: // Victory
|
||||
case 4: // Advance
|
||||
case 5: // No
|
||||
case 6: // Yes
|
||||
case 7: // Bow
|
||||
case 8: // Unaware
|
||||
case 9: // Social Waiting
|
||||
case 10: // Laugh
|
||||
case 11: // Applaud
|
||||
case 12: // Dance
|
||||
case 13: // Sorrow
|
||||
case 14: // Charm
|
||||
case 15: // Shyness
|
||||
case 28: // Propose
|
||||
case 29: // Provoke
|
||||
useSocial(activeChar, data.getOptionId());
|
||||
break;
|
||||
case 30: // Beauty Shop
|
||||
if (useSocial(activeChar, data.getOptionId()))
|
||||
{
|
||||
activeChar.broadcastInfo();
|
||||
}
|
||||
break;
|
||||
case 16: // Exchange Bows
|
||||
case 17: // High Five
|
||||
case 18: // Couple Dance
|
||||
useCoupleSocial(activeChar, data.getOptionId());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean useSocial(L2PcInstance activeChar, int id)
|
||||
{
|
||||
if (activeChar.isFishing())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_FISHING3);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.canMakeSocialAction())
|
||||
{
|
||||
activeChar.broadcastPacket(new com.l2jmobius.gameserver.network.serverpackets.SocialAction(activeChar.getObjectId(), id));
|
||||
|
||||
// Notify to scripts
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerSocialAction(activeChar, id), activeChar);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void useCoupleSocial(L2PcInstance player, int id)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Object target = player.getTarget();
|
||||
if ((target == null) || !target.isPlayer())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
return;
|
||||
}
|
||||
|
||||
final int distance = (int) player.calculateDistance(target, false, false);
|
||||
if ((distance > 125) || (distance < 15) || (player.getObjectId() == target.getObjectId()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_REQUEST_CANNOT_BE_COMPLETED_BECAUSE_THE_TARGET_DOES_NOT_MEET_LOCATION_REQUIREMENTS);
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
if (player.isInStoreMode() || player.isInCraftMode())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_PRIVATE_STORE_MODE_OR_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInCombat() || player.isInDuel() || AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isFishing())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_FISHING3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getReputation() < 0)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_CHAOTIC_STATE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInOlympiadMode())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInSiege())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_CASTLE_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInHideoutSiege())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_PARTICIPATING_IN_A_CLAN_HALL_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
|
||||
if (player.isMounted() || player.isFlyingMounted() || player.isInBoat() || player.isInAirShip())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_RIDING_A_SHIP_STEED_OR_STRIDER_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isTransformed())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRANSFORMING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isAlikeDead())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_DEAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(player);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
// Checks for partner.
|
||||
final L2PcInstance partner = target.getActingPlayer();
|
||||
if (partner.isInStoreMode() || partner.isInCraftMode())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_PRIVATE_STORE_MODE_OR_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isInCombat() || partner.isInDuel() || AttackStanceTaskManager.getInstance().hasAttackStanceTask(partner))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_BATTLE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.getMultiSociaAction() > 0)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_PARTICIPATING_IN_A_COUPLE_ACTION_AND_CANNOT_BE_REQUESTED_FOR_ANOTHER_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isFishing())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_FISHING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.getReputation() < 0)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_CHAOTIC_STATE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isInOlympiadMode())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isInHideoutSiege())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_PARTICIPATING_IN_A_CLAN_HALL_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isInSiege())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_CASTLE_SIEGE_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isMounted() || partner.isFlyingMounted() || partner.isInBoat() || partner.isInAirShip())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_RIDING_A_SHIP_STEED_OR_STRIDER_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isTeleporting())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TELEPORTING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isTransformed())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_TRANSFORMING_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (partner.isAlikeDead())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_CURRENTLY_DEAD_AND_CANNOT_BE_REQUESTED_FOR_A_COUPLE_ACTION);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isAllSkillsDisabled() || partner.isAllSkillsDisabled())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_COUPLE_ACTION_WAS_CANCELLED);
|
||||
return;
|
||||
}
|
||||
|
||||
player.setMultiSocialAction(id, partner.getObjectId());
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_REQUESTED_A_COUPLE_ACTION_WITH_C1);
|
||||
sm.addPcName(partner);
|
||||
player.sendPacket(sm);
|
||||
|
||||
if ((player.getAI().getIntention() != CtrlIntention.AI_INTENTION_IDLE) || (partner.getAI().getIntention() != CtrlIntention.AI_INTENTION_IDLE))
|
||||
{
|
||||
final NextAction nextAction = new NextAction(CtrlEvent.EVT_ARRIVED, CtrlIntention.AI_INTENTION_MOVE_TO, () -> partner.sendPacket(new ExAskCoupleAction(player.getObjectId(), id)));
|
||||
player.getAI().setNextAction(nextAction);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isCastingNow())
|
||||
{
|
||||
final NextAction nextAction = new NextAction(CtrlEvent.EVT_FINISH_CASTING, CtrlIntention.AI_INTENTION_CAST, () -> partner.sendPacket(new ExAskCoupleAction(player.getObjectId(), id)));
|
||||
player.getAI().setNextAction(nextAction);
|
||||
return;
|
||||
}
|
||||
|
||||
partner.sendPacket(new ExAskCoupleAction(player.getObjectId(), id));
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new SocialAction());
|
||||
}
|
||||
}
|
||||
47
trunk/dist/game/data/scripts/handlers/playeractions/TacticalSignTarget.java
vendored
Normal file
47
trunk/dist/game/data/scripts/handlers/playeractions/TacticalSignTarget.java
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
/**
|
||||
* Tactical Signs targeting player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class TacticalSignTarget implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if (!activeChar.isInParty())
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.getParty().setTargetBasedOnTacticalSignId(activeChar, data.getOptionId());
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new TacticalSignTarget());
|
||||
}
|
||||
}
|
||||
48
trunk/dist/game/data/scripts/handlers/playeractions/TacticalSignUse.java
vendored
Normal file
48
trunk/dist/game/data/scripts/handlers/playeractions/TacticalSignUse.java
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
/**
|
||||
* Tactical Signs setting player action handler.
|
||||
* @author Nik
|
||||
*/
|
||||
public final class TacticalSignUse implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
if ((!activeChar.isInParty() || (activeChar.getTarget() == null) || !activeChar.getTarget().isCharacter()))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.getParty().addTacticalSign(activeChar, data.getOptionId(), (L2Character) activeChar.getTarget());
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new TacticalSignUse());
|
||||
}
|
||||
}
|
||||
36
trunk/dist/game/data/scripts/handlers/playeractions/TeleportBookmark.java
vendored
Normal file
36
trunk/dist/game/data/scripts/handlers/playeractions/TeleportBookmark.java
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
public final class TeleportBookmark implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new TeleportBookmark());
|
||||
}
|
||||
}
|
||||
72
trunk/dist/game/data/scripts/handlers/playeractions/UnsummonPet.java
vendored
Normal file
72
trunk/dist/game/data/scripts/handlers/playeractions/UnsummonPet.java
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Unsummon Pet player action handler.
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class UnsummonPet implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
final L2Summon pet = activeChar.getPet();
|
||||
|
||||
if (pet == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_PET);
|
||||
}
|
||||
else if (((L2PetInstance) pet).isUncontrollable())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.WHEN_YOUR_PET_S_HUNGER_GAUGE_IS_AT_0_YOU_CANNOT_USE_YOUR_PET);
|
||||
}
|
||||
else if (pet.isDead())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.DEAD_PETS_CANNOT_BE_RETURNED_TO_THEIR_SUMMONING_ITEM);
|
||||
}
|
||||
else if (pet.isAttackingNow() || pet.isInCombat() || pet.isMovementDisabled())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.A_PET_CANNOT_BE_UNSUMMONED_DURING_BATTLE);
|
||||
}
|
||||
else if (pet.isHungry())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_RESTORE_A_HUNGRY_PET);
|
||||
}
|
||||
else
|
||||
{
|
||||
pet.unSummon(activeChar);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new UnsummonPet());
|
||||
}
|
||||
}
|
||||
70
trunk/dist/game/data/scripts/handlers/playeractions/UnsummonServitor.java
vendored
Normal file
70
trunk/dist/game/data/scripts/handlers/playeractions/UnsummonServitor.java
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.playeractions;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IPlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.handler.PlayerActionHandler;
|
||||
import com.l2jmobius.gameserver.model.ActionDataHolder;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* Unsummon Servitor player action handler.
|
||||
* @author St3eT
|
||||
*/
|
||||
public final class UnsummonServitor implements IPlayerActionHandler
|
||||
{
|
||||
@Override
|
||||
public void useAction(L2PcInstance activeChar, ActionDataHolder data, boolean ctrlPressed, boolean shiftPressed)
|
||||
{
|
||||
boolean canUnsummon = true;
|
||||
|
||||
if (activeChar.hasServitors())
|
||||
{
|
||||
for (L2Summon s : activeChar.getServitors().values())
|
||||
{
|
||||
if (s.isBetrayed())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOUR_PET_SERVITOR_IS_UNRESPONSIVE_AND_WILL_NOT_OBEY_ANY_ORDERS);
|
||||
canUnsummon = false;
|
||||
break;
|
||||
}
|
||||
else if (s.isAttackingNow() || s.isInCombat() || s.isMovementDisabled())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.A_SERVITOR_WHOM_IS_ENGAGED_IN_BATTLE_CANNOT_BE_DE_ACTIVATED);
|
||||
canUnsummon = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (canUnsummon)
|
||||
{
|
||||
activeChar.getServitors().values().forEach(s -> s.unSummon(activeChar));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_A_SERVITOR);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
PlayerActionHandler.getInstance().registerHandler(new UnsummonServitor());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user