Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/admincommandhandlers/AdminRes.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/admincommandhandlers/AdminRes.java
- index 7bbfcbf..3d6e092 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/admincommandhandlers/AdminRes.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/admincommandhandlers/AdminRes.java
- @@ -47,7 +47,7 @@
- {
- L2Object obj = activeChar.getTarget();
- - if (!resParam.isEmpty())
- + if (resParam != null)
- {
- L2PcInstance plr = L2World.getInstance().getPlayer(resParam);
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Recipes.java b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Recipes.java
- index 4620157..9075256 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Recipes.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/handlers/itemhandlers/Recipes.java
- @@ -8,6 +8,7 @@
- import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jhellas.gameserver.model.actor.item.L2ItemInstance;
- import com.l2jhellas.gameserver.network.SystemMessageId;
- +import com.l2jhellas.gameserver.network.serverpackets.ItemList;
- import com.l2jhellas.gameserver.network.serverpackets.SystemMessage;
- public class Recipes implements IItemHandler
- @@ -29,76 +30,59 @@
- {
- if (!(playable instanceof L2PcInstance))
- return;
- - L2PcInstance activeChar = (L2PcInstance) playable;
- - L2RecipeList rp = RecipeData.getInstance().getRecipeByItemId(item.getItemId());
- - if (activeChar.hasRecipeList(rp.getId()))
- - {
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED);
- - activeChar.sendPacket(sm);
- - }
- +
- + final L2PcInstance activeChar = (L2PcInstance) playable;
- +
- + final L2RecipeList rp = RecipeData.getInstance().getRecipeByItemId(item.getItemId());
- +
- + if(rp == null)
- + return;
- +
- + if (activeChar.hasRecipeList(rp.getId(),rp.isDwarvenRecipe()))
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.RECIPE_ALREADY_REGISTERED));
- else
- {
- if (rp.isDwarvenRecipe())
- {
- if (activeChar.hasDwarvenCraft())
- {
- + // can't add recipe, because create item level too low
- if (rp.getLevel() > activeChar.getDwarvenCraft())
- - {
- - // can't add recipe, because create item level too low
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER);
- - activeChar.sendPacket(sm);
- - }
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER));
- else if (activeChar.getDwarvenRecipeBook().size() >= activeChar.getDwarfRecipeLimit())
- - {
- - // Up to $s1 recipes can be registered.
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
- - sm.addNumber(activeChar.getDwarfRecipeLimit());
- - activeChar.sendPacket(sm);
- - }
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER).addNumber(activeChar.getDwarfRecipeLimit()));
- else
- {
- activeChar.registerDwarvenRecipeList(rp);
- activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
- String itemName = ItemTable.getInstance().getTemplate(rp.getItemId()).getItemName();
- activeChar.sendMessage("Added recipe " + itemName + " to Dwarven RecipeBook.");
- + activeChar.sendPacket(new ItemList(activeChar,false));
- }
- }
- else
- - {
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT);
- - activeChar.sendPacket(sm);
- - }
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT));
- }
- else
- {
- if (activeChar.hasCommonCraft())
- {
- + // can't add recipe, because create item level too low
- if (rp.getLevel() > activeChar.getCommonCraft())
- - {
- - // can't add recipe, because create item level too low
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER);
- - activeChar.sendPacket(sm);
- - }
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CREATE_LVL_TOO_LOW_TO_REGISTER));
- else if (activeChar.getCommonRecipeBook().size() >= activeChar.getCommonRecipeLimit())
- - {
- - // Up to $s1 recipes can be registered.
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER);
- - sm.addNumber(activeChar.getCommonRecipeLimit());
- - activeChar.sendPacket(sm);
- - }
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.UP_TO_S1_RECIPES_CAN_REGISTER).addNumber(activeChar.getCommonRecipeLimit()));
- else
- {
- activeChar.registerCommonRecipeList(rp);
- activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
- String itemName = ItemTable.getInstance().getTemplate(rp.getItemId()).getItemName();
- activeChar.sendMessage("Added recipe " + itemName + " to Common RecipeBook.");
- + activeChar.sendPacket(new ItemList(activeChar,false));
- }
- }
- else
- - {
- - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT);
- - activeChar.sendPacket(sm);
- - }
- + activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANT_REGISTER_NO_ABILITY_TO_CRAFT));
- }
- }
- }
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Attackable.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Attackable.java
- index 34954ad..7e6d89d 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Attackable.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/L2Attackable.java
- @@ -1266,13 +1266,9 @@
- {
- RewardItem item = new RewardItem(8612, 1); // Herb of Warrior
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- _spec = true;
- }
- else
- @@ -1284,27 +1280,17 @@
- {
- item = null;
- if (i == 0)
- - {
- item = new RewardItem(8606, 1); // Herb of Power
- - }
- if (i == 1)
- - {
- item = new RewardItem(8608, 1); // Herb of Atk. Spd.
- - }
- if (i == 2)
- - {
- item = new RewardItem(8610, 1); // Herb of Critical
- // Attack
- - }
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- break;
- }
- }
- @@ -1316,13 +1302,9 @@
- {
- RewardItem item = new RewardItem(8613, 1); // Herb of Mystic
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- _spec = true;
- }
- else
- @@ -1334,23 +1316,14 @@
- {
- item2 = null;
- if (i == 0)
- - {
- item2 = new RewardItem(8607, 1); // Herb of Magic
- - }
- if (i == 1)
- - {
- item2 = new RewardItem(8609, 1); // Herb of Casting
- - // Speed
- - }
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item2.getItemId(), item2.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item2);
- - }
- break;
- }
- }
- @@ -1362,13 +1335,9 @@
- {
- RewardItem item = new RewardItem(8614, 1); // Herb of Recovery
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- _mp = true;
- _hp = true;
- _spec = true;
- @@ -1381,13 +1350,10 @@
- {
- RewardItem item = new RewardItem(8600, 1); // Herb of Life
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- +
- _hp = true;
- }
- }
- @@ -1399,13 +1365,10 @@
- RewardItem item = new RewardItem(8601, 1); // Greater Herb
- // of Life
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- +
- _hp = true;
- }
- }
- @@ -1417,13 +1380,9 @@
- RewardItem item = new RewardItem(8602, 1); // Superior Herb
- // of Life
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- }
- }
- // mp - restore mp type
- @@ -1434,13 +1393,9 @@
- {
- RewardItem item = new RewardItem(8603, 1); // Herb of Manna
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- _mp = true;
- }
- }
- @@ -1452,13 +1407,9 @@
- RewardItem item = new RewardItem(8604, 1); // Greater Herb
- // of Mana
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- _mp = true;
- }
- }
- @@ -1470,13 +1421,9 @@
- RewardItem item = new RewardItem(8605, 1); // Superior Herb
- // of Mana
- if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS)
- - {
- player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
- - }
- else
- - {
- dropItem(player, item);
- - }
- }
- }
- // speed enhance type
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java
- index e695de9..91453a0 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java
- @@ -1094,6 +1094,11 @@
- _dwarvenRecipeBook.put(recipe.getId(), recipe);
- }
- + public boolean hasRecipeList(int recipeId, boolean isDwarven)
- + {
- + return (isDwarven) ? _dwarvenRecipeBook.containsKey(recipeId) : _commonRecipeBook.containsKey(recipeId);
- + }
- +
- public boolean hasRecipeList(int recipeId)
- {
- if (_dwarvenRecipeBook.containsKey(recipeId))
- @@ -7057,6 +7062,10 @@
- switch (mountType)
- {
- case 0:
- +
- + if (isFlying())
- + removeSkill(SkillTable.getInstance().getInfo(4289, 1));
- +
- setIsFlying(false);
- setIsRiding(false);
- break; // Dismounted
- @@ -8437,13 +8446,11 @@
- public void restartRecom()
- {
- - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement(DELETE_CHAR_RECOMS))
- {
- - PreparedStatement statement = con.prepareStatement(DELETE_CHAR_RECOMS);
- statement.setInt(1, getObjectId());
- - statement.execute();
- - statement.close();
- -
- + statement.execute();
- _recomChars.clear();
- }
- catch (Exception e)
- @@ -10078,16 +10085,19 @@
- long banLength = 0;
- String banReason = "";
- - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement(BAN_CHAT_GET))
- {
- - PreparedStatement statement = con.prepareStatement(BAN_CHAT_GET);
- statement.setString(1, getName());
- - ResultSet rset = statement.executeQuery();
- - rset.next();
- - banLength = rset.getLong("chatban_timer");
- - banReason = rset.getString("chatban_reason");
- - rset.close();
- - statement.close();
- +
- + try (ResultSet rset = statement.executeQuery())
- + {
- + while (rset.next())
- + {
- + banLength = rset.getLong("chatban_timer");
- + banReason = rset.getString("chatban_reason");
- + }
- + }
- }
- catch (SQLException e)
- {
- @@ -10124,14 +10134,13 @@
- banLengthMSec = nowTime + (banLength * 1000);
- }
- - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement(BAN_CHAT_SET))
- {
- - PreparedStatement statement = con.prepareStatement(BAN_CHAT_SET);
- statement.setLong(1, banLengthMSec);
- statement.setString(2, banReason);
- statement.setString(3, getName());
- statement.execute();
- - statement.close();
- }
- catch (SQLException e)
- {
- @@ -10422,9 +10431,9 @@
- public void getAchievemntData()
- {
- - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT * FROM achievements WHERE owner_id=" + getObjectId()))
- {
- - PreparedStatement statement = con.prepareStatement("SELECT * FROM achievements WHERE owner_id=" + getObjectId());
- ResultSet rs = statement.executeQuery();
- String values = "owner_id";
- String in = Integer.toString(getObjectId());
- @@ -11857,24 +11866,22 @@
- {
- _friendList.clear();
- - try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id = ?"))
- {
- - PreparedStatement statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id = ?");
- - statement.setInt(1, getObjectId());
- - ResultSet rset = statement.executeQuery();
- -
- - int friendId;
- - while (rset.next())
- - {
- - friendId = rset.getInt("friend_id");
- - if (friendId == getObjectId())
- - continue;
- -
- - _friendList.add(friendId);
- - }
- -
- - rset.close();
- - statement.close();
- + statement.setInt(1, getObjectId());
- + try (ResultSet rset = statement.executeQuery())
- + {
- + int friendId;
- + while (rset.next())
- + {
- + friendId = rset.getInt("friend_id");
- + if (friendId == getObjectId())
- + continue;
- +
- + _friendList.add(friendId);
- + }
- + }
- }
- catch (Exception e)
- {
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/Logout.java b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/Logout.java
- index cff9884..e49d3e7 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/Logout.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/Logout.java
- @@ -16,7 +16,6 @@
- import com.l2jhellas.gameserver.network.serverpackets.ActionFailed;
- import com.l2jhellas.gameserver.network.serverpackets.FriendList;
- import com.l2jhellas.gameserver.network.serverpackets.SystemMessage;
- -import com.l2jhellas.gameserver.skills.SkillTable;
- import com.l2jhellas.gameserver.taskmanager.AttackStanceTaskManager;
- import com.l2jhellas.util.database.L2DatabaseFactory;
- @@ -93,9 +92,9 @@
- else
- EventManager.getInstance().onLogout(player);
- }
- -
- - if (player.isFlying())
- - player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
- +
- + if(player.isMounted())
- + player.dismount();
- player.endDuel();
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRecipeShopListSet.java b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRecipeShopListSet.java
- index 16754fb..e2d3246 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRecipeShopListSet.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRecipeShopListSet.java
- @@ -1,12 +1,7 @@
- package com.l2jhellas.gameserver.network.clientpackets;
- -import java.util.Arrays;
- -import java.util.Collection;
- -import java.util.List;
- -
- import com.l2jhellas.Config;
- import com.l2jhellas.gameserver.datatables.xml.RecipeData;
- -import com.l2jhellas.gameserver.enums.ZoneId;
- import com.l2jhellas.gameserver.enums.player.StoreType;
- import com.l2jhellas.gameserver.model.L2ManufactureItem;
- import com.l2jhellas.gameserver.model.L2ManufactureList;
- @@ -14,7 +9,6 @@
- import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jhellas.gameserver.network.SystemMessageId;
- import com.l2jhellas.gameserver.network.serverpackets.RecipeShopMsg;
- -import com.l2jhellas.gameserver.taskmanager.AttackStanceTaskManager;
- import com.l2jhellas.util.Util;
- public final class RequestRecipeShopListSet extends L2GameClientPacket
- @@ -56,27 +50,9 @@
- return;
- }
- - if (player.isInsideZone(ZoneId.NO_STORE))
- - {
- - player.sendPacket(SystemMessageId.NO_PRIVATE_STORE_HERE);
- + if (!player.canOpenPrivateStore())
- return;
- - }
- -
- - if (player.isSitting() && !player.isInStoreMode())
- - return;
- -
- - if (player.isAlikeDead() || player.isMounted() || player.isProcessingRequest())
- - return;
- - if (player.isInDuel() || player.isCastingNow() || AttackStanceTaskManager.getInstance().isInAttackStance(player) || player.isInOlympiadMode())
- - {
- - player.sendPacket(SystemMessageId.CANT_OPERATE_PRIVATE_STORE_DURING_COMBAT);
- - return;
- - }
- -
- - final List<Collection<L2RecipeList>> dwarfRecipes = Arrays.asList(player.getDwarvenRecipeBook());
- - final List<Collection<L2RecipeList>> commonRecipes = Arrays.asList(player.getCommonRecipeBook());
- -
- L2ManufactureList createList = new L2ManufactureList();
- createList.clear();
- @@ -94,12 +70,12 @@
- return;
- }
- - if (!dwarfRecipes.contains(list) && !commonRecipes.contains(list))
- - {
- + if(!player.hasRecipeList(recipeID,list.isDwarvenRecipe()))
- + {
- Util.handleIllegalPlayerAction(player, "Warning!! Player " + player.getName() + " of account " + player.getAccountName() + " tried to set recipe which he dont have.", Config.DEFAULT_PUNISH);
- return;
- }
- -
- +
- if (cost > 2000000000)
- return;
- diff --git a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRestart.java b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRestart.java
- index a2ff29b..abd85c5 100644
- --- a/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRestart.java
- +++ b/L2JHellasC/java/com/l2jhellas/gameserver/network/clientpackets/RequestRestart.java
- @@ -13,7 +13,6 @@
- import com.l2jhellas.gameserver.network.serverpackets.CharSelectInfo;
- import com.l2jhellas.gameserver.network.serverpackets.RestartResponse;
- import com.l2jhellas.gameserver.network.serverpackets.SystemMessage;
- -import com.l2jhellas.gameserver.skills.SkillTable;
- import com.l2jhellas.gameserver.taskmanager.AttackStanceTaskManager;
- public final class RequestRestart extends L2GameClientPacket
- @@ -104,10 +103,9 @@
- player.getActiveRequester().onTradeCancel(player);
- player.onTradeCancel(player.getActiveRequester());
- }
- -
- -
- - if (player.isFlying())
- - player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
- +
- + if(player.isMounted())
- + player.dismount();
- if (player.isRegisteredInFunEvent())
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement