int val = Integer.parseInt(command.substring(15));
showChatWindow(player, val, null, true);
}
else if(command.startsWith("SevenSigns"))
{
SystemMessage sm;
String path;
int cabal = SevenSigns.CABAL_NULL;
int stoneType = 0;
// int inventorySize = player.getInventory().getSize() + 1;
L2ItemInstance ancientAdena = player.getInventory().getItemByItemId(SevenSigns.ANCIENT_ADENA_ID);
long 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)
{
}
}
}
switch(val)
{
case 2: // Purchase Record of the Seven Signs
if(!player.getInventory().validateCapacity(1))
{
player.sendPacket(Msg.YOUR_INVENTORY_IS_FULL);
return;
}
if(SevenSigns.RECORD_SEVEN_SIGNS_COST > player.getAdena())
{
player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
return;
}
player.reduceAdena(SevenSigns.RECORD_SEVEN_SIGNS_COST, true);
player.getInventory().addItem(ItemTable.getInstance().createItem(SevenSigns.RECORD_SEVEN_SIGNS_ID));
player.sendPacket(SystemMessage.obtainItems(SevenSigns.RECORD_SEVEN_SIGNS_ID, 1, 0));
break;
case 3: // Join Cabal Intro 1
case 8: // Festival of Darkness Intro - SevenSigns x [0]1
cabal = SevenSigns.getInstance().getPriestCabal(getNpcId());
showChatWindow(player, val, SevenSigns.getCabalShortName(cabal), false);
break;
case 10: // Teleport Locations List
cabal = SevenSigns.getInstance().getPriestCabal(getNpcId());
if(SevenSigns.getInstance().isSealValidationPeriod())
{
showChatWindow(player, val, "", false);
}
else
{
int town = TownManager.getInstance().getClosestTownNumber(this);
if(town >= 6 && town <= 16)
{
showChatWindow(player, val, String.valueOf(town), false);
}
else
{
showChatWindow(player, val, "no", 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(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.AlreadyMember", player).addString(SevenSigns.getCabalName(cabal)));
return;
}
if(player.getClassId().level() == 0)
{
player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.YouAreNewbie", player));
break;
}
else if(player.getClassId().level() >= 2)
{
if(Config.ALT_GAME_REQUIRE_CASTLE_DAWN)
{
if(getPlayerAllyHasCastle(player))
{
if(cabal == SevenSigns.CABAL_DUSK)
{
player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.CastleOwning", player));
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(Functions.getItemCount(player, SevenSigns.CERTIFICATE_OF_APPROVAL_ID) > 0)
{
Functions.removeItem(player, SevenSigns.CERTIFICATE_OF_APPROVAL_ID, 1);
allowJoinDawn = true;
}
else if(Config.ALT_GAME_ALLOW_ADENA_DAWN && player.getAdena() >= SevenSigns.ADENA_JOIN_DAWN_COST)
{
player.reduceAdena(SevenSigns.ADENA_JOIN_DAWN_COST, true);
allowJoinDawn = true;
}
if(!allowJoinDawn)
{
if(Config.ALT_GAME_ALLOW_ADENA_DAWN)
{
player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.CastleOwningCertificate", player));
}
else
{
player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.CastleOwningCertificate2", player));
}
return;
}
}
}
}
SevenSigns.getInstance().setPlayerInfo(player.getObjectId(), cabal, newSeal);
if(cabal == SevenSigns.CABAL_DAWN)
{
player.sendPacket(Msg.YOU_WILL_PARTICIPATE_IN_THE_SEVEN_SIGNS_AS_A_MEMBER_OF_THE_LORDS_OF_DAWN); // Joined Dawn
}
else
{
player.sendPacket(Msg.YOU_WILL_PARTICIPATE_IN_THE_SEVEN_SIGNS_AS_A_MEMBER_OF_THE_REVOLUTIONARIES_OF_DUSK);
} // Joined Dusk
//Show a confirmation message to the user, indicating which seal they chose.
switch(newSeal)
{
case SevenSigns.SEAL_AVARICE:
player.sendPacket(Msg.YOUVE_CHOSEN_TO_FIGHT_FOR_THE_SEAL_OF_AVARICE_DURING_THIS_QUEST_EVENT_PERIOD);
break;
case SevenSigns.SEAL_GNOSIS:
player.sendPacket(Msg.YOUVE_CHOSEN_TO_FIGHT_FOR_THE_SEAL_OF_GNOSIS_DURING_THIS_QUEST_EVENT_PERIOD);
break;
case SevenSigns.SEAL_STRIFE:
player.sendPacket(Msg.YOUVE_CHOSEN_TO_FIGHT_FOR_THE_SEAL_OF_STRIFE_DURING_THIS_QUEST_EVENT_PERIOD);
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);
long redStoneCount = redStones == null ? 0 : redStones.getCount();
L2ItemInstance greenStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
long greenStoneCount = greenStones == null ? 0 : greenStones.getCount();
L2ItemInstance blueStones = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
long blueStoneCount = blueStones == null ? 0 : blueStones.getCount();
long contribScore = SevenSigns.getInstance().getPlayerContribScore(player);
boolean stonesFound = false;
if(contribScore == SevenSigns.MAXIMUM_PLAYER_CONTRIB)
{
player.sendPacket(Msg.CONTRIBUTION_LEVEL_HAS_EXCEEDED_THE_LIMIT_YOU_MAY_NOT_CONTINUE);
}
else
{
long redContribCount = 0;
long greenContribCount = 0;
long blueContribCount = 0;
switch(stoneType)
{
case 1:
blueContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - contribScore) / SevenSigns.BLUE_CONTRIB_POINTS;
if(blueContribCount > blueStoneCount)
{
blueContribCount = blueStoneCount;
}
break;
case 2:
greenContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - contribScore) / SevenSigns.GREEN_CONTRIB_POINTS;
if(greenContribCount > greenStoneCount)
{
greenContribCount = greenStoneCount;
}
break;
case 3:
redContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - contribScore) / SevenSigns.RED_CONTRIB_POINTS;
if(redContribCount > redStoneCount)
{
redContribCount = redStoneCount;
}
break;
case 4:
long tempContribScore = contribScore;
redContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.RED_CONTRIB_POINTS;
if(redContribCount > redStoneCount)
{
redContribCount = redStoneCount;
}
tempContribScore += redContribCount * SevenSigns.RED_CONTRIB_POINTS;
greenContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.GREEN_CONTRIB_POINTS;
if(greenContribCount > greenStoneCount)
{
greenContribCount = greenStoneCount;
}
tempContribScore += greenContribCount * SevenSigns.GREEN_CONTRIB_POINTS;
blueContribCount = (SevenSigns.MAXIMUM_PLAYER_CONTRIB - tempContribScore) / SevenSigns.BLUE_CONTRIB_POINTS;
if(blueContribCount > blueStoneCount)
{
blueContribCount = blueStoneCount;
}
break;
}
if(redContribCount > 0)
{
L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_RED_ID);
if(temp != null && temp.getCount() >= redContribCount)
{
player.getInventory().destroyItemByItemId(SevenSigns.SEAL_STONE_RED_ID, (int) redContribCount, true);
stonesFound = true;
}
}
if(greenContribCount > 0)
{
L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID);
if(temp != null && temp.getCount() >= greenContribCount)
{
player.getInventory().destroyItemByItemId(SevenSigns.SEAL_STONE_GREEN_ID, (int) greenContribCount, true);
stonesFound = true;
}
}
if(blueContribCount > 0)
{
L2ItemInstance temp = player.getInventory().getItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID);
if(temp != null && temp.getCount() >= blueContribCount)
{
player.getInventory().destroyItemByItemId(SevenSigns.SEAL_STONE_BLUE_ID, (int) blueContribCount, true);
stonesFound = true;
}
}
if(!stonesFound)
{
player.sendMessage(new CustomMessage("l2p.gameserver.model.instances.L2SignsPriestInstance.DontHaveAnySSType", player));
return;
}
contribScore = SevenSigns.getInstance().addPlayerStoneContrib(player, blueContribCount, greenContribCount, redContribCount);
sm = new SystemMessage(SystemMessage.YOUR_CONTRIBUTION_SCORE_IS_INCREASED_BY_S1);
sm.addNumber(contribScore);
player.sendPacket(sm);
showChatWindow(player, 6, null, false);
}
break;
case 7: // Exchange Ancient Adena for Adena - SevenSigns 7 xxxxxxx