actual freya branch
This commit is contained in:
+59
@@ -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.usercommandhandlers;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* @author JIV
|
||||
* Support for /mybirthday command
|
||||
*
|
||||
*/
|
||||
public class Birthday implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
126
|
||||
};
|
||||
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(activeChar.getCreateTime());
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_BIRTHDAY_IS_S3_S4_S2);
|
||||
sm.addPcName(activeChar);
|
||||
sm.addString(Integer.toString(cal.get(Calendar.YEAR)));
|
||||
sm.addString(Integer.toString(cal.get(Calendar.MONTH)+1));
|
||||
sm.addString(Integer.toString(cal.get(Calendar.DATE)));
|
||||
|
||||
|
||||
activeChar.sendPacket(sm);
|
||||
return true;
|
||||
}
|
||||
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+68
@@ -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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Chris
|
||||
*/
|
||||
public class ChannelDelete implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
93
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
if (activeChar.isInParty())
|
||||
{
|
||||
if (activeChar.getParty().isLeader(activeChar) && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getChannelLeader().equals(activeChar))
|
||||
{
|
||||
L2CommandChannel channel = activeChar.getParty().getCommandChannel();
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.COMMAND_CHANNEL_DISBANDED);
|
||||
channel.broadcastToChannelMembers(sm);
|
||||
|
||||
channel.disbandChannel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+73
@@ -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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Chris
|
||||
*/
|
||||
public class ChannelLeave implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
96
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
if (activeChar.isInParty())
|
||||
{
|
||||
if (activeChar.getParty().isLeader(activeChar) && activeChar.getParty().isInCommandChannel())
|
||||
{
|
||||
L2CommandChannel channel = activeChar.getParty().getCommandChannel();
|
||||
L2Party party = activeChar.getParty();
|
||||
channel.removeParty(party);
|
||||
|
||||
party.getLeader().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LEFT_COMMAND_CHANNEL));
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_PARTY_LEFT_COMMAND_CHANNEL);
|
||||
sm.addString(party.getLeader().getName());
|
||||
channel.broadcastToChannelMembers(sm);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+59
@@ -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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExMultiPartyCommandChannelInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author chris_00
|
||||
*/
|
||||
public class ChannelListUpdate implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
97
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
if (activeChar.getParty() == null || activeChar.getParty().getCommandChannel() == null)
|
||||
return false;
|
||||
|
||||
L2CommandChannel channel = activeChar.getParty().getCommandChannel();
|
||||
|
||||
activeChar.sendPacket(new ExMultiPartyCommandChannelInfo(channel));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.util.StringUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Support for clan penalty user command.
|
||||
* @author Tempy
|
||||
*/
|
||||
public class ClanPenalty implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
100
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
boolean penalty = false;
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final StringBuilder htmlContent = StringUtil.startAppend(500,
|
||||
"<html><body>" +
|
||||
"<center><table width=270 border=0 bgcolor=111111>" +
|
||||
"<tr><td width=170>Penalty</td>" +
|
||||
"<td width=100 align=center>Expiration Date</td></tr>" +
|
||||
"</table><table width=270 border=0><tr>"
|
||||
);
|
||||
|
||||
if (activeChar.getClanJoinExpiryTime() > System.currentTimeMillis()) {
|
||||
StringUtil.append(htmlContent,
|
||||
"<td width=170>Unable to join a clan.</td>" +
|
||||
"<td width=100 align=center>",
|
||||
format.format(activeChar.getClanJoinExpiryTime()),
|
||||
"</td>"
|
||||
);
|
||||
penalty = true;
|
||||
}
|
||||
|
||||
if (activeChar.getClanCreateExpiryTime() > System.currentTimeMillis()) {
|
||||
StringUtil.append(htmlContent,
|
||||
"<td width=170>Unable to create a clan.</td>" +
|
||||
"<td width=100 align=center>",
|
||||
format.format(activeChar.getClanCreateExpiryTime()),
|
||||
"</td>"
|
||||
);
|
||||
penalty = true;
|
||||
}
|
||||
|
||||
if (activeChar.getClan() != null && activeChar.getClan().getCharPenaltyExpiryTime() > System.currentTimeMillis()) {
|
||||
StringUtil.append(htmlContent,
|
||||
"<td width=170>Unable to invite a clan member.</td>" +
|
||||
"<td width=100 align=center>",
|
||||
format.format(activeChar.getClan().getCharPenaltyExpiryTime()),
|
||||
"</td>"
|
||||
);
|
||||
penalty = true;
|
||||
}
|
||||
|
||||
if (!penalty) {
|
||||
htmlContent.append(
|
||||
"<td width=170>No penalty is imposed.</td>" +
|
||||
"<td width=100 align=center> </td>");
|
||||
}
|
||||
|
||||
htmlContent.append(
|
||||
"</tr></table><img src=\"L2UI.SquareWhite\" width=270 height=1>" +
|
||||
"</center></body></html>");
|
||||
|
||||
NpcHtmlMessage penaltyHtml = new NpcHtmlMessage(0);
|
||||
penaltyHtml.setHtml(htmlContent.toString());
|
||||
activeChar.sendPacket(penaltyHtml);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
|
||||
/**
|
||||
* Support for /clanwarlist command
|
||||
* @author Tempy
|
||||
*/
|
||||
public class ClanWarsList implements IUserCommandHandler
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(ClanWarsList.class.getName());
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
88, 89, 90
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0] && id != COMMAND_IDS[1] && id != COMMAND_IDS[2])
|
||||
return false;
|
||||
|
||||
L2Clan clan = activeChar.getClan();
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
activeChar.sendMessage("You are not in a clan.");
|
||||
return false;
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
java.sql.Connection con = null;
|
||||
|
||||
try
|
||||
{
|
||||
con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement;
|
||||
|
||||
if (id == 88)
|
||||
{
|
||||
// Attack List
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON));
|
||||
statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 not in (select clan1 from clan_wars where clan2=?)");
|
||||
statement.setInt(1, clan.getClanId());
|
||||
statement.setInt(2, clan.getClanId());
|
||||
}
|
||||
else if (id == 89)
|
||||
{
|
||||
// Under Attack List
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU));
|
||||
statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan2=? and clan_id=clan1 and clan1 not in (select clan2 from clan_wars where clan1=?)");
|
||||
statement.setInt(1, clan.getClanId());
|
||||
statement.setInt(2, clan.getClanId());
|
||||
}
|
||||
else
|
||||
// ID = 90
|
||||
{
|
||||
// War List
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.WAR_LIST));
|
||||
statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 in (select clan1 from clan_wars where clan2=?)");
|
||||
statement.setInt(1, clan.getClanId());
|
||||
statement.setInt(2, clan.getClanId());
|
||||
}
|
||||
|
||||
ResultSet rset = statement.executeQuery();
|
||||
|
||||
while (rset.next())
|
||||
{
|
||||
String clanName = rset.getString("clan_name");
|
||||
int ally_id = rset.getInt("ally_id");
|
||||
|
||||
if (ally_id > 0)
|
||||
{
|
||||
// Target With Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
|
||||
sm.addString(clanName);
|
||||
sm.addString(rset.getString("ally_name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target Without Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS);
|
||||
sm.addString(clanName);
|
||||
}
|
||||
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FRIEND_LIST_FOOTER));
|
||||
|
||||
rset.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
L2DatabaseFactory.close(con);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Support for /dismount command.
|
||||
* @author Micht
|
||||
*/
|
||||
public class DisMount implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
62
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public synchronized boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
if (activeChar.isRentedPet())
|
||||
activeChar.stopRentPet();
|
||||
else if (activeChar.isMounted())
|
||||
activeChar.dismount();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GameTimeController;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.datatables.MapRegionTable;
|
||||
import com.l2jserver.gameserver.datatables.SkillTable;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
|
||||
import com.l2jserver.gameserver.model.L2Skill;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Escape implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
52
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
// Thanks nbd
|
||||
if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int unstuckTimer = (activeChar.getAccessLevel().isGm() ? 1000 : Config.UNSTUCK_INTERVAL * 1000);
|
||||
|
||||
// Check to see if the player is in a festival.
|
||||
if (activeChar.isFestivalParticipant())
|
||||
{
|
||||
activeChar.sendMessage("You may not use an escape command in a festival.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to see if player is in jail
|
||||
if (activeChar.isInJail())
|
||||
{
|
||||
activeChar.sendMessage("You can not escape from jail.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GrandBossManager.getInstance().getZone(activeChar) != null && !activeChar.isGM())
|
||||
{
|
||||
activeChar.sendMessage("You may not use an escape command in a Boss Zone.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted()
|
||||
|| activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isCombatFlagEquipped())
|
||||
return false;
|
||||
activeChar.forceIsCasting(GameTimeController.getGameTicks() + unstuckTimer / GameTimeController.MILLIS_IN_TICK);
|
||||
|
||||
|
||||
L2Skill escape = SkillTable.getInstance().getInfo(2099, 1); // 5 minutes escape
|
||||
L2Skill GM_escape = SkillTable.getInstance().getInfo(2100, 1); // 1 second escape
|
||||
if (activeChar.getAccessLevel().isGm())
|
||||
{
|
||||
if (GM_escape != null)
|
||||
{
|
||||
activeChar.doCast(GM_escape);
|
||||
return true;
|
||||
}
|
||||
activeChar.sendMessage("You use Escape: 1 second.");
|
||||
}
|
||||
else if (Config.UNSTUCK_INTERVAL == 300 && escape != null)
|
||||
{
|
||||
activeChar.doCast(escape);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config.UNSTUCK_INTERVAL > 100)
|
||||
{
|
||||
activeChar.sendMessage("You use Escape: " + unstuckTimer / 60000 + " minutes.");
|
||||
}
|
||||
else
|
||||
activeChar.sendMessage("You use Escape: " + unstuckTimer / 1000 + " seconds.");
|
||||
}
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
//SoE Animation section
|
||||
activeChar.setTarget(activeChar);
|
||||
activeChar.disableAllSkills();
|
||||
|
||||
MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, unstuckTimer, 0);
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 810000/*900*/);
|
||||
SetupGauge sg = new SetupGauge(0, unstuckTimer);
|
||||
activeChar.sendPacket(sg);
|
||||
//End SoE Animation section
|
||||
|
||||
EscapeFinalizer ef = new EscapeFinalizer(activeChar);
|
||||
// continue execution later
|
||||
activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, unstuckTimer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static class EscapeFinalizer implements Runnable
|
||||
{
|
||||
private L2PcInstance _activeChar;
|
||||
|
||||
EscapeFinalizer(L2PcInstance activeChar)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (_activeChar.isDead())
|
||||
return;
|
||||
|
||||
_activeChar.setIsIn7sDungeon(false);
|
||||
_activeChar.enableAllSkills();
|
||||
_activeChar.setIsCastingNow(false);
|
||||
_activeChar.setInstanceId(0);
|
||||
|
||||
try
|
||||
{
|
||||
_activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.InstanceManager;
|
||||
import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nille02
|
||||
*/
|
||||
public class InstanceZone implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
114
|
||||
};
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(activeChar);
|
||||
if (world != null && world.templateId >= 0)
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_CURRENTLY_INUSE_S1);
|
||||
sm.addString(InstanceManager.getInstance().getInstanceIdName(world.templateId));
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
|
||||
Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(activeChar.getObjectId());
|
||||
boolean firstMessage = true;
|
||||
if (instanceTimes != null)
|
||||
for(int instanceId : instanceTimes.keySet())
|
||||
{
|
||||
long remainingTime = (instanceTimes.get(instanceId) - System.currentTimeMillis()) / 1000;
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
if (firstMessage)
|
||||
{
|
||||
firstMessage = false;
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INSTANCE_ZONE_TIME_LIMIT));
|
||||
}
|
||||
int hours = (int) (remainingTime / 3600);
|
||||
int minutes = (int) ((remainingTime%3600) / 60);
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES);
|
||||
sm.addString(InstanceManager.getInstance().getInstanceIdName(instanceId));
|
||||
sm.addNumber(hours);
|
||||
sm.addNumber(minutes);
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
InstanceManager.getInstance().deleteInstanceTime(activeChar.getObjectId(), instanceId);
|
||||
}
|
||||
if (firstMessage)
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NO_INSTANCEZONE_TIME_LIMIT));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.MapRegionTable;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public class Loc implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
int _nearestTown = MapRegionTable.getInstance().getClosestTownNumber(activeChar);
|
||||
SystemMessageId msg;
|
||||
switch (_nearestTown)
|
||||
{
|
||||
case 0:
|
||||
msg = SystemMessageId.LOC_TI_S1_S2_S3;
|
||||
break;
|
||||
case 1:
|
||||
msg = SystemMessageId.LOC_ELVEN_S1_S2_S3;
|
||||
break;
|
||||
case 2:
|
||||
msg = SystemMessageId.LOC_DARK_ELVEN_S1_S2_S3;
|
||||
break;
|
||||
case 3:
|
||||
msg = SystemMessageId.LOC_ORC_S1_S2_S3;
|
||||
break;
|
||||
case 4:
|
||||
msg = SystemMessageId.LOC_DWARVEN_S1_S2_S3;
|
||||
break;
|
||||
case 5:
|
||||
msg = SystemMessageId.LOC_GLUDIO_S1_S2_S3;
|
||||
break;
|
||||
case 6:
|
||||
msg = SystemMessageId.LOC_GLUDIN_S1_S2_S3;
|
||||
break;
|
||||
case 7:
|
||||
msg = SystemMessageId.LOC_DION_S1_S2_S3;
|
||||
break;
|
||||
case 8:
|
||||
msg = SystemMessageId.LOC_GIRAN_S1_S2_S3;
|
||||
break;
|
||||
case 9:
|
||||
msg = SystemMessageId.LOC_OREN_S1_S2_S3;
|
||||
break;
|
||||
case 10:
|
||||
msg = SystemMessageId.LOC_ADEN_S1_S2_S3;
|
||||
break;
|
||||
case 11:
|
||||
msg = SystemMessageId.LOC_HUNTER_S1_S2_S3;
|
||||
break;
|
||||
case 12:
|
||||
msg = SystemMessageId.LOC_GIRAN_HARBOR_S1_S2_S3;
|
||||
break;
|
||||
case 13:
|
||||
msg = SystemMessageId.LOC_HEINE_S1_S2_S3;
|
||||
break;
|
||||
case 14:
|
||||
msg = SystemMessageId.LOC_RUNE_S1_S2_S3;
|
||||
break;
|
||||
case 15:
|
||||
msg = SystemMessageId.LOC_GODDARD_S1_S2_S3;
|
||||
break;
|
||||
case 16:
|
||||
msg = SystemMessageId.LOC_SCHUTTGART_S1_S2_S3;
|
||||
break;
|
||||
case 17:
|
||||
msg = SystemMessageId.LOC_FLORAN_S1_S2_S3;
|
||||
break;
|
||||
case 18:
|
||||
msg = SystemMessageId.LOC_PRIMEVAL_ISLE_S1_S2_S3;
|
||||
break;
|
||||
case 19:
|
||||
msg = SystemMessageId.LOC_KAMAEL_VILLAGE_S1_S2_S3;
|
||||
break;
|
||||
case 20:
|
||||
msg = SystemMessageId.LOC_WASTELANDS_CAMP_S1_S2_S3;
|
||||
break;
|
||||
case 21:
|
||||
msg = SystemMessageId.LOC_FANTASY_ISLAND_S1_S2_S3;
|
||||
break;
|
||||
case 22:
|
||||
msg = SystemMessageId.LOC_NETRAL_ZONE_S1_S2_S3;
|
||||
break;
|
||||
case 23:
|
||||
msg = SystemMessageId.LOC_COLISEUM_S1_S2_S3;
|
||||
break;
|
||||
case 24:
|
||||
msg = SystemMessageId.LOC_GM_CONSULATION_SERVICE_S1_S2_S3;
|
||||
break;
|
||||
case 25:
|
||||
msg = SystemMessageId.LOC_DIMENSIONAL_GAP_S1_S2_S3;
|
||||
break;
|
||||
case 26:
|
||||
msg = SystemMessageId.LOC_CEMETARY_OF_THE_EMPIRE_S1_S2_S3;
|
||||
break;
|
||||
case 27:
|
||||
msg = SystemMessageId.LOC_STEEL_CITADEL_S1_S2_S3;
|
||||
break;
|
||||
case 28:
|
||||
msg = SystemMessageId.LOC_STEEL_CITADEL_RESISTANCE;
|
||||
break;
|
||||
case 29:
|
||||
msg = SystemMessageId.LOC_KAMALOKA;
|
||||
break;
|
||||
case 30:
|
||||
msg = SystemMessageId.LOC_NIA_KAMALOKA;
|
||||
break;
|
||||
case 31:
|
||||
msg = SystemMessageId.LOC_RIM_KAMALOKA;
|
||||
break;
|
||||
case 32:
|
||||
msg = SystemMessageId.LOC_KEUCEREUS_S1_S2_S3;
|
||||
break;
|
||||
case 33:
|
||||
msg = SystemMessageId.LOC_IN_SEED_INFINITY_S1_S2_S3;
|
||||
break;
|
||||
case 34:
|
||||
msg = SystemMessageId.LOC_OUT_SEED_INFINITY_S1_S2_S3;
|
||||
break;
|
||||
case 35:
|
||||
msg = SystemMessageId.LOC_CLEFT_S1_S2_S3;
|
||||
break;
|
||||
default:
|
||||
msg = SystemMessageId.LOC_ADEN_S1_S2_S3;
|
||||
}
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(msg);
|
||||
if(msg.getParamCount() == 3)
|
||||
{
|
||||
sm.addNumber(activeChar.getX());
|
||||
sm.addNumber(activeChar.getY());
|
||||
sm.addNumber(activeChar.getZ());
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Support for /mount command.
|
||||
* @author Tempy
|
||||
*/
|
||||
public class Mount implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
61
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public synchronized boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
return activeChar.mountPlayer(activeChar.getPet());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+59
@@ -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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.olympiad.Olympiad;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Support for /olympiadstat command
|
||||
* Added by kamy
|
||||
*/
|
||||
public class OlympiadStat implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
109
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_CURRENT_RECORD_FOR_THIS_OLYMPIAD_SESSION_IS_S1_MATCHES_S2_WINS_S3_DEFEATS_YOU_HAVE_EARNED_S4_OLYMPIAD_POINTS);
|
||||
sm.addNumber(Olympiad.getInstance().getCompetitionDone(activeChar.getObjectId()));
|
||||
sm.addNumber(Olympiad.getInstance().getCompetitionWon(activeChar.getObjectId()));
|
||||
sm.addNumber(Olympiad.getInstance().getCompetitionLost(activeChar.getObjectId()));
|
||||
sm.addNumber(Olympiad.getInstance().getNoblePoints(activeChar.getObjectId()));
|
||||
activeChar.sendPacket(sm);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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.usercommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Support for /partyinfo command
|
||||
* Added by Tempy - 28 Jul 05
|
||||
*/
|
||||
public class PartyInfo implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
81
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
return false;
|
||||
|
||||
if (!activeChar.isInParty())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PARTY_INFORMATION));
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FRIEND_LIST_FOOTER));
|
||||
return false;
|
||||
}
|
||||
|
||||
L2Party playerParty = activeChar.getParty();
|
||||
int memberCount = playerParty.getMemberCount();
|
||||
int lootDistribution = playerParty.getLootDistribution();
|
||||
String partyLeader = playerParty.getPartyMembers().get(0).getName();
|
||||
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PARTY_INFORMATION));
|
||||
|
||||
switch (lootDistribution)
|
||||
{
|
||||
case L2Party.ITEM_LOOTER:
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_FINDERS_KEEPERS));
|
||||
break;
|
||||
case L2Party.ITEM_ORDER:
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_BY_TURN));
|
||||
break;
|
||||
case L2Party.ITEM_ORDER_SPOIL:
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_BY_TURN_INCLUDE_SPOIL));
|
||||
break;
|
||||
case L2Party.ITEM_RANDOM:
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_RANDOM));
|
||||
break;
|
||||
case L2Party.ITEM_RANDOM_SPOIL:
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_RANDOM_INCLUDE_SPOIL));
|
||||
break;
|
||||
}
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PARTY_LEADER_C1);
|
||||
sm.addString(partyLeader);
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
activeChar.sendMessage("Members: " + memberCount + "/9");
|
||||
|
||||
activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FRIEND_LIST_FOOTER));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/** 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.usercommandhandlers;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GameTimeController;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public class Time implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
77
|
||||
};
|
||||
|
||||
private static final SimpleDateFormat fmt = new SimpleDateFormat("H:mm.");
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
|
||||
*/
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (COMMAND_IDS[0] != id)
|
||||
return false;
|
||||
|
||||
int t = GameTimeController.getInstance().getGameTime();
|
||||
String h = "" + (t / 60) % 24;
|
||||
String m;
|
||||
if (t % 60 < 10)
|
||||
m = "0" + t % 60;
|
||||
else
|
||||
m = "" + t % 60;
|
||||
|
||||
SystemMessage sm;
|
||||
if (GameTimeController.getInstance().isNowNight())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.TIME_S1_S2_IN_THE_NIGHT);
|
||||
sm.addString(h);
|
||||
sm.addString(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.TIME_S1_S2_IN_THE_DAY);
|
||||
sm.addString(h);
|
||||
sm.addString(m);
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
if (Config.L2JMOD_DISPLAY_SERVER_TIME)
|
||||
activeChar.sendMessage("Server time is " + fmt.format(new Date(System.currentTimeMillis())));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
|
||||
*/
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user