actual freya branch

This commit is contained in:
2026-09-12 15:39:57 +00:00
parent 9fa534b20e
commit 8049e0a882
18540 changed files with 1228200 additions and 0 deletions
@@ -0,0 +1,59 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExShowVariationCancelWindow;
import com.l2jserver.gameserver.network.serverpackets.ExShowVariationMakeWindow;
public class Augment implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Augment"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
try
{
switch(Integer.parseInt(command.substring(8, 9).trim()))
{
case 1:
activeChar.sendPacket(new ExShowVariationMakeWindow());
return true;
case 2:
activeChar.sendPacket(new ExShowVariationCancelWindow());
return true;
}
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,58 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
public class Buy implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Buy"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2MerchantInstance))
return false;
try
{
StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
if (st.countTokens() < 1)
return false;
((L2MerchantInstance)target).showBuyWindow(activeChar, Integer.parseInt(st.nextToken()));
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,55 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class BuyShadowItem implements IBypassHandler
{
private static final String[] COMMANDS =
{
"BuyShadowItem"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2MerchantInstance))
return false;
NpcHtmlMessage html = new NpcHtmlMessage(((L2Npc)target).getObjectId());
if (activeChar.getLevel() < 40)
html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item-lowlevel.htm");
else if ((activeChar.getLevel() >= 40) && (activeChar.getLevel() < 46))
html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item_d.htm");
else if ((activeChar.getLevel() >= 46) && (activeChar.getLevel() < 52))
html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item_c.htm");
else if (activeChar.getLevel() >= 52)
html.setFile(activeChar.getHtmlPrefix(), "data/html/common/shadow_item_b.htm");
html.replace("%objectId%", String.valueOf(((L2Npc)target).getObjectId()));
activeChar.sendPacket(html);
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,66 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
public class CPRecovery implements IBypassHandler
{
private static final String[] COMMANDS =
{
"CPRecovery"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
final L2Npc npc = (L2Npc) target;
if (npc.getNpcId() != 31225 && npc.getNpcId() != 31226)
return false;
if (activeChar.isCursedWeaponEquipped())
{
activeChar.sendMessage("Go away, you're not welcome here.");
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return true;
}
if (!activeChar.reduceAdena("RestoreCP", 100, activeChar.getLastFolkNPC(), true))
return false;
L2Skill skill = SkillTable.getInstance().getInfo(4380, 1);
if (skill != null)
{
npc.setTarget(activeChar);
npc.doCast(skill);
}
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,54 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
public class ChatLink implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Chat"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (IndexOutOfBoundsException ioobe)
{
}
catch (NumberFormatException nfe)
{
}
((L2Npc)target).showChatWindow(activeChar, val);
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,143 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2ClanHallManagerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2WarehouseInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalList;
import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalList.WarehouseListType;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.WareHouseDepositList;
import com.l2jserver.gameserver.network.serverpackets.WareHouseWithdrawalList;
public class ClanWarehouse implements IBypassHandler
{
private static final String[] COMMANDS =
{
"withdrawc",
"withdrawsortedc",
"depositc"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2WarehouseInstance) && !(target instanceof L2ClanHallManagerInstance))
return false;
if (activeChar.isEnchanting())
return false;
if (activeChar.getClan() == null)
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE));
return false;
}
if (activeChar.getClan().getLevel() == 0)
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ONLY_LEVEL_1_CLAN_OR_HIGHER_CAN_USE_WAREHOUSE));
return false;
}
try
{
if (command.toLowerCase().startsWith(COMMANDS[0])) // WithdrawC
{
if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_CLAN)
{
NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc)target).getObjectId());
msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/WhSortedC.htm");
msg.replace("%objectId%", String.valueOf(((L2Npc)target).getObjectId()));
activeChar.sendPacket(msg);
}
else
showWithdrawWindow(activeChar, null, (byte) 0);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedC
{
final String param[] = command.split(" ");
if (param.length > 2)
showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
else if (param.length > 1)
showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
else
showWithdrawWindow(activeChar, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositC
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
activeChar.setActiveWarehouse(activeChar.getClan().getWarehouse());
activeChar.tempInventoryDisable();
if (Config.DEBUG)
_log.fine("Source: L2WarehouseInstance.java; Player: "+activeChar.getName()+"; Command: showDepositWindowClan; Message: Showing items to deposit.");
activeChar.sendPacket(new WareHouseDepositList(activeChar, WareHouseDepositList.CLAN));
return true;
}
return false;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
private static final void showWithdrawWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
if ((player.getClanPrivileges() & L2Clan.CP_CL_VIEW_WAREHOUSE) != L2Clan.CP_CL_VIEW_WAREHOUSE)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_CLAN_WAREHOUSE));
return;
}
player.setActiveWarehouse(player.getClan().getWarehouse());
if (player.getActiveWarehouse().getSize() == 0)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
return;
}
if (itemtype != null)
player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN, itemtype, sortorder));
else
player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.CLAN));
if (Config.DEBUG)
_log.fine("Source: L2WarehouseInstance.java; Player: "+player.getName()+"; Command: showRetrieveWindowClan; Message: Showing stored items.");
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,44 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.datatables.HennaTreeTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SymbolMakerInstance;
import com.l2jserver.gameserver.network.serverpackets.HennaEquipList;
public class DrawHenna implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Draw"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2SymbolMakerInstance))
return false;
activeChar.sendPacket(new HennaEquipList(activeChar, HennaTreeTable.getInstance().getAvailableHenna(activeChar.getClassId())));
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,351 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.Calendar;
import java.util.List;
import com.l2jserver.Config;
import com.l2jserver.gameserver.SevenSigns;
import com.l2jserver.gameserver.SevenSignsFestival;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2FestivalGuideInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.templates.StatsSet;
import com.l2jserver.util.StringUtil;
public class Festival implements IBypassHandler
{
private static final String[] COMMANDS =
{
"festival",
"festivaldesc"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2FestivalGuideInstance))
return false;
final L2FestivalGuideInstance npc = (L2FestivalGuideInstance)target;
try
{
final int val;
if (command.toLowerCase().startsWith(COMMANDS[1]))
{
val = Integer.parseInt(command.substring(13));
npc.showChatWindow(activeChar, val, null, true);
return true;
}
else
{
final L2Party party;
val = Integer.parseInt(command.substring(9, 10));
switch (val)
{
case 1: // Become a Participant
// Check if the festival period is active, if not then don't allow registration.
if (SevenSigns.getInstance().isSealValidationPeriod())
{
npc.showChatWindow(activeChar, 2, "a", false);
return true;
}
// Check if a festival is in progress, then don't allow registration yet.
if (SevenSignsFestival.getInstance().isFestivalInitialized())
{
activeChar.sendMessage("You cannot sign up while a festival is in progress.");
return true;
}
// Check if the player is in a formed party already.
if (!activeChar.isInParty())
{
npc.showChatWindow(activeChar, 2, "b", false);
return true;
}
party = activeChar.getParty();
// Check if the player is the party leader.
if (!party.isLeader(activeChar))
{
npc.showChatWindow(activeChar, 2, "c", false);
return true;
}
// Check to see if the party has at least 5 members.
if (party.getMemberCount() < Config.ALT_FESTIVAL_MIN_PLAYER)
{
npc.showChatWindow(activeChar, 2, "b", false);
return true;
}
// Check if all the party members are in the required level range.
if (party.getLevel() > SevenSignsFestival.getMaxLevelForFestival(npc.getFestivalType()))
{
npc.showChatWindow(activeChar, 2, "d", false);
return true;
}
// Check to see if the player has already signed up
if (activeChar.isFestivalParticipant())
{
SevenSignsFestival.getInstance().setParticipants(npc.getFestivalOracle(), npc.getFestivalType(), party);
npc.showChatWindow(activeChar, 2, "f", false);
return true;
}
npc.showChatWindow(activeChar, 1, null, false);
break;
case 2: // Seal Stones
final int stoneType = Integer.parseInt(command.substring(11));
final int stoneCount = npc.getStoneCount(stoneType);
if (stoneCount <= 0)
return false;
if (!activeChar.destroyItemByItemId("SevenSigns", stoneType, stoneCount, npc, true))
return false;
SevenSignsFestival.getInstance().setParticipants(npc.getFestivalOracle(), npc.getFestivalType(), activeChar.getParty());
SevenSignsFestival.getInstance().addAccumulatedBonus(npc.getFestivalType(), stoneType, stoneCount);
npc.showChatWindow(activeChar, 2, "e", false);
break;
case 3: // Score Registration
// Check if the festival period is active, if not then don't register the score.
if (SevenSigns.getInstance().isSealValidationPeriod())
{
npc.showChatWindow(activeChar, 3, "a", false);
return true;
}
// Check if a festival is in progress, if it is don't register the score.
if (SevenSignsFestival.getInstance().isFestivalInProgress())
{
activeChar.sendMessage("You cannot register a score while a festival is in progress.");
return true;
}
// Check if the player is in a party.
if (!activeChar.isInParty())
{
npc.showChatWindow(activeChar, 3, "b", false);
return true;
}
final List<Integer> prevParticipants = SevenSignsFestival.getInstance().getPreviousParticipants(npc.getFestivalOracle(), npc.getFestivalType());
// Check if there are any past participants.
if (prevParticipants == null
|| prevParticipants.isEmpty()
|| !prevParticipants.contains(activeChar.getObjectId()))
{
npc.showChatWindow(activeChar, 3, "b", false);
return true;
}
// Check if this player was the party leader in the festival.
if (activeChar.getObjectId() != prevParticipants.get(0))
{
npc.showChatWindow(activeChar, 3, "b", false);
return true;
}
final L2ItemInstance bloodOfferings = activeChar.getInventory().getItemByItemId(SevenSignsFestival.FESTIVAL_OFFERING_ID);
// Check if the player collected any blood offerings during the festival.
if (bloodOfferings == null)
{
activeChar.sendMessage("You do not have any blood offerings to contribute.");
return true;
}
final long offeringScore = bloodOfferings.getCount() * SevenSignsFestival.FESTIVAL_OFFERING_VALUE;
if (!activeChar.destroyItem("SevenSigns", bloodOfferings, npc, false))
return true;
final boolean isHighestScore = SevenSignsFestival.getInstance().setFinalScore(activeChar, npc.getFestivalOracle(), npc.getFestivalType(), offeringScore);
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CONTRIB_SCORE_INCREASED_S1);
sm.addItemNumber(offeringScore);
activeChar.sendPacket(sm);
if (isHighestScore)
npc.showChatWindow(activeChar, 3, "c", false);
else
npc.showChatWindow(activeChar, 3, "d", false);
break;
case 4: // Current High Scores
final StringBuilder strBuffer = StringUtil.startAppend(500,
"<html><body>Festival Guide:<br>These are the top scores of the week, for the ");
final StatsSet dawnData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DAWN, npc.getFestivalType());
final StatsSet duskData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DUSK, npc.getFestivalType());
final StatsSet overallData = SevenSignsFestival.getInstance().getOverallHighestScoreData(npc.getFestivalType());
final int dawnScore = dawnData.getInteger("score");
final int duskScore = duskData.getInteger("score");
int overallScore = 0;
// If no data is returned, assume there is no record, or all scores are 0.
if (overallData != null)
overallScore = overallData.getInteger("score");
StringUtil.append(strBuffer,
SevenSignsFestival.getFestivalName(npc.getFestivalType()),
" festival.<br>");
if (dawnScore > 0)
{
StringUtil.append(strBuffer,
"Dawn: ",
calculateDate(dawnData.getString("date")),
". Score ",
String.valueOf(dawnScore),
"<br>",
dawnData.getString("members"),
"<br>"
);
}
else
strBuffer.append("Dawn: No record exists. Score 0<br>");
if (duskScore > 0)
{
StringUtil.append(strBuffer,
"Dusk: ",
calculateDate(duskData.getString("date")),
". Score ",
String.valueOf(duskScore),
"<br>",
duskData.getString("members"),
"<br>"
);
}
else
strBuffer.append("Dusk: No record exists. Score 0<br>");
if (overallScore > 0)
{
final String cabalStr;
if (overallData.getString("cabal").equals("dawn"))
cabalStr = "Children of Dawn";
else
cabalStr = "Children of Dusk";
StringUtil.append(strBuffer,
"Consecutive top scores: ",
calculateDate(overallData.getString("date")),
". Score ",
String.valueOf(overallScore),
"<br>Affilated side: ",
cabalStr,
"<br>",
overallData.getString("members"),
"<br>"
);
}
else
strBuffer.append("Consecutive top scores: No record exists. Score 0<br>");
StringUtil.append(strBuffer,
"<a action=\"bypass -h npc_",
String.valueOf(npc.getObjectId()),
"_Chat 0\">Go back.</a></body></html>"
);
NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
html.setHtml(strBuffer.toString());
activeChar.sendPacket(html);
break;
case 8: // Increase the Festival Challenge
if (!activeChar.isInParty())
return true;
if (!SevenSignsFestival.getInstance().isFestivalInProgress())
return true;
party = activeChar.getParty();
if (!party.isLeader(activeChar))
{
npc.showChatWindow(activeChar, 8, "a", false);
return true;
}
if (SevenSignsFestival.getInstance().increaseChallenge(npc.getFestivalOracle(), npc.getFestivalType()))
npc.showChatWindow(activeChar, 8, "b", false);
else
npc.showChatWindow(activeChar, 8, "c", false);
break;
case 9: // Leave the Festival
if (!activeChar.isInParty())
return true;
party = activeChar.getParty();
if (party.isLeader(activeChar))
SevenSignsFestival.getInstance().updateParticipants(activeChar, null);
else
{
if (party.getMemberCount() > Config.ALT_FESTIVAL_MIN_PLAYER)
party.removePartyMember(activeChar);
else
activeChar.sendMessage("Only the party leader can leave a festival when a party has minimum number of members.");
}
break;
case 0: // Distribute Accumulated Bonus
if (!SevenSigns.getInstance().isSealValidationPeriod())
{
activeChar.sendMessage("Bonuses cannot be paid during the competition period.");
return true;
}
if (SevenSignsFestival.getInstance().distribAccumulatedBonus(activeChar) > 0)
npc.showChatWindow(activeChar, 0, "a", false);
else
npc.showChatWindow(activeChar, 0, "b", false);
break;
default:
npc.showChatWindow(activeChar, val, null, false);
}
}
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
private final String calculateDate(String milliFromEpoch)
{
long numMillis = Long.valueOf(milliFromEpoch);
Calendar calCalc = Calendar.getInstance();
calCalc.setTimeInMillis(numMillis);
return calCalc.get(Calendar.YEAR) + "/" + calCalc.get(Calendar.MONTH) + "/" + calCalc.get(Calendar.DAY_OF_MONTH);
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,84 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2FortSiegeNpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class FortSiege implements IBypassHandler
{
private static final String[] COMMANDS =
{
"fort_register",
"fort_unregister"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2FortSiegeNpcInstance))
return false;
if (activeChar.getClanId() > 0
&& (activeChar.getClanPrivileges() & L2Clan.CP_CS_MANAGE_SIEGE) == L2Clan.CP_CS_MANAGE_SIEGE)
{
if (command.toLowerCase().startsWith(COMMANDS[0])) // register
{
if (System.currentTimeMillis() < TerritoryWarManager.getInstance().getTWStartTimeInMillis()
&& TerritoryWarManager.getInstance().getIsRegistrationOver())
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_SIEGE_REGISTRATION_TIME2));
return false;
}
else if (System.currentTimeMillis() > TerritoryWarManager.getInstance().getTWStartTimeInMillis()
&& TerritoryWarManager.getInstance().isTWChannelOpen())
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_SIEGE_REGISTRATION_TIME2));
return false;
}
else if (((L2Npc)target).getFort().getSiege().registerAttacker(activeChar, false))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.REGISTERED_TO_S1_FORTRESS_BATTLE);
sm.addString(((L2Npc)target).getFort().getName());
activeChar.sendPacket(sm);
((L2Npc)target).showChatWindow(activeChar, 7);
return true;
}
}
else if (command.toLowerCase().startsWith(COMMANDS[1])) // unregister
{
((L2Npc)target).getFort().getSiege().removeSiegeClan(activeChar.getClan());
((L2Npc)target).showChatWindow(activeChar, 8);
return true;
}
return false;
}
else
((L2Npc)target).showChatWindow(activeChar, 10);
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,114 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringTokenizer;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.ItemAuctionManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.itemauction.ItemAuction;
import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExItemAuctionInfoPacket;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class ItemAuctionLink implements IBypassHandler
{
private static final SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy");
private static final String[] COMMANDS =
{
"ItemAuction"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
if (!Config.ALT_ITEM_AUCTION_ENABLED)
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_AUCTION_PERIOD));
return true;
}
final ItemAuctionInstance au = ItemAuctionManager.getInstance().getManagerInstance(((L2Npc)target).getNpcId());
if (au == null)
return false;
try
{
StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // bypass "ItemAuction"
if (!st.hasMoreTokens())
return false;
String cmd = st.nextToken();
if ("show".equalsIgnoreCase(cmd))
{
if (!activeChar.getFloodProtectors().getItemAuction().tryPerformAction("RequestInfoItemAuction"))
return false;
if (activeChar.isItemAuctionPolling())
return false;
final ItemAuction currentAuction = au.getCurrentAuction();
final ItemAuction nextAuction = au.getNextAuction();
if (currentAuction == null)
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_AUCTION_PERIOD));
if (nextAuction != null) // used only once when database is empty
activeChar.sendMessage("The next auction will begin on the " + fmt.format(new Date(nextAuction.getStartingTime())) + ".");
return true;
}
activeChar.sendPacket(new ExItemAuctionInfoPacket(false, currentAuction, nextAuction));
}
else if ("cancel".equalsIgnoreCase(cmd))
{
final ItemAuction[] auctions = au.getAuctionsByBidder(activeChar.getObjectId());
boolean returned = false;
for (final ItemAuction auction : auctions)
{
if (auction.cancelBid(activeChar))
returned = true;
}
if (!returned)
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_OFFERINGS_OWN_OR_MADE_BID_FOR));
}
else
return false;
}
catch (Exception e)
{
_log.severe("Exception in: " + getClass().getSimpleName() + ":" + e.getMessage());
}
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,58 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class Link implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Link"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
try
{
String path = command.substring(5).trim();
if (path.indexOf("..") != -1)
return false;
String filename = "data/html/" + path;
NpcHtmlMessage html = new NpcHtmlMessage(((L2Npc)target).getObjectId());
html.setFile(activeChar.getHtmlPrefix(), filename);
html.replace("%objectId%", String.valueOf(((L2Npc)target).getObjectId()));
activeChar.sendPacket(html);
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,320 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.text.DateFormat;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.games.Lottery;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class Loto implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Loto"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (IndexOutOfBoundsException ioobe)
{
}
catch (NumberFormatException nfe)
{
}
if (val == 0)
{
// new loto ticket
for (int i = 0; i < 5; i++)
activeChar.setLoto(i, 0);
}
showLotoWindow(activeChar, (L2Npc)target, val);
return false;
}
/**
* Open a Loto window on client with the text of the L2NpcInstance.<BR><BR>
*
* <B><U> Actions</U> :</B><BR><BR>
* <li>Get the text of the selected HTML file in function of the npcId and of the page number </li>
* <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance </li>
* <li>Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet </li><BR>
*
* @param player The L2PcInstance that talk with the L2NpcInstance
* @param npc L2Npc loto instance
* @param val The number of the page of the L2NpcInstance to display
*
*/
// 0 - first buy lottery ticket window
// 1-20 - buttons
// 21 - second buy lottery ticket window
// 22 - selected ticket with 5 numbers
// 23 - current lottery jackpot
// 24 - Previous winning numbers/Prize claim
// >24 - check lottery ticket by item object id
public static final void showLotoWindow(L2PcInstance player, L2Npc npc, int val)
{
int npcId = npc.getTemplate().npcId;
String filename;
SystemMessage sm;
NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
if (val == 0) // 0 - first buy lottery ticket window
{
filename = (npc.getHtmlPath(npcId, 1));
html.setFile(player.getHtmlPrefix(), filename);
}
else if (val >= 1 && val <= 21) // 1-20 - buttons, 21 - second buy lottery ticket window
{
if (!Lottery.getInstance().isStarted())
{
//tickets can't be sold
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_CURRENT_SOLD));
return;
}
if (!Lottery.getInstance().isSellableTickets())
{
//tickets can't be sold
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_AVAILABLE));
return;
}
filename = (npc.getHtmlPath(npcId, 5));
html.setFile(player.getHtmlPrefix(), filename);
int count = 0;
int found = 0;
// counting buttons and unsetting button if found
for (int i = 0; i < 5; i++)
{
if (player.getLoto(i) == val)
{
//unsetting button
player.setLoto(i, 0);
found = 1;
}
else if (player.getLoto(i) > 0)
{
count++;
}
}
//if not rearched limit 5 and not unseted value
if (count < 5 && found == 0 && val <= 20)
for (int i = 0; i < 5; i++)
if (player.getLoto(i) == 0)
{
player.setLoto(i, val);
break;
}
//setting pusshed buttons
count = 0;
for (int i = 0; i < 5; i++)
if (player.getLoto(i) > 0)
{
count++;
String button = String.valueOf(player.getLoto(i));
if (player.getLoto(i) < 10)
button = "0" + button;
String search = "fore=\"L2UI.lottoNum" + button + "\" back=\"L2UI.lottoNum" + button + "a_check\"";
String replace = "fore=\"L2UI.lottoNum" + button + "a_check\" back=\"L2UI.lottoNum" + button + "\"";
html.replace(search, replace);
}
if (count == 5)
{
String search = "0\">Return";
String replace = "22\">Your lucky numbers have been selected above.";
html.replace(search, replace);
}
}
else if (val == 22) //22 - selected ticket with 5 numbers
{
if (!Lottery.getInstance().isStarted())
{
//tickets can't be sold
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_CURRENT_SOLD));
return;
}
if (!Lottery.getInstance().isSellableTickets())
{
//tickets can't be sold
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_AVAILABLE));
return;
}
long price = Config.ALT_LOTTERY_TICKET_PRICE;
int lotonumber = Lottery.getInstance().getId();
int enchant = 0;
int type2 = 0;
for (int i = 0; i < 5; i++)
{
if (player.getLoto(i) == 0)
return;
if (player.getLoto(i) < 17)
enchant += Math.pow(2, player.getLoto(i) - 1);
else
type2 += Math.pow(2, player.getLoto(i) - 17);
}
if (player.getAdena() < price)
{
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
player.sendPacket(sm);
return;
}
if (!player.reduceAdena("Loto", price, npc, true))
return;
Lottery.getInstance().increasePrize(price);
sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_S2);
sm.addNumber(lotonumber);
sm.addItemName(4442);
player.sendPacket(sm);
L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), 4442);
item.setCount(1);
item.setCustomType1(lotonumber);
item.setEnchantLevel(enchant);
item.setCustomType2(type2);
player.getInventory().addItem("Loto", item, player, npc);
InventoryUpdate iu = new InventoryUpdate();
iu.addItem(item);
L2ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
iu.addModifiedItem(adenaupdate);
player.sendPacket(iu);
filename = (npc.getHtmlPath(npcId, 6));
html.setFile(player.getHtmlPrefix(), filename);
}
else if (val == 23) //23 - current lottery jackpot
{
filename = (npc.getHtmlPath(npcId, 3));
html.setFile(player.getHtmlPrefix(), filename);
}
else if (val == 24) // 24 - Previous winning numbers/Prize claim
{
filename = (npc.getHtmlPath(npcId, 4));
html.setFile(player.getHtmlPrefix(), filename);
int lotonumber = Lottery.getInstance().getId();
String message = "";
for (L2ItemInstance item : player.getInventory().getItems())
{
if (item == null)
continue;
if (item.getItemId() == 4442 && item.getCustomType1() < lotonumber)
{
message = message + "<a action=\"bypass -h npc_%objectId%_Loto " + item.getObjectId() + "\">" + item.getCustomType1() + " Event Number ";
int[] numbers = Lottery.getInstance().decodeNumbers(item.getEnchantLevel(), item.getCustomType2());
for (int i = 0; i < 5; i++)
{
message += numbers[i] + " ";
}
long[] check = Lottery.getInstance().checkTicket(item);
if (check[0] > 0)
{
switch ((int)check[0])
{
case 1:
message += "- 1st Prize";
break;
case 2:
message += "- 2nd Prize";
break;
case 3:
message += "- 3th Prize";
break;
case 4:
message += "- 4th Prize";
break;
}
message += " " + check[1] + "a.";
}
message += "</a><br>";
}
}
if (message.isEmpty())
{
message += "There has been no winning lottery ticket.<br>";
}
html.replace("%result%", message);
}
else if (val == 25) //25 - lottery instructions
{
filename = (npc.getHtmlPath(npcId, 2));
html.setFile(player.getHtmlPrefix(), filename);
}
else if (val > 25) // >25 - check lottery ticket by item object id
{
int lotonumber = Lottery.getInstance().getId();
L2ItemInstance item = player.getInventory().getItemByObjectId(val);
if (item == null || item.getItemId() != 4442 || item.getCustomType1() >= lotonumber)
return;
long[] check = Lottery.getInstance().checkTicket(item);
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(4442);
player.sendPacket(sm);
long adena = check[1];
if (adena > 0)
player.addAdena("Loto", adena, npc, true);
player.destroyItem("Loto", item, npc, false);
return;
}
html.replace("%objectId%", String.valueOf(npc.getObjectId()));
html.replace("%race%", "" + Lottery.getInstance().getId());
html.replace("%adena%", "" + Lottery.getInstance().getPrize());
html.replace("%ticket_price%", "" + Config.ALT_LOTTERY_TICKET_PRICE);
html.replace("%prize5%", "" + (Config.ALT_LOTTERY_5_NUMBER_RATE * 100));
html.replace("%prize4%", "" + (Config.ALT_LOTTERY_4_NUMBER_RATE * 100));
html.replace("%prize3%", "" + (Config.ALT_LOTTERY_3_NUMBER_RATE * 100));
html.replace("%prize2%", "" + Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE);
html.replace("%enddate%", "" + DateFormat.getDateInstance().format(Lottery.getInstance().getEndDate()));
player.sendPacket(html);
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,172 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.CastleManager;
import com.l2jserver.gameserver.instancemanager.CastleManorManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2CastleChamberlainInstance;
import com.l2jserver.gameserver.model.actor.instance.L2ManorManagerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Castle;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.BuyListSeed;
import com.l2jserver.gameserver.network.serverpackets.ExShowCropInfo;
import com.l2jserver.gameserver.network.serverpackets.ExShowCropSetting;
import com.l2jserver.gameserver.network.serverpackets.ExShowManorDefaultInfo;
import com.l2jserver.gameserver.network.serverpackets.ExShowProcureCropDetail;
import com.l2jserver.gameserver.network.serverpackets.ExShowSeedInfo;
import com.l2jserver.gameserver.network.serverpackets.ExShowSeedSetting;
import com.l2jserver.gameserver.network.serverpackets.ExShowSellCropList;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class ManorManager implements IBypassHandler
{
private static final String[] COMMANDS =
{
"manor_menu_select"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
final L2Npc manager = activeChar.getLastFolkNPC();
final boolean isCastle = manager instanceof L2CastleChamberlainInstance;
if (!(manager instanceof L2ManorManagerInstance || isCastle))
return false;
if (!activeChar.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, true, false))
return false;
try
{
final Castle castle = manager.getCastle();
if (isCastle)
{
if (activeChar.getClan() == null
|| castle.getOwnerId() != activeChar.getClanId()
|| (activeChar.getClanPrivileges() & L2Clan.CP_CS_MANOR_ADMIN) != L2Clan.CP_CS_MANOR_ADMIN)
{
manager.showChatWindow(activeChar, "data/html/chamberlain/chamberlain-noprivs.htm");
return false;
}
if (castle.getSiege().getIsInProgress())
{
manager.showChatWindow(activeChar, "data/html/chamberlain/chamberlain-busy.htm");
return false;
}
}
if (CastleManorManager.getInstance().isUnderMaintenance())
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE));
return true;
}
final StringTokenizer st = new StringTokenizer(command, "&");
final int ask = Integer.parseInt(st.nextToken().split("=")[1]);
final int state = Integer.parseInt(st.nextToken().split("=")[1]);
final int time = Integer.parseInt(st.nextToken().split("=")[1]);
final int castleId;
if (state < 0)
castleId = castle.getCastleId(); // info for current manor
else
castleId = state; // info for requested manor
switch (ask)
{
case 1: // Seed purchase
if (isCastle)
break;
if (castleId != castle.getCastleId())
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR);
sm.addString(manager.getCastle().getName());
activeChar.sendPacket(sm);
}
else
activeChar.sendPacket(new BuyListSeed(activeChar.getAdena(), castleId, castle.getSeedProduction(CastleManorManager.PERIOD_CURRENT)));
break;
case 2: // Crop sales
if (isCastle)
break;
activeChar.sendPacket(new ExShowSellCropList(activeChar, castleId, castle.getCropProcure(CastleManorManager.PERIOD_CURRENT)));
break;
case 3: // Current seeds (Manor info)
if (time == 1 && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
activeChar.sendPacket(new ExShowSeedInfo(castleId, null));
else
activeChar.sendPacket(new ExShowSeedInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getSeedProduction(time)));
break;
case 4: // Current crops (Manor info)
if (time == 1 && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
activeChar.sendPacket(new ExShowCropInfo(castleId, null));
else
activeChar.sendPacket(new ExShowCropInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getCropProcure(time)));
break;
case 5: // Basic info (Manor info)
activeChar.sendPacket(new ExShowManorDefaultInfo());
break;
case 6: // Buy harvester
if (isCastle)
break;
((L2MerchantInstance)manager).showBuyWindow(activeChar, 300000 + manager.getNpcId());
break;
case 7: // Edit seed setup
if (!isCastle)
break;
if (castle.isNextPeriodApproved())
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM));
else
activeChar.sendPacket(new ExShowSeedSetting(castle.getCastleId()));
break;
case 8: // Edit crop setup
if (!isCastle)
break;
if (castle.isNextPeriodApproved())
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM));
else
activeChar.sendPacket(new ExShowCropSetting(castle.getCastleId()));
break;
case 9: // Edit sales (Crop sales)
if (isCastle)
break;
activeChar.sendPacket(new ExShowProcureCropDetail(state));
break;
default:
return false;
}
return true;
}
catch (Exception e)
{
_log.info(e.getMessage());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,64 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
public class Multisell implements IBypassHandler
{
private static final String[] COMMANDS =
{
"multisell",
"exc_multisell"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
try
{
int listId;
if (command.toLowerCase().startsWith(COMMANDS[0])) // multisell
{
listId = Integer.parseInt(command.substring(9).trim());
MultiSell.getInstance().separateAndSend(listId, activeChar, (L2Npc)target, false);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[1])) // exc_multisell
{
listId = Integer.parseInt(command.substring(13).trim());
MultiSell.getInstance().separateAndSend(listId, activeChar, (L2Npc)target, true);
return true;
}
return false;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,101 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.SiegeManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ItemList;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class Observation implements IBypassHandler
{
private static final String[] COMMANDS =
{
"observesiege",
"observeoracle",
"observe"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
try
{
if (command.toLowerCase().startsWith(COMMANDS[0])) // siege
{
String val = command.substring(13);
StringTokenizer st = new StringTokenizer(val);
st.nextToken(); // Bypass cost
if (SiegeManager.getInstance().getSiege(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())) != null)
doObserve(activeChar, (L2Npc)target, val);
else
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ONLY_VIEW_SIEGE));
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[1])) // oracle
{
String val = command.substring(13);
StringTokenizer st = new StringTokenizer(val);
st.nextToken(); // Bypass cost
doObserve(activeChar, (L2Npc)target, val);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[2])) // observe
{
doObserve(activeChar, (L2Npc)target, command.substring(8));
return true;
}
return false;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
private static final void doObserve(L2PcInstance player, L2Npc npc, String val)
{
StringTokenizer st = new StringTokenizer(val);
long cost = Long.parseLong(st.nextToken());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
int z = Integer.parseInt(st.nextToken());
if (player.reduceAdena("Broadcast", cost, npc, true))
{
// enter mode
player.enterObserverMode(x, y, z);
player.sendPacket(new ItemList(player, false));
}
player.sendPacket(ActionFailed.STATIC_PACKET);
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,300 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.datatables.NpcBufferTable;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2ItemInstance;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2OlympiadManagerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.olympiad.CompetitionType;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExHeroList;
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.L2FastList;
/**
*
* @author DS
*
*/
public class OlympiadManagerLink implements IBypassHandler
{
private static final String[] COMMANDS =
{
"olympiaddesc",
"olympiadnoble",
"olybuff",
"olympiad"
};
private static final String FEWER_THAN = "Fewer than " + String.valueOf(Config.ALT_OLY_REG_DISPLAY);
private static final String MORE_THAN = "More than " + String.valueOf(Config.ALT_OLY_REG_DISPLAY);
private static final int GATE_PASS = Config.ALT_OLY_COMP_RITEM;
public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2OlympiadManagerInstance))
return false;
try
{
if (command.toLowerCase().startsWith(COMMANDS[0])) // desc
{
int val = Integer.parseInt(command.substring(13,14));
String suffix = command.substring(14);
((L2OlympiadManagerInstance)target).showChatWindow(activeChar, val, suffix);
}
else if (command.toLowerCase().startsWith(COMMANDS[1])) // noble
{
if (!activeChar.isNoble() || activeChar.getClassId().level() < 3)
return false;
int passes;
int val = Integer.parseInt(command.substring(14));
NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
switch(val)
{
case 1:
OlympiadManager.getInstance().unRegisterNoble(activeChar);
break;
case 2:
final int nonClassed = OlympiadManager.getInstance().getRegisteredNonClassBased().size();
final int teams = OlympiadManager.getInstance().getRegisteredTeamsBased().size();
final Collection<List<Integer>> allClassed = OlympiadManager.getInstance().getRegisteredClassBased().values();
int classed = 0;
if (!allClassed.isEmpty())
{
for (List<Integer> cls : allClassed)
{
if (cls != null)
classed += cls.size();
}
}
html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_registered.htm");
if (Config.ALT_OLY_REG_DISPLAY > 0)
{
html.replace("%listClassed%", classed < Config.ALT_OLY_REG_DISPLAY ? FEWER_THAN : MORE_THAN);
html.replace("%listNonClassedTeam%", teams < Config.ALT_OLY_REG_DISPLAY ? FEWER_THAN : MORE_THAN);
html.replace("%listNonClassed%", nonClassed < Config.ALT_OLY_REG_DISPLAY ? FEWER_THAN : MORE_THAN);
}
else
{
html.replace("%listClassed%", String.valueOf(classed));
html.replace("%listNonClassedTeam%", String.valueOf(teams));
html.replace("%listNonClassed%", String.valueOf(nonClassed));
}
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
break;
case 3:
int points = Olympiad.getInstance().getNoblePoints(activeChar.getObjectId());
html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_points1.htm");
html.replace("%points%", String.valueOf(points));
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
break;
case 4:
OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.NON_CLASSED);
break;
case 5:
OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.CLASSED);
break;
case 6:
passes = Olympiad.getInstance().getNoblessePasses(activeChar, false);
if (passes > 0)
{
html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_settle.htm");
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
}
else
{
html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_nopoints2.htm");
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
}
break;
case 7:
MultiSell.getInstance().separateAndSend(102, activeChar, (L2Npc)target, false);
break;
case 8:
MultiSell.getInstance().separateAndSend(103, activeChar, (L2Npc)target, false);
break;
case 9:
int point = Olympiad.getInstance().getLastNobleOlympiadPoints(activeChar.getObjectId());
html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "noble_points2.htm");
html.replace("%points%", String.valueOf(point));
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
break;
case 10:
passes = Olympiad.getInstance().getNoblessePasses(activeChar, true);
if (passes > 0)
{
L2ItemInstance item = activeChar.getInventory().addItem("Olympiad", GATE_PASS, passes, activeChar, target);
InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(item);
activeChar.sendPacket(iu);
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
sm.addItemNumber(passes);
sm.addItemName(item);
activeChar.sendPacket(sm);
}
break;
case 11:
OlympiadManager.getInstance().registerNoble(activeChar, CompetitionType.TEAMS);
break;
default:
_log.warning("Olympiad System: Couldnt send packet for request " + val);
break;
}
}
else if (command.toLowerCase().startsWith(COMMANDS[2])) // buff
{
if (activeChar.olyBuff <= 0)
return false;
NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
String[] params = command.split(" ");
if (params[1] == null)
{
_log.warning("Olympiad Buffer Warning: npcId = " + ((L2Npc)target).getNpcId() + " has no buffGroup set in the bypass for the buff selected.");
return false;
}
int buffGroup = Integer.parseInt(params[1]);
int[] npcBuffGroupInfo = NpcBufferTable.getInstance().getSkillInfo(((L2Npc)target).getNpcId(), buffGroup);
if (npcBuffGroupInfo == null)
{
_log.warning("Olympiad Buffer Warning: npcId = " + ((L2Npc)target).getNpcId() + " Location: " + target.getX() + ", " + target.getY() + ", " + target.getZ() + " Player: " + activeChar.getName() + " has tried to use skill group (" + buffGroup + ") not assigned to the NPC Buffer!");
return false;
}
int skillId = npcBuffGroupInfo[0];
int skillLevel = npcBuffGroupInfo[1];
L2Skill skill = SkillTable.getInstance().getInfo(skillId,skillLevel);
target.setTarget(activeChar);
if (activeChar.olyBuff > 0)
{
if (skill != null)
{
activeChar.olyBuff--;
target.broadcastPacket(new MagicSkillUse(target, activeChar, skill.getId(), skill.getLevel(), 0, 0));
skill.getEffects(activeChar, activeChar);
L2Summon summon = activeChar.getPet();
if (summon != null)
{
target.broadcastPacket(new MagicSkillUse(target, summon, skill.getId(), skill.getLevel(), 0, 0));
skill.getEffects(summon, summon);
}
}
}
if (activeChar.olyBuff > 0)
{
html.setFile(activeChar.getHtmlPrefix(), activeChar.olyBuff == 5 ? Olympiad.OLYMPIAD_HTML_PATH + "olympiad_buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_5buffs.htm");
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
}
else
{
html.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_nobuffs.htm");
html.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(html);
target.deleteMe();
}
}
else if (command.toLowerCase().startsWith(COMMANDS[3])) // olympiad
{
int val = Integer.parseInt(command.substring(9,10));
NpcHtmlMessage reply = new NpcHtmlMessage(target.getObjectId());
switch (val)
{
case 2:
// for example >> Olympiad 1_88
int classId = Integer.parseInt(command.substring(11));
if ((classId >= 88 && classId <= 118) || (classId >= 131 && classId <= 134) || classId == 136)
{
L2FastList<String> names = Olympiad.getInstance().getClassLeaderBoard(classId);
reply.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_ranking.htm");
int index = 1;
for (String name : names)
{
reply.replace("%place"+index+"%", String.valueOf(index));
reply.replace("%rank"+index+"%", name);
index++;
if (index > 10)
break;
}
for (; index <= 10; index++)
{
reply.replace("%place"+index+"%", "");
reply.replace("%rank"+index+"%", "");
}
reply.replace("%objectId%", String.valueOf(target.getObjectId()));
activeChar.sendPacket(reply);
}
break;
case 4:
activeChar.sendPacket(new ExHeroList());
break;
default:
_log.warning("Olympiad System: Couldnt send packet for request " + val);
break;
}
}
}
catch (Exception e)
{
_log.log(Level.INFO, "Exception in " + e.getMessage(), e);
}
return true;
}
public final String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,258 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.logging.Level;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2OlympiadManagerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.model.olympiad.OlympiadGameManager;
import com.l2jserver.gameserver.model.olympiad.OlympiadGameTask;
import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.StringUtil;
/**
*
* @author DS
*
*/
public class OlympiadObservation implements IBypassHandler
{
private static final String[] COMMANDS =
{
"arenalist",
"arenachange"
};
public final boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
try
{
final boolean isManager = target instanceof L2OlympiadManagerInstance;
if (!isManager)
{
// without npc command can be used only in observer mode on arena
if (!activeChar.inObserverMode()
|| activeChar.isInOlympiadMode()
|| activeChar.getOlympiadGameId() < 0)
return false;
}
if (command.startsWith(COMMANDS[0])) //list
{
NpcHtmlMessage message = new NpcHtmlMessage(0);
if (command.length() < 10)
{
if (isManager)
{
message.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_observe.htm");
message.replace("%objectId%", String.valueOf(target.getObjectId()));
}
else
message.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_arena_observe.htm");
activeChar.sendPacket(message);
return true;
}
final int firstArena, lastArena;
switch (Integer.parseInt(command.substring(10).trim()))
{
case 1:
firstArena = 0;
lastArena = 21;
break;
case 2:
firstArena = 22;
lastArena = 43;
break;
case 3:
firstArena = 44;
lastArena = 65;
break;
case 4:
firstArena = 66;
lastArena = 87;
break;
default:
return false;
}
StringBuilder list = new StringBuilder(3500);
OlympiadGameTask task;
if (isManager)
{
message.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_observe_list.htm");
for (int i = firstArena; i <= lastArena; i++)
{
task = OlympiadGameManager.getInstance().getOlympiadTask(i);
if (task != null)
{
StringUtil.append(list,
"<a action=\"bypass -h npc_%objectId%_arenachange ",
String.valueOf(i),
"\">Arena ",
String.valueOf(i + 1),
"&nbsp;&nbsp;&nbsp;");
if (task.isGameStarted())
{
if (task.isBattleStarted())
StringUtil.append(list, "&$1719;"); // Playing
else
StringUtil.append(list, "&$1718;"); // Standby
StringUtil.append(list,
"&nbsp;&nbsp;&nbsp;",
task.getGame().getPlayerNames()[0],
"&nbsp; : &nbsp;",
task.getGame().getPlayerNames()[1]);
}
else
{
StringUtil.append(list, "&$906;", // Initial State
"</td><td>&nbsp;");
}
StringUtil.append(list, "</a><br>");
}
}
message.replace("%list%", list.toString());
message.replace("%objectId%", String.valueOf(target.getObjectId()));
}
else
{
message.setFile(activeChar.getHtmlPrefix(), Olympiad.OLYMPIAD_HTML_PATH + "olympiad_arena_observe_list.htm");
for (int i = firstArena; i <= lastArena; i++)
{
task = OlympiadGameManager.getInstance().getOlympiadTask(i);
if (task != null)
{
StringUtil.append(list,
"<tr><td fixwidth=30><a action=\"bypass arenachange ",
String.valueOf(i),
"\">",
String.valueOf(i + 1),
"</a></td><td fixwidth=60>");
if (task.isGameStarted())
{
if (task.isBattleStarted())
StringUtil.append(list, "&$1719;"); // Playing
else
StringUtil.append(list, "&$1718;"); // Standby
StringUtil.append(list,
"</td><td>",
task.getGame().getPlayerNames()[0],
"&nbsp;",
task.getGame().getPlayerNames()[1]);
}
else
{
StringUtil.append(list, "&$906;", // Initial State
"</td><td>&nbsp;");
}
StringUtil.append(list, "</td><td><font color=\"aaccff\"></font></td></tr>");
}
}
}
for (int i = firstArena; i <= lastArena; i++)
{
task = OlympiadGameManager.getInstance().getOlympiadTask(i);
if (task != null)
{
StringUtil.append(list,
"<tr><td fixwidth=30><a action=\"bypass arenachange ",
String.valueOf(i),
"\">",
String.valueOf(i + 1),
"</a></td><td fixwidth=60>");
if (task.isGameStarted())
{
if (task.isBattleStarted())
StringUtil.append(list, "&$1719;"); // Playing
else
StringUtil.append(list, "&$1718;"); // Standby
StringUtil.append(list,
"</td><td>",
task.getGame().getPlayerNames()[0],
"&nbsp;",
task.getGame().getPlayerNames()[1]);
}
else
{
StringUtil.append(list, "&$906;", // Initial State
"</td><td>&nbsp;");
}
StringUtil.append(list,
"</td><td><font color=\"aaccff\"></font></td></tr>");
}
message.replace("%list%", list.toString());
}
activeChar.sendPacket(message);
return true;
}
else //change
{
if (isManager)
{
if (OlympiadManager.getInstance().isRegisteredInComp(activeChar))
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.WHILE_YOU_ARE_ON_THE_WAITING_LIST_YOU_ARE_NOT_ALLOWED_TO_WATCH_THE_GAME));
return false;
}
if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(activeChar.getObjectId()))
{
activeChar.sendMessage("You can not observe games while registered for TvT");
return false;
}
}
final int arenaId = Integer.parseInt(command.substring(12).trim());
final OlympiadGameTask nextArena = OlympiadGameManager.getInstance().getOlympiadTask(arenaId);
if (nextArena != null)
{
activeChar.enterOlympiadObserverMode(nextArena.getZone().getSpawns().get(0), arenaId);
return true;
}
}
}
catch (Exception e)
{
_log.log(Level.INFO, "Exception in " + e.getMessage(), e);
}
return false;
}
public final String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,70 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import java.util.logging.Level;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class PlayerHelp implements IBypassHandler
{
private static final String[] COMMANDS =
{
"player_help"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
try
{
if (command.length() < 13)
return false;
final String path = command.substring(12);
if (path.indexOf("..") != -1)
return false;
final StringTokenizer st = new StringTokenizer(path);
final String[] cmd = st.nextToken().split("#");
NpcHtmlMessage html;
if (cmd.length > 1)
{
final int itemId = Integer.parseInt(cmd[1]);
html = new NpcHtmlMessage(1,itemId);
}
else
html = new NpcHtmlMessage(1);
html.setFile(activeChar.getHtmlPrefix(), "data/html/help/"+cmd[0]);
html.disableValidation();
activeChar.sendPacket(html);
}
catch (Exception e)
{
_log.log(Level.INFO, "Exception in " + e.getMessage(), e);
}
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,121 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalList;
import com.l2jserver.gameserver.network.serverpackets.SortedWareHouseWithdrawalList.WarehouseListType;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.WareHouseDepositList;
import com.l2jserver.gameserver.network.serverpackets.WareHouseWithdrawalList;
public class PrivateWarehouse implements IBypassHandler
{
private static final String[] COMMANDS =
{
"withdrawp",
"withdrawsortedp",
"depositp"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
if (activeChar.isEnchanting())
return false;
try
{
if (command.toLowerCase().startsWith(COMMANDS[0])) // WithdrawP
{
if (Config.L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE)
{
NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc)target).getObjectId());
msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/WhSortedP.htm");
msg.replace("%objectId%", String.valueOf(((L2Npc)target).getObjectId()));
activeChar.sendPacket(msg);
}
else
showWithdrawWindow(activeChar, null, (byte) 0);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[1])) // WithdrawSortedP
{
final String param[] = command.split(" ");
if (param.length > 2)
showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.getOrder(param[2]));
else if (param.length > 1)
showWithdrawWindow(activeChar, WarehouseListType.valueOf(param[1]), SortedWareHouseWithdrawalList.A2Z);
else
showWithdrawWindow(activeChar, WarehouseListType.ALL, SortedWareHouseWithdrawalList.A2Z);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[2])) // DepositP
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
activeChar.setActiveWarehouse(activeChar.getWarehouse());
activeChar.tempInventoryDisable();
if (Config.DEBUG)
_log.fine("Source: L2WarehouseInstance.java; Player: "+activeChar.getName()+"; Command: showDepositWindow; Message: Showing items to deposit.");
activeChar.sendPacket(new WareHouseDepositList(activeChar, WareHouseDepositList.PRIVATE));
return true;
}
return false;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
private static final void showWithdrawWindow(L2PcInstance player, WarehouseListType itemtype, byte sortorder)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
player.setActiveWarehouse(player.getWarehouse());
if (player.getActiveWarehouse().getSize() == 0)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_ITEM_DEPOSITED_IN_WH));
return;
}
if (itemtype != null)
player.sendPacket(new SortedWareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE, itemtype, sortorder));
else
player.sendPacket(new WareHouseWithdrawalList(player, WareHouseWithdrawalList.PRIVATE));
if (Config.DEBUG)
_log.fine("Source: L2WarehouseInstance.java; Player: "+player.getName()+"; Command: showRetrieveWindow; Message: Showing stored items.");
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,252 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.List;
import javolution.util.FastList;
import com.l2jserver.Config;
import com.l2jserver.gameserver.cache.HtmCache;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.StringUtil;
public class QuestLink implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Quest"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
String quest = "";
try
{
quest = command.substring(5).trim();
}
catch (IndexOutOfBoundsException ioobe)
{
}
if (quest.length() == 0)
showQuestWindow(activeChar, (L2Npc)target);
else
showQuestWindow(activeChar, (L2Npc)target, quest);
return true;
}
/**
* Open a choose quest window on client with all quests available of the L2NpcInstance.<BR><BR>
*
* <B><U> Actions</U> :</B><BR><BR>
* <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance </li><BR><BR>
*
* @param player The L2PcInstance that talk with the L2NpcInstance
* @param quests The table containing quests of the L2NpcInstance
*
*/
public static void showQuestChooseWindow(L2PcInstance player, L2Npc npc, Quest[] quests)
{
final StringBuilder sb = StringUtil.startAppend(150,
"<html><body>"
);
for (Quest q : quests)
{
StringUtil.append(sb,
"<a action=\"bypass -h npc_",
String.valueOf(npc.getObjectId()),
"_Quest ",
q.getName(),
"\">[",
q.getDescr()
);
QuestState qs = player.getQuestState(q.getScriptName());
if (qs != null)
{
if (qs.getState() == State.STARTED && qs.getInt("cond") > 0)
sb.append(" (In Progress)");
else if (qs.getState() == State.COMPLETED)
sb.append(" (Done)");
}
sb.append("]</a><br>");
}
sb.append("</body></html>");
// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
npc.insertObjectIdAndShowChatWindow(player, sb.toString());
}
/**
* Open a quest window on client with the text of the L2NpcInstance.<BR><BR>
*
* <B><U> Actions</U> :</B><BR><BR>
* <li>Get the text of the quest state in the folder data/scripts/quests/questId/stateId.htm </li>
* <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance </li>
* <li>Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet </li><BR><BR>
*
* @param player The L2PcInstance that talk with the L2NpcInstance
* @param questId The Identifier of the quest to display the message
*
*/
public static void showQuestWindow(L2PcInstance player, L2Npc npc, String questId)
{
String content = null;
Quest q = QuestManager.getInstance().getQuest(questId);
// Get the state of the selected quest
QuestState qs = player.getQuestState(questId);
if (q != null)
{
if ((q.getQuestIntId() >= 1 && q.getQuestIntId() < 20000) && (player.getWeightPenalty() >= 3 || !player.isInventoryUnder80(true)))
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
return;
}
if (qs == null)
{
if (q.getQuestIntId() >= 1 && q.getQuestIntId() < 20000)
{
if (player.getAllActiveQuests().length > 40) // if too many ongoing quests, don't show window and send message
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.TOO_MANY_QUESTS));
return;
}
}
// check for start point
Quest[] qlst = npc.getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START);
if (qlst != null && qlst.length > 0)
{
for (Quest temp : qlst)
{
if (temp == q)
{
qs = q.newQuestState(player);
break;
}
}
}
}
}
else
content = Quest.getNoQuestMsg(player); // no quests found
if (qs != null)
{
// If the quest is alreday started, no need to show a window
if (!qs.getQuest().notifyTalk(npc, qs))
return;
questId = qs.getQuest().getName();
String stateId = State.getStateName(qs.getState());
String path = "data/scripts/quests/" + questId + "/" + stateId + ".htm";
content = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), path); //TODO path for quests html
if (Config.DEBUG)
{
if (content != null)
{
_log.fine("Showing quest window for quest " + questId + " html path: " + path);
}
else
{
_log.fine("File not exists for quest " + questId + " html path: " + path);
}
}
}
// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
if (content != null)
npc.insertObjectIdAndShowChatWindow(player, content);
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}
/**
* Collect awaiting quests/start points and display a QuestChooseWindow (if several available) or QuestWindow.<BR><BR>
*
* @param player The L2PcInstance that talk with the L2NpcInstance
*
*/
public static void showQuestWindow(L2PcInstance player, L2Npc npc)
{
// collect awaiting quests and start points
List<Quest> options = new FastList<Quest>();
QuestState[] awaits = player.getQuestsForTalk(npc.getTemplate().npcId);
Quest[] starts = npc.getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START);
// Quests are limited between 1 and 999 because those are the quests that are supported by the client.
// By limiting them there, we are allowed to create custom quests at higher IDs without interfering
if (awaits != null)
{
for (QuestState x : awaits)
{
if (!options.contains(x.getQuest()))
if ((x.getQuest().getQuestIntId() > 0) && (x.getQuest().getQuestIntId() < 20000))
options.add(x.getQuest());
}
}
if (starts != null)
{
for (Quest x : starts)
{
if (!options.contains(x))
if ((x.getQuestIntId() > 0) && (x.getQuestIntId() < 20000))
options.add(x);
}
}
// Display a QuestChooseWindow (if several quests are available) or QuestWindow
if (options.size() > 1)
{
showQuestChooseWindow(player, npc, options.toArray(new Quest[options.size()]));
}
else if (options.size() == 1)
{
showQuestWindow(player, npc, options.get(0).getName());
}
else
{
showQuestWindow(player, npc, "");
}
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,43 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2AdventurerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExShowQuestInfo;
public class QuestList implements IBypassHandler
{
private static final String[] COMMANDS =
{
"questlist"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2AdventurerInstance))
return false;
activeChar.sendPacket(new ExShowQuestInfo());
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,54 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Object.InstanceType;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExGetPremiumItemList;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class ReceivePremium implements IBypassHandler
{
private static final String[] COMMANDS =
{
"ReceivePremium"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target.isInstanceType(InstanceType.L2Npc)))
return false;
if (activeChar.getPremiumItemList().isEmpty())
{
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NO_MORE_VITAMIN_ITEMS_TO_BE_FOUND));
return false;
}
activeChar.sendPacket(new ExGetPremiumItemList(activeChar));
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,43 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExShowBaseAttributeCancelWindow;
public class ReleaseAttribute implements IBypassHandler
{
private static final String[] COMMANDS =
{
"ReleaseAttribute"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
activeChar.sendPacket(new ExShowBaseAttributeCancelWindow(activeChar));
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,104 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.StringUtil;
public class RemoveDeathPenalty implements IBypassHandler
{
private static final String[] COMMANDS =
{
"remove_dp"
};
static final int[] pen_clear_price =
{
3600, 8640, 25200, 50400, 86400, 144000, 144000, 144000
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
try
{
final int cmdChoice = Integer.parseInt(command.substring(10, 11).trim());
final L2Npc npc = (L2Npc)target;
switch (cmdChoice)
{
case 1:
String filename = "data/html/default/30981-1.htm";
NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
html.setFile(activeChar.getHtmlPrefix(), filename);
html.replace("%objectId%", String.valueOf(npc.getObjectId()));
html.replace("%dp_price%", String.valueOf(pen_clear_price[activeChar.getExpertiseLevel()]));
activeChar.sendPacket(html);
break;
case 2:
NpcHtmlMessage Reply = new NpcHtmlMessage(npc.getObjectId());
final StringBuilder replyMSG = StringUtil.startAppend(400,
"<html><body>Black Judge:<br>"
);
if (activeChar.getDeathPenaltyBuffLevel() > 0)
{
if (activeChar.getAdena() >= pen_clear_price[activeChar.getExpertiseLevel()])
{
if (!activeChar.reduceAdena("DeathPenality", pen_clear_price[activeChar.getExpertiseLevel()], npc, true))
return false;
activeChar.setDeathPenaltyBuffLevel(activeChar.getDeathPenaltyBuffLevel() - 1);
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.DEATH_PENALTY_LIFTED));
activeChar.sendPacket(new EtcStatusUpdate(activeChar));
return true;
}
else
{
replyMSG.append("The wound you have received from death's touch is too deep to be healed for the money you have to give me. Find more money if you wish death's mark to be fully removed from you.");
}
}
else
{
replyMSG.append("You have no more death wounds that require healing.<br>" +
"Go forth and fight, both for this world and your own glory.");
}
replyMSG.append("</body></html>");
Reply.setHtml(replyMSG.toString());
activeChar.sendPacket(Reply);
break;
}
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,54 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2HennaInstance;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SymbolMakerInstance;
import com.l2jserver.gameserver.network.serverpackets.HennaRemoveList;
public class RemoveHennaList implements IBypassHandler
{
private static final String[] COMMANDS =
{
"RemoveList"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2SymbolMakerInstance))
return false;
boolean hasHennas = false;
for (int i = 1; i <= 3; i++)
{
L2HennaInstance henna = activeChar.getHenna(i);
if (henna != null)
hasHennas = true;
}
if (hasHennas)
activeChar.sendPacket(new HennaRemoveList(activeChar));
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,119 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import com.l2jserver.Config;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
public class RentPet implements IBypassHandler
{
private static final String[] COMMANDS =
{
"RentPet"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2MerchantInstance))
return false;
if (!Config.ALLOW_RENTPET)
return false;
if (!Config.LIST_PET_RENT_NPC.contains(((L2Npc)target).getTemplate().npcId))
return false;
try
{
StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
if (st.countTokens() < 1)
{
NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc)target).getObjectId());
msg.setHtml("<html><body>Pet Manager:<br>" +
"You can rent a wyvern or strider for adena.<br>My prices:<br1>" +
"<table border=0><tr><td>Ride</td></tr>" +
"<tr><td>Wyvern</td><td>Strider</td></tr>" +
"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 1\">30 sec/1800 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 11\">30 sec/900 adena</a></td></tr>" +
"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 2\">1 min/7200 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 12\">1 min/3600 adena</a></td></tr>" +
"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 3\">10 min/720000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 13\">10 min/360000 adena</a></td></tr>" +
"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 4\">30 min/6480000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 14\">30 min/3240000 adena</a></td></tr>" +
"</table>" +
"</body></html>");
msg.replace("%objectId%", String.valueOf(((L2Npc)target).getObjectId()));
activeChar.sendPacket(msg);
}
else
tryRentPet(activeChar, Integer.parseInt(st.nextToken()));
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public static final void tryRentPet(L2PcInstance player, int val)
{
if (player == null || player.getPet() != null || player.isMounted() || player.isRentedPet() || player.isTransformed() || player.isCursedWeaponEquipped())
return;
if (!player.disarmWeapons())
return;
int petId;
double price = 1;
int cost[] = {1800, 7200, 720000, 6480000};
int ridetime[] = {30, 60, 600, 1800};
if (val > 10)
{
petId = 12526;
val -= 10;
price /= 2;
}
else
petId = 12621;
if (val < 1 || val > 4)
return;
price *= cost[val - 1];
int time = ridetime[val - 1];
if (!player.reduceAdena("Rent", (long) price, player.getLastFolkNPC(), true))
return;
player.mount(petId, 0, false);
SetupGauge sg = new SetupGauge(3, time*1000);
player.sendPacket(sg);
player.startRentPet(time);
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,100 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.SevenSigns;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2WyvernManagerInstance;
import com.l2jserver.gameserver.util.Util;
public class RideWyvern implements IBypassHandler
{
private static final String[] COMMANDS =
{
"RideWyvern"
};
private static final int[] STRIDERS = { 12526, 12527, 12528, 16038, 16039, 16040, 16068, 13197 };
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2WyvernManagerInstance))
return false;
L2WyvernManagerInstance npc = (L2WyvernManagerInstance)target;
if (!npc.isOwnerClan(activeChar))
return false;
if(!Config.ALLOW_WYVERN_DURING_SIEGE && (npc.isInSiege() || activeChar.isInSiege()))
{
activeChar.sendMessage("You cannot ride wyvern during siege.");
return false;
}
if ((SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DUSK) && SevenSigns.getInstance().isSealValidationPeriod())
{
activeChar.sendMessage("You cannot ride wyvern while Seal of Strife controlled by Dusk.");
return false;
}
if(activeChar.getPet() == null)
{
if(activeChar.isMounted())
activeChar.sendMessage("You already have a pet.");
else
activeChar.sendMessage("Summon your Strider first.");
}
else if (Util.contains(STRIDERS, activeChar.getPet().getNpcId()))
{
if (activeChar.getInventory().getItemByItemId(1460) != null && activeChar.getInventory().getItemByItemId(1460).getCount() >= 25)
{
if (activeChar.getPet().getLevel() < 55)
{
activeChar.sendMessage("Your Strider Has not reached the required level.");
}
else
{
activeChar.getPet().unSummon(activeChar);
if (activeChar.mount(12621, 0, true))
{
activeChar.getInventory().destroyItemByItemId("Wyvern", 1460, 25, activeChar, npc);
activeChar.addSkill(SkillTable.FrequentSkill.WYVERN_BREATH.getSkill());
activeChar.sendMessage("The Wyvern has been summoned successfully!");
}
return true;
}
}
else
{
activeChar.sendMessage("You need 25 Crystals: B Grade.");
}
}
else
{
activeChar.sendMessage("Unsummon your pet.");
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,80 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
public class Rift implements IBypassHandler
{
private static final String[] COMMANDS =
{
"enterrift",
"changeriftroom",
"exitrift"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
if (command.toLowerCase().startsWith(COMMANDS[0])) // EnterRift
{
try
{
Byte b1 = Byte.parseByte(command.substring(10)); // Selected Area: Recruit, Soldier etc
DimensionalRiftManager.getInstance().start(activeChar, b1, (L2Npc)target);
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
}
else
{
final boolean inRift = activeChar.isInParty() && activeChar.getParty().isInDimensionalRift();
if (command.toLowerCase().startsWith(COMMANDS[1])) //ChangeRiftRoom
{
if (inRift)
activeChar.getParty().getDimensionalRift().manualTeleport(activeChar, (L2Npc)target);
else
DimensionalRiftManager.getInstance().handleCheat(activeChar, (L2Npc)target);
return true;
}
else if (command.toLowerCase().startsWith(COMMANDS[2])) // ExitRift
{
if (inRift)
activeChar.getParty().getDimensionalRift().manualExitRift(activeChar, (L2Npc)target);
else
DimensionalRiftManager.getInstance().handleCheat(activeChar, (L2Npc)target);
}
return true;
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,130 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.datatables.SkillTreesData;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class SkillList implements IBypassHandler
{
private static final String[] COMMANDS =
{
"SkillList"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2NpcInstance))
return false;
if (Config.ALT_GAME_SKILL_LEARN)
{
try
{
String id = command.substring(9).trim();
if (id.length() != 0)
{
L2NpcInstance.showSkillList(activeChar, (L2Npc)target, ClassId.values()[Integer.parseInt(id)]);
}
else
{
boolean own_class = false;
ClassId[] classesToTeach = ((L2NpcInstance)target).getClassesToTeach();
if (classesToTeach != null)
{
for (ClassId cid : classesToTeach)
{
if (cid.equalsOrChildOf(activeChar.getClassId()))
{
own_class = true;
break;
}
}
}
String text = "<html><body><center>Skill learning:</center><br>";
if (!own_class)
{
String charType = activeChar.getClassId().isMage() ? "fighter" : "mage";
text +=
"Skills of your class are the easiest to learn.<br>"+
"Skills of another class of your race are a little harder.<br>"+
"Skills for classes of another race are extremely difficult.<br>"+
"But the hardest of all to learn are the "+ charType +"skills!<br>";
}
// make a list of classes
if (classesToTeach != null)
{
int count = 0;
ClassId classCheck = activeChar.getClassId();
while ((count == 0) && (classCheck != null))
{
for (ClassId cid : classesToTeach)
{
if (cid.level() > classCheck.level())
continue;
if (SkillTreesData.getInstance().getAvailableSkills(activeChar, cid, false, false).isEmpty())
continue;
text += "<a action=\"bypass -h npc_%objectId%_SkillList "+cid.getId()+"\">Learn "+cid+"'s class Skills</a><br>\n";
count++;
}
classCheck = classCheck.getParent();
}
classCheck = null;
}
else
text += "No Skills.<br>";
text += "</body></html>";
NpcHtmlMessage html = new NpcHtmlMessage(((L2Npc)target).getObjectId());
html.setHtml(text);
html.replace("%objectId%", String.valueOf(((L2Npc)target).getObjectId()));
activeChar.sendPacket(html);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
}
else
{
L2NpcInstance.showSkillList(activeChar, (L2Npc) target, activeChar.getClassId());
}
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,63 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class SupportBlessing implements IBypassHandler
{
private static final String[] COMMANDS =
{
"GiveBlessing"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
// Blessing of protection - author kerberos_20. Used codes from Rayan - L2Emu project.
// Prevent a cursed weapon weilder of being buffed - I think no need of that becouse karma check > 0
// if (player.isCursedWeaponEquiped())
// return;
int player_level = activeChar.getLevel();
// Select the player
((L2Npc)target).setTarget(activeChar);
// If the player is too high level, display a message and return
if (player_level > 39 || activeChar.getClassId().level() >= 2)
{
NpcHtmlMessage msg = new NpcHtmlMessage(((L2Npc)target).getObjectId());
msg.setHtml("<html><body>Newbie Guide:<br>I'm sorry, but you are not eligible to receive the protection blessing.<br1>It can only be bestowed on <font color=\"LEVEL\">characters below level 39 who have not made a seccond transfer.</font></body></html>");
activeChar.sendPacket(msg);
return true;
}
L2Skill skill = SkillTable.FrequentSkill.BLESSING_OF_PROTECTION.getSkill();
((L2Npc)target).doCast(skill);
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,164 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.datatables.HelperBuffTable;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Skill;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2SummonInstance;
import com.l2jserver.gameserver.templates.L2HelperBuff;
import com.l2jserver.gameserver.templates.skills.L2SkillType;
public class SupportMagic implements IBypassHandler
{
private static final String[] COMMANDS =
{
"supportmagicservitor",
"supportmagic"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
boolean result = false;
if (command.toLowerCase().startsWith(COMMANDS[0]))
result = makeSupportMagic(activeChar, (L2Npc)target, true);
else if (command.toLowerCase().startsWith(COMMANDS[1]))
result = makeSupportMagic(activeChar, (L2Npc)target, false);
return result;
}
/**
* Add Newbie helper buffs to L2Player according to its level.<BR><BR>
*
* <B><U> Actions</U> :</B><BR><BR>
* <li>Get the range level in wich player must be to obtain buff </li>
* <li>If player level is out of range, display a message and return </li>
* <li>According to player level cast buff </li><BR><BR>
*
* <FONT COLOR=#FF0000><B> Newbie Helper Buff list is define in sql table helper_buff_list</B></FONT><BR><BR>
*
* @param player The L2PcInstance that talk with the L2NpcInstance
*
*/
public static boolean makeSupportMagic(L2PcInstance player, L2Npc npc, boolean isSummon)
{
if (player == null)
return false;
// Prevent a cursed weapon weilder of being buffed
if (player.isCursedWeaponEquipped())
return false;
int player_level = player.getLevel();
int lowestLevel = 0;
int highestLevel = 0;
if (isSummon)
{
if (player.getPet() == null || !(player.getPet() instanceof L2SummonInstance))
{
String content = "<html><body>Only servitors can receive this Support Magic. If you do not have a servitor, you cannot access these spells.</body></html>";
npc.insertObjectIdAndShowChatWindow(player, content);
return true;
}
npc.setTarget(player.getPet());
}
else
// Select the player
npc.setTarget(player);
if (isSummon)
{
lowestLevel = HelperBuffTable.getInstance().getServitorLowestLevel();
highestLevel = HelperBuffTable.getInstance().getServitorHighestLevel();
}
else
{
// Calculate the min and max level between which the player must be to obtain buff
if (player.isMageClass())
{
lowestLevel = HelperBuffTable.getInstance().getMagicClassLowestLevel();
highestLevel = HelperBuffTable.getInstance().getMagicClassHighestLevel();
}
else
{
lowestLevel = HelperBuffTable.getInstance().getPhysicClassLowestLevel();
highestLevel = HelperBuffTable.getInstance().getPhysicClassHighestLevel();
}
}
// If the player is too high level, display a message and return
if (player_level > highestLevel)
{
String content = "<html><body>Newbie Guide:<br>Only a <font color=\"LEVEL\">novice character of level " + highestLevel
+ " or less</font> can receive my support magic.<br>Your novice character is the first one that you created and raised in this world.</body></html>";
npc.insertObjectIdAndShowChatWindow(player, content);
return true;
}
// If the player is too low level, display a message and return
if (player_level < lowestLevel)
{
String content = "<html><body>Come back here when you have reached level " + lowestLevel + ". I will give you support magic then.</body></html>";
npc.insertObjectIdAndShowChatWindow(player, content);
return true;
}
L2Skill skill = null;
if (isSummon)
{
for (L2HelperBuff helperBuffItem : HelperBuffTable.getInstance().getHelperBuffTable())
{
if (helperBuffItem.isForSummon())
{
skill = SkillTable.getInstance().getInfo(helperBuffItem.getSkillID(), helperBuffItem.getSkillLevel());
if (skill != null)
npc.doCast(skill);
}
}
}
else
{
// Go through the Helper Buff list define in sql table helper_buff_list and cast skill
for (L2HelperBuff helperBuffItem : HelperBuffTable.getInstance().getHelperBuffTable())
{
if (helperBuffItem.isMagicClassBuff() == player.isMageClass())
{
if (player_level >= helperBuffItem.getLowerLevel() && player_level <= helperBuffItem.getUpperLevel())
{
skill = SkillTable.getInstance().getInfo(helperBuffItem.getSkillID(), helperBuffItem.getSkillLevel());
if (skill.getSkillType() == L2SkillType.SUMMON)
player.doSimultaneousCast(skill);
else
npc.doCast(skill);
}
}
}
}
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,73 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.datatables.ClanTable;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class TerritoryStatus implements IBypassHandler
{
private static final String[] COMMANDS =
{
"TerritoryStatus"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
final L2Npc npc = (L2Npc)target;
final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
{
if (npc.getCastle().getOwnerId() > 0)
{
html.setFile(activeChar.getHtmlPrefix(), "data/html/territorystatus.htm");
L2Clan clan = ClanTable.getInstance().getClan(npc.getCastle().getOwnerId());
html.replace("%clanname%", clan.getName());
html.replace("%clanleadername%", clan.getLeaderName());
}
else
{
html.setFile(activeChar.getHtmlPrefix(), "data/html/territorynoclan.htm");
}
}
html.replace("%castlename%", npc.getCastle().getName());
html.replace("%taxpercent%", "" + npc.getCastle().getTaxPercent());
html.replace("%objectId%", String.valueOf(npc.getObjectId()));
{
if (npc.getCastle().getCastleId() > 6)
{
html.replace("%territory%", "The Kingdom of Elmore");
}
else
{
html.replace("%territory%", "The Kingdom of Aden");
}
}
activeChar.sendPacket(html);
return true;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,227 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import com.l2jserver.gameserver.datatables.MultiSell;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.instancemanager.CastleManager;
import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2MercenaryManagerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
import com.l2jserver.gameserver.network.serverpackets.ExShowDominionRegistry;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;
public class TerritoryWar implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Territory",
"TW_Multisell",
"TW_Buy_List",
"TW_Buy",
"TW_Buy_Elite",
"CalcRewards",
"ReceiveRewards"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
try
{
StringTokenizer st = new StringTokenizer(command, " ");
String actualCommand = st.nextToken(); // Get actual command
if (actualCommand.equalsIgnoreCase("Territory"))
{
if (st.countTokens() < 1)
return false;
int castleId = Integer.parseInt(st.nextToken());
activeChar.sendPacket(new ExShowDominionRegistry(castleId, activeChar));
}
else if (!(target instanceof L2MercenaryManagerInstance))
return false;
L2MercenaryManagerInstance mercman = ((L2MercenaryManagerInstance)target);
if (actualCommand.equalsIgnoreCase("TW_Multisell"))
{
if (st.countTokens() < 1)
return false;
int territoryItemId = Integer.parseInt(st.nextToken());
if (activeChar.getInventory().getItemByItemId(territoryItemId) == null)
{
mercman.showChatWindow(activeChar, 1);
return true;
}
int val = Integer.parseInt(st.nextToken());
MultiSell.getInstance().separateAndSend(val, activeChar, mercman, false);
}
else if (actualCommand.equalsIgnoreCase("TW_Buy_List"))
{
if (st.countTokens() < 1)
return false;
String itemId = st.nextToken();
NpcHtmlMessage html = new NpcHtmlMessage(mercman.getObjectId());
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/" + st.nextToken());
html.replace("%itemId%", itemId);
html.replace("%noblessBadge%", String.valueOf(TerritoryWarManager.MINTWBADGEFORNOBLESS));
html.replace("%striderBadge%", String.valueOf(TerritoryWarManager.MINTWBADGEFORSTRIDERS));
html.replace("%gstriderBadge%", String.valueOf(TerritoryWarManager.MINTWBADGEFORBIGSTRIDER));
html.replace("%objectId%", String.valueOf(mercman.getObjectId()));
activeChar.sendPacket(html);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
else if (actualCommand.equalsIgnoreCase("TW_Buy"))
{
int itemId = Integer.parseInt(st.nextToken());
int count = Integer.parseInt(st.nextToken());
int type = Integer.parseInt(st.nextToken());
if (activeChar.getInventory().getItemByItemId(itemId) != null)
{
long playerItemCount = activeChar.getInventory().getItemByItemId(itemId).getCount();
if (count <= playerItemCount)
{
int boughtId = 0;
switch(type)
{
case 0:
if (activeChar.isNoble())
return false;
boughtId = 7694;
activeChar.setNoble(true);
activeChar.sendPacket(new UserInfo(activeChar));
activeChar.sendPacket(new ExBrExtraUserInfo(activeChar));
break;
case 1:
boughtId = 4422;
break;
case 2:
boughtId = 4423;
break;
case 3:
boughtId = 4424;
break;
case 4:
boughtId = 14819;
break;
default:
_log.warning("TerritoryWar buy: not handled type: " + type);
return false;
}
activeChar.destroyItemByItemId("QUEST", itemId, count, mercman, true);
activeChar.addItem("QUEST", boughtId, 1, mercman, false);
mercman.showChatWindow(activeChar, 7);
return true;
}
}
mercman.showChatWindow(activeChar, 6);
}
else if (actualCommand.equalsIgnoreCase("TW_Buy_Elite"))
{
if(activeChar.getInventory().getItemByItemId(13767) != null)
{
int _castleid = mercman.getCastle().getCastleId();
if (_castleid > 0)
MultiSell.getInstance().separateAndSend(_castleid+676, activeChar, mercman, false);
}
else
{
NpcHtmlMessage html = new NpcHtmlMessage(mercman.getObjectId());
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/nocert.htm");
activeChar.sendPacket(html);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
}
else if (actualCommand.equalsIgnoreCase("CalcRewards"))
{
int territoryId = Integer.parseInt(st.nextToken());
int[] reward = TerritoryWarManager.getInstance().calcReward(activeChar);
NpcHtmlMessage html = new NpcHtmlMessage(mercman.getObjectId());
if (TerritoryWarManager.getInstance().isTWInProgress() || reward[0] == 0)
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-0a.htm");
else if (reward[0] != territoryId)
{
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-0b.htm");
html.replace("%castle%", CastleManager.getInstance().getCastleById(reward[0] - 80).getName());
}
else if (reward[1] == 0)
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-0a.htm");
else
{
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-1.htm");
html.replace("%castle%", CastleManager.getInstance().getCastleById(reward[0] - 80).getName());
html.replace("%badge%", String.valueOf(reward[1]));
html.replace("%adena%", String.valueOf(reward[1] * 5000));
}
html.replace("%territoryId%", String.valueOf(territoryId));
html.replace("%objectId%", String.valueOf(mercman.getObjectId()));
activeChar.sendPacket(html);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
else if (actualCommand.equalsIgnoreCase("ReceiveRewards"))
{
int territoryId = Integer.parseInt(st.nextToken());
int badgeId = 57;
if (TerritoryWarManager.getInstance().TERRITORY_ITEM_IDS.containsKey(territoryId))
badgeId = TerritoryWarManager.getInstance().TERRITORY_ITEM_IDS.get(territoryId);
int[] reward = TerritoryWarManager.getInstance().calcReward(activeChar);
NpcHtmlMessage html = new NpcHtmlMessage(mercman.getObjectId());
if (TerritoryWarManager.getInstance().isTWInProgress() || reward[0] == 0)
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-0a.htm");
else if (reward[0] != territoryId)
{
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-0b.htm");
html.replace("%castle%", CastleManager.getInstance().getCastleById(reward[0] - 80).getName());
}
else if (reward[1] == 0)
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-0a.htm");
else
{
html.setFile(activeChar.getHtmlPrefix(), "data/html/mercmanager/reward-2.htm");
activeChar.addItem("QUEST", badgeId, reward[1], mercman, true);
activeChar.addAdena("QUEST", reward[1] * 5000, mercman, true);
TerritoryWarManager.getInstance().resetReward(activeChar);
}
html.replace("%objectId%", String.valueOf(mercman.getObjectId()));
activeChar.sendPacket(html);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,68 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.handler.VoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
/**
*
* @author DS
*
*/
public class VoiceCommand implements IBypassHandler
{
private static final String[] COMMANDS =
{
"voice"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
// only voice commands allowed
if (command.length() > 7 && command.charAt(6) == '.')
{
final String vc, vparams;
int endOfCommand = command.indexOf(" ", 7);
if (endOfCommand > 0)
{
vc = command.substring(7, endOfCommand).trim();
vparams = command.substring(endOfCommand).trim();
}
else
{
vc = command.substring(7).trim();
vparams = null;
}
if (vc.length() > 0)
{
IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getVoicedCommandHandler(vc);
if (vch != null)
return vch.useVoicedCommand(vc, activeChar, vparams);
}
}
return false;
}
public String[] getBypassList()
{
return COMMANDS;
}
}
@@ -0,0 +1,87 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.bypasshandlers;
import java.util.StringTokenizer;
import com.l2jserver.Config;
import com.l2jserver.gameserver.TradeController;
import com.l2jserver.gameserver.handler.IBypassHandler;
import com.l2jserver.gameserver.model.L2TradeList;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ShopPreviewList;
public class Wear implements IBypassHandler
{
private static final String[] COMMANDS =
{
"Wear"
};
public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)
{
if (!(target instanceof L2Npc))
return false;
if (!Config.ALLOW_WEAR)
return false;
try
{
StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
if (st.countTokens() < 1)
return false;
showWearWindow(activeChar, Integer.parseInt(st.nextToken()));
return true;
}
catch (Exception e)
{
_log.info("Exception in " + getClass().getSimpleName());
}
return false;
}
private static final void showWearWindow(L2PcInstance player, int val)
{
player.tempInventoryDisable();
if (Config.DEBUG)
_log.fine("Showing wearlist");
L2TradeList list = TradeController.getInstance().getBuyList(val);
if (list != null)
{
ShopPreviewList bl = new ShopPreviewList(list, player.getAdena(), player.getExpertiseLevel());
player.sendPacket(bl);
}
else
{
_log.warning("no buylist with id:" + val);
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}
public String[] getBypassList()
{
return COMMANDS;
}
}