/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * http://www.gnu.org/copyleft/gpl.html */ package net.sf.l2j.gameserver.clientpackets; import java.nio.ByteBuffer; import java.util.logging.Logger; import net.sf.l2j.gameserver.ClientThread; import net.sf.l2j.gameserver.model.L2PcInstance; import net.sf.l2j.gameserver.model.L2Friend; import net.sf.l2j.gameserver.serverpackets.RequestFriendAddReply; import net.sf.l2j.gameserver.serverpackets.SystemMessage; /** * sample * fb * 01 00 00 00 * * format cdd * * * @version $Revision: 1.7.4.2 $ $Date: 2005/03/27 15:29:30 $ */ public class FriendAddRequestResult extends ClientBasePacket { private static final String _C__FB_FRIENDADDREQUESTRESULT = "[C] FB FriendAddRequestResult"; private static Logger _log = Logger.getLogger(FriendAddRequestResult.class.getName()); private final int _response; public FriendAddRequestResult(ByteBuffer buf, ClientThread client) { super(buf, client); _response = readD(); } void runImpl() { L2PcInstance player = getClient().getActiveChar(); String playerName = player.getName(); L2PcInstance requestor = player.getTransactionRequester(); RequestFriendAddReply join = new RequestFriendAddReply(_response); player.sendPacket(join); L2Friend friend = new L2Friend(); if (_response == 1) { friend.friendAdd(requestor, playerName); } else { SystemMessage msg = new SystemMessage(SystemMessage.YOU_HAVE_FAILED_TO_INVITE_A_FRIEND); requestor.sendPacket(msg); } player.setTransactionRequester(null); requestor.setTransactionRequester(null); } /* (non-Javadoc) * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType() */ public String getType() { return _C__FB_FRIENDADDREQUESTRESULT ; } }