Skip to content
Snippets Groups Projects
Commit 13e181d6 authored by Nos's avatar Nos
Browse files

BETA: Implemented `SiegeStatus` user command.

Reviewed By: Zoey76, !UnAfraid, jurchiks
Patch By: Tryskell
parent fbf571df
No related branches found
No related tags found
No related merge requests found
<html><title>Siege Status Report</title><body>
Kills: %kill_count%<br1>
Deaths: %death_count%<br>
<center>
<img src="L2UI.SquareWhite" width=270 height=1>
<table width=270 border=0 bgcolor="111111">
<tr><td width=170>Name</td><td width=100 align=center>Status</td></tr>
</table>
<table width=270 border=0>
%member_list%
</table>
<img src="L2UI.SquareWhite" width=270 height=1>
</center>
</body>
</html>
...@@ -268,6 +268,7 @@ import handlers.usercommandhandlers.Mount; ...@@ -268,6 +268,7 @@ import handlers.usercommandhandlers.Mount;
import handlers.usercommandhandlers.MyBirthday; import handlers.usercommandhandlers.MyBirthday;
import handlers.usercommandhandlers.OlympiadStat; import handlers.usercommandhandlers.OlympiadStat;
import handlers.usercommandhandlers.PartyInfo; import handlers.usercommandhandlers.PartyInfo;
import handlers.usercommandhandlers.SiegeStatus;
import handlers.usercommandhandlers.Time; import handlers.usercommandhandlers.Time;
import handlers.usercommandhandlers.Unstuck; import handlers.usercommandhandlers.Unstuck;
import handlers.voicedcommandhandlers.Banking; import handlers.voicedcommandhandlers.Banking;
...@@ -527,6 +528,7 @@ public class MasterHandler ...@@ -527,6 +528,7 @@ public class MasterHandler
ChannelDelete.class, ChannelDelete.class,
ChannelInfo.class, ChannelInfo.class,
MyBirthday.class, MyBirthday.class,
SiegeStatus.class,
}, },
{ {
// Voiced Command Handlers // Voiced Command Handlers
......
/*
* Copyright (C) 2004-2013 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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.usercommandhandlers;
import com.l2jserver.gameserver.handler.IUserCommandHandler;
import com.l2jserver.gameserver.instancemanager.SiegeManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Siege;
import com.l2jserver.gameserver.model.zone.type.L2SiegeZone;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* @author Tryskell
*/
public class SiegeStatus implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
99
};
private static final String INSIDE_SIEGE_ZONE = "Castle Siege in Progress";
private static final String OUTSIDE_SIEGE_ZONE = "No Castle Siege Area";
@Override
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
if (id != COMMAND_IDS[0])
{
return false;
}
if (!activeChar.isNoble() || !activeChar.isClanLeader())
{
activeChar.sendPacket(SystemMessageId.ONLY_NOBLESSE_LEADER_CAN_VIEW_SIEGE_STATUS_WINDOW);
return false;
}
for (Siege siege : SiegeManager.getInstance().getSieges())
{
if (!siege.getIsInProgress())
{
continue;
}
final L2Clan clan = activeChar.getClan();
if (!siege.checkIsAttacker(clan) && !siege.checkIsDefender(clan))
{
continue;
}
final L2SiegeZone siegeZone = siege.getCastle().getZone();
final StringBuilder sb = new StringBuilder();
for (L2PcInstance member : clan.getOnlineMembers(0))
{
sb.append("<tr><td width=170>");
sb.append(member.getName());
sb.append("</td><td width=100>");
sb.append(siegeZone.isInsideZone(member) ? INSIDE_SIEGE_ZONE : OUTSIDE_SIEGE_ZONE);
sb.append("</td></tr>");
}
final NpcHtmlMessage html = new NpcHtmlMessage();
html.setFile(activeChar.getHtmlPrefix(), "data/html/siege/siege_status.htm");
html.replace("%kill_count%", clan.getSiegeKills());
html.replace("%death_count%", clan.getSiegeDeaths());
html.replace("%member_list%", sb.toString());
activeChar.sendPacket(html);
return true;
}
activeChar.sendPacket(SystemMessageId.ONLY_NOBLESSE_LEADER_CAN_VIEW_SIEGE_STATUS_WINDOW);
return false;
}
@Override
public int[] getUserCommandList()
{
return COMMAND_IDS;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment