package net.sf.l2j.gameserver.clientpackets;
import java.nio.ByteBuffer;
import java.util.logging.Logger;
import net.sf.l2j.gameserver.ClientThread;
public class RequestStopPledgeWar extends ClientBasePacket
{
private static final String _C__4F_REQUESTSTOPPLEDGEWAR = "[C] 4F RequestStopPledgewar";
private static Logger _log = Logger.getLogger(RequestStopPledgeWar.class.getName());
String _pledgeName;
public RequestStopPledgeWar(ByteBuffer buf, ClientThread client)
{
super(buf, client);
_pledgeName = readS();
}
void runImpl()
{
_log.info("RequestStopPledgeWar by "+getClient().getActiveChar().getClan().getName()+" with "+_pledgeName);
}
public String getType()
{
return _C__4F_REQUESTSTOPPLEDGEWAR;
}
}
package net.sf.l2j.gameserver.clientpackets;
import java.nio.ByteBuffer;
import java.util.logging.Logger;
import net.sf.l2j.gameserver.ClanTable;
import net.sf.l2j.gameserver.ClientThread;
import net.sf.l2j.gameserver.model.L2Clan;
import net.sf.l2j.gameserver.model.L2PcInstance;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.serverpackets.StartPledgeWar;
public class RequestStartPledgeWar extends ClientBasePacket
{
private static final String _C__4D_REQUESTSTARTPLEDGEWAR = "[C] 4D RequestStartPledgewar";
private static Logger _log = Logger.getLogger(RequestStartPledgeWar.class.getName());
String _pledgeName;
L2Clan _clan;
L2PcInstance player;
public RequestStartPledgeWar(ByteBuffer buf, ClientThread client)
{
super(buf, client);
_pledgeName = readS();
}
void runImpl()
{
_clan = getClient().getActiveChar().getClan();
player = getClient().getActiveChar();
if(_clan == null)
return;
_log.info("RequestStartPledgeWar by "+_clan.getName()+" with "+_pledgeName);
if(_clan.getLevel() < 3)
{
player.sendMessage("Only lvl3+ clans can declare war.");
player.sendPacket(new ActionFailed());
return;
}
else if(_clan.isAtWar())
{
player.sendMessage("U cant declare war wit multiply clans.");
player.sendPacket(new ActionFailed());
return;
}
else if(_clan.getAllyId() > 0)
{
player.sendMessage("U cant declare war with clan in ally.");
player.sendPacket(new ActionFailed());
return;
}
L2Clan clan = ClanTable.getInstance().getClan(_pledgeName);
_log.info("RequestStartPledgeWar, leader: "+clan.getLeaderName()+" clan: "+_clan.getName());
L2World.getInstance().getPlayer(clan.getLeaderName()).sendPacket(new StartPledgeWar(_clan.getName(),player.getName()));
}
public String getType()
{
return _C__4D_REQUESTSTARTPLEDGEWAR;
}
}
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.serverpackets.ManagePledgePower;
public class RequestPledgePower extends ClientBasePacket
{
private static final String _C__C0_REQUESTPLEDGEPOWER = "[C] C0 RequestPledgePower";
private static Logger _log = Logger.getLogger(RequestPledgePower.class.getName());
// clan related authority
private static final int CP_CL_JOIN_CLAN = 1; // Join clan
private static final int CP_CL_GIVE_TITLE = 2; // Give a title
private static final int CP_CL_VIEW_WAREHOUSE = 4; // View warehouse content
private static final int CP_CL_REGISTER_CREST = 8; // Register clan crest
// clanhall related authority
private static final int CP_CH_OPEN_DOOR = 10; // open a door
private static final int CP_CH_OTHER_RIGHTS = 20; //??
private static final int CP_CH_DISMISS = 40; //??
// castle related authority
private static final int CP_CS_OPEN_DOOR = 80;
private static final int CP_CS_OTHER_RIGHTS = 100; //???
private static final int CP_CS_DISMISS = 200; //???
public RequestPledgePower(ByteBuffer buf, ClientThread client)
{
super(buf,client);
_clanid = readD();
_action = readD(); // 1 - get riv(privileges button), 2 - request priv(authorize button), 3 - set priv(ok button in authorize window)
_log.info("Clan privileges request: "+_action +" and clanid "+_clanid);
if(_action == 2)
{
_priv = readD();
}
}
public void runImpl()
{
L2PcInstance activeChar = getClient().getActiveChar();
switch(_action)
{
case 1:
//case 2:
_log.info("sending clan privileges reply");
activeChar.sendPacket(new ManagePledgePower(activeChar.getClan()));
break;
default:
}
}
public boolean hasPriv(int privString, int privRequest)
{
if((privString & privRequest) == privRequest)
return true;
return false;
}
public int addPriv(int privString, int privRequest)
{
return (privString |= privRequest);
}
public int removePriv(int privString, int privRequest)
{
return (privString &=(~privRequest));
}
public String getType()
{
return _C__C0_REQUESTPLEDGEPOWER;
}
private int _clanid;
private int _action;
private int _priv;
}
package net.sf.l2j.gameserver.serverpackets;
import java.util.logging.Logger;
import net.sf.l2j.gameserver.model.L2Clan;
// 0xE8 is Manor Trade packet :)
public class ManagePledgePower extends ServerBasePacket
{
private static final String _S__30_MANAGEPLEDGEPOWER = "[S] 30 MANAGEPLEDGEPOWER";
private static Logger _log = Logger.getLogger(ManagePledgePower.class.getName());
final void runImpl()
{
}
public ManagePledgePower(L2Clan clan)
{
_clan = clan;
}
final void writeImpl()
{
writeC(0x30);
writeD(100);
writeD(100);
_log.info("Fucki'n pledgePw3r packet SENT!");
}
public String getType()
{
return _S__30_MANAGEPLEDGEPOWER;
}
private L2Clan _clan;
}
package net.sf.l2j.gameserver.serverpackets;
public class StartPledgeWar extends ServerBasePacket
{
private static final String _S__65_STARTPLEDGEWAR = "[S] 65 StartPledgeWar";
private String _pledgeName;
private String _char;
public StartPledgeWar(String pledge, String charName)
{
_pledgeName = pledge;
_char = charName;
}
final void runImpl(){}
final void writeImpl()
{
writeC(0x65);
writeS(_pledgeName);
writeS(_char);
}
public String getType()
{
return _S__65_STARTPLEDGEWAR;
}
}