int val = Integer.parseInt(command.substring(15));
showChatWindow(player, val, null, true);
}
else if (command.startsWith("SevenSigns"))
{
SystemMessage sm;
InventoryUpdate iu;
StatusUpdate su;
String path;
int cabal = SevenSigns.CABAL_NULL;
int stoneType = 0;
L2ItemInstance ancientAdena = player.getInventory().getItemByItemId(
SevenSigns.ANCIENT_ADENA_ID);
int ancientAdenaAmount = ancientAdena == null ? 0 : ancientAdena.getCount();
int val = Integer.parseInt(command.substring(11, 12).trim());
if (command.length() > 12) // SevenSigns x[x] x [x..x]
val = Integer.parseInt(command.substring(11, 13).trim());
if (command.length() > 13)
{
try
{
cabal = Integer.parseInt(command.substring(14, 15).trim());
}
catch (Exception e)
{
try
{
cabal = Integer.parseInt(command.substring(13, 14).trim());
}
catch (Exception e2)
{
try
{
StringTokenizer st = new StringTokenizer(command.trim());
st.nextToken();
cabal = Integer.parseInt(st.nextToken());
}
catch (Exception e3)
{
_log.warning("Failed to retrieve cabal from bypass command. NpcId: " + getNpcId() + "; Command: " + command);
}
}
}
}
switch (val)
{
case 2: // Purchase Record of the Seven Signs
if (!player.getInventory().validateCapacity(1))
{
player.sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
break;
}
L2ItemInstance adenaItem = player.getInventory().getAdenaInstance();
if (!player.reduceAdena("SevenSigns", SevenSigns.RECORD_SEVEN_SIGNS_COST, this, true))
{
player.sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
break;
}
L2ItemInstance recordSevenSigns = player.getInventory().addItem(
"SevenSigns",
SevenSigns.RECORD_SEVEN_SIGNS_ID,
1, player, this);
// Send inventory update packet
iu = new InventoryUpdate();
iu.addNewItem(recordSevenSigns);
iu.addItem(adenaItem);
sendPacket(iu);
// Update current load as well
su = new StatusUpdate(player.getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
sendPacket(su);
sm = new SystemMessage(SystemMessageId.EARNED_ITEM);
sm.addItemName(SevenSigns.RECORD_SEVEN_SIGNS_ID);
player.sendPacket(sm);
break;
case 3: // Join Cabal Intro 1
case 8: // Festival of Darkness Intro - SevenSigns x [0]1
case 10: // Teleport Locations List
showChatWindow(player, val, SevenSigns.getCabalShortName(cabal), false);
break;
case 4: // Join a Cabal - SevenSigns 4 [0]1 x
int newSeal = Integer.parseInt(command.substring(15));
int oldCabal = SevenSigns.getInstance().getPlayerCabal(player);
if (oldCabal != SevenSigns.CABAL_NULL)
{
player.sendMessage("You are already a member of the "
+ SevenSigns.getCabalName(cabal) + ".");
return;
}
if (player.getClassId().level() == 0)
{
player.sendMessage("You must have already completed your first class transfer.");
break;
}
else if (player.getClassId().level() >= 2)
{
if (Config.ALT_GAME_REQUIRE_CASTLE_DAWN)
{
if (getPlayerAllyHasCastle(player))
{
if (cabal == SevenSigns.CABAL_DUSK)
{
player.sendMessage("You must not be a member of a castle-owning clan to join the Revolutionaries of Dusk.");
return;
}
}
/*if (!getPlayerAllyHasCastle(player))
{
if (cabal == SevenSigns.CABAL_DAWN)
{
player.sendMessage("You must be a member of a castle-owning clan to join the Lords Of Dawn.");
return;
}
}
*/
else
{
/*
* If the player is trying to join the Lords of Dawn, check if they are
* carrying a Lord's certificate.
*
* If not then try to take the required amount of adena instead.
*/
if (cabal == SevenSigns.CABAL_DAWN)
{
boolean allowJoinDawn = false;
if (player.destroyItemByItemId(
"SevenSigns",
SevenSigns.CERTIFICATE_OF_APPROVAL_ID,
1, this, false))
{
sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM);
sm.addNumber(1);
sm.addItemName(SevenSigns.CERTIFICATE_OF_APPROVAL_ID);
player.sendPacket(sm);
allowJoinDawn = true;
}
else if (player.reduceAdena("SevenSigns",
SevenSigns.ADENA_JOIN_DAWN_COST, this,
false))
{
sm = new SystemMessage(SystemMessageId.DISSAPEARED_ADENA);
sm.addNumber(SevenSigns.ADENA_JOIN_DAWN_COST);
player.sendPacket(sm);
allowJoinDawn = true;
}
if (!allowJoinDawn)
{
player.sendMessage("You must be a member of a castle-owning clan, have a Certificate of Lord's Approval, or pay 50000 adena to join the Lords of Dawn.");
return;
}
}
}
}
}
SevenSigns.getInstance().setPlayerInfo(player, cabal, newSeal);
if (cabal == SevenSigns.CABAL_DAWN) player.sendPacket(new SystemMessage(
SystemMessageId.SEVENSIGNS_PARTECIPATION_DAWN)); // Joined Dawn
else player.sendPacket(new SystemMessage(SystemMessageId.SEVENSIGNS_PARTECIPATION_DUSK)); // Joined Dusk
// Show a confirmation message to the user, indicating which seal they chose.
switch (newSeal)
{
case SevenSigns.SEAL_AVARICE:
player.sendPacket(new SystemMessage(SystemMessageId.FIGHT_FOR_AVARICE));
break;
case SevenSigns.SEAL_GNOSIS:
player.sendPacket(new SystemMessage(SystemMessageId.FIGHT_FOR_GNOSIS));
break;
case SevenSigns.SEAL_STRIFE:
player.sendPacket(new SystemMessage(SystemMessageId.FIGHT_FOR_STRIFE));
break;
}
showChatWindow(player, 4, SevenSigns.getCabalShortName(cabal), false);
break;
case 6: // Contribute Seal Stones - SevenSigns 6 x
stoneType = Integer.parseInt(command.substring(13));
L2ItemInstance redStones = player.getInventory().getItemByItemId(
SevenSigns.SEAL_STONE_RED_ID);
int redStoneCount = redStones == null ? 0 : redStones.getCount();
L2ItemInstance greenStones = player.getInventory().getItemByItemId(
SevenSigns.SEAL_STONE_GREEN_ID);
int greenStoneCount = greenStones == null ? 0 : greenStones.getCount();
L2ItemInstance blueStones = player.getInventory().getItemByItemId(
SevenSigns.SEAL_STONE_BLUE_ID);
int blueStoneCount = blueStones == null ? 0 : blueStones.getCount();
int contribScore = SevenSigns.getInstance().getPlayerContribScore(player);
boolean stonesFound = false;
if (contribScore == Config.ALT_MAXIMUM_PLAYER_CONTRIB)
{
player.sendPacket(new SystemMessage(SystemMessageId.CONTRIB_SCORE_EXCEEDED));
break;
}
int redContribCount = 0;
int greenContribCount = 0;
int blueContribCount = 0;
switch (stoneType)
{
case 1:
blueContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - contribScore)
/ SevenSigns.BLUE_CONTRIB_POINTS;
if (blueContribCount > blueStoneCount)
blueContribCount = blueStoneCount;
break;
case 2:
greenContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - contribScore)
/ SevenSigns.GREEN_CONTRIB_POINTS;
if (greenContribCount > greenStoneCount)
greenContribCount = greenStoneCount;
break;
case 3:
redContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - contribScore)
/ SevenSigns.RED_CONTRIB_POINTS;
if (redContribCount > redStoneCount) redContribCount = redStoneCount;
break;
case 4:
int tempContribScore = contribScore;
redContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore)
/ SevenSigns.RED_CONTRIB_POINTS;
if (redContribCount > redStoneCount) redContribCount = redStoneCount;
tempContribScore += redContribCount * SevenSigns.RED_CONTRIB_POINTS;
greenContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore)
/ SevenSigns.GREEN_CONTRIB_POINTS;
if (greenContribCount > greenStoneCount)
greenContribCount = greenStoneCount;
tempContribScore += greenContribCount * SevenSigns.GREEN_CONTRIB_POINTS;
blueContribCount = (Config.ALT_MAXIMUM_PLAYER_CONTRIB - tempContribScore)
/ SevenSigns.BLUE_CONTRIB_POINTS;
if (blueContribCount > blueStoneCount)
blueContribCount = blueStoneCount;
break;
}
if (redContribCount > 0)
{
if (player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_RED_ID,
redContribCount, this, false))
stonesFound = true;
}
if (greenContribCount > 0)
{
if (player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_GREEN_ID,
greenContribCount, this, false))
stonesFound = true;
}
if (blueContribCount > 0)
{
if (player.destroyItemByItemId("SevenSigns", SevenSigns.SEAL_STONE_BLUE_ID,
blueContribCount, this, false))
stonesFound = true;
}
if (!stonesFound)
{
player.sendMessage("You do not have any seal stones of that type.");
break;
}
contribScore = SevenSigns.getInstance().addPlayerStoneContrib(
player,
blueContribCount,
greenContribCount,
redContribCount);
sm = new SystemMessage(SystemMessageId.CONTRIB_SCORE_INCREASED);
sm.addNumber(contribScore);
player.sendPacket(sm);
showChatWindow(player, 6, null, false);
break;
case 7: // Exchange Ancient Adena for Adena - SevenSigns 7 xxxxxxx
int ancientAdenaConvert = 0;
try
{
ancientAdenaConvert = Integer.parseInt(command.substring(13).trim());
}
catch (NumberFormatException e)
{
player.sendMessage("You must enter an integer amount.");
break;
}
catch (StringIndexOutOfBoundsException e)
{
player.sendMessage("You must enter an amount.");
break;
}
if (ancientAdenaAmount < ancientAdenaConvert || ancientAdenaConvert < 1)
{
player.sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
break;
}
player.reduceAncientAdena("SevenSigns", ancientAdenaConvert, this, true);
player.addAdena("SevenSigns", ancientAdenaConvert, this, true);