This commit is contained in:
68
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ChannelDelete.java
vendored
Normal file
68
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ChannelDelete.java
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Channel Delete user command.
|
||||
* @author Chris
|
||||
*/
|
||||
public class ChannelDelete implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
93
|
||||
};
|
||||
|
||||
@Override
|
||||
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().getLeader().equals(activeChar))
|
||||
{
|
||||
L2CommandChannel channel = activeChar.getParty().getCommandChannel();
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_COMMAND_CHANNEL_HAS_BEEN_DISBANDED);
|
||||
channel.broadcastPacket(sm);
|
||||
|
||||
channel.disbandChannel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
60
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ChannelInfo.java
vendored
Normal file
60
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ChannelInfo.java
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExMultiPartyCommandChannelInfo;
|
||||
|
||||
/**
|
||||
* Channel Info user command.
|
||||
* @author chris_00
|
||||
*/
|
||||
public class ChannelInfo implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
97
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((activeChar.getParty() == null) || (activeChar.getParty().getCommandChannel() == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2CommandChannel channel = activeChar.getParty().getCommandChannel();
|
||||
activeChar.sendPacket(new ExMultiPartyCommandChannelInfo(channel));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
74
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ChannelLeave.java
vendored
Normal file
74
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ChannelLeave.java
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.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;
|
||||
|
||||
/**
|
||||
* Channel Leave user command.
|
||||
* @author Chris, Zoey76
|
||||
*/
|
||||
public class ChannelLeave implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
96
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_LEAVE_A_COMMAND_CHANNEL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.getParty().isInCommandChannel())
|
||||
{
|
||||
final L2CommandChannel channel = activeChar.getParty().getCommandChannel();
|
||||
final L2Party party = activeChar.getParty();
|
||||
channel.removeParty(party);
|
||||
party.getLeader().sendPacket(SystemMessageId.YOU_HAVE_QUIT_THE_COMMAND_CHANNEL);
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_LEFT_THE_COMMAND_CHANNEL);
|
||||
sm.addPcName(party.getLeader());
|
||||
channel.broadcastPacket(sm);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
88
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ClanPenalty.java
vendored
Normal file
88
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ClanPenalty.java
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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 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;
|
||||
|
||||
/**
|
||||
* Clan Penalty user command.
|
||||
* @author Tempy
|
||||
*/
|
||||
public class ClanPenalty implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
100
|
||||
};
|
||||
|
||||
@Override
|
||||
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>");
|
||||
|
||||
final NpcHtmlMessage penaltyHtml = new NpcHtmlMessage();
|
||||
penaltyHtml.setHtml(htmlContent.toString());
|
||||
activeChar.sendPacket(penaltyHtml);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
134
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
vendored
Normal file
134
trunk/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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 java.sql.Connection;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Clan War Start, Under Attack List, War List user commands.
|
||||
* @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
|
||||
};
|
||||
// SQL queries
|
||||
private static final String ATTACK_LIST = "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=?)";
|
||||
private static final String UNDER_ATTACK_LIST = "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=?)";
|
||||
private static final String WAR_LIST = "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=?)";
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if ((id != COMMAND_IDS[0]) && (id != COMMAND_IDS[1]) && (id != COMMAND_IDS[2]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2Clan clan = activeChar.getClan();
|
||||
if (clan == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.NOT_JOINED_IN_ANY_CLAN);
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
String query;
|
||||
// Attack List
|
||||
if (id == 88)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_YOU_VE_DECLARED_WAR_ON);
|
||||
query = ATTACK_LIST;
|
||||
}
|
||||
// Under Attack List
|
||||
else if (id == 89)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
|
||||
query = UNDER_ATTACK_LIST;
|
||||
}
|
||||
// War List
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CLAN_WAR_LIST);
|
||||
query = WAR_LIST;
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
ps.setInt(2, clan.getId());
|
||||
|
||||
SystemMessage sm;
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
String clanName;
|
||||
int ally_id;
|
||||
while (rs.next())
|
||||
{
|
||||
clanName = rs.getString("clan_name");
|
||||
ally_id = rs.getInt("ally_id");
|
||||
if (ally_id > 0)
|
||||
{
|
||||
// Target With Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
|
||||
sm.addString(clanName);
|
||||
sm.addString(rs.getString("ally_name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Target Without Ally
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLIANCE_EXISTS);
|
||||
sm.addString(clanName);
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.EMPTY3);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "", e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
59
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Dismount.java
vendored
Normal file
59
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Dismount.java
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Dismount user command.
|
||||
* @author Micht
|
||||
*/
|
||||
public class Dismount implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
62
|
||||
};
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
52
trunk/dist/game/data/scripts/handlers/usercommandhandlers/InstanceZone.java
vendored
Normal file
52
trunk/dist/game/data/scripts/handlers/usercommandhandlers/InstanceZone.java
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExInzoneWaiting;
|
||||
|
||||
/**
|
||||
* Instance Zone user command.
|
||||
* @author nille02, UnAfraid
|
||||
*/
|
||||
public class InstanceZone implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
90
|
||||
};
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
activeChar.sendPacket(new ExInzoneWaiting(activeChar));
|
||||
return true;
|
||||
}
|
||||
}
|
79
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Loc.java
vendored
Normal file
79
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Loc.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.enums.Race;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.instancemanager.ZoneManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2RespawnZone;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Loc user command.
|
||||
*/
|
||||
public class Loc implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
int region;
|
||||
L2RespawnZone zone = ZoneManager.getInstance().getZone(activeChar, L2RespawnZone.class);
|
||||
if (zone != null)
|
||||
{
|
||||
region = MapRegionManager.getInstance().getRestartRegion(activeChar, zone.getAllRespawnPoints().get(Race.HUMAN)).getLocId();
|
||||
}
|
||||
else
|
||||
{
|
||||
region = MapRegionManager.getInstance().getMapRegionLocId(activeChar);
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
if (region > 0)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(region);
|
||||
if (sm.getSystemMessageId().getParamCount() == 3)
|
||||
{
|
||||
sm.addInt(activeChar.getX());
|
||||
sm.addInt(activeChar.getY());
|
||||
sm.addInt(activeChar.getZ());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.CURRENT_LOCATION_S1);
|
||||
sm.addString(activeChar.getX() + ", " + activeChar.getY() + ", " + activeChar.getZ());
|
||||
}
|
||||
activeChar.sendPacket(sm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
50
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Mount.java
vendored
Normal file
50
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Mount.java
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* Mount user command.
|
||||
* @author Tempy
|
||||
*/
|
||||
public class Mount implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
61
|
||||
};
|
||||
|
||||
@Override
|
||||
public synchronized boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return activeChar.mountPlayer(activeChar.getSummon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
64
trunk/dist/game/data/scripts/handlers/usercommandhandlers/MyBirthday.java
vendored
Normal file
64
trunk/dist/game/data/scripts/handlers/usercommandhandlers/MyBirthday.java
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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 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;
|
||||
|
||||
/**
|
||||
* My Birthday user command.
|
||||
* @author JIV
|
||||
*/
|
||||
public class MyBirthday implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
126
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Calendar date = activeChar.getCreateDate();
|
||||
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_BIRTHDAY_IS_S3_S4_S2);
|
||||
sm.addPcName(activeChar);
|
||||
sm.addString(Integer.toString(date.get(Calendar.YEAR)));
|
||||
sm.addString(Integer.toString(date.get(Calendar.MONTH) + 1));
|
||||
sm.addString(Integer.toString(date.get(Calendar.DATE)));
|
||||
|
||||
activeChar.sendPacket(sm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
88
trunk/dist/game/data/scripts/handlers/usercommandhandlers/OlympiadStat.java
vendored
Normal file
88
trunk/dist/game/data/scripts/handlers/usercommandhandlers/OlympiadStat.java
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.L2Object;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Olympiad Stat user command.
|
||||
* @author kamy, Zoey76
|
||||
*/
|
||||
public class OlympiadStat implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
109
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int nobleObjId = activeChar.getObjectId();
|
||||
final L2Object target = activeChar.getTarget();
|
||||
if (target != null)
|
||||
{
|
||||
if (target.isPlayer() && target.getActingPlayer().isNoble())
|
||||
{
|
||||
nobleObjId = target.getObjectId();
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_COMMAND_CAN_ONLY_BE_USED_WHEN_THE_TARGET_IS_AN_AWAKENED_NOBLESSE_EXALTED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!activeChar.isNoble())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_COMMAND_CAN_ONLY_BE_USED_WHEN_THE_TARGET_IS_AN_AWAKENED_NOBLESSE_EXALTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.FOR_THE_CURRENT_OLYMPIAD_YOU_HAVE_PARTICIPATED_IN_S1_MATCH_ES_AND_HAD_S2_WIN_S_AND_S3_DEFEAT_S_YOU_CURRENTLY_HAVE_S4_OLYMPIAD_POINT_S);
|
||||
sm.addInt(Olympiad.getInstance().getCompetitionDone(nobleObjId));
|
||||
sm.addInt(Olympiad.getInstance().getCompetitionWon(nobleObjId));
|
||||
sm.addInt(Olympiad.getInstance().getCompetitionLost(nobleObjId));
|
||||
sm.addInt(Olympiad.getInstance().getNoblePoints(nobleObjId));
|
||||
activeChar.sendPacket(sm);
|
||||
|
||||
final SystemMessage sm2 = SystemMessage.getSystemMessage(SystemMessageId.THE_MATCHES_THIS_WEEK_ARE_ALL_CLASS_BATTLES_THE_NUMBER_OF_MATCHES_THAT_ARE_ALLOWED_TO_PARTICIPATE_IS_S1);
|
||||
sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatches(nobleObjId));
|
||||
sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatchesClassed(nobleObjId));
|
||||
sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatchesNonClassed(nobleObjId));
|
||||
sm2.addInt(Olympiad.getInstance().getRemainingWeeklyMatchesTeam(nobleObjId));
|
||||
activeChar.sendPacket(sm2);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
86
trunk/dist/game/data/scripts/handlers/usercommandhandlers/PartyInfo.java
vendored
Normal file
86
trunk/dist/game/data/scripts/handlers/usercommandhandlers/PartyInfo.java
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
/**
|
||||
* Party Info user command.
|
||||
* @author Tempy
|
||||
*/
|
||||
public class PartyInfo implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
81
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(SystemMessageId.PARTY_INFORMATION);
|
||||
if (activeChar.isInParty())
|
||||
{
|
||||
final L2Party party = activeChar.getParty();
|
||||
switch (party.getDistributionType())
|
||||
{
|
||||
case FINDERS_KEEPERS:
|
||||
activeChar.sendPacket(SystemMessageId.LOOTING_METHOD_FINDERS_KEEPERS);
|
||||
break;
|
||||
case RANDOM:
|
||||
activeChar.sendPacket(SystemMessageId.LOOTING_METHOD_RANDOM);
|
||||
break;
|
||||
case RANDOM_INCLUDING_SPOIL:
|
||||
activeChar.sendPacket(SystemMessageId.LOOTING_METHOD_RANDOM_INCLUDING_SPOIL);
|
||||
break;
|
||||
case BY_TURN:
|
||||
activeChar.sendPacket(SystemMessageId.LOOTING_METHOD_BY_TURN);
|
||||
break;
|
||||
case BY_TURN_INCLUDING_SPOIL:
|
||||
activeChar.sendPacket(SystemMessageId.LOOTING_METHOD_BY_TURN_INCLUDING_SPOIL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!party.isLeader(activeChar))
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PARTY_LEADER_C1);
|
||||
sm.addPcName(party.getLeader());
|
||||
activeChar.sendPacket(sm);
|
||||
}
|
||||
activeChar.sendMessage("Members: " + party.getMemberCount() + "/9"); // TODO: Custom?
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.EMPTY3);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
102
trunk/dist/game/data/scripts/handlers/usercommandhandlers/SiegeStatus.java
vendored
Normal file
102
trunk/dist/game/data/scripts/handlers/usercommandhandlers/SiegeStatus.java
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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_A_CLAN_LEADER_THAT_IS_A_NOBLESSE_EXALTED_CAN_VIEW_THE_SIEGE_WAR_STATUS_WINDOW_DURING_A_SIEGE_WAR);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Siege siege : SiegeManager.getInstance().getSieges())
|
||||
{
|
||||
if (!siege.isInProgress())
|
||||
{
|
||||
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_A_CLAN_LEADER_THAT_IS_A_NOBLESSE_EXALTED_CAN_VIEW_THE_SIEGE_WAR_STATUS_WINDOW_DURING_A_SIEGE_WAR);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
|
||||
}
|
89
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Time.java
vendored
Normal file
89
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Time.java
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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 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;
|
||||
|
||||
/**
|
||||
* Time user command.
|
||||
*/
|
||||
public class Time implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
77
|
||||
};
|
||||
|
||||
private static final SimpleDateFormat fmt = new SimpleDateFormat("H:mm.");
|
||||
|
||||
@Override
|
||||
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().isNight())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_CURRENT_TIME_IS_S1_S22);
|
||||
sm.addString(h);
|
||||
sm.addString(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_CURRENT_TIME_IS_S1_S2);
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
150
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java
vendored
Normal file
150
trunk/dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 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.Config;
|
||||
import com.l2jserver.gameserver.GameTimeController;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.handler.IUserCommandHandler;
|
||||
import com.l2jserver.gameserver.model.TeleportWhereType;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Unstuck user command.
|
||||
*/
|
||||
public class Unstuck implements IUserCommandHandler
|
||||
{
|
||||
private static final int[] COMMAND_IDS =
|
||||
{
|
||||
52
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useUserCommand(int id, L2PcInstance activeChar)
|
||||
{
|
||||
// Thanks nbd
|
||||
if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
else if (activeChar.isJailed())
|
||||
{
|
||||
activeChar.sendMessage("You cannot use this function while you are jailed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
int unstuckTimer = (activeChar.getAccessLevel().isGm() ? 1000 : Config.UNSTUCK_INTERVAL * 1000);
|
||||
|
||||
if (activeChar.isInOlympiadMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THAT_SKILL_IN_A_OLYMPIAD_MATCH);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted() || activeChar.isAlikeDead() || activeChar.inObserverMode() || activeChar.isCombatFlagEquipped())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
activeChar.forceIsCasting(GameTimeController.getInstance().getGameTicks() + (unstuckTimer / GameTimeController.MILLIS_IN_TICK));
|
||||
|
||||
Skill escape = SkillData.getInstance().getSkill(2099, 1); // 5 minutes escape
|
||||
Skill GM_escape = SkillData.getInstance().getSkill(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, 900);
|
||||
SetupGauge sg = new SetupGauge(0, unstuckTimer);
|
||||
activeChar.sendPacket(sg);
|
||||
// End SoE Animation section
|
||||
|
||||
// continue execution later
|
||||
activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(new EscapeFinalizer(activeChar), unstuckTimer));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class EscapeFinalizer implements Runnable
|
||||
{
|
||||
private final L2PcInstance _activeChar;
|
||||
|
||||
protected EscapeFinalizer(L2PcInstance activeChar)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_activeChar.isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_activeChar.enableAllSkills();
|
||||
_activeChar.setIsCastingNow(false);
|
||||
_activeChar.setInstanceId(0);
|
||||
_activeChar.teleToLocation(TeleportWhereType.TOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getUserCommandList()
|
||||
{
|
||||
return COMMAND_IDS;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user