### Eclipse Workspace Patch 1.0
#P L2jFanatic_GameServer
Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 26)
+++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
@@ -61,6 +61,7 @@
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRepairChar;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRes;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminRideWyvern;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSendDonate;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminShop;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSiege;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminSkill;
@@ -126,6 +127,7 @@
registerAdminCommandHandler(new AdminRepairChar());
registerAdminCommandHandler(new AdminRes());
registerAdminCommandHandler(new AdminRideWyvern());
+ registerAdminCommandHandler(new AdminSendDonate());
registerAdminCommandHandler(new AdminShop());
registerAdminCommandHandler(new AdminSiege());
registerAdminCommandHandler(new AdminSkill());
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSendDonate.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSendDonate.java (revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminSendDonate.java (working copy)
@@ -0,0 +1,234 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.datatables.ItemTable;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.idfactory.IdFactory;
+import net.sf.l2j.gameserver.model.L2ItemInstance.ItemLocation;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+import net.sf.l2j.gameserver.templates.item.L2Item;
+import net.sf.l2j.gameserver.util.GMAudit;
+
+public class AdminSendDonate implements IAdminCommandHandler
+{
+ protected static final Logger _log = Logger.getLogger(AdminSendDonate.class.getName());
+
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_senddonate",
+ "admin_givedonate"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if (command.equals("admin_senddonate"))
+ {
+ AdminHelpPage.showHelpPage(activeChar, "senddonate.htm");
+ }
+ else if (command.startsWith("admin_givedonate"))
+ {
+ StringTokenizer st = new StringTokenizer(command, " ");
+ st.nextToken();
+
+ String playername = "";
+ L2PcInstance player = null;
+
+ if (st.countTokens() == 4)
+ {
+ playername = st.nextToken();
+ player = L2World.getInstance().getPlayer(playername);
+ String id = st.nextToken();
+ int idval = Integer.parseInt(id);
+ String num = st.nextToken();
+ int numval = Integer.parseInt(num);
+ String location = st.nextToken();
+
+ // Can't use on yourself
+ if (player != null && player.equals(activeChar))
+ {
+ activeChar.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF);
+ return false;
+ }
+
+ if (player != null)
+ createItem(activeChar, player, idval, numval, getItemLocation(location));
+ else
+ giveItemToOfflinePlayer(activeChar, playername, idval, numval, getItemLocation(location));
+
+ auditAction(command, activeChar, playername);
+ }
+ else
+ {
+ activeChar.sendChatMessage(0, 0, "SYS", "Please fill in all the blanks before requesting a item creation.");
+ }
+
+ AdminHelpPage.showHelpPage(activeChar, "senddonate.htm");
+ }
+
+ return true;
+ }
+
+ /**
+ * Create item on player inventory. If player is offline, store item on database by giveItemToOfflinePlayer method.
+ * @param activeChar
+ * @param player
+ * @param id
+ * @param count
+ * @param location
+ */
+ private static void createItem(L2PcInstance activeChar, L2PcInstance player, int id, int count, ItemLocation location)
+ {
+ L2Item item = ItemTable.getInstance().getTemplate(id);
+ if (item == null)
+ {
+ activeChar.sendChatMessage(0, 0, "SYS", "Unknown Item ID.");
+ return;
+ }
+
+ if (count > 10 && !item.isStackable())
+ {
+ activeChar.sendChatMessage(0, 0, "SYS", "You can't to create more than 10 non stackable items!");
+ return;
+ }
+
+ if (location == ItemLocation.INVENTORY)
+ player.getInventory().addItem("Admin", id, count, player, activeChar);
+ else if (location == ItemLocation.WAREHOUSE)
+ player.getWarehouse().addItem("Admin", id, count, player, activeChar);
+
+ if (activeChar != player)
+ {
+ if (count > 1)
+ player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S2_S1).addItemName(id).addNumber(count));
+ else
+ player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1).addItemName(id));
+ }
+
+ activeChar.sendChatMessage(0, 0, "SYS", "Spawned " + count + " " + item.getName() + " in " + player.getName() + " " + (location == ItemLocation.INVENTORY ? "inventory" : "warehouse") + ".");
+ }
+
+ /**
+ * If player is offline, store item by SQL Query
+ * @param activeChar
+ * @param playername
+ * @param id
+ * @param count
+ * @param location
+ */
+ private static void giveItemToOfflinePlayer(L2PcInstance activeChar, String playername, int id, int count, ItemLocation location)
+ {
+ L2Item item = ItemTable.getInstance().getTemplate(id);
+ int objectId = IdFactory.getInstance().getNextId();
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection())
+ {
+ PreparedStatement statement = con.prepareStatement("SELECT obj_Id FROM characters WHERE char_name=?");
+ statement.setString(1, playername);
+ ResultSet result = statement.executeQuery();
+ int objId = 0;
+
+ if (result.next())
+ {
+ objId = result.getInt(1);
+ }
+
+ result.close();
+ statement.close();
+
+ if (objId == 0)
+ {
+ activeChar.sendChatMessage(0, 0, "SYS", "Char \"" + playername + "\" does not exists!");
+ con.close();
+ return;
+ }
+
+ if (item == null)
+ {
+ activeChar.sendChatMessage(0, 0, "SYS", "Unknown Item ID.");
+ return;
+ }
+
+ if (count > 1 && !item.isStackable())
+ {
+ activeChar.sendChatMessage(0, 0, "SYS", "You can't to create more than 1 non stackable items!");
+ return;
+ }
+
+ statement = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
+ statement.setInt(1, objId);
+ statement.setInt(2, item.getItemId());
+ statement.setInt(3, count);
+ statement.setString(4, location.name());
+ statement.setInt(5, 0);
+ statement.setInt(6, 0);
+ statement.setInt(7, objectId);
+ statement.setInt(8, 0);
+ statement.setInt(9, 0);
+ statement.setInt(10, -1);
+ statement.setLong(11, 0);
+
+ statement.executeUpdate();
+ statement.close();
+
+ activeChar.sendChatMessage(0, 0, "SYS", "Created " + count + " " + item.getName() + " in " + playername + " " + (location == ItemLocation.INVENTORY ? "inventory" : "warehouse") + ".");
+ _log.info("Insert item: (" + objId + ", " + item.getName() + ", " + count + ", " + objectId + ")");
+ }
+ catch (SQLException e)
+ {
+ _log.log(Level.SEVERE, "Could not insert item " + item.getName() + " into DB: Reason: " + e.getMessage(), e);
+ }
+ }
+
+ private static ItemLocation getItemLocation(String name)
+ {
+ ItemLocation location = null;
+ if (name.equalsIgnoreCase("inventory"))
+ location = ItemLocation.INVENTORY;
+ else if (name.equalsIgnoreCase("warehouse"))
+ location = ItemLocation.WAREHOUSE;
+ return location;
+ }
+
+ private static void auditAction(String fullCommand, L2PcInstance activeChar, String target)
+ {
+ if (!Config.GMAUDIT)
+ return;
+
+ String[] command = fullCommand.split(" ");
+
+ GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", command[0], (target.equals("") ? "no-target" : target), (command.length > 2 ? command[2] : ""));
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
#P L2jFanatic_DataPack
Index: data/xml/admin_commands_rights.xml
===================================================================
--- data/xml/admin_commands_rights.xml (revision 27)
+++ data/xml/admin_commands_rights.xml (working copy)
@@ -300,6 +300,10 @@
<aCar name="admin_ride" accessLevel="1" />
<aCar name="admin_unride" accessLevel="1" />
+ <!-- SEND DONATE -->
+ <aCar name="admin_senddonate" accessLevel="1" />
+ <aCar name="admin_givedonate" accessLevel="1" />
+
<!-- SHOP -->
<aCar name="admin_buy" accessLevel="1" />
<aCar name="admin_gmshop" accessLevel="1" />
Index: data/html/admin/senddonate.htm
===================================================================
--- data/html/admin/senddonate.htm (revision 0)
+++ data/html/admin/senddonate.htm (working copy)
@@ -0,0 +1,23 @@
+<html><title>Donate</title><body>
+ <center>
+ <img src="Sek.cbui371" width=275 height=1>
+ <table width=275 bgcolor=000000>
+ <tr>
+ <td width=45><button value="Main" action="bypass -h admin_admin" width=45 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
+ <td width=180 align="center"><font color="LEVEL">Send Donate Menu</font></td>
+ <td width=45><button value="Back" action="bypass -h admin_admin" width=45 height=15 back="sek.cbui94" fore="sek.cbui92"></td>
+ </tr>
+ </table>
+ <img src="Sek.cbui371" width=275 height=1><br>
+ <table width=280><tr><td>First fill the player's name. Then, fill in the ID number of the Item ID to create the item you want. Then fill in the quantity of the item you want to create in item count. Finally, choose where to create the item: in the warehouse or in the inventory.</td></tr></table><br>
+ <table width=240>
+ <tr><td>Player Name:</td><td><edit var="playername" width=100></td></tr>
+ <tr><td>Item ID:</td><td><edit var="itemid" width=100 type=number></td></tr>
+ <tr><td>Item Count:</td><td><edit var="itemnum" width=100 type=number></td></tr>
+ <tr><td>Location:</td><td><combobox width=100 height=17 var=location list=Warehouse;Inventory;></td></tr>
+ </table>
+ <br><br>
+ <button value="Send Donate" action="bypass -h admin_givedonate $playername $itemid $itemnum $location" width=95 height=21 back="bigbutton_over" fore="bigbutton"><br>
+ <table width=280><tr><td align="center"><font color="FF0000">Non-stackable items can't have amount superior to 10.</font></font></td></tr></table>
+ </center>
+</body></html>
CitarConfig.java
public static int STARTING_ADENA;
public static int STARTING_AA;
//Class Itmes On new Players\\
+ public static boolean CLASS_ITEMS_ENABLE;
+ public static int FIGHTER_ITEMS_PRICE;
+ public static int MAGE_ITEMS_PRICE;
STARTING_ADENA = Integer.parseInt(otherSettings.getProperty("StartingAdena", "100"));
STARTING_AA = Integer.parseInt(otherSettings.getProperty("StartingAncientAdena", "0"));
+ CLASS_ITEMS_ENABLE = Boolean.parseBoolean(otherSettings.getProperty("ClassItemsCmd", "false"));
+ FIGHTER_ITEMS_PRICE = Integer.parseInt(otherSettings.getProperty("FighterItemsPirce", "50000000"));
+ MAGE_ITEMS_PRICE = Integer.parseInt(otherSettings.getProperty("MageItemsPirce", "50000000"));
Citarproperties
#Amount of adena/AA that a new character is given
StartingAdena = 0
StartingAncientAdena = 0
+
+#------------------------------------------------------------------
+# Class Items.
+# .daggeritems / .bowitems / .tankitems / .mageitems
+#------------------------------------------------------------------
+ClassItemsCmd = false
+#
+FighterItemsPirce = 50000000
+#
+MageItemsPirce = 50000000
+
CitarVoicedCommandHandler.java
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.ClassItem;
private VoicedCommandHandler()
{
_datatable = new FastMap<>();
+
+ if(Config.CLASS_ITEMS_ENABLE)
+ {
+ registerVoicedCommandHandler(new ClassItems());
+ }
CitarClassItem.java
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
public class ClassItems implements IVoicedCommandHandler
{
private static String[] _voicedCommands =
{
"daggeritems", "bowitems", "tankitems", "mageitems"
};
/**
* @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler(java.lang.String,
* com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
*/
@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if(activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.FIGHTER_ITEMS_PRICE)
{
activeChar.sendMessage("You do not have enough Adena");
return false;
}
if(activeChar.isInOlympiadMode())
{
activeChar.sendMessage("Sorry,you are in the Olympiad now.");
return false;
}
if(activeChar.isInDuel())
{
activeChar.sendMessage("Sorry,you are in a duel!");
return false;
}
if(activeChar.atEvent)
{
activeChar.sendMessage("Sorry,you are on event now.");
return false;
}
if(!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && activeChar.getKarma() > 0)
{
activeChar.sendMessage("Sorry,PK player can't use this.");
return false;
}
if(activeChar.isDead())
{
activeChar.sendMessage("Sorry,Dead player can't take items.");
return false;
}
if(activeChar.isFakeDeath())
{
activeChar.sendMessage("Sorry,on fake death mode can't use this.");
return false;
}
if(command.equalsIgnoreCase("daggeritems"))
{
activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
activeChar.getInventory().addItem("Angel Slayer", 6367, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Dragonic Light", 6379, 1, activeChar, activeChar );
activeChar.getInventory().addItem("Dragonic Boots", 6380, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Dragonic Gloves", 6381, 1, activeChar, activeChar );
activeChar.getInventory().addItem("Dragonic Helmet", 6382, 1, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
activeChar.sendMessage("Now You Have Dagger Items On Your Invetory. Take a Look!.");
}
else if (command.equalsIgnoreCase("bowitems"))
{
activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
activeChar.getInventory().addItem("Draconic Bow", 7577, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Draconic Light", 6379, 1, activeChar, activeChar );
activeChar.getInventory().addItem("Draconic Boots", 6380, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Draconic Gloves", 6381, 1, activeChar, activeChar );
activeChar.getInventory().addItem("Draconic Helmet", 6382, 1, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
activeChar.sendMessage("Now You Have Bow Items On Your Invetory. Take a Look!.");
}
else if (command.equalsIgnoreCase("tankitems"))
{
activeChar.getInventory().reduceAdena("Adena", Config.FIGHTER_ITEMS_PRICE, activeChar, null);
activeChar.getInventory().addItem("Forgotten Blade", 6582, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Imperial Armor", 6373, 1, activeChar, activeChar );
activeChar.getInventory().addItem("Imperial ArmorP2", 6374, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Imperial Gloves", 6375, 1, activeChar, activeChar );
activeChar.getInventory().addItem("Imperial Boots", 6376, 1, activeChar, activeChar);
activeChar.getInventory().addItem("Imperial Helmet", 6378, 1, activeChar, activeChar );
activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
activeChar.sendMessage("Now You Have Tank Items On Your Invetory. Take a Look!.");
}
else if (command.equalsIgnoreCase("mageitems"))
{
activeChar.getInventory().destroyItemByItemId("Adena", 57, Config.MAGE_ITEMS_PRICE, activeChar, null);
activeChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, activeChar, activeChar);
activeChar.getInventory().addItem("DC Robe", 2407, 1, activeChar, activeChar );
activeChar.getInventory().addItem("DC Gloves", 5767, 1, activeChar, activeChar);
activeChar.getInventory().addItem("DC Boots", 5779, 1, activeChar, activeChar );
activeChar.getInventory().addItem("DC Helmet", 512, 1, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Necklace", 920, 1, activeChar, activeChar );
activeChar.getInventory().addItem("TEO Earring", 858, 2, activeChar, activeChar);
activeChar.getInventory().addItem("TEO Ring", 889, 2, activeChar, activeChar );
activeChar.sendMessage("Now You Have Mage Items On Your Invetory. Take a Look!");
}
return true;
}
/**
* @see com.l2jfrozen.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
*/
@Override
public String[] getVoicedCommandList()
{
return _voicedCommands;
}
}
CitarTradeOff.java
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfree.gameserver.handler.voicedcommandhandlers;
import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.SystemMessageId;
import com.l2jfree.gameserver.network.serverpackets.SystemMessage;
/**
* @author Intrepid
*
*/
public class TradeOff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"tradeoff",
"tradeon"
};
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if ((command.startsWith("tradeoff")))
{
if(activeChar.getTradeRefusal())
{
activeChar.sendMessage("Trade refusal is already enabled!");
}
else
{
activeChar.setTradeRefusal(true);
activeChar.sendMessage("Trade refusal enabled");
}
}
if ((command.startsWith("tradeon")))
{
if(!activeChar.getTradeRefusal())
{
activeChar.sendMessage("Trade refusal is already disabled!");
}
else
{
activeChar.setTradeRefusal(false);
activeChar.sendMessage("Trade refusal disabled");
}
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
Citarpmoff.java
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
/**
* @author Intrepid
*
*/
public class pmoff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"pmoff"
};
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if ((command.startsWith("pmoff")))
{
if (activeChar.getMessageRefusal()) // already in message refusal mode
{
activeChar.setMessageRefusal(false);
activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_ACCEPTANCE_MODE));
}
else
{
activeChar.setMessageRefusal(true);
activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_REFUSAL_MODE));
}
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
CitarCl.java
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GameTimeController;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding.EscapeFinalizer;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;
/**
*
*
*/
public class Cl implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = { "cl" };
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.equalsIgnoreCase("cl"))
{
if (activeChar.getClan() == null)
{
return false;
}
L2PcInstance leader;
leader = (L2PcInstance)L2World.getInstance().findObject(activeChar.getClan().getLeaderId());
if(leader == null)
{
activeChar.sendMessage("Your partner is not online.");
return false;
}
else if(leader.isInJail())
{
activeChar.sendMessage("Your leader is in Jail.");
return false;
}
else if(leader.isInOlympiadMode())
{
activeChar.sendMessage("Your leader is in the Olympiad now.");
return false;
}
else if(leader.atEvent)
{
activeChar.sendMessage("Your leader is in an event.");
return false;
}
else if (leader.isInDuel())
{
activeChar.sendMessage("Your leader is in a duel.");
return false;
}
else if (leader.isFestivalParticipant())
{
activeChar.sendMessage("Your leader is in a festival.");
return false;
}
else if (leader.isInParty() && leader.getParty().isInDimensionalRift())
{
activeChar.sendMessage("Your leader is in dimensional rift.");
return false;
}
else if (leader.inObserverMode())
{
activeChar.sendMessage("Your leader is in the observation.");
}
else if(leader.getClan() != null
&& CastleManager.getInstance().getCastleByOwner(leader.getClan()) != null
&& CastleManager.getInstance().getCastleByOwner(leader.getClan()).getSiege().getIsInProgress())
{
activeChar.sendMessage("Your leader is in siege, you can't go to your leader.");
return false;
}
else if(activeChar.isInJail())
{
activeChar.sendMessage("You are in Jail!");
return false;
}
else if(activeChar.isInOlympiadMode())
{
activeChar.sendMessage("You are in the Olympiad now.");
return false;
}
else if(activeChar._inEventVIP)
{
activeChar.sendPacket(SystemMessage.sendString("Your leader is in a VIP event."));
return false;
}
else if(activeChar.atEvent)
{
activeChar.sendMessage("You are in an event.");
return false;
}
else if (activeChar.isInDuel())
{
activeChar.sendMessage("You are in a duel!");
return false;
}
else if (activeChar.inObserverMode())
{
activeChar.sendMessage("You are in the observation.");
}
else if(activeChar.getClan() != null
&& CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null
&& CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getSiege().getIsInProgress())
{
activeChar.sendMessage("You are in siege, you can't go to your leader.");
return false;
}
else if (activeChar.isFestivalParticipant())
{
activeChar.sendMessage("You are in a festival.");
return false;
}
else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
{
activeChar.sendMessage("You are in the dimensional rift.");
return false;
}
else if (activeChar == leader)
{
activeChar.sendMessage("You cannot teleport to yourself.");
return false;
}
if(activeChar.getInventory().getItemByItemId(3470) == null)
{
activeChar.sendMessage("You need one or more Gold Bars to use the cl-teleport system.");
return false;
}
int leaderx;
int leadery;
int leaderz;
leaderx = leader.getX();
leadery = leader.getY();
leaderz = leader.getZ();
activeChar.teleToLocation(leaderx, leadery, leaderz);
activeChar.sendMessage("You have been teleported to your leader!");
activeChar.getInventory().destroyItemByItemId("RessSystem", 3470, 1, activeChar, activeChar.getTarget());
activeChar.sendMessage("One GoldBar has dissapeared! Thank you!");
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
Citarvoicedcommandhandlers/Valakas.java
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfree.gameserver.handler.voicedcommandhandlers;
import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.instancemanager.SiegeManager;
import com.l2jfree.gameserver.instancemanager.ValakasManager;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.model.entity.Siege;
import com.l2jfree.gameserver.model.zone.L2Zone;
/**
* @author Horus
*
*/
public class Valakas implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{ "valakas" };
/* (non-Javadoc)
* @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(String, com.l2jfree.gameserver.model.L2PcInstance), String)
*/
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String text)
{
if (command.startsWith("valakas"))
return valakas(activeChar);
return false;
}
/* (non-Javadoc)
* @see com.l2jfree.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
*/
private boolean valakas(L2PcInstance activeChar)
{
Siege siege = SiegeManager.getInstance().getSiege(activeChar);
if (activeChar.isTransformed())
{
activeChar.sendMessage("You can't teleport to valakas while transformed");
return false;
}
//check player is dead or using fake death and has his movement disabled
if (activeChar.isMovementDisabled() || activeChar.isAlikeDead())
{
activeChar.sendMessage("You can't teleport to valakas with fake death nor rooted");
return false;
}
// Check if the player is currently in Siege
if (siege != null && siege.getIsInProgress())
{
activeChar.sendMessage("You are in siege, cannot teleport to Valakas.");
return false;
}
// Check if the player is a Cursed Weapon owner
if (activeChar.isCursedWeaponEquipped())
{
activeChar.sendMessage("You cannot teleport to Valakas! You are currently holding a cursed weapon.");
return false;
}
// Check if the player is in Duel
if (activeChar.isInDuel())
{
activeChar.sendMessage("You cannot teleport to Valakas! You are in a duel!");
return false;
}
//check if the player is in a DimensionalRift
if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
{
activeChar.sendMessage("You cannot teleport to Valakas! You are in the dimensional rift.");
return false;
}
// Check if the player is in an event
if (activeChar.isInFunEvent())
{
activeChar.sendMessage("You cannot teleport to Valakas since you are in an event.");
return false;
}
//check player is in Olympiad
if (activeChar.isInOlympiadMode() || activeChar.getOlympiadGameId() != -1)
{
activeChar.sendMessage("Teleporting to Valakas whilst in Olympiad isn't allowed.");
return false;
}
// Check if player is in observer mode
if (activeChar.inObserverMode())
{
activeChar.sendMessage("You cannot teleport to Valakas in Observer mode!");
return false;
}
//check player has karma/pk/pvp status
if (activeChar.getKarma() > 0 || activeChar.getPvpFlag() > 0)
{
activeChar.sendMessage("Flagged Players & Karma Players cannot use this command.");
return false;
}
//Check if player is immobilized
if (activeChar.isImmobilized())
{
activeChar.sendMessage("Immobilized players cannot use this command.");
return false;
}
if (!(activeChar.getAdena() >= 500000))
activeChar.sendMessage("You do not hold enough adena to teleport.");
// check if no one is targeted
if (activeChar.getTarget() == null)
ValakasManager.getInstance().Teleport(activeChar);
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
Citarinstancemanager/ValakasManager.java
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfree.gameserver.instancemanager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.l2jfree.Config;
import com.l2jfree.gameserver.ThreadPoolManager;
import com.l2jfree.gameserver.ai.CtrlIntention;
import com.l2jfree.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.serverpackets.SetupGauge;
import com.l2jfree.gameserver.network.serverpackets.SocialAction;
/**
* @author Horus
*
*/
public final class ValakasManager
{
private static final Log _log = LogFactory.getLog(ValakasManager.class.getName());
private static ValakasManager _instance;
public static final ValakasManager getInstance()
{
if (_instance == null)
{
_instance = new ValakasManager();
_log.info("ValakasManager: initialized.");
}
return _instance;
}
/**
* @param activeChar
* @param text
*/
public void Teleport(L2PcInstance activeChar)
{
activeChar.startAbnormalEffect(L2MonsterInstance.ABNORMAL_EFFECT_MAGIC_CIRCLE);
activeChar.sendMessage("You will be teleported in " + 120 + " Seconds.");
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
if(activeChar.isSitting())
{
activeChar.sendMessage("You cannot be sitting while teleporting to Valakas.");
return;
}
SetupGauge sg = new SetupGauge(SetupGauge.BLUE, 120 * 1000);
activeChar.sendPacket(sg);
activeChar.setIsImmobilized(true);
ThreadPoolManager.getInstance().scheduleGeneral(new PlayerTeleportTask(activeChar), 120 * 1000);
}
/**
* @param activeChar
*/
class PlayerTeleportTask implements Runnable
{
private final L2PcInstance _activeChar;
PlayerTeleportTask(L2PcInstance activeChar)
{
_activeChar = activeChar;
}
public void run()
{
if (_activeChar == null)
return;
if (_activeChar.isAttackingNow() || _activeChar.isCastingNow())
{
_activeChar.sendMessage("Cannot teleport if you are Casting or Attacking.");
return;
}
_activeChar.stopAbnormalEffect(L2MonsterInstance.ABNORMAL_EFFECT_MAGIC_CIRCLE);
_activeChar.getInventory().reduceAdena("ValakasManager", 500000, _activeChar, null);
_activeChar.setIsImmobilized(false);
_activeChar.teleToLocation(2138*** -115436, -1639);
_activeChar.sendMessage("You have successfully teleported to Valakas.");
_activeChar.sendMessage("horusicarus@gmail.com");
_log.info("ValakasManager: Player " + _activeChar.getName() + " was sucessfully ported.");
}
}
Citarstat.java
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
/**
*
*
*/
public class Stat implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = { "stat" };
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if (command.equalsIgnoreCase("stat"))
{
if (activeChar.getTarget()==null)
{
activeChar.sendMessage("You have no one targeted.");
return false;
}
if (!(activeChar.getTarget() instanceof L2PcInstance))
{
activeChar.sendMessage("You can only get the info of a player.");
return false;
}
L2PcInstance targetp = (L2PcInstance)activeChar.getTarget();
activeChar.sendMessage("========="+ targetp.getName() +"=========");
activeChar.sendMessage("Level: " + targetp.getLevel());
if (targetp.getClan() != null)
{
activeChar.sendMessage("Clan: " + targetp.getClan().getName());
activeChar.sendMessage("Alliance: " + targetp.getClan().getAllyName());
}
else
{
activeChar.sendMessage("Alliance: None");
activeChar.sendMessage("Clan: None");
}
activeChar.sendMessage("Adena: " + targetp.getAdena());
if(activeChar.getInventory().getItemByItemId(6393) == null)
{
activeChar.sendMessage("Medals : 0");
}
else
{
activeChar.sendMessage("Medals : " + targetp.getInventory().getItemByItemId(6393).getCount());
}
if(activeChar.getInventory().getItemByItemId(3470) == null)
{
activeChar.sendMessage("Gold Bars : 0");
}
else
{
activeChar.sendMessage("Gold Bars : " + targetp.getInventory().getItemByItemId(3470).getCount());
}
activeChar.sendMessage("PvP Kills: " + targetp.getPvpKills());
activeChar.sendMessage("PvP Flags: " + targetp.getPvpFlag());
activeChar.sendMessage("PK Kills: " + targetp.getPkKills());
activeChar.sendMessage("HP, CP, MP: " + targetp.getMaxHp() + ", " +targetp.getMaxCp() + ", " + targetp.getMaxMp());
activeChar.sendMessage("Wep Enchant: " + targetp.getInventory().getPaperdollItem(9).getEnchantLevel());
activeChar.sendMessage("=========<L2 Pure>=========");
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
CitarCORE:
Index: java/com/l2jserver/gameserver/LoginServerThread.java
===================================================================
--- java/com/l2jserver/gameserver/LoginServerThread.java (revision 5708)
+++ java/com/l2jserver/gameserver/LoginServerThread.java (working copy)
@@ -45,6 +45,7 @@
import com.l2jserver.gameserver.network.gameserverpackets.AuthRequest;
import com.l2jserver.gameserver.network.gameserverpackets.BlowFishKey;
import com.l2jserver.gameserver.network.gameserverpackets.ChangeAccessLevel;
+import com.l2jserver.gameserver.network.gameserverpackets.ChangePassword;
import com.l2jserver.gameserver.network.gameserverpackets.PlayerAuthRequest;
import com.l2jserver.gameserver.network.gameserverpackets.PlayerInGame;
import com.l2jserver.gameserver.network.gameserverpackets.PlayerLogout;
@@ -55,6 +56,7 @@
import com.l2jserver.gameserver.network.loginserverpackets.KickPlayer;
import com.l2jserver.gameserver.network.loginserverpackets.LoginServerFail;
import com.l2jserver.gameserver.network.loginserverpackets.PlayerAuthResponse;
+import com.l2jserver.gameserver.network.loginserverpackets.ChangePasswordResponse;
import com.l2jserver.gameserver.network.serverpackets.CharSelectionInfo;
import com.l2jserver.gameserver.network.serverpackets.LoginFail;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -334,6 +336,9 @@
KickPlayer kp = new KickPlayer(decrypt);
doKickPlayer(kp.getAccount());
break;
+ case 0x06:
+ new ChangePasswordResponse(decrypt);
+ break;
}
}
}
@@ -559,6 +564,20 @@
}
}
+ public void sendChangePassword(String accountName, String charName, String oldpass, String newpass)
+ {
+ ChangePassword cp = new ChangePassword(accountName, charName, oldpass, newpass);
+ try
+ {
+ sendPacket(cp);
+ }
+ catch (IOException e)
+ {
+ if (Config.DEBUG)
+ _log.log(Level.WARNING, "", e);
+ }
+ }
+
/**
* @return
*/
Index: java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java
===================================================================
--- java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java (revision 0)
+++ java/com/l2jserver/gameserver/network/gameserverpackets/ChangePassword.java (working copy)
@@ -0,0 +1,38 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.network.gameserverpackets;
+
+import com.l2jserver.util.network.BaseSendablePacket;
+
+/**
+ * @author UnAfraid
+ */
+public class ChangePassword extends BaseSendablePacket
+{
+ public ChangePassword(String accountName, String characterName, String oldPass, String newPass)
+ {
+ writeC(0x0B);
+ writeS(accountName);
+ writeS(characterName);
+ writeS(oldPass);
+ writeS(newPass);
+ }
+
+ @Override
+ public byte[] getContent()
+ {
+ return getBytes();
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/network/loginserverpackets/ChangePasswordResponse.java
===================================================================
--- java/com/l2jserver/gameserver/network/loginserverpackets/ChangePasswordResponse.java (revision 0)
+++ java/com/l2jserver/gameserver/network/loginserverpackets/ChangePasswordResponse.java (working copy)
@@ -0,0 +1,37 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.network.loginserverpackets;
+
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.network.BaseRecievePacket;
+
+
+public class ChangePasswordResponse extends BaseRecievePacket
+{
+
+ public ChangePasswordResponse(byte[] decrypt)
+ {
+ super(decrypt);
+ //boolean isSuccessful = readC() > 0;
+ String character = readS();
+ String msgToSend = readS();
+
+ L2PcInstance player = L2World.getInstance().getPlayer(character);
+
+ if (player != null)
+ player.sendMessage(msgToSend);
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/loginserver/GameServerThread.java
===================================================================
--- java/com/l2jserver/loginserver/GameServerThread.java (revision 5708)
+++ java/com/l2jserver/loginserver/GameServerThread.java (working copy)
@@ -33,6 +33,7 @@
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
import com.l2jserver.loginserver.gameserverpackets.BlowFishKey;
import com.l2jserver.loginserver.gameserverpackets.ChangeAccessLevel;
+import com.l2jserver.loginserver.gameserverpackets.ChangePassword;
import com.l2jserver.loginserver.gameserverpackets.GameServerAuth;
import com.l2jserver.loginserver.gameserverpackets.PlayerAuthRequest;
import com.l2jserver.loginserver.gameserverpackets.PlayerInGame;
@@ -40,6 +41,7 @@
import com.l2jserver.loginserver.gameserverpackets.PlayerTracert;
import com.l2jserver.loginserver.gameserverpackets.ServerStatus;
import com.l2jserver.loginserver.loginserverpackets.AuthResponse;
+import com.l2jserver.loginserver.loginserverpackets.ChangePasswordResponse;
import com.l2jserver.loginserver.loginserverpackets.InitLS;
import com.l2jserver.loginserver.loginserverpackets.KickPlayer;
import com.l2jserver.loginserver.loginserverpackets.LoginServerFail;
@@ -166,6 +168,9 @@
case 07:
onReceivePlayerTracert(data);
break;
+ case 0x0B:
+ new ChangePassword(data);
+ break;
default:
_log.warning("Unknown Opcode ("+Integer.toHexString(packetType).toUpperCase()+") from GameServer, closing connection.");
forceClose(LoginServerFail.NOT_AUTHED);
@@ -658,6 +663,20 @@
}
}
+ public void ChangePasswordResponse(byte successful, String characterName, String msgToSend)
+ {
+ ChangePasswordResponse cp = new ChangePasswordResponse(successful, characterName, msgToSend);
+ try
+ {
+ sendPacket(cp);
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
/**
* @param gameHost The gameHost to set.
*/
Index: java/com/l2jserver/loginserver/gameserverpackets/ChangePassword.java
===================================================================
--- java/com/l2jserver/loginserver/gameserverpackets/ChangePassword.java (revision 0)
+++ java/com/l2jserver/loginserver/gameserverpackets/ChangePassword.java (working copy)
@@ -0,0 +1,131 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.loginserver.gameserverpackets;
+
+import java.security.MessageDigest;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.loginserver.GameServerTable;
+import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
+import com.l2jserver.loginserver.GameServerThread;
+import com.l2jserver.Base64;
+import com.l2jserver.util.network.BaseRecievePacket;
+
+/**
+ * @author Nik
+ */
+public class ChangePassword extends BaseRecievePacket
+{
+ protected static Logger _log = Logger.getLogger(ChangePassword.class.getName());
+ private static GameServerThread gst = null;
+
+ public ChangePassword(byte[] decrypt)
+ {
+ super(decrypt);
+
+ String accountName = readS();
+ String characterName = readS();
+ String curpass = readS();
+ String newpass = readS();
+
+ // get the GameServerThread
+ Collection<GameServerInfo> serverList = GameServerTable.getInstance().getRegisteredGameServers().values();
+ for (GameServerInfo gsi : serverList)
+ {
+ if ((gsi.getGameServerThread() != null) && gsi.getGameServerThread().hasAccountOnGameServer(accountName))
+ {
+ gst = gsi.getGameServerThread();
+ }
+ }
+
+ if (gst == null)
+ {
+ return;
+ }
+
+ if ((curpass == null) || (newpass == null))
+ {
+ gst.ChangePasswordResponse((byte) 0, characterName, "Invalid password data! Try again.");
+ }
+ else
+ {
+ Connection con = null;
+ try
+ {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+
+ byte[] raw = curpass.getBytes("UTF-8");
+ raw = md.digest(raw);
+ String curpassEnc = Base64.encodeBytes(raw);
+ String pass = null;
+ int passUpdated = 0;
+
+ // SQL connection
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?");
+ statement.setString(1, accountName);
+ ResultSet rset = statement.executeQuery();
+ if (rset.next())
+ {
+ pass = rset.getString("password");
+ }
+ rset.close();
+ statement.close();
+
+ if (curpassEnc.equals(pass))
+ {
+ byte[] password = newpass.getBytes("UTF-8");
+ password = md.digest(password);
+
+ // SQL connection
+ PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?");
+ ps.setString(1, Base64.encodeBytes(password));
+ ps.setString(2, accountName);
+ passUpdated = ps.executeUpdate();
+ ps.close();
+
+ _log.log(Level.INFO, "The password for account " + accountName + " has been changed from " + curpassEnc + " to " + Base64.encodeBytes(password));
+ if (passUpdated > 0)
+ {
+ gst.ChangePasswordResponse((byte) 1, characterName, "You have successfully changed your password!");
+ }
+ else
+ {
+ gst.ChangePasswordResponse((byte) 0, characterName, "The password change was unsuccessful!");
+ }
+ }
+ else
+ {
+ gst.ChangePasswordResponse((byte) 0, characterName, "The typed current password doesn't match with your current one.");
+ }
+ }
+ catch (Exception e)
+ {
+ _log.warning("Error while changing password for account " + accountName + " requested by player " + characterName + "! " + e);
+ }
+ finally
+ {
+ // close the database connection at the end
+ L2DatabaseFactory.close(con);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: java/com/l2jserver/loginserver/loginserverpackets/ChangePasswordResponse.java
===================================================================
--- java/com/l2jserver/loginserver/loginserverpackets/ChangePasswordResponse.java (revision 0)
+++ java/com/l2jserver/loginserver/loginserverpackets/ChangePasswordResponse.java (working copy)
@@ -0,0 +1,37 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.loginserver.loginserverpackets;
+
+import com.l2jserver.util.network.BaseSendablePacket;
+
+/**
+ * @author Nik
+ */
+public class ChangePasswordResponse extends BaseSendablePacket
+{
+ public ChangePasswordResponse(byte successful, String characterName, String msgToSend)
+ {
+ writeC(0x06);
+ // writeC(successful); //0 false, 1 true
+ writeS(characterName);
+ writeS(msgToSend);
+ }
+
+ @Override
+ public byte[] getContent()
+ {
+ return getBytes();
+ }
+}
\ No newline at end of file
CitarDATA:
Index: dist/game/data/html/mods/ChangePassword.htm
===================================================================
--- dist/game/data/html/mods/ChangePassword.htm (revision 0)
+++ dist/game/data/html/mods/ChangePassword.htm (working copy)
@@ -0,0 +1,10 @@
+<html><body>
+<center>
+<td>
+<tr>Current Password:</tr><tr><edit type="password" var="oldpass" width=150></tr><br>
+<tr>New Password</tr><tr><edit type="password" var="newpass" width=150></tr><br>
+<tr>Repeat New Password</tr><tr><edit type="password" var="repeatnewpass" width=150></tr><br>
+<td>
+<button value="Change Password" action="bypass -h voice .changepassword $oldpass $newpass $repeatnewpass" width=160 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
+</center>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9149)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -240,6 +240,7 @@
import handlers.usercommandhandlers.PartyInfo;
import handlers.usercommandhandlers.Time;
import handlers.voicedcommandhandlers.Banking;
+import handlers.voicedcommandhandlers.ChangePassword;
import handlers.voicedcommandhandlers.ChatAdmin;
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.Lang;
@@ -548,6 +549,7 @@
VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Lang());
if (Config.L2JMOD_DEBUG_VOICE_COMMAND)
VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Debug());
+ VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new ChangePassword());
_log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers");
}
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java (working copy)
@@ -0,0 +1,99 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package handlers.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"
+ };
+
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (target != null)
+ {
+ 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(1, html));
+ return true;
+ }
+ return true;
+ }
+
+ public String[] getVoicedCommandList()
+ {
+ return _voicedCommands;
+ }
+}
\ No newline at end of file
CitarADAPTACIÓN:
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java b/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
index f31bf55..ced0f5a 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/voicedcommandhandlers/ChangePassword.java
@@ -18,7 +18,9 @@
*/
package handlers.voicedcommandhandlers;
+import java.util.Map;
import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import com.l2jserver.gameserver.LoginServerThread;
@@ -32,6 +34,8 @@
*/
public class ChangePassword implements IVoicedCommandHandler
{
+ private static final Map<Integer, Long> REUSES = new ConcurrentHashMap<>();
+ private static final int REUSE = 30 * 60 * 1000; // 30 Min
private static final String[] _voicedCommands =
{
"changepassword"
@@ -77,6 +81,13 @@
return false;
}
+ final Long timeStamp = REUSES.get(activeChar.getObjectId());
+ if ((timeStamp != null) && ((System.currentTimeMillis() - REUSE) < timeStamp.longValue()))
+ {
+ activeChar.sendMessage("You cannot change the password so often!");
+ return false;
+ }
+ REUSES.put(activeChar.getObjectId(), System.currentTimeMillis());
LoginServerThread.getInstance().sendChangePassword(activeChar.getAccountName(), activeChar.getName(), curpass, newpass);
}
else
### Eclipse Workspace Patch 1.0
#P L2jFrozen_GameServer
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSoulShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSoulShot.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSoulShot.java (working copy)
@@ -156,7 +156,8 @@
// Pet uses the power of spirit.
activeOwner.sendPacket(new SystemMessage(SystemMessageId.PET_USE_THE_POWER_OF_SPIRIT));
- Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, 2033, 1, 0, 0), 360000/*600*/);
+ if (!activeOwner.isSSDisabled())
+ Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, 2033, 1, 0, 0), 360000/*600*/);
activeOwner = null;
activePet = null;
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/FishShots.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/FishShots.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/FishShots.java (working copy)
@@ -92,7 +92,8 @@
//activeChar.sendPacket(new SystemMessage(SystemMessage.ENABLED_SPIRITSHOT));
MagicSkillUser MSU = new MagicSkillUser(activeChar, SKILL_IDS[grade], 1, 0, 0);
- Broadcast.toSelfAndKnownPlayers(activeChar, MSU);
+ if (!activeChar.isSSDisabled())
+ Broadcast.toSelfAndKnownPlayers(activeChar, MSU);
MSU = null;
activeChar.setTarget(oldTarget);
Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -20222,4 +20222,60 @@
}
sendSkillList();
}
+
+ private boolean _cantGainXP = false;
+ private boolean _isPartyInvProt = false;
+ private boolean _isInTradeProt = false;
+ private boolean _isSSDisabled = false;
+ private boolean _isInRefusal = false;
+
+ public boolean isInTradeProt()
+ {
+ return _isInTradeProt;
+ }
+
+ public void setIsInTradeProt(boolean value)
+ {
+ _isInTradeProt = value;
+ }
+
+ public boolean isSSDisabled()
+ {
+ return _isSSDisabled;
+ }
+
+ public void setIsSSDisabled(boolean value)
+ {
+ _isSSDisabled = value;
+ }
+
+ public boolean isPartyInvProt()
+ {
+ return _isPartyInvProt;
+ }
+
+ public void setIsPartyInvProt(boolean value)
+ {
+ _isPartyInvProt = value;
+ }
+
+ public void cantGainXP(boolean b)
+ {
+ _cantGainXP = b;
+ }
+
+ public boolean cantGainXP()
+ {
+ return _cantGainXP;
+ }
+
+ public void setInRefusalMode(boolean b)
+ {
+ _isInRefusal = b;
+ }
+
+ public boolean isInRefusalMode()
+ {
+ return _isInRefusal;
+ }
}
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java (working copy)
@@ -78,6 +78,12 @@
return;
}
+ if (target.isPartyInvProt())
+ {
+ requestor.sendMessage("You can't invite that player because he is in party protection.");
+ return;
+ }
+
if (target.isInParty())
{
SystemMessage msg = new SystemMessage(SystemMessageId.S1_IS_ALREADY_IN_PARTY);
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BlessedSpiritShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BlessedSpiritShot.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BlessedSpiritShot.java (working copy)
@@ -137,7 +137,8 @@
// Send message to client
activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
- Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
+ if (!activeChar.isSSDisabled())
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
activeChar = null;
weaponInst = null;
Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Menu;
+registerVoicedCommandHandler( new Menu());
if (Config.BANKING_SYSTEM_ENABLED)
Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Menu.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Menu.java (revision 0)
+++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Menu.java (revision 0)
@@ -0,0 +1,173 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
import javolution.text.TextBuilder;
import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
public class Menu implements IVoicedCommandHandler
{
private final String[] _voicedCommands =
{
"menu"
};
@Override
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
mainHtml(activeChar);
return true;
}
public static void mainHtml(L2PcInstance activeChar)
{
NpcHtmlMessage nhm = new NpcHtmlMessage(5);
TextBuilder tb = new TextBuilder("");
tb.append("<html><head><title>Personal Menu</title></head><body>");
tb.append("<center>");
tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
tb.append("<td valign=\"top\">Players online <font color=\"FF6600\"> "+L2World.getInstance().getAllPlayers().size()+"</font>");
tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, use this menu for everything related to your gameplay.<br1></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("</center>");
tb.append("<center>");
tb.append("<table border=\"1\" width=\"100\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td width=\"52\">ON</td>");
tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
tb.append("</tr>");
tb.append("<tr>");
tb.append("<td width=\"52\">OFF</td>");
tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
tb.append("</tr>");
tb.append("</table><br>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"52\">Buff Protection</td>");
if(activeChar.isBuffProtected())
tb.append("<td width=\"16\"><button action=\"bypass -h buffprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
if(!activeChar.isBuffProtected())
tb.append("<td width=\"16\"><button action=\"bypass -h buffprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("</tr>");
tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY buff from another character.</font></td></tr>");
tb.append("</table>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"52\">Personal Message Refusal</td>");
if(activeChar.getMessageRefusal())
tb.append("<td width=\"16\"><button action=\"bypass -h pmref\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
if(!activeChar.getMessageRefusal())
tb.append("<td width=\"16\"><button action=\"bypass -h pmref\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("</tr>");
tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY pm from another character.</font></td></tr>");
tb.append("</table>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"52\">Trade Request Protection</td>");
if(activeChar.isInTradeProt())
tb.append("<td width=\"16\"><button action=\"bypass -h tradeprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
if(!activeChar.isInTradeProt())
tb.append("<td width=\"16\"><button action=\"bypass -h tradeprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("</tr>");
tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY trade request from another character.</font></td></tr>");
tb.append("</table>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"52\">Soulshot/Spiritshot Effect</td>");
if(activeChar.isSSDisabled())
tb.append("<td width=\"16\"><button action=\"bypass -h ssprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
if(!activeChar.isSSDisabled())
tb.append("<td width=\"16\"><button action=\"bypass -h ssprot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("</tr>");
tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you will enchance your pc's performance by disabling your ss effects.</font></td><td align=\"center\" valign=\"middle\"><button action=\"bypass -h page2\" width=16 height=16 back=\"L2UI_CH3.next1\" fore=\"L2UI_CH3.next1\"></td></tr>");
tb.append("</table>");
tb.append("</center>");
tb.append("</body></html>");
nhm.setHtml(tb.toString());
activeChar.sendPacket(nhm);
}
public static void mainHtml2(L2PcInstance activeChar)
{
NpcHtmlMessage nhm = new NpcHtmlMessage(5);
TextBuilder tb = new TextBuilder("");
tb.append("<html><head><title>Personal Menu</title></head><body>");
tb.append("<center>");
tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
tb.append("<td valign=\"top\">Players online <font color=\"FF6600\"> "+L2World.getInstance().getAllPlayers().size()+"</font>");
tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, use this menu for everything related to your gameplay.<br1></td>");
tb.append("</tr>");
tb.append("</table>");
tb.append("</center>");
tb.append("<center>");
tb.append("<table border=\"1\" width=\"100\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td width=\"52\">ON</td>");
tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
tb.append("</tr>");
tb.append("<tr>");
tb.append("<td width=\"52\">OFF</td>");
tb.append("<td width=\"16\"><button width=16 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("<td><button width=32 height=12 back=\"L2UI_CH3.tutorial_pointer1\" fore=\"L2UI_CH3.tutorial_pointer1\"></td>");
tb.append("</tr>");
tb.append("</table><br>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"52\">Party Invite Protection</td>");
if(activeChar.isPartyInvProt())
tb.append("<td width=\"16\"><button action=\"bypass -h partyin\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
if(!activeChar.isPartyInvProt())
tb.append("<td width=\"16\"><button action=\"bypass -h partyin\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("</tr>");
tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve ANY party invite from another character.</font></td></tr>");
tb.append("</table>");
tb.append("<table border=\"1\" width=\"250\" height=\"12\" bgcolor=\"000000\">");
tb.append("<tr>");
tb.append("<td align=\"center\" width=\"52\">Exp Gain Protection</td>");
if(activeChar.cantGainXP())
tb.append("<td width=\"16\"><button action=\"bypass -h xpnot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_hp\" fore=\"L2UI_CH3.br_bar1_hp\"></td>");
if(!activeChar.cantGainXP())
tb.append("<td width=\"16\"><button action=\"bypass -h xpnot\" width=24 height=12 back=\"L2UI_CH3.br_bar1_mp\" fore=\"L2UI_CH3.br_bar1_mp\"></td>");
tb.append("</tr>");
tb.append("<tr><td width=\"250\"><font color=\"00FF00\">By enabling that you won't be able to recieve expirience from killing monsters.</font></td><td align=\"center\" valign=\"middle\"><button action=\"bypass -h page1\" width=16 height=16 back=\"L2UI_CH3.back1\" fore=\"L2UI_CH3.next1\"></td></tr>");
tb.append("</table>");
tb.append("</center>");
tb.append("</body></html>");
nhm.setHtml(tb.toString());
activeChar.sendPacket(nhm);
}
@Override
public String[] getVoicedCommandList()
{
return _voicedCommands;
}
}
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SpiritShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SpiritShot.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SpiritShot.java (working copy)
@@ -128,7 +128,8 @@
// Send message to client
activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SPIRITSHOT));
- Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
+ if (!activeChar.isSSDisabled())
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
activeChar = null;
}
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java (working copy)
@@ -202,7 +202,13 @@
player.sendPacket(new SystemMessage(SystemMessageId.TARGET_TOO_FAR));
return;
}
-
+
+ if (partner.isInTradeProt())
+ {
+ player.sendMessage(partner.getName() + " is in Trade Protection Mode");
+ return;
+ }
+
// Alt game - Karma punishment
if(!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0 || partner.getKarma() > 0))
{
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SoulShots.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SoulShots.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/SoulShots.java (working copy)
@@ -142,7 +142,8 @@
// Send message to client
activeChar.sendPacket(new SystemMessage(SystemMessageId.ENABLED_SOULSHOT));
- Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
+ if (!activeChar.isSSDisabled())
+ Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, SKILL_IDS[weaponGrade], 1, 0, 0), 360000/*600*/);
activeChar = null;
}
Index: head-src/com/l2jfrozen/gameserver/model/actor/stat/PcStat.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/stat/PcStat.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/model/actor/stat/PcStat.java (working copy)
@@ -58,6 +58,9 @@
//Player is Gm and access level is below or equal to canGainExp and is in party, don't give Xp
if(!getActiveChar().getAccessLevel().canGainExp() && getActiveChar().isInParty())
return false;
+
+ if (activeChar.cantGainXP())
+ return false;
if(!super.addExp(value))
return false;
@@ -111,6 +114,9 @@
L2PcInstance activeChar = getActiveChar();
if(!activeChar.getAccessLevel().canGainExp() && activeChar.isInParty())
return false;
+
+ if (activeChar.cantGainXP())
+ return false;
// if this player has a pet that takes from the owner's Exp, give the pet Exp now
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
@@ -28,6 +28,7 @@
import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Menu;
import com.l2jfrozen.gameserver.model.L2Object;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance;
@@ -41,8 +42,10 @@
import com.l2jfrozen.gameserver.model.entity.event.TvT;
import com.l2jfrozen.gameserver.model.entity.event.VIP;
import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
import com.l2jfrozen.gameserver.util.GMAudit;
public final class RequestBypassToServer extends L2GameClientPacket
@@ -308,7 +311,90 @@
player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());
}
}
-
+ else if (_command.startsWith("page1"))
+ Menu.mainHtml(activeChar);
+ else if (_command.startsWith("buffprot"))
+ {
+ if (activeChar.isBuffProtected())
+ {
+ +activeChar.setIsBuffProtected(false);
+ +activeChar.sendMessage("Buff protection is disabled.");
+ +Menu.mainHtml(activeChar);
+ }
+ else
+ {
+ activeChar.setIsBuffProtected(true);
+ activeChar.sendMessage("Buff protection is enabled.");
+ Menu.mainHtml(activeChar);
+ }
+ }
+ else if (_command.startsWith("tradeprot"))
+ {
+ if (activeChar.isInTradeProt())
+ {
+ +activeChar.setIsInTradeProt(false);
+ +activeChar.sendMessage("Trade acceptance mode is enabled.");
+ +Menu.mainHtml(activeChar);
+ }
+ else
+ {
+ activeChar.setIsInTradeProt(true);
+ activeChar.sendMessage("Trade refusal mode is enabled.");
+ Menu.mainHtml(activeChar);
+ }
+ }
+ else if (_command.startsWith("ssprot"))
+ {
+ if (activeChar.isSSDisabled())
+ {
+ activeChar.setIsSSDisabled(false);
+ activeChar.sendMessage("Soulshots effects are enabled.");
+ Menu.mainHtml(activeChar);
+ }
+ else
+ {
+ activeChar.setIsSSDisabled(true);
+ activeChar.sendMessage("Soulshots effects are disabled.");
+ Menu.mainHtml(activeChar);
+ }
+ }
+ else if (_command.startsWith("xpnot"))
+ {
+ if (activeChar.cantGainXP())
+ {
+ activeChar.cantGainXP(false);
+ activeChar.sendMessage("Enable Xp");
+ Menu.mainHtml2(activeChar);
+ }
+ else
+ {
+ activeChar.cantGainXP(true);
+ activeChar.sendMessage("Disable Xp");
+ Menu.mainHtml2(activeChar);
+ }
+ }
+ else if (_command.startsWith("pmref"))
+ {
+ if (activeChar.getMessageRefusal())
+ {
+ activeChar.setMessageRefusal(false);
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_ACCEPTANCE_MODE));
+ Menu.mainHtml(activeChar);
+ }
+ else
+ {
+ activeChar.setMessageRefusal(true);
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.MESSAGE_REFUSAL_MODE));
+ Menu.mainHtml(activeChar);
+ }
+ }
+ else if (_command.startsWith("partyin"))
+ {
+ if (activeChar.isPartyInvProt())
+ {
+ activeChar.setIsPartyInvProt(false);
+ activeChar.sendMessage("Party acceptance mode is enabled.");
+ Menu.mainHtml2(activeChar);
+ }
+ else
+ {
+ activeChar.setIsPartyInvProt(true);
+ activeChar.sendMessage("Party refusal mode is enabled.");
+ Menu.mainHtml2(activeChar);
+ }
+ }
+ else if (_command.startsWith("page2"))
+ Menu.mainHtml2(activeChar);
// Jstar's Custom Bypass Caller!
else if(_command.startsWith("custom_"))
{
Index: head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSpiritShot.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSpiritShot.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/itemhandlers/BeastSpiritShot.java (working copy)
@@ -169,7 +169,8 @@
// Pet uses the power of spirit.
activeOwner.sendPacket(new SystemMessage(SystemMessageId.PET_USE_THE_POWER_OF_SPIRIT));
- Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, isBlessed ? 2009 : 2008, 1, 0, 0), 360000/*600*/);
+ if (!activeOwner.isSSDisabled())
+ Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUser(activePet, activePet, isBlessed ? 2009 : 2008, 1, 0, 0), 360000/*600*/);
activeOwner = null;
activePet = null;
Index: head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Continuous.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Continuous.java (revision 986)
+++ head-src/com/l2jfrozen/gameserver/handler/skillhandlers/Continuous.java (working copy)
@@ -143,7 +143,16 @@
|| skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
|| skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
|| skill.getSkillType() == L2Skill.SkillType.REFLECT))
- continue;
+ continue;
+
+ if (activeChar instanceof L2PcInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
+ && (skill.getSkillType() == L2Skill.SkillType.BUFF
+ || skill.getSkillType() == L2Skill.SkillType.HEAL_PERCENT
+ || skill.getSkillType() == L2Skill.SkillType.FORCE_BUFF
+ || skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
+ || skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
+ || skill.getSkillType() == L2Skill.SkillType.REFLECT))
+ continue;
// Player holding a cursed weapon can't be buffed and can't buff
if(skill.getSkillType() == L2Skill.SkillType.BUFF)
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfree.gameserver.handler.voicedcommandhandlers;
import com.l2jfree.gameserver.handler.IVoicedCommandHandler;
import com.l2jfree.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfree.gameserver.network.SystemMessageId;
import com.l2jfree.gameserver.network.serverpackets.SystemMessage;
/**
* @author Intrepid
*
*/
public class TradeOff implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS =
{
"tradeoff",
"tradeon"
};
public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
if ((command.startsWith("tradeoff")))
{
if(activeChar.getTradeRefusal())
{
activeChar.sendMessage("Trade refusal is already enabled!");
}
else
{
activeChar.setTradeRefusal(true);
activeChar.sendMessage("Trade refusal enabled");
}
}
if ((command.startsWith("tradeon")))
{
if(!activeChar.getTradeRefusal())
{
activeChar.sendMessage("Trade refusal is already disabled!");
}
else
{
activeChar.setTradeRefusal(false);
activeChar.sendMessage("Trade refusal disabled");
}
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
registerVoicedCommandHandler(new CastleDoors());
registerVoicedCommandHandler(new Hellbound());
registerVoicedCommandHandler(new Banking());
+ registerVoicedCommandHandler(new TradeOff());