/**
* License
* THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
* CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE").
* THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.
* ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR
* COPYRIGHT LAW IS PROHIBITED.
*
* BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
* AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE
* MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED
* HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
*
*/
package l1j.server.server.clientpackets;
import java.util.logging.Logger;
import l1j.server.server.ClientThread;
import l1j.server.server.model.L1Object;
import l1j.server.server.model.L1World;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.model.identity.L1ItemId;
import l1j.server.server.templates.L1BoardTopic;
// Referenced classes of package l1j.server.server.clientpackets:
// ClientBasePacket
/**
* 收到由客戶端傳送寫入公告欄的封包
*/
public class C_BoardWrite extends ClientBasePacket {
private static final String C_BOARD_WRITE = "[C] C_BoardWrite";
private static Logger _log = Logger.getLogger(C_BoardWrite.class.getName());
public C_BoardWrite(byte decrypt[], ClientThread client) {
super(decrypt);
int id = readD();
String title = readS();
String content = readS();
L1Object tg = L1World.getInstance().findObject(id);
if (tg == null) {
_log.warning("不正確的 NPCID : " + id);
return;
}
L1PcInstance pc = client.getActiveChar();
L1BoardTopic.create(pc.getName(), title, content);
pc.getInventory().consumeItem(L1ItemId.ADENA, 300);
}
@Override
public String getType() {
return C_BOARD_WRITE;
}
}