getClient().sendPacket(new ActionFailed());
return;
}
L2Summon pet = activeChar.getPet();
L2Object target = activeChar.getTarget();
if (Config.DEBUG)
_log.info("Requested Action ID: " + String.valueOf(_actionId));
switch (_actionId)
{
case 0:
if (activeChar.getMountType() != 0)
break;
if (target != null
&& !activeChar.isSitting()
&& target instanceof L2StaticObjectInstance
&& ((L2StaticObjectInstance)target).getType() == 1
&& CastleManager.getInstance().getCastle(target) != null
&& activeChar.isInsideRadius(target, L2StaticObjectInstance.INTERACTION_DISTANCE, false, false)
)
{
ChairSit cs = new ChairSit(activeChar,((L2StaticObjectInstance)target).getStaticObjectId());
activeChar.sendPacket(cs);
activeChar.sitDown();
activeChar.broadcastPacket(cs);
break;
}
if (activeChar.isSitting())
activeChar.standUp();
else
activeChar.sitDown();
if (Config.DEBUG)
_log.fine("new wait type: "+(activeChar.isSitting() ? "SITTING" : "STANDING"));
break;
case 1:
if (activeChar.isRunning())
activeChar.setWalking();
else
activeChar.setRunning();
if (Config.DEBUG)
_log.fine("new move type: "+(activeChar.isRunning() ? "RUNNING" : "WALKIN"));
break;
case 15:
case 21: // pet follow/stop
if (pet != null && !pet.isMovementDisabled() && !activeChar.isBetrayed())
pet.setFollowStatus(!pet.getFollowStatus());
break;
case 16:
case 22: // pet attack
if (target != null && pet != null && pet != target && !pet.isAttackingDisabled() && !activeChar.isBetrayed())
{
if (activeChar.isInOlympiadMode() && !activeChar.isOlympiadStart()){
// if L2PcInstance is in Olympia and the match isn't already start, send a Server->Client packet ActionFailed
activeChar.sendPacket(new ActionFailed());
return;
}
if (activeChar.getAccessLevel() < Config.GM_PEACEATTACK &&
activeChar.isInsidePeaceZone(pet, target))
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
return;
}
if (target.isAutoAttackable(activeChar) || _ctrlPressed)
{
if (target instanceof L2DoorInstance)
{
if(((L2DoorInstance)target).isAttackable(activeChar) && pet.getNpcId() != L2SiegeSummonInstance.SWOOP_CANNON_ID)
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
// siege golem AI doesn't support attacking other than doors at the moment
else if (pet.getNpcId() != L2SiegeSummonInstance.SIEGE_GOLEM_ID)
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
}
break;
case 17:
case 23: // pet - cancel action
if (pet != null && !pet.isMovementDisabled() && !activeChar.isBetrayed())
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null);
break;
case 19: // pet unsummon
if (pet != null && !activeChar.isBetrayed())
{
//returns pet to control item
if (pet.isDead())
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.DEAD_PET_CANNOT_BE_RETURNED));
}
else if (pet.isAttackingNow() || pet.isRooted())
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.PET_CANNOT_SENT_BACK_DURING_BATTLE));
}
else
{
// if it is a pet and not a summon
if (pet instanceof L2PetInstance)
{
L2PetInstance petInst = (L2PetInstance)pet;
// if the pet is more than 40% fed
if (petInst.getCurrentFed() > (petInst.getMaxFed() * 0.40))
pet.unSummon(activeChar);
else
activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_RESTORE_HUNGRY_PETS));
}
}
}
break;
case 38: // pet mount
// mount
if (pet != null && pet.isMountable() && !activeChar.isMounted() && !activeChar.isBetrayed())
{
if (activeChar.isDead())
{
//A strider cannot be ridden when 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() || pet.isRooted())
{
//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 strider cannot be ridden while in battle
SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
activeChar.sendPacket(msg);
msg = null;
}
else if (activeChar.isSitting() || activeChar.isMoving())
{
//A strider can be ridden only when standing
SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CAN_BE_RIDDEN_ONLY_WHILE_STANDING);
activeChar.sendPacket(msg);
msg = null;
}
else if (activeChar.isFishing())
{
//You can't mount, dismount, break and drop items while fishing
SystemMessage msg = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_2);
activeChar.sendPacket(msg);
msg = null;
}
else if (activeChar.isCursedWeaponEquiped())
{
//You can't mount, dismount, break and drop items while weilding a cursed weapon
SystemMessage msg = new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE);
activeChar.sendPacket(msg);
}
else if (!pet.isDead() && !activeChar.isMounted())
{
if(!activeChar.disarmWeapons()) return;
Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().npcId);
activeChar.broadcastPacket(mount);
activeChar.setMountType(mount.getMountType());
activeChar.setMountObjectID(pet.getControlItemId());
pet.unSummon(activeChar);
}
}
else if (activeChar.isRentedPet())
{
activeChar.stopRentPet();
}
else if (activeChar.isMounted())
{
if (activeChar.setMountType(0))
{
if (activeChar.isFlying())activeChar.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
activeChar.broadcastPacket(dismount);
activeChar.setMountObjectID(0);
}
}
break;
case 32: // Wild Hog Cannon - Mode Change
useSkill(4230);
break;
case 36: // Soulless - Toxic Smoke
useSkill(4259);
break;
case 37:
if (activeChar.isAlikeDead())
{
getClient().sendPacket(new ActionFailed());
return;
}
if(activeChar.getPrivateStoreType() != 0){
activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
activeChar.broadcastUserInfo();
}
if (activeChar.isSitting())
activeChar.standUp();
if (activeChar.getCreateList() == null)
{
activeChar.setCreateList(new L2ManufactureList());
}
activeChar.sendPacket(new RecipeShopManageList(activeChar, true));
break;
case 39: // Soulless - Parasite Burst
useSkill(4138);
break;
case 41: // Wild Hog Cannon - Attack
useSkill(4230);
break;
case 42: // Kai the Cat - Self Damage Shield
useSkill(4378, activeChar);
break;
case 43: // Unicorn Merrow - Hydro Screw
useSkill(4137);
break;
case 44: // Big Boom - Boom Attack
useSkill(4139);
break;
case 45: // Unicorn Boxer - Master Recharge
useSkill(4025, activeChar);
break;
case 46: // Mew the Cat - Mega Storm Strike
useSkill(4261);
break;
case 47: // Silhouette - Steal Blood
useSkill(4260);
break;
case 48: // Mechanic Golem - Mech. Cannon
useSkill(4068);
break;
case 51:
// Player shouldn't be able to set stores if he/she is alike dead (dead or fake death)
if (activeChar.isAlikeDead())
{
getClient().sendPacket(new ActionFailed());
return;
}
if(activeChar.getPrivateStoreType() != 0){
activeChar.setPrivateStoreType(L2PcInstance.STORE_PRIVATE_NONE);
activeChar.broadcastUserInfo();
}
if (activeChar.isSitting())
activeChar.standUp();
if (activeChar.getCreateList() == null)
activeChar.setCreateList(new L2ManufactureList());
activeChar.sendPacket(new RecipeShopManageList(activeChar, false));
break;
case 52: // unsummon
if (pet != null && pet instanceof L2SummonInstance)
pet.unSummon(activeChar);
break;
case 53: // move to target
if (target != null && pet != null && pet != target && !pet.isMovementDisabled())
{
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
new L2CharPosition(target.getX(),target.getY(), target.getZ(), 0 ));
}
break;
case 54: // move to target hatch/strider
if (target != null && pet != null && pet != target && !pet.isMovementDisabled())
{
pet.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
new L2CharPosition(target.getX(),target.getY(), target.getZ(), 0 ));
}
break;
case 96: // Quit Party Command Channel
_log.info("98 Accessed");
break;