|
@@ -42,8 +42,13 @@ import com.l2jserver.gameserver.util.Util;
|
|
|
import com.l2jserver.util.StringUtil;
|
|
|
|
|
|
/**
|
|
|
- * Castle Chamberlains implementation used for: - tax rate control - regional<br>
|
|
|
- * manor system control - castle treasure control - ...
|
|
|
+ * Castle Chamberlains implementation used for:
|
|
|
+ * <ul>
|
|
|
+ * <li>Tax rate control regional</li>
|
|
|
+ * <li>Manor system control</li>
|
|
|
+ * <li>Castle treasure control</li>
|
|
|
+ * <li>Manor's agreement exchange</li>
|
|
|
+ * </ul>
|
|
|
*/
|
|
|
public class L2CastleChamberlainInstance extends L2MerchantInstance
|
|
|
{
|
|
@@ -91,7 +96,7 @@ public class L2CastleChamberlainInstance extends L2MerchantInstance
|
|
|
String actualCommand = st.nextToken(); // Get actual command
|
|
|
|
|
|
String val = "";
|
|
|
- if (st.countTokens() >= 1)
|
|
|
+ if (st.hasMoreTokens())
|
|
|
{
|
|
|
val = st.nextToken();
|
|
|
}
|
|
@@ -1244,6 +1249,98 @@ public class L2CastleChamberlainInstance extends L2MerchantInstance
|
|
|
player.sendPacket(html);
|
|
|
return;
|
|
|
}
|
|
|
+ else if (actualCommand.equalsIgnoreCase("manors_cert"))
|
|
|
+ {
|
|
|
+ final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
|
|
+ // Zoey76: TODO: Check privileges and replace with enum/constants.
|
|
|
+ if (isMyLord(player) || (validatePrivileges(player, 5) && (validateCondition(player) == COND_OWNER)))
|
|
|
+ {
|
|
|
+ if (getCastle().getSiege().getIsInProgress())
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/chamberlain-busy.htm");
|
|
|
+ html.replace("%npcname%", String.valueOf(getName()));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ final int cabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId());
|
|
|
+ if ((cabal == SevenSigns.CABAL_DAWN) && SevenSigns.getInstance().isCompetitionPeriod())
|
|
|
+ {
|
|
|
+ final int ticketCount = getCastle().getTicketBuyCount();
|
|
|
+ if (ticketCount < (Config.SSQ_DAWN_TICKET_QUANTITY / Config.SSQ_DAWN_TICKET_BUNDLE))
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/ssq_selldawnticket.htm");
|
|
|
+ html.replace("%DawnTicketLeft%", String.valueOf(Config.SSQ_DAWN_TICKET_QUANTITY - (ticketCount * Config.SSQ_DAWN_TICKET_BUNDLE)));
|
|
|
+ html.replace("%DawnTicketBundle%", String.valueOf(Config.SSQ_DAWN_TICKET_BUNDLE));
|
|
|
+ html.replace("%DawnTicketPrice%", String.valueOf(Config.SSQ_DAWN_TICKET_PRICE * Config.SSQ_DAWN_TICKET_BUNDLE));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/ssq_notenoughticket.htm");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/ssq_notdawnorevent.htm");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/chamberlain-noprivs.htm");
|
|
|
+ }
|
|
|
+ html.replace("%objectId%", String.valueOf(getObjectId()));
|
|
|
+ player.sendPacket(html);
|
|
|
+ }
|
|
|
+ else if (actualCommand.equalsIgnoreCase("manors_cert_confirm"))
|
|
|
+ {
|
|
|
+ final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
|
|
|
+ // Zoey76: TODO: Check privileges and replace with enum/constants.
|
|
|
+ if (isMyLord(player) || (validatePrivileges(player, 5) && (validateCondition(player) == COND_OWNER)))
|
|
|
+ {
|
|
|
+ if (getCastle().getSiege().getIsInProgress())
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/chamberlain-busy.htm");
|
|
|
+ html.replace("%npcname%", String.valueOf(getName()));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ final int cabal = SevenSigns.getInstance().getPlayerCabal(player.getObjectId());
|
|
|
+ if ((cabal == SevenSigns.CABAL_DAWN) && SevenSigns.getInstance().isCompetitionPeriod())
|
|
|
+ {
|
|
|
+ final int ticketCount = getCastle().getTicketBuyCount();
|
|
|
+ if (ticketCount < (Config.SSQ_DAWN_TICKET_QUANTITY / Config.SSQ_DAWN_TICKET_BUNDLE))
|
|
|
+ {
|
|
|
+ final long totalCost = Config.SSQ_DAWN_TICKET_PRICE * Config.SSQ_DAWN_TICKET_BUNDLE;
|
|
|
+ if (player.getAdena() >= totalCost)
|
|
|
+ {
|
|
|
+ // Take the adena.
|
|
|
+ player.reduceAdena(actualCommand, totalCost, this, true);
|
|
|
+ // Give the certificate.
|
|
|
+ player.addItem(actualCommand, Config.SSQ_MANORS_AGREEMENT_ID, Config.SSQ_DAWN_TICKET_BUNDLE, this, true);
|
|
|
+ // Set the ticket count for the player's clan.
|
|
|
+ getCastle().setTicketBuyCount(ticketCount + 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/chamberlain_noadena.htm");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/ssq_notenoughticket.htm");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/ssq_notdawnorevent.htm");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ html.setFile(player.getHtmlPrefix(), "data/html/chamberlain/chamberlain-noprivs.htm");
|
|
|
+ }
|
|
|
+ html.replace("%objectId%", String.valueOf(getObjectId()));
|
|
|
+ player.sendPacket(html);
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
super.onBypassFeedback(player, command);
|