This commit is contained in:
87
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Banking.java
vendored
Normal file
87
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Banking.java
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* This class trades Gold Bars for Adena and vice versa.
|
||||
* @author Ahmed
|
||||
*/
|
||||
public class Banking implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] _voicedCommands =
|
||||
{
|
||||
"bank",
|
||||
"withdraw",
|
||||
"deposit"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (command.equals("bank"))
|
||||
{
|
||||
activeChar.sendMessage(".deposit (" + Config.BANKING_SYSTEM_ADENA + " Adena = " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar) / .withdraw (" + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar = " + Config.BANKING_SYSTEM_ADENA + " Adena)");
|
||||
}
|
||||
else if (command.equals("deposit"))
|
||||
{
|
||||
if (activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.BANKING_SYSTEM_ADENA)
|
||||
{
|
||||
if (!activeChar.reduceAdena("Goldbar", Config.BANKING_SYSTEM_ADENA, activeChar, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
activeChar.getInventory().addItem("Goldbar", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
|
||||
activeChar.getInventory().updateDatabase();
|
||||
activeChar.sendMessage("Thank you, you now have " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar(s), and " + Config.BANKING_SYSTEM_ADENA + " less adena.");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You do not have enough Adena to convert to Goldbar(s), you need " + Config.BANKING_SYSTEM_ADENA + " Adena.");
|
||||
}
|
||||
}
|
||||
else if (command.equals("withdraw"))
|
||||
{
|
||||
if (activeChar.getInventory().getInventoryItemCount(3470, 0) >= Config.BANKING_SYSTEM_GOLDBARS)
|
||||
{
|
||||
if (!activeChar.destroyItemByItemId("Adena", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
activeChar.getInventory().addAdena("Adena", Config.BANKING_SYSTEM_ADENA, activeChar, null);
|
||||
activeChar.getInventory().updateDatabase();
|
||||
activeChar.sendMessage("Thank you, you now have " + Config.BANKING_SYSTEM_ADENA + " Adena, and " + Config.BANKING_SYSTEM_GOLDBARS + " less Goldbar(s).");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You do not have any Goldbars to turn into " + Config.BANKING_SYSTEM_ADENA + " Adena.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return _voicedCommands;
|
||||
}
|
||||
}
|
135
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/CastleVCmd.java
vendored
Normal file
135
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/CastleVCmd.java
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Castle;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class CastleVCmd implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"opendoors",
|
||||
"closedoors",
|
||||
"ridewyvern"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case "opendoors":
|
||||
if (!params.equals("castle"))
|
||||
{
|
||||
activeChar.sendMessage("Only Castle doors can be open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!activeChar.isClanLeader())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_MAY_ISSUE_COMMANDS);
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2DoorInstance door = (L2DoorInstance) activeChar.getTarget();
|
||||
if (door == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
return false;
|
||||
}
|
||||
|
||||
final Castle castle = CastleManager.getInstance().getCastleById(activeChar.getClan().getCastleId());
|
||||
if (castle == null)
|
||||
{
|
||||
activeChar.sendMessage("Your clan does not own a castle.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (castle.getSiege().isInProgress())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_CASTLE_GATES_CANNOT_BE_OPENED_AND_CLOSED_DURING_A_SIEGE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (castle.checkIfInZone(door.getX(), door.getY(), door.getZ()))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_GATE_IS_BEING_OPENED);
|
||||
door.openMe();
|
||||
}
|
||||
break;
|
||||
case "closedoors":
|
||||
if (!params.equals("castle"))
|
||||
{
|
||||
activeChar.sendMessage("Only Castle doors can be closed.");
|
||||
return false;
|
||||
}
|
||||
if (!activeChar.isClanLeader())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_MAY_ISSUE_COMMANDS);
|
||||
return false;
|
||||
}
|
||||
final L2DoorInstance door2 = (L2DoorInstance) activeChar.getTarget();
|
||||
if (door2 == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
|
||||
return false;
|
||||
}
|
||||
final Castle castle2 = CastleManager.getInstance().getCastleById(activeChar.getClan().getCastleId());
|
||||
if (castle2 == null)
|
||||
{
|
||||
activeChar.sendMessage("Your clan does not own a castle.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (castle2.getSiege().isInProgress())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_CASTLE_GATES_CANNOT_BE_OPENED_AND_CLOSED_DURING_A_SIEGE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (castle2.checkIfInZone(door2.getX(), door2.getY(), door2.getZ()))
|
||||
{
|
||||
activeChar.sendMessage("The gate is being closed.");
|
||||
door2.closeMe();
|
||||
}
|
||||
break;
|
||||
case "ridewyvern":
|
||||
if (activeChar.isClanLeader() && (activeChar.getClan().getCastleId() > 0))
|
||||
{
|
||||
activeChar.mount(12621, 0, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
113
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
vendored
Normal file
113
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.gameserver.LoginServerThread;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class ChangePassword implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] _voicedCommands =
|
||||
{
|
||||
"changepassword"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(target);
|
||||
try
|
||||
{
|
||||
String curpass = null, newpass = null, repeatnewpass = null;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
curpass = st.nextToken();
|
||||
}
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
newpass = st.nextToken();
|
||||
}
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
repeatnewpass = st.nextToken();
|
||||
}
|
||||
|
||||
if (!((curpass == null) || (newpass == null) || (repeatnewpass == null)))
|
||||
{
|
||||
if (!newpass.equals(repeatnewpass))
|
||||
{
|
||||
activeChar.sendMessage("The new password doesn't match with the repeated one!");
|
||||
return false;
|
||||
}
|
||||
if (newpass.length() < 3)
|
||||
{
|
||||
activeChar.sendMessage("The new password is shorter than 3 chars! Please try with a longer one.");
|
||||
return false;
|
||||
}
|
||||
if (newpass.length() > 30)
|
||||
{
|
||||
activeChar.sendMessage("The new password is longer than 30 chars! Please try with a shorter one.");
|
||||
return false;
|
||||
}
|
||||
|
||||
LoginServerThread.getInstance().sendChangePassword(activeChar.getAccountName(), activeChar.getName(), curpass, newpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("Invalid password data! You have to fill all boxes.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
activeChar.sendMessage("A problem occured while changing password!");
|
||||
_log.log(Level.WARNING, "", e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// showHTML(activeChar);
|
||||
String html = HtmCache.getInstance().getHtm("en", "data/html/mods/ChangePassword.htm");
|
||||
if (html == null)
|
||||
{
|
||||
html = "<html><body><br><br><center><font color=LEVEL>404:</font> File Not Found</center></body></html>";
|
||||
}
|
||||
activeChar.sendPacket(new NpcHtmlMessage(html));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return _voicedCommands;
|
||||
}
|
||||
}
|
167
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/ChatAdmin.java
vendored
Normal file
167
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/ChatAdmin.java
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.AdminTable;
|
||||
import com.l2jserver.gameserver.datatables.CharNameTable;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
public class ChatAdmin implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"banchat",
|
||||
"unbanchat"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (!AdminTable.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (command.equals(VOICED_COMMANDS[0])) // banchat
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
activeChar.sendMessage("Usage: .banchat name [minutes]");
|
||||
return true;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(params);
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
String name = st.nextToken();
|
||||
long expirationTime = 0;
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
String token = st.nextToken();
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
expirationTime = System.currentTimeMillis() + (Integer.parseInt(st.nextToken()) * 60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
int objId = CharNameTable.getInstance().getIdByName(name);
|
||||
if (objId > 0)
|
||||
{
|
||||
L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
activeChar.sendMessage("Player not online !");
|
||||
return false;
|
||||
}
|
||||
if (player.isChatBanned())
|
||||
{
|
||||
activeChar.sendMessage("Player is already punished !");
|
||||
return false;
|
||||
}
|
||||
if (player == activeChar)
|
||||
{
|
||||
activeChar.sendMessage("You can't ban yourself !");
|
||||
return false;
|
||||
}
|
||||
if (player.isGM())
|
||||
{
|
||||
activeChar.sendMessage("You can't ban GM !");
|
||||
return false;
|
||||
}
|
||||
if (AdminTable.getInstance().hasAccess(command, player.getAccessLevel()))
|
||||
{
|
||||
activeChar.sendMessage("You can't ban moderator !");
|
||||
return false;
|
||||
}
|
||||
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, expirationTime, "Chat banned by moderator", activeChar.getName()));
|
||||
player.sendMessage("Chat banned by moderator " + activeChar.getName());
|
||||
|
||||
if (expirationTime > 0)
|
||||
{
|
||||
activeChar.sendMessage("Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("Player " + player.getName() + " chat banned forever.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("Player not found !");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (command.equals(VOICED_COMMANDS[1])) // unbanchat
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
activeChar.sendMessage("Usage: .unbanchat name");
|
||||
return true;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(params);
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
String name = st.nextToken();
|
||||
|
||||
int objId = CharNameTable.getInstance().getIdByName(name);
|
||||
if (objId > 0)
|
||||
{
|
||||
L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||
if ((player == null) || !player.isOnline())
|
||||
{
|
||||
activeChar.sendMessage("Player not online !");
|
||||
return false;
|
||||
}
|
||||
if (!player.isChatBanned())
|
||||
{
|
||||
activeChar.sendMessage("Player is not chat banned !");
|
||||
return false;
|
||||
}
|
||||
|
||||
PunishmentManager.getInstance().stopPunishment(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||
|
||||
activeChar.sendMessage("Player " + player.getName() + " chat unbanned.");
|
||||
player.sendMessage("Chat unbanned by moderator " + activeChar.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("Player not found !");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
61
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Debug.java
vendored
Normal file
61
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Debug.java
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.AdminTable;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
public class Debug implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"debug"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (!AdminTable.getInstance().hasAccess(command, activeChar.getAccessLevel()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (VOICED_COMMANDS[0].equalsIgnoreCase(command))
|
||||
{
|
||||
if (activeChar.isDebug())
|
||||
{
|
||||
activeChar.setDebug(null);
|
||||
activeChar.sendMessage("Debugging disabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.setDebug(activeChar);
|
||||
activeChar.sendMessage("Debugging enabled.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
56
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Hellbound.java
vendored
Normal file
56
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Hellbound.java
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
import hellbound.HellboundEngine;
|
||||
|
||||
/**
|
||||
* Hellbound voiced command.
|
||||
* @author DS
|
||||
*/
|
||||
public class Hellbound implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"hellbound"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (HellboundEngine.getInstance().isLocked())
|
||||
{
|
||||
activeChar.sendMessage("Hellbound is currently locked.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final int maxTrust = HellboundEngine.getInstance().getMaxTrust();
|
||||
activeChar.sendMessage("Hellbound level: " + HellboundEngine.getInstance().getLevel() + " trust: " + HellboundEngine.getInstance().getTrust() + (maxTrust > 0 ? "/" + maxTrust : ""));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
81
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Lang.java
vendored
Normal file
81
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Lang.java
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.util.StringUtil;
|
||||
|
||||
public class Lang implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"lang"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (!Config.L2JMOD_MULTILANG_ENABLE || !Config.L2JMOD_MULTILANG_VOICED_ALLOW)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final NpcHtmlMessage msg = new NpcHtmlMessage();
|
||||
if (params == null)
|
||||
{
|
||||
final StringBuilder html = StringUtil.startAppend(100);
|
||||
for (String lang : Config.L2JMOD_MULTILANG_ALLOWED)
|
||||
{
|
||||
StringUtil.append(html, "<button value=\"", lang.toUpperCase(), "\" action=\"bypass -h voice .lang ", lang, "\" width=60 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>");
|
||||
}
|
||||
|
||||
msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/Lang/LanguageSelect.htm");
|
||||
msg.replace("%list%", html.toString());
|
||||
activeChar.sendPacket(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
final StringTokenizer st = new StringTokenizer(params);
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
final String lang = st.nextToken().trim();
|
||||
if (activeChar.setLang(lang))
|
||||
{
|
||||
msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/Lang/Ok.htm");
|
||||
activeChar.sendPacket(msg);
|
||||
return true;
|
||||
}
|
||||
msg.setFile(activeChar.getHtmlPrefix(), "data/html/mods/Lang/Error.htm");
|
||||
activeChar.sendPacket(msg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
85
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/SetVCmd.java
vendored
Normal file
85
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/SetVCmd.java
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Zoey76
|
||||
*/
|
||||
public class SetVCmd implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"set name",
|
||||
"set home",
|
||||
"set group"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (command.equals("set"))
|
||||
{
|
||||
final L2Object target = activeChar.getTarget();
|
||||
if ((target == null) || !target.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getTarget().getActingPlayer();
|
||||
if ((activeChar.getClan() == null) || (player.getClan() == null) || (activeChar.getClan().getId() != player.getClan().getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params.startsWith("privileges"))
|
||||
{
|
||||
final String val = params.substring(11);
|
||||
if (!Util.isDigit(val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int n = Integer.parseInt(val);
|
||||
if ((activeChar.getClanPrivileges().getBitmask() <= n) || !activeChar.isClanLeader())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
player.getClanPrivileges().setBitmask(n);
|
||||
activeChar.sendMessage("Your clan privileges have been set to " + n + " by " + activeChar.getName() + ".");
|
||||
}
|
||||
else if (params.startsWith("title"))
|
||||
{
|
||||
// TODO why is this empty?
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
87
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/StatsVCmd.java
vendored
Normal file
87
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/StatsVCmd.java
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.L2Event;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @author Zoey76.
|
||||
*/
|
||||
public class StatsVCmd implements IVoicedCommandHandler
|
||||
{
|
||||
private static final String[] VOICED_COMMANDS =
|
||||
{
|
||||
"stats"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (!command.equals("stats") || (params == null) || params.isEmpty())
|
||||
{
|
||||
activeChar.sendMessage("Usage: .stats <player name>");
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance pc = L2World.getInstance().getPlayer(params);
|
||||
if ((pc == null))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THAT_PLAYER_IS_NOT_ONLINE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pc.getClient().isDetached())
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CURRENTLY_OFFLINE);
|
||||
sm.addPcName(pc);
|
||||
activeChar.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!L2Event.isParticipant(pc) || (pc.getEventStatus() == null))
|
||||
{
|
||||
activeChar.sendMessage("That player is not an event participant.");
|
||||
return false;
|
||||
}
|
||||
|
||||
final StringBuilder replyMSG = StringUtil.startAppend(300 + (pc.getEventStatus().getKills().size() * 50), "<html><body>" + "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br><br>Statistics for player <font color=\"LEVEL\">", pc.getName(), "</font><br>Total kills <font color=\"FF0000\">", String.valueOf(pc.getEventStatus().getKills().size()), "</font><br><br>Detailed list: <br>");
|
||||
for (L2PcInstance plr : pc.getEventStatus().getKills())
|
||||
{
|
||||
StringUtil.append(replyMSG, "<font color=\"FF0000\">", plr.getName(), "</font><br>");
|
||||
}
|
||||
replyMSG.append("</body></html>");
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
adminReply.setHtml(replyMSG.toString());
|
||||
activeChar.sendPacket(adminReply);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return VOICED_COMMANDS;
|
||||
}
|
||||
}
|
477
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java
vendored
Normal file
477
trunk/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java
vendored
Normal file
@ -0,0 +1,477 @@
|
||||
/*
|
||||
* 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.voicedcommandhandlers;
|
||||
|
||||
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.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
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.enums.PlayerAction;
|
||||
import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.CoupleManager;
|
||||
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
|
||||
import com.l2jserver.gameserver.instancemanager.SiegeManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.L2Event;
|
||||
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
||||
import com.l2jserver.gameserver.model.skills.AbnormalVisualEffect;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* Wedding voiced commands handler.
|
||||
* @author evill33t
|
||||
*/
|
||||
public class Wedding implements IVoicedCommandHandler
|
||||
{
|
||||
static final Logger _log = Logger.getLogger(Wedding.class.getName());
|
||||
private static final String[] _voicedCommands =
|
||||
{
|
||||
"divorce",
|
||||
"engage",
|
||||
"gotolove"
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
|
||||
{
|
||||
if (activeChar == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (command.startsWith("engage"))
|
||||
{
|
||||
return engage(activeChar);
|
||||
}
|
||||
else if (command.startsWith("divorce"))
|
||||
{
|
||||
return divorce(activeChar);
|
||||
}
|
||||
else if (command.startsWith("gotolove"))
|
||||
{
|
||||
return goToLove(activeChar);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean divorce(L2PcInstance activeChar)
|
||||
{
|
||||
if (activeChar.getPartnerId() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int _partnerId = activeChar.getPartnerId();
|
||||
int _coupleId = activeChar.getCoupleId();
|
||||
long AdenaAmount = 0;
|
||||
|
||||
if (activeChar.isMarried())
|
||||
{
|
||||
activeChar.sendMessage("You are now divorced.");
|
||||
|
||||
AdenaAmount = (activeChar.getAdena() / 100) * Config.L2JMOD_WEDDING_DIVORCE_COSTS;
|
||||
activeChar.getInventory().reduceAdena("Wedding", AdenaAmount, activeChar, null);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendMessage("You have broken up as a couple.");
|
||||
}
|
||||
|
||||
final L2PcInstance partner = L2World.getInstance().getPlayer(_partnerId);
|
||||
if (partner != null)
|
||||
{
|
||||
partner.setPartnerId(0);
|
||||
if (partner.isMarried())
|
||||
{
|
||||
partner.sendMessage("Your spouse has decided to divorce you.");
|
||||
}
|
||||
else
|
||||
{
|
||||
partner.sendMessage("Your fiance has decided to break the engagement with you.");
|
||||
}
|
||||
|
||||
// give adena
|
||||
if (AdenaAmount > 0)
|
||||
{
|
||||
partner.addAdena("WEDDING", AdenaAmount, null, false);
|
||||
}
|
||||
}
|
||||
CoupleManager.getInstance().deleteCouple(_coupleId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean engage(L2PcInstance activeChar)
|
||||
{
|
||||
if (activeChar.getTarget() == null)
|
||||
{
|
||||
activeChar.sendMessage("You have no one targeted.");
|
||||
return false;
|
||||
}
|
||||
else if (!(activeChar.getTarget() instanceof L2PcInstance))
|
||||
{
|
||||
activeChar.sendMessage("You can only ask another player to engage you.");
|
||||
return false;
|
||||
}
|
||||
else if (activeChar.getPartnerId() != 0)
|
||||
{
|
||||
activeChar.sendMessage("You are already engaged.");
|
||||
if (Config.L2JMOD_WEDDING_PUNISH_INFIDELITY)
|
||||
{
|
||||
activeChar.startAbnormalVisualEffect(true, AbnormalVisualEffect.BIG_HEAD); // give player a Big Head
|
||||
// lets recycle the sevensigns debuffs
|
||||
int skillId;
|
||||
|
||||
int skillLevel = 1;
|
||||
|
||||
if (activeChar.getLevel() > 40)
|
||||
{
|
||||
skillLevel = 2;
|
||||
}
|
||||
|
||||
if (activeChar.isMageClass())
|
||||
{
|
||||
skillId = 4362;
|
||||
}
|
||||
else
|
||||
{
|
||||
skillId = 4361;
|
||||
}
|
||||
|
||||
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
|
||||
if (!activeChar.isAffectedBySkill(skillId))
|
||||
{
|
||||
skill.applyEffects(activeChar, activeChar);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final L2PcInstance ptarget = (L2PcInstance) activeChar.getTarget();
|
||||
// check if player target himself
|
||||
if (ptarget.getObjectId() == activeChar.getObjectId())
|
||||
{
|
||||
activeChar.sendMessage("Is there something wrong with you, are you trying to go out with youself?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ptarget.isMarried())
|
||||
{
|
||||
activeChar.sendMessage("Player already married.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ptarget.isEngageRequest())
|
||||
{
|
||||
activeChar.sendMessage("Player already asked by someone else.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ptarget.getPartnerId() != 0)
|
||||
{
|
||||
activeChar.sendMessage("Player already engaged with someone else.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex()) && !Config.L2JMOD_WEDDING_SAMESEX)
|
||||
{
|
||||
activeChar.sendMessage("Gay marriage is not allowed on this server!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if target has player on friendlist
|
||||
boolean FoundOnFriendList = false;
|
||||
int objectId;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
|
||||
statement.setInt(1, ptarget.getObjectId());
|
||||
final ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
{
|
||||
objectId = rset.getInt("friendId");
|
||||
if (objectId == activeChar.getObjectId())
|
||||
{
|
||||
FoundOnFriendList = true;
|
||||
}
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("could not read friend data:" + e);
|
||||
}
|
||||
|
||||
if (!FoundOnFriendList)
|
||||
{
|
||||
activeChar.sendMessage("The player you want to ask is not on your friends list, you must first be on each others friends list before you choose to engage.");
|
||||
return false;
|
||||
}
|
||||
|
||||
ptarget.setEngageRequest(true, activeChar.getObjectId());
|
||||
ptarget.addAction(PlayerAction.USER_ENGAGE);
|
||||
|
||||
final ConfirmDlg dlg = new ConfirmDlg(activeChar.getName() + " is asking to engage you. Do you want to start a new relationship?");
|
||||
dlg.addTime(15 * 1000);
|
||||
ptarget.sendPacket(dlg);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean goToLove(L2PcInstance activeChar)
|
||||
{
|
||||
if (!activeChar.isMarried())
|
||||
{
|
||||
activeChar.sendMessage("You're not married.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.getPartnerId() == 0)
|
||||
{
|
||||
activeChar.sendMessage("Couldn't find your fiance in the Database - Inform a Gamemaster.");
|
||||
_log.severe("Married but couldn't find parter for " + activeChar.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GrandBossManager.getInstance().getZone(activeChar) != null)
|
||||
{
|
||||
activeChar.sendMessage("You are inside a Boss Zone.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isCombatFlagEquipped())
|
||||
{
|
||||
activeChar.sendMessage("While you are holding a Combat Flag or Territory Ward you can't go to your love!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isCursedWeaponEquipped())
|
||||
{
|
||||
activeChar.sendMessage("While you are holding a Cursed Weapon you can't go to your love!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GrandBossManager.getInstance().getZone(activeChar) != null)
|
||||
{
|
||||
activeChar.sendMessage("You are inside a Boss Zone.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isJailed())
|
||||
{
|
||||
activeChar.sendMessage("You are in Jail!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isInOlympiadMode())
|
||||
{
|
||||
activeChar.sendMessage("You are in the Olympiad now.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (L2Event.isParticipant(activeChar))
|
||||
{
|
||||
activeChar.sendMessage("You are in an event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isInDuel())
|
||||
{
|
||||
activeChar.sendMessage("You are in a duel!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.inObserverMode())
|
||||
{
|
||||
activeChar.sendMessage("You are in the observation.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((SiegeManager.getInstance().getSiege(activeChar) != null) && SiegeManager.getInstance().getSiege(activeChar).isInProgress())
|
||||
{
|
||||
activeChar.sendMessage("You are in a siege, you cannot go to your partner.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Thanks nbd
|
||||
if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
|
||||
{
|
||||
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
|
||||
{
|
||||
activeChar.sendMessage("You are in area which blocks summoning.");
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance partner = L2World.getInstance().getPlayer(activeChar.getPartnerId());
|
||||
if ((partner == null) || !partner.isOnline())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is not online.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar.getInstanceId() != partner.getInstanceId())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in another World!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (partner.isJailed())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in Jail.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (partner.isCursedWeaponEquipped())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is holding a Cursed Weapon and you can't go to your love!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GrandBossManager.getInstance().getZone(partner) != null)
|
||||
{
|
||||
activeChar.sendMessage("Your partner is inside a Boss Zone.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (partner.isInOlympiadMode())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in the Olympiad now.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (L2Event.isParticipant(partner))
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in an event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (partner.isInDuel())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in a duel.");
|
||||
return false;
|
||||
}
|
||||
if (partner.inObserverMode())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in the observation.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((SiegeManager.getInstance().getSiege(partner) != null) && SiegeManager.getInstance().getSiege(partner).isInProgress())
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in a siege, you cannot go to your partner.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TvTEvent.onEscapeUse(partner.getObjectId()))
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in an event.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (partner.isInsideZone(ZoneId.NO_SUMMON_FRIEND))
|
||||
{
|
||||
activeChar.sendMessage("Your partner is in area which blocks summoning.");
|
||||
return false;
|
||||
}
|
||||
|
||||
final int teleportTimer = Config.L2JMOD_WEDDING_TELEPORT_DURATION * 1000;
|
||||
activeChar.sendMessage("After " + (teleportTimer / 60000) + " min. you will be teleported to your partner.");
|
||||
activeChar.getInventory().reduceAdena("Wedding", Config.L2JMOD_WEDDING_TELEPORT_PRICE, activeChar, null);
|
||||
|
||||
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
// SoE Animation section
|
||||
activeChar.setTarget(activeChar);
|
||||
activeChar.disableAllSkills();
|
||||
|
||||
final MagicSkillUse msk = new MagicSkillUse(activeChar, 1050, 1, teleportTimer, 0);
|
||||
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk, 900);
|
||||
final SetupGauge sg = new SetupGauge(0, teleportTimer);
|
||||
activeChar.sendPacket(sg);
|
||||
// End SoE Animation section
|
||||
|
||||
final EscapeFinalizer ef = new EscapeFinalizer(activeChar, partner.getLocation());
|
||||
// continue execution later
|
||||
activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, teleportTimer));
|
||||
activeChar.forceIsCasting(GameTimeController.getInstance().getGameTicks() + (teleportTimer / GameTimeController.MILLIS_IN_TICK));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static class EscapeFinalizer implements Runnable
|
||||
{
|
||||
private final L2PcInstance _activeChar;
|
||||
private final Location _partnerLoc;
|
||||
|
||||
EscapeFinalizer(L2PcInstance activeChar, Location loc)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
_partnerLoc = loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_activeChar.isDead())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((SiegeManager.getInstance().getSiege(_partnerLoc) != null) && SiegeManager.getInstance().getSiege(_partnerLoc).isInProgress())
|
||||
{
|
||||
_activeChar.sendMessage("Your partner is in siege, you can't go to your partner.");
|
||||
return;
|
||||
}
|
||||
|
||||
_activeChar.enableAllSkills();
|
||||
_activeChar.setIsCastingNow(false);
|
||||
|
||||
try
|
||||
{
|
||||
_activeChar.teleToLocation(_partnerLoc);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getVoicedCommandList()
|
||||
{
|
||||
return _voicedCommands;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user