123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- /*
- * 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 com.l2jserver.gameserver.network.clientpackets;
- import java.util.logging.Logger;
- import com.l2jserver.Config;
- import com.l2jserver.gameserver.ai.CtrlIntention;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.network.SystemMessageId;
- import com.l2jserver.gameserver.network.serverpackets.SocialAction;
- import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
- import com.l2jserver.gameserver.util.Util;
- /**
- * This class ...
- *
- * @version $Revision: 1.6.4.4 $ $Date: 2005/03/27 15:29:30 $
- */
- public class RequestSocialAction extends L2GameClientPacket
- {
- private static final String _C__1B_REQUESTSOCIALACTION = "[C] 1B RequestSocialAction";
- private static Logger _log = Logger.getLogger(RequestSocialAction.class.getName());
- // format cd
- private int _actionId;
- @Override
- protected void readImpl()
- {
- _actionId = readD();
- }
- @Override
- protected void runImpl()
- {
- L2PcInstance activeChar = getClient().getActiveChar();
- if (activeChar == null)
- return;
- // You cannot do anything else while fishing
- if (activeChar.isFishing())
- {
- SystemMessage sm = new SystemMessage(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
- activeChar.sendPacket(sm);
- sm = null;
- return;
- }
- // check if its the actionId is allowed
- if (_actionId < 2 || _actionId > 14)
- {
- Util.handleIllegalPlayerAction(activeChar, "Warning!! Character "+activeChar.getName()+" of account "+activeChar.getAccountName()+" requested an internal Social Action.", Config.DEFAULT_PUNISH);
- return;
- }
- if ( activeChar.getPrivateStoreType()==0 &&
- activeChar.getActiveRequester()==null &&
- !activeChar.isAlikeDead() &&
- (!activeChar.isAllSkillsDisabled() || activeChar.isInDuel()) &&
- !activeChar.isCastingNow() && !activeChar.isCastingSimultaneouslyNow() &&
- activeChar.getAI().getIntention()==CtrlIntention.AI_INTENTION_IDLE)
- {
- if (Config.DEBUG) _log.fine("Social Action:" + _actionId);
- SocialAction atk = new SocialAction(activeChar.getObjectId(), _actionId);
- activeChar.broadcastPacket(atk);
- /*
- // Schedule a social task to wait for the animation to finish
- ThreadPoolManager.getInstance().scheduleGeneral(new SocialTask(this), 2600);
- activeChar.setIsParalyzed(true);
- */
- }
- }
- /*
- class SocialTask implements Runnable
- {
- L2PcInstance _player;
- SocialTask(RequestSocialAction action)
- {
- _player = getClient().getActiveChar();
- }
- public void run()
- {
- _player.setIsParalyzed(false);
- }
- }
- */
- /* (non-Javadoc)
- * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
- */
- @Override
- public String getType()
- {
- return _C__1B_REQUESTSOCIALACTION;
- }
- }
|