Fixed Talking Island and Faeron Village scrolls of escape.
Dropped Batalion Zone due to lack of further development. Added Various missing syncs from L2jServer Ertheia.
This commit is contained in:
@ -849,24 +849,6 @@ public final class Config
|
||||
public static float PREMIUM_RATE_SPOIL_AMOUNT;
|
||||
public static Map<Integer, Float> PREMIUM_RATE_DROP_CHANCE_BY_ID;
|
||||
public static Map<Integer, Float> PREMIUM_RATE_DROP_AMOUNT_BY_ID;
|
||||
public static boolean BTZ_PVP_ENABLED;
|
||||
public static int[][] BTZ_SPAWN_LOCATIONS;
|
||||
public static int BTZ_REVIVE_DELAY;
|
||||
public static boolean BTZ_REVIVE;
|
||||
public static boolean BTZ_GIVE_NOBLES;
|
||||
public static List<String> BTZ_ITEMS = new ArrayList<>();
|
||||
public static List<String> BTZ_CLASSES = new ArrayList<>();
|
||||
public static List<String> BTZ_GRADES = new ArrayList<>();
|
||||
public static int BTZ_RADIUS;
|
||||
public static int BTZ_ENCHANT;
|
||||
public static boolean BTZ_RESTART_ZONE;
|
||||
public static boolean BTZ_STORE_ZONE;
|
||||
public static boolean BTZ_LOGOUT_ZONE;
|
||||
public static boolean BTZ_REVIVE_NOBLESS;
|
||||
public static boolean BTZ_REVIVE_HEAL;
|
||||
public static boolean BTZ_REMOVE_BUFFS;
|
||||
public static boolean BTZ_REMOVE_PETS;
|
||||
public static List<int[]> BTZ_REWARDS;
|
||||
public static boolean PC_BANG_ENABLED;
|
||||
public static int PC_BANG_MAX_POINTS;
|
||||
public static boolean PC_BANG_ENABLE_DOUBLE_POINTS;
|
||||
@ -2699,71 +2681,6 @@ public final class Config
|
||||
}
|
||||
}
|
||||
|
||||
BTZ_PVP_ENABLED = CustomSettings.getBoolean("BTZEnablePvP", false);
|
||||
BTZ_SPAWN_LOCATIONS = parseZonesList(CustomSettings.getString("BTZSpawnLoc", "150111,144740,-12248"));
|
||||
BTZ_REVIVE_DELAY = CustomSettings.getInt("BTZReviveDelay", 10);
|
||||
if (BTZ_REVIVE_DELAY != 0)
|
||||
{
|
||||
BTZ_REVIVE = true;
|
||||
}
|
||||
BTZ_GIVE_NOBLES = CustomSettings.getBoolean("BTZGiveNoblesse", false);
|
||||
tempString = CustomSettings.getString("BTZItems", "").split(",");
|
||||
if (tempString.length != 0)
|
||||
{
|
||||
for (String i : tempString)
|
||||
{
|
||||
BTZ_ITEMS.add(i);
|
||||
}
|
||||
}
|
||||
tempString = CustomSettings.getString("BTZGrades", "").split(",");
|
||||
if (tempString.length != 0)
|
||||
{
|
||||
for (String i : tempString)
|
||||
{
|
||||
if (i.equals("D") || i.equals("C") || i.equals("B") || i.equals("A") || i.equals("S") || i.equals("S80") || i.equals("S84") || i.equals("R") || i.equals("R95") || i.equals("R99"))
|
||||
{
|
||||
BTZ_GRADES.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
tempString = CustomSettings.getString("BTZClasses", "").split(",");
|
||||
if (tempString.length != 0)
|
||||
{
|
||||
for (String i : tempString)
|
||||
{
|
||||
BTZ_CLASSES.add(i);
|
||||
}
|
||||
}
|
||||
BTZ_RADIUS = CustomSettings.getInt("BTZRespawnRadius", 500);
|
||||
BTZ_ENCHANT = CustomSettings.getInt("BTZEnchant", 0);
|
||||
BTZ_REMOVE_BUFFS = CustomSettings.getBoolean("BTZRemoveBuffs", false);
|
||||
BTZ_REMOVE_PETS = CustomSettings.getBoolean("BTZRemovePets", false);
|
||||
BTZ_RESTART_ZONE = CustomSettings.getBoolean("BTZRestartZone", false);
|
||||
BTZ_STORE_ZONE = CustomSettings.getBoolean("BTZStoreZone", false);
|
||||
BTZ_LOGOUT_ZONE = CustomSettings.getBoolean("BTZLogoutZone", false);
|
||||
BTZ_REVIVE_NOBLESS = CustomSettings.getBoolean("BTZReviveNoblesse", false);
|
||||
BTZ_REVIVE_HEAL = CustomSettings.getBoolean("BTZReviveHeal", false);
|
||||
BTZ_REWARDS = new ArrayList<>();
|
||||
tempString = CustomSettings.getString("BTZRewards", "57,100000").split(";");
|
||||
for (String reward : tempString)
|
||||
{
|
||||
String[] rewardSplit = reward.split(",");
|
||||
if (rewardSplit.length == 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
BTZ_REWARDS.add(new int[]
|
||||
{
|
||||
Integer.parseInt(rewardSplit[0]),
|
||||
Integer.parseInt(rewardSplit[1])
|
||||
});
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PC_BANG_ENABLED = CustomSettings.getBoolean("Enabled", false);
|
||||
PC_BANG_MAX_POINTS = CustomSettings.getInt("MaxPcBangPoints", 200000);
|
||||
if (PC_BANG_MAX_POINTS < 0)
|
||||
@ -4138,55 +4055,6 @@ public final class Config
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int[][] parseZonesList(String line)
|
||||
{
|
||||
final String[] propertySplit = line.split(";");
|
||||
if (propertySplit.length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
String[] valueSplit;
|
||||
final int[][] result = new int[propertySplit.length][];
|
||||
for (String value : propertySplit)
|
||||
{
|
||||
valueSplit = value.split(",");
|
||||
if (valueSplit.length != 3)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
result[i] = new int[3];
|
||||
try
|
||||
{
|
||||
result[i][0] = Integer.parseInt(valueSplit[0]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
result[i][1] = Integer.parseInt(valueSplit[1]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
result[i][2] = Integer.parseInt(valueSplit[2]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static class IPConfigData implements IXmlReader
|
||||
{
|
||||
private static final List<String> _subnets = new ArrayList<>(5);
|
||||
|
@ -98,7 +98,6 @@ import com.l2jserver.gameserver.handler.EffectHandler;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
import com.l2jserver.gameserver.instancemanager.AirShipManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.BoatManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CastleManager;
|
||||
@ -106,6 +105,7 @@ import com.l2jserver.gameserver.instancemanager.CastleManorManager;
|
||||
import com.l2jserver.gameserver.instancemanager.ClanEntryManager;
|
||||
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
|
||||
import com.l2jserver.gameserver.instancemanager.ClanHallManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CoupleManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager;
|
||||
@ -241,7 +241,7 @@ public final class GameServer
|
||||
FishingMonstersData.getInstance();
|
||||
FishingRodsData.getInstance();
|
||||
HennaData.getInstance();
|
||||
AuctionHouseManager.getInstance();
|
||||
CommissionManager.getInstance();
|
||||
PrimeShopData.getInstance();
|
||||
AppearanceItemData.getInstance();
|
||||
|
||||
|
@ -31,5 +31,5 @@ public enum ItemLocation
|
||||
REFUND,
|
||||
MAIL,
|
||||
FREIGHT,
|
||||
AUCTION_HOUSE
|
||||
COMMISSION
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public enum MailType
|
||||
NEWS_INFORMER,
|
||||
NPC,
|
||||
BIRTHDAY,
|
||||
SYSTEM,
|
||||
COMMISSION_ITEM_RETURNED,
|
||||
COMMISSION_ITEM_SOLD,
|
||||
MENTOR_NPC,
|
||||
PRIME_SHOP_GIFT
|
||||
|
@ -1,855 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.instancemanager;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.enums.MailType;
|
||||
import com.l2jserver.gameserver.model.entity.Message;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class AuctionHouseManager
|
||||
{
|
||||
Connection con = null;
|
||||
private static final Logger _log = Logger.getLogger(AuctionHouseManager.class.getName());
|
||||
private static List<Auctions> auctions = new CopyOnWriteArrayList<>();
|
||||
private static HashMap<Integer, Integer> convertedCategories;
|
||||
private static HashMap<Integer, Integer> mainCategories;
|
||||
|
||||
public AuctionHouseManager()
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": Initializing.");
|
||||
loadCategoryConverter();
|
||||
loadMainCategoriesConverter();
|
||||
_log.info(getClass().getSimpleName() + ": Loaded " + mainCategories.size() + " Auction Sections.");
|
||||
load();
|
||||
_log.info(getClass().getSimpleName() + ": Loaded " + auctions.size() + " Auctions.");
|
||||
}
|
||||
|
||||
private void load()
|
||||
{
|
||||
auctions.clear();
|
||||
int auctionID = 0;
|
||||
int sellerID = 0;
|
||||
int count = 0;
|
||||
int category = 0;
|
||||
int duration = 0;
|
||||
int itemOID = 0;
|
||||
int itemID = 0;
|
||||
long price = 0;
|
||||
long finishTime = 0;
|
||||
String itemName = "";
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM auction_house");)
|
||||
{
|
||||
ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
{
|
||||
auctionID = (rset.getInt("auctionID"));
|
||||
sellerID = (rset.getInt("sellerID"));
|
||||
itemName = (rset.getString("itemName"));
|
||||
itemOID = (rset.getInt("itemOID"));
|
||||
price = (rset.getLong("price"));
|
||||
count = (rset.getInt("count"));
|
||||
category = (rset.getInt("category"));
|
||||
duration = (rset.getInt("duration"));
|
||||
finishTime = (rset.getLong("finishTime"));
|
||||
itemID = (rset.getInt("itemID"));
|
||||
L2ItemInstance item = new L2ItemInstance(itemOID, itemID);
|
||||
createAuction(auctionID, sellerID, itemOID, item, itemName, price, count, duration, finishTime, category);
|
||||
}
|
||||
statement.execute();
|
||||
|
||||
rset.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Failed loading auction. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public void insertAuction(Auctions auction)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO auction_house (auctionID, sellerID, itemName, itemOID, price, count, category, duration, finishTime, itemID) values (?,?,?,?,?,?,?,?,?,?)");)
|
||||
{
|
||||
statement.setInt(1, auction.getAuctionId());
|
||||
statement.setInt(2, auction.getPlayerID());
|
||||
statement.setString(3, auction.getItemName());
|
||||
statement.setInt(4, auction.getItemOID());
|
||||
statement.setLong(5, auction.getPrice());
|
||||
statement.setLong(6, auction.getCount());
|
||||
statement.setInt(7, auction.getCategory());
|
||||
statement.setInt(8, auction.getDuration());
|
||||
statement.setLong(9, auction.getFinishTime());
|
||||
statement.setInt(10, auction.getItem().getId());
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Could not insert auction: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAuction(int auctionID)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM auction_house WHERE auctionID=?");)
|
||||
{
|
||||
|
||||
statement.setInt(1, auctionID);
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Could not delete auction: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadCategoryConverter()
|
||||
{
|
||||
convertedCategories = new HashMap<>();
|
||||
|
||||
convertedCategories.put(4294967, 1);
|
||||
convertedCategories.put(8589934, 2);
|
||||
convertedCategories.put(12884901, 3);
|
||||
convertedCategories.put(17179869, 4);
|
||||
convertedCategories.put(21474836, 5);
|
||||
convertedCategories.put(25769803, 6);
|
||||
convertedCategories.put(30064771, 7);
|
||||
convertedCategories.put(34359738, 8);
|
||||
convertedCategories.put(38654705, 9);
|
||||
convertedCategories.put(42949672, 10);
|
||||
convertedCategories.put(47244640, 11);
|
||||
convertedCategories.put(51539607, 12);
|
||||
convertedCategories.put(55834574, 13);
|
||||
convertedCategories.put(60129542, 14);
|
||||
convertedCategories.put(64424509, 15);
|
||||
convertedCategories.put(68719476, 16);
|
||||
convertedCategories.put(73014444, 17);
|
||||
convertedCategories.put(77309411, 18);
|
||||
|
||||
convertedCategories.put(81604378, 19);
|
||||
convertedCategories.put(85899345, 20);
|
||||
convertedCategories.put(90194313, 21);
|
||||
convertedCategories.put(94489280, 22);
|
||||
convertedCategories.put(98784247, 23);
|
||||
convertedCategories.put(103079215, 24);
|
||||
convertedCategories.put(107374182, 25);
|
||||
convertedCategories.put(111669149, 26);
|
||||
convertedCategories.put(115964116, 27);
|
||||
convertedCategories.put(120259084, 28);
|
||||
convertedCategories.put(124554051, 29);
|
||||
convertedCategories.put(128849018, 30);
|
||||
convertedCategories.put(133143986, 31);
|
||||
convertedCategories.put(137438953, 32);
|
||||
convertedCategories.put(141733920, 33);
|
||||
convertedCategories.put(146028888, 34);
|
||||
|
||||
convertedCategories.put(150323855, 35);
|
||||
convertedCategories.put(154618822, 36);
|
||||
convertedCategories.put(158913789, 37);
|
||||
convertedCategories.put(163208757, 38);
|
||||
convertedCategories.put(167503724, 39);
|
||||
convertedCategories.put(171798691, 40);
|
||||
|
||||
convertedCategories.put(180388626, 41);
|
||||
convertedCategories.put(184683593, 42);
|
||||
|
||||
convertedCategories.put(188978561, 43);
|
||||
convertedCategories.put(193273528, 44);
|
||||
convertedCategories.put(197568495, 45);
|
||||
convertedCategories.put(201863462, 46);
|
||||
convertedCategories.put(206158430, 47);
|
||||
convertedCategories.put(210453397, 48);
|
||||
convertedCategories.put(214748364, 49);
|
||||
convertedCategories.put(219043332, 50);
|
||||
convertedCategories.put(223338299, 51);
|
||||
convertedCategories.put(227633266, 52);
|
||||
convertedCategories.put(231928233, 53);
|
||||
convertedCategories.put(236223201, 54);
|
||||
convertedCategories.put(240518168, 55);
|
||||
convertedCategories.put(244813135, 56);
|
||||
convertedCategories.put(249108103, 57);
|
||||
convertedCategories.put(253403070, 58);
|
||||
}
|
||||
|
||||
private void loadMainCategoriesConverter()
|
||||
{
|
||||
mainCategories = new HashMap<>();
|
||||
|
||||
mainCategories.put(4294967, 61);
|
||||
mainCategories.put(8589934, 62);
|
||||
mainCategories.put(12884901, 63);
|
||||
mainCategories.put(17179869, 64);
|
||||
mainCategories.put(21474836, 65);
|
||||
}
|
||||
|
||||
public int getClientCategory(int category)
|
||||
{
|
||||
if (convertedCategories.get(category) != null)
|
||||
{
|
||||
return convertedCategories.get(category);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getMainClientCategory(int category)
|
||||
{
|
||||
if (mainCategories.get(category) != null)
|
||||
{
|
||||
return mainCategories.get(category);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void createAuction(int auctionID, int playerOID, int itemOID, L2ItemInstance item, String itemName, long price, long count, int duration, long finishTime, int category)
|
||||
{
|
||||
auctions.add(new Auctions(auctionID, itemName, itemOID, item, price, count, duration, playerOID, finishTime, category));
|
||||
}
|
||||
|
||||
public void deleteAuction(long auctionID)
|
||||
{
|
||||
for (int i = 0; i < auctions.size(); i++)
|
||||
{
|
||||
if (auctions.get(i).getAuctionId() == auctionID)
|
||||
{
|
||||
deleteItemFromPlayer(auctions.get(i).getItemOID(), auctions.get(i).getPlayerID());
|
||||
removeAuction(auctions.get(i).getAuctionId());
|
||||
auctions.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteItemFromPlayer(int playerID, int itemOID)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND object_id=? AND loc='AUCTION_HOUSE'");)
|
||||
{
|
||||
statement.setInt(1, playerID);
|
||||
statement.setInt(2, itemOID);
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Could not delete auction: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkForAuctionsDeletion()
|
||||
{
|
||||
int i = 0;
|
||||
if (!auctions.isEmpty())
|
||||
{
|
||||
for (Auctions auction : auctions)
|
||||
{
|
||||
if ((System.currentTimeMillis() / 1000) >= auction.getFinishTime())
|
||||
{
|
||||
Message msg = new Message(auction.getPlayerID(), "CommissionBuyTitle", "Auction Manager", SystemMessageId.THE_REGISTRATION_PERIOD_FOR_THE_ITEM_YOU_REGISTERED_HAS_EXPIRED.getId(), SystemMessageId.THE_AUCTION_HOUSE_REGISTRATION_PERIOD_HAS_EXPIRED_AND_THE_CORRESPONDING_ITEM_IS_BEING_FORWARDED.getId(), MailType.SYSTEM);
|
||||
msg.createAttachments().addItem("DeleteAuction", auction.getItem().getId(), auction.getCount(), null, null);
|
||||
MailManager.getInstance().sendMessage(msg);
|
||||
removeAuction(auction.getAuctionId());
|
||||
deleteItemFromPlayer(auction.getItemOID(), auction.getPlayerID());
|
||||
auctions.remove(i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Auctions getAuctionById(int id)
|
||||
{
|
||||
for (Auctions auction : auctions)
|
||||
{
|
||||
if (auction.getAuctionId() == id)
|
||||
{
|
||||
return auction;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Auctions getAuctionById(long id)
|
||||
{
|
||||
for (Auctions auction : auctions)
|
||||
{
|
||||
if (auction.getAuctionId() == id)
|
||||
{
|
||||
return auction;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getAuctionsSizeById(int grade, String search)
|
||||
{
|
||||
int i = 0;
|
||||
for (Auctions auction : auctions)
|
||||
{
|
||||
if (grade == -1)
|
||||
{
|
||||
if (auction.getItem().getName().contains(search))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (grade != -1)
|
||||
{
|
||||
if ((grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(search))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getAuctionsSizeById(long id, int grade, String search)
|
||||
{
|
||||
int ids[][] =
|
||||
{
|
||||
//@formatter:off
|
||||
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18},
|
||||
{19, 20, 21, 22, 23, 24, 25, 26, 27, 28},
|
||||
{29, 30, 31, 32, 33, 34},
|
||||
{35, 36, 37, 38, 39, 40},
|
||||
{41, 42},
|
||||
{43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58}
|
||||
//@formatter:on
|
||||
};
|
||||
int i = 0;
|
||||
int IDS[] = null;
|
||||
if (id == 61)
|
||||
{
|
||||
IDS = ids[1];
|
||||
}
|
||||
else if (id == 62)
|
||||
{
|
||||
IDS = ids[2];
|
||||
}
|
||||
else if (id == 63)
|
||||
{
|
||||
IDS = ids[3];
|
||||
}
|
||||
else if (id == 64)
|
||||
{
|
||||
IDS = ids[4];
|
||||
}
|
||||
else if (id == 65)
|
||||
{
|
||||
IDS = ids[5];
|
||||
}
|
||||
else if (id == 101)
|
||||
{
|
||||
IDS = ids[0];
|
||||
}
|
||||
|
||||
if ((((id > 60) && (id < 66)) || (id == 101)) && (IDS != null))
|
||||
{
|
||||
for (int ID : IDS)
|
||||
{
|
||||
for (Auctions auction : auctions)
|
||||
{
|
||||
if ((grade == -1) && search.equals(""))
|
||||
{
|
||||
if (auction.getCategory() == ID)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grade != -1)
|
||||
{
|
||||
if (search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == ID) && (grade == auction.getItem().getItem().getCrystalType().getId()))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == ID) && (grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(search))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == ID) && auction.getItem().getName().contains(search))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Auctions auction : auctions)
|
||||
{
|
||||
if ((grade == -1) && search.equals(""))
|
||||
{
|
||||
if (auction.getCategory() == id)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grade != -1)
|
||||
{
|
||||
if (search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == id) && (grade == auction.getItem().getItem().getCrystalType().getId()))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == id) && (grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(search))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == id) && auction.getItem().getName().contains(search))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getCategoryByItem(L2ItemInstance item)
|
||||
{
|
||||
final String itemName = item.getName().toLowerCase();
|
||||
|
||||
if (item.isWeapon())
|
||||
{
|
||||
if (item.getItem().isPetItem())
|
||||
{
|
||||
return 41; // Pet Equipment
|
||||
}
|
||||
|
||||
switch (item.getWeaponItem().getItemType())
|
||||
{
|
||||
case SWORD:
|
||||
{
|
||||
if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
|
||||
{
|
||||
return 5; // 2-H Sword
|
||||
}
|
||||
|
||||
if (item.getWeaponItem().isMagicWeapon())
|
||||
{
|
||||
return 2; // 1-H Magic Sword
|
||||
}
|
||||
|
||||
return 1; // 1-H Sword
|
||||
}
|
||||
case DAGGER:
|
||||
{
|
||||
return 3; // Dagger
|
||||
}
|
||||
case RAPIER:
|
||||
{
|
||||
return 4; // Rapier
|
||||
}
|
||||
case ANCIENTSWORD:
|
||||
{
|
||||
return 6; // Ancient
|
||||
}
|
||||
case DUAL:
|
||||
{
|
||||
return 7; // Dual Swords
|
||||
}
|
||||
case DUALDAGGER:
|
||||
{
|
||||
return 8; // Dual Daggers
|
||||
}
|
||||
case BLUNT:
|
||||
{
|
||||
if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
|
||||
{
|
||||
if (item.getWeaponItem().isMagicWeapon())
|
||||
{
|
||||
return 12; // 2-H Magic Blunt
|
||||
}
|
||||
|
||||
return 11; // 2-H Blunt
|
||||
}
|
||||
|
||||
if (item.getWeaponItem().isMagicWeapon())
|
||||
{
|
||||
return 10; // 1-H Magic Blunt
|
||||
}
|
||||
|
||||
return 9; // 1-H Blunt
|
||||
}
|
||||
case DUALBLUNT:
|
||||
{
|
||||
return 13; // Dual Blunt
|
||||
}
|
||||
case BOW:
|
||||
{
|
||||
return 14; // Bow
|
||||
}
|
||||
case CROSSBOW:
|
||||
{
|
||||
return 15; // Crossbow
|
||||
}
|
||||
case DUALFIST:
|
||||
{
|
||||
return 16; // Fist Weapon
|
||||
}
|
||||
case POLE:
|
||||
{
|
||||
return 17; // Spear
|
||||
}
|
||||
default:
|
||||
{
|
||||
return 18; // Other Weapon
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.isArmor())
|
||||
{
|
||||
if (item.getItem().isPetItem())
|
||||
{
|
||||
return 41; // Pet Equipment
|
||||
}
|
||||
|
||||
switch (item.getArmorItem().getBodyPart())
|
||||
{
|
||||
case L2Item.SLOT_HEAD:
|
||||
{
|
||||
return 19; // Helmet
|
||||
}
|
||||
case L2Item.SLOT_CHEST:
|
||||
{
|
||||
return 20; // Armor Top
|
||||
}
|
||||
case L2Item.SLOT_LEGS:
|
||||
{
|
||||
return 21; // Armor Pants
|
||||
}
|
||||
case L2Item.SLOT_FULL_ARMOR:
|
||||
case L2Item.SLOT_ALLDRESS:
|
||||
{
|
||||
return 22; // Full Body
|
||||
}
|
||||
case L2Item.SLOT_GLOVES:
|
||||
{
|
||||
return 23; // Gloves
|
||||
}
|
||||
case L2Item.SLOT_FEET:
|
||||
{
|
||||
return 24; // Feet
|
||||
}
|
||||
case L2Item.SLOT_L_HAND:
|
||||
{
|
||||
if (itemName.contains("sigil"))
|
||||
{
|
||||
return 26; // Sigil
|
||||
}
|
||||
|
||||
return 25; // Shield
|
||||
}
|
||||
case L2Item.SLOT_UNDERWEAR:
|
||||
{
|
||||
return 27; // Underwear
|
||||
}
|
||||
case L2Item.SLOT_BACK:
|
||||
{
|
||||
return 28; // Cloak
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.isEtcItem())
|
||||
{
|
||||
// Accessory
|
||||
switch (item.getEtcItem().getBodyPart())
|
||||
{
|
||||
case L2Item.SLOT_R_FINGER:
|
||||
case L2Item.SLOT_L_FINGER:
|
||||
case L2Item.SLOT_LR_FINGER:
|
||||
{
|
||||
return 29; // Ring
|
||||
}
|
||||
case L2Item.SLOT_R_EAR:
|
||||
case L2Item.SLOT_L_EAR:
|
||||
case L2Item.SLOT_LR_EAR:
|
||||
{
|
||||
return 30; // Earring
|
||||
}
|
||||
case L2Item.SLOT_NECK:
|
||||
{
|
||||
return 31; // Necklace
|
||||
}
|
||||
case L2Item.SLOT_BELT:
|
||||
{
|
||||
return 32; // Belt
|
||||
}
|
||||
case L2Item.SLOT_R_BRACELET:
|
||||
case L2Item.SLOT_L_BRACELET:
|
||||
{
|
||||
return 33; // Bracelet
|
||||
}
|
||||
case L2Item.SLOT_HAIR:
|
||||
case L2Item.SLOT_HAIR2:
|
||||
case L2Item.SLOT_HAIRALL:
|
||||
{
|
||||
return 34; // Hair Accessory
|
||||
}
|
||||
}
|
||||
|
||||
// Supplies
|
||||
if (item.getEtcItem().isPotion() || item.getEtcItem().isElixir())
|
||||
{
|
||||
return 35; // Potion
|
||||
}
|
||||
|
||||
if (item.getEtcItem().getHandlerName() != null)
|
||||
{
|
||||
switch (item.getEtcItem().getHandlerName())
|
||||
{
|
||||
case "EnchantScrolls":
|
||||
{
|
||||
if (itemName.contains("weapon"))
|
||||
{
|
||||
return 36; // Scroll: Enchant Weapon
|
||||
}
|
||||
|
||||
if (itemName.contains("armor"))
|
||||
{
|
||||
return 37; // Scroll: Enchant Armor
|
||||
}
|
||||
}
|
||||
case "SoulShots":
|
||||
{
|
||||
return 39; // Soulshot
|
||||
}
|
||||
case "SpiritShot":
|
||||
{
|
||||
return 40; // SpiritShot
|
||||
}
|
||||
case "PetFood":
|
||||
case "BeastSoulShot":
|
||||
case "BeastSpiritShot":
|
||||
case "SummonItems":
|
||||
{
|
||||
return 42; // Pet Supplies
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemName.contains("scroll"))
|
||||
{
|
||||
return 38; // Scroll: Other
|
||||
}
|
||||
|
||||
// Misc
|
||||
if (itemName.contains("crystal") && itemName.contains("-grade"))
|
||||
{
|
||||
return 43; // Crystal
|
||||
}
|
||||
if (itemName.contains("recipe"))
|
||||
{
|
||||
return 44; // Recipe
|
||||
}
|
||||
if (itemName.contains("life stone"))
|
||||
{
|
||||
return 46; // Life Stone
|
||||
}
|
||||
if (itemName.contains("soul crystal"))
|
||||
{
|
||||
return 47; // Soul Crystal
|
||||
}
|
||||
if (itemName.contains("stone") && (itemName.contains("fire") || itemName.contains("water") || itemName.contains("earth") || itemName.contains("wind") || itemName.contains("dark") || itemName.contains("holy")))
|
||||
{
|
||||
return 48; // Attribute Stone
|
||||
}
|
||||
if (itemName.contains("weapon") && itemName.contains("enchant") && itemName.contains("stone"))
|
||||
{
|
||||
return 49; // Weapon Enchant Stone
|
||||
}
|
||||
if (itemName.contains("armor") && itemName.contains("enchant") && itemName.contains("stone"))
|
||||
{
|
||||
return 50; // Armor Enchant Stone
|
||||
}
|
||||
if (itemName.contains("spellbook") || itemName.contains("forgotten scroll"))
|
||||
{
|
||||
return 51; // Spellbook
|
||||
}
|
||||
if (itemName.contains("gemstone") && itemName.contains("-grade"))
|
||||
{
|
||||
return 52; // Gemstone
|
||||
}
|
||||
if (itemName.contains("magic pouch"))
|
||||
{
|
||||
return 53; // Pouch
|
||||
}
|
||||
if (itemName.contains("magic pin"))
|
||||
{
|
||||
return 54; // Pin
|
||||
}
|
||||
if (itemName.contains("magic rune clip"))
|
||||
{
|
||||
return 55; // Magic Rune Clip
|
||||
}
|
||||
if (itemName.contains("magic ornament"))
|
||||
{
|
||||
return 56; // Magic Ornament
|
||||
}
|
||||
if (itemName.contains("dye") && (itemName.contains("str") || itemName.contains("dex") || itemName.contains("con") || itemName.contains("int") || itemName.contains("wit") || itemName.contains("men") || itemName.contains("luc") || itemName.contains("cha")))
|
||||
{
|
||||
return 57; // Dye
|
||||
}
|
||||
if (itemName.contains("ingredient") || itemName.contains("piece") || itemName.contains("edge") || itemName.contains("beads") || itemName.contains("stave") || itemName.contains("design") || itemName.contains("fragment") || itemName.contains("blade") || itemName.contains("head") || itemName.contains("part") || itemName.contains("gem") || itemName.contains("shaft") || itemName.contains("stone") || itemName.contains("fabric") || itemName.contains("pattern") || itemName.contains("lining"))
|
||||
{
|
||||
return 45; // Major Crafting Ingredients
|
||||
}
|
||||
}
|
||||
|
||||
return 58; // Other Item
|
||||
}
|
||||
|
||||
public List<Auctions> getAuctions()
|
||||
{
|
||||
return auctions;
|
||||
}
|
||||
|
||||
public class Auctions
|
||||
{
|
||||
int auctionID;
|
||||
int itemOID;
|
||||
int duration;
|
||||
int playerID;
|
||||
int category;
|
||||
L2ItemInstance item;
|
||||
long price;
|
||||
long count;
|
||||
long finishTime;
|
||||
String itemName;
|
||||
|
||||
public Auctions(int _auctionID, String _itemName, int _itemOID, L2ItemInstance _item, long _price, long _count, int _duration, int _playerID, long _finishTime, int _category)
|
||||
{
|
||||
auctionID = _auctionID;
|
||||
itemName = _itemName;
|
||||
itemOID = _itemOID;
|
||||
item = _item;
|
||||
price = _price;
|
||||
count = _count;
|
||||
duration = _duration;
|
||||
playerID = _playerID;
|
||||
finishTime = _finishTime;
|
||||
category = _category;
|
||||
}
|
||||
|
||||
public int getAuctionId()
|
||||
{
|
||||
return auctionID;
|
||||
}
|
||||
|
||||
public String getItemName()
|
||||
{
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public int getItemOID()
|
||||
{
|
||||
return itemOID;
|
||||
}
|
||||
|
||||
public L2ItemInstance getItem()
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
public long getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public long getCount()
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
public int getDuration()
|
||||
{
|
||||
return duration;
|
||||
}
|
||||
|
||||
public int getPlayerID()
|
||||
{
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public long getFinishTime()
|
||||
{
|
||||
return finishTime;
|
||||
}
|
||||
|
||||
public int getCategory()
|
||||
{
|
||||
return category;
|
||||
}
|
||||
}
|
||||
|
||||
public static final AuctionHouseManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final AuctionHouseManager _instance = new AuctionHouseManager();
|
||||
}
|
||||
}
|
@ -0,0 +1,478 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.instancemanager;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.enums.ItemLocation;
|
||||
import com.l2jserver.gameserver.enums.MailType;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.CommissionManagerInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItem;
|
||||
import com.l2jserver.gameserver.model.entity.Message;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Mail;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionBuyItem;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionDelete;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionList.CommissionListReplyType;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionRegister;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public final class CommissionManager
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(CommissionManager.class.getName());
|
||||
|
||||
private static final int INTERACTION_DISTANCE = 250;
|
||||
private static final int ITEMS_LIMIT_PER_REQUEST = 999;
|
||||
private static final int MAX_ITEMS_REGISTRED_PER_PLAYER = 10;
|
||||
private static final long MIN_REGISTRATION_AND_SALE_FEE = 1000;
|
||||
private static final double REGISTRATION_FEE_PER_DAY = 0.001;
|
||||
private static final double SALE_FEE_PER_DAY = 0.005;
|
||||
|
||||
private static final String SELECT_ALL_ITEMS = "SELECT * FROM `items` WHERE `loc` = ?";
|
||||
private static final String SELECT_ALL_COMMISSION_ITEMS = "SELECT * FROM `commission_items`";
|
||||
private static final String INSERT_COMMISSION_ITEM = "INSERT INTO `commission_items`(`item_object_id`, `price_per_unit`, `start_time`, `duration_in_days`) VALUES (?, ?, ?, ?)";
|
||||
private static final String DELETE_COMMISSION_ITEM = "DELETE FROM `commission_items` WHERE `commission_id` = ?";
|
||||
|
||||
private final Map<Long, CommissionItem> _commissionItems = new ConcurrentSkipListMap<>();
|
||||
|
||||
protected CommissionManager()
|
||||
{
|
||||
final Map<Integer, L2ItemInstance> itemInstances = new HashMap<>();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
|
||||
{
|
||||
ps.setString(1, ItemLocation.COMMISSION.toString());
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final int itemOwnerId = rs.getInt("owner_id");
|
||||
final int itemObjectId = rs.getInt("object_id");
|
||||
final L2ItemInstance itemInstance = L2ItemInstance.restoreFromDb(itemOwnerId, rs);
|
||||
if (itemInstance == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Failed loading item instance with item object id " + itemObjectId + " and owner id " + itemOwnerId + ".");
|
||||
continue;
|
||||
}
|
||||
|
||||
itemInstances.put(itemObjectId, itemInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try (Statement st = con.createStatement();
|
||||
ResultSet rs = st.executeQuery(SELECT_ALL_COMMISSION_ITEMS))
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final long commissionId = rs.getLong("commission_id");
|
||||
final L2ItemInstance itemInstance = itemInstances.get(rs.getInt("item_object_id"));
|
||||
if (itemInstance == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Failed loading commission item with commission id " + commissionId + " because item instance does not exist or failed to load.");
|
||||
continue;
|
||||
}
|
||||
final CommissionItem commissionItem = new CommissionItem(commissionId, itemInstance, rs.getLong("price_per_unit"), rs.getTimestamp("start_time").toInstant(), rs.getByte("duration_in_days"));
|
||||
_commissionItems.put(commissionItem.getCommissionId(), commissionItem);
|
||||
if (commissionItem.getEndTime().isBefore(Instant.now()))
|
||||
{
|
||||
expireSale(commissionItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
commissionItem.setSaleEndTask(ThreadPoolManager.getInstance().scheduleGeneral(() -> expireSale(commissionItem), Duration.between(Instant.now(), commissionItem.getEndTime()).toMillis()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading commission items.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the player the auctions filtered by filter.
|
||||
* @param player the player
|
||||
* @param filter the filter
|
||||
*/
|
||||
public void showAuctions(L2PcInstance player, Predicate<L2Item> filter)
|
||||
{
|
||||
//@formatter:off
|
||||
final List<CommissionItem> commissionItems = _commissionItems.values().stream()
|
||||
.filter(c -> filter.test(c.getItemInfo().getItem()))
|
||||
.limit(ITEMS_LIMIT_PER_REQUEST)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
|
||||
if (commissionItems.isEmpty())
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionList(CommissionListReplyType.ITEM_DOES_NOT_EXIST));
|
||||
return;
|
||||
}
|
||||
|
||||
int chunks = commissionItems.size() / ExResponseCommissionList.MAX_CHUNK_SIZE;
|
||||
if (commissionItems.size() > (chunks * ExResponseCommissionList.MAX_CHUNK_SIZE))
|
||||
{
|
||||
chunks++;
|
||||
}
|
||||
|
||||
for (int i = chunks - 1; i >= 0; i--)
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionList(CommissionListReplyType.AUCTIONS, commissionItems, i, i * ExResponseCommissionList.MAX_CHUNK_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the player his auctions.
|
||||
* @param player the player
|
||||
*/
|
||||
public void showPlayerAuctions(L2PcInstance player)
|
||||
{
|
||||
//@formatter:off
|
||||
final List<CommissionItem> commissionItems = _commissionItems.values().stream()
|
||||
.filter(c -> c.getItemInstance().getOwnerId() == player.getObjectId())
|
||||
.limit(MAX_ITEMS_REGISTRED_PER_PLAYER)
|
||||
.collect(Collectors.toList());
|
||||
//@formatter:on
|
||||
|
||||
if (!commissionItems.isEmpty())
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionList(CommissionListReplyType.PLAYER_AUCTIONS, commissionItems));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionList(CommissionListReplyType.PLAYER_AUCTIONS_EMPTY));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an item for the given player.
|
||||
* @param player the player
|
||||
* @param itemObjectId the item object id
|
||||
* @param itemCount the item count
|
||||
* @param pricePerUnit the price per unit
|
||||
* @param durationInDays the duration in days
|
||||
*/
|
||||
public void registerItem(L2PcInstance player, int itemObjectId, long itemCount, long pricePerUnit, byte durationInDays)
|
||||
{
|
||||
if (itemCount < 1)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_FAILED_TO_BE_REGISTERED);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
final long totalPrice = itemCount * pricePerUnit;
|
||||
if (totalPrice <= MIN_REGISTRATION_AND_SALE_FEE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_CANNOT_BE_REGISTERED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(itemObjectId);
|
||||
if ((itemInstance == null) || !itemInstance.isAvailable(player, false, false) || (itemInstance.getCount() < itemCount))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_FAILED_TO_BE_REGISTERED);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
//@formatter:off
|
||||
final long playerRegisteredItems = _commissionItems.values().stream()
|
||||
.filter(c -> c.getItemInstance().getOwnerId() == player.getObjectId())
|
||||
.count();
|
||||
//@formatter:on
|
||||
|
||||
if (playerRegisteredItems >= MAX_ITEMS_REGISTRED_PER_PLAYER)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_FAILED_TO_BE_REGISTERED);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
final long registrationFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, (totalPrice * REGISTRATION_FEE_PER_DAY) * durationInDays);
|
||||
if (!player.getInventory().reduceAdena("Commission Registration Fee", registrationFee, player, null))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_TO_REGISTER_THE_ITEM);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
itemInstance = player.getInventory().detachItem("Commission Registration", itemInstance, itemCount, ItemLocation.COMMISSION, player, null);
|
||||
if (itemInstance == null)
|
||||
{
|
||||
player.getInventory().addAdena("Commission error refund", registrationFee, player, null);
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_FAILED_TO_BE_REGISTERED);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
|
||||
{
|
||||
final Instant startTime = Instant.now();
|
||||
ps.setInt(1, itemInstance.getObjectId());
|
||||
ps.setLong(2, pricePerUnit);
|
||||
ps.setTimestamp(3, Timestamp.from(startTime));
|
||||
ps.setByte(4, durationInDays);
|
||||
ps.executeUpdate();
|
||||
try (ResultSet rs = ps.getGeneratedKeys())
|
||||
{
|
||||
if (rs.next())
|
||||
{
|
||||
final CommissionItem commissionItem = new CommissionItem(rs.getLong(1), itemInstance, pricePerUnit, startTime, durationInDays);
|
||||
final ScheduledFuture<?> saleEndTask = ThreadPoolManager.getInstance().scheduleGeneral(() -> expireSale(commissionItem), Duration.between(Instant.now(), commissionItem.getEndTime()).toMillis());
|
||||
commissionItem.setSaleEndTask(saleEndTask);
|
||||
_commissionItems.put(commissionItem.getCommissionId(), commissionItem);
|
||||
player.getLastCommissionInfos().put(itemInstance.getId(), new ExResponseCommissionInfo(itemInstance.getId(), pricePerUnit, itemCount, (byte) ((durationInDays - 1) / 2)));
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_BEEN_SUCCESSFULLY_REGISTERED);
|
||||
player.sendPacket(ExResponseCommissionRegister.SUCCEED);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed inserting commission item. ItemInstance: " + itemInstance, e);
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_FAILED_TO_BE_REGISTERED);
|
||||
player.sendPacket(ExResponseCommissionRegister.FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an item and returns it to the player.
|
||||
* @param player the player
|
||||
* @param commissionId the commission id
|
||||
*/
|
||||
public void deleteItem(L2PcInstance player, long commissionId)
|
||||
{
|
||||
final CommissionItem commissionItem = getCommissionItem(commissionId);
|
||||
if (commissionItem == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_HAS_FAILED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
player.sendPacket(ExResponseCommissionDelete.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (commissionItem.getItemInstance().getOwnerId() != player.getObjectId())
|
||||
{
|
||||
player.sendPacket(ExResponseCommissionDelete.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getInventory().getSize(false) >= (player.getInventoryLimit() * 0.8)) || (player.getWeightPenalty() >= 3))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.IF_THE_WEIGHT_IS_80_OR_MORE_AND_THE_INVENTORY_NUMBER_IS_90_OR_MORE_PURCHASE_CANCELLATION_IS_NOT_POSSIBLE);
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_HAS_FAILED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
player.sendPacket(ExResponseCommissionDelete.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_commissionItems.remove(commissionId) == null) || !commissionItem.getSaleEndTask().cancel(false))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_HAS_FAILED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
player.sendPacket(ExResponseCommissionDelete.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (deleteItemFromDB(commissionId))
|
||||
{
|
||||
player.getInventory().addItem("Commission Cancellation", commissionItem.getItemInstance(), player, null);
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_FOR_THE_ITEM_IS_SUCCESSFUL);
|
||||
player.sendPacket(ExResponseCommissionDelete.SUCCEED);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_HAS_FAILED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
player.sendPacket(ExResponseCommissionDelete.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Buys the item for the given player.
|
||||
* @param player the player
|
||||
* @param commissionId the commission id
|
||||
*/
|
||||
public void buyItem(L2PcInstance player, long commissionId)
|
||||
{
|
||||
final CommissionItem commissionItem = getCommissionItem(commissionId);
|
||||
if (commissionItem == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_HAS_FAILED);
|
||||
player.sendPacket(ExResponseCommissionBuyItem.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemInstance = commissionItem.getItemInstance();
|
||||
if (itemInstance.getOwnerId() == player.getObjectId())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_HAS_FAILED);
|
||||
player.sendPacket(ExResponseCommissionBuyItem.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getInventory().getSize(false) >= (player.getInventoryLimit() * 0.8)) || (player.getWeightPenalty() >= 3))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.IF_THE_WEIGHT_IS_80_OR_MORE_AND_THE_INVENTORY_NUMBER_IS_90_OR_MORE_PURCHASE_CANCELLATION_IS_NOT_POSSIBLE);
|
||||
player.sendPacket(ExResponseCommissionBuyItem.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
final long totalPrice = itemInstance.getCount() * commissionItem.getPricePerUnit();
|
||||
if (!player.getInventory().reduceAdena("Commission Registration Fee", totalPrice, player, null))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
player.sendPacket(ExResponseCommissionBuyItem.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_commissionItems.remove(commissionId) == null) || !commissionItem.getSaleEndTask().cancel(false))
|
||||
{
|
||||
player.getInventory().addAdena("Commission error refund", totalPrice, player, null);
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_HAS_FAILED);
|
||||
player.sendPacket(ExResponseCommissionBuyItem.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (deleteItemFromDB(commissionId))
|
||||
{
|
||||
final long saleFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, (totalPrice * SALE_FEE_PER_DAY) * commissionItem.getDurationInDays());
|
||||
final Message mail = new Message(itemInstance.getOwnerId(), itemInstance, MailType.COMMISSION_ITEM_SOLD);
|
||||
|
||||
final Mail attachement = mail.createAttachments();
|
||||
attachement.addItem("Commission Item Sold", Inventory.ADENA_ID, totalPrice - saleFee, player, null);
|
||||
MailManager.getInstance().sendMessage(mail);
|
||||
|
||||
player.sendPacket(new ExResponseCommissionBuyItem(commissionItem));
|
||||
player.getInventory().addItem("Commission Buy Item", commissionItem.getItemInstance(), player, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addAdena("Commission error refund", totalPrice, player, null);
|
||||
player.sendPacket(ExResponseCommissionBuyItem.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a commission item from database.
|
||||
* @param commissionId the commission item
|
||||
* @return {@code true} if the item was deleted successfully, {@code false} otherwise
|
||||
*/
|
||||
private boolean deleteItemFromDB(long commissionId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
|
||||
{
|
||||
ps.setLong(1, commissionId);
|
||||
if (ps.executeUpdate() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed deleting commission item. Commission ID: " + commissionId, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expires the sale of a commission item and sends the item back to the player.
|
||||
* @param commissionItem the comission item
|
||||
*/
|
||||
private void expireSale(CommissionItem commissionItem)
|
||||
{
|
||||
if ((_commissionItems.remove(commissionItem.getCommissionId()) != null) && deleteItemFromDB(commissionItem.getCommissionId()))
|
||||
{
|
||||
final Message mail = new Message(commissionItem.getItemInstance().getOwnerId(), commissionItem.getItemInstance(), MailType.COMMISSION_ITEM_RETURNED);
|
||||
MailManager.getInstance().sendMessage(mail);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commission item.
|
||||
* @param commissionId the commission id to get
|
||||
* @return the commission item if it exists, {@code null} otherwise
|
||||
*/
|
||||
public CommissionItem getCommissionItem(long commissionId)
|
||||
{
|
||||
return _commissionItems.get(commissionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player is allowed to interact with commission manager.
|
||||
* @param player the player
|
||||
* @return {@code true} if the player is allowed to interact, {@code false} otherwise
|
||||
*/
|
||||
public static boolean isPlayerAllowedToInteract(L2PcInstance player)
|
||||
{
|
||||
final L2Npc npc = player.getLastFolkNPC();
|
||||
if ((npc != null) && (npc instanceof CommissionManagerInstance))
|
||||
{
|
||||
return npc.calculateDistance(player, true, false) <= INTERACTION_DISTANCE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance.
|
||||
* @return the single instance
|
||||
*/
|
||||
public static CommissionManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final CommissionManager _instance = new CommissionManager();
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ package com.l2jserver.gameserver.instancemanager;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Duel;
|
||||
@ -29,20 +30,11 @@ import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
public final class DuelManager
|
||||
{
|
||||
private final Map<Integer, Duel> _duels = new ConcurrentHashMap<>();
|
||||
private int _currentDuelId = 0x90;
|
||||
private final AtomicInteger _currentDuelId = new AtomicInteger();
|
||||
|
||||
protected DuelManager()
|
||||
{
|
||||
}
|
||||
|
||||
private int getNextDuelId()
|
||||
{
|
||||
// In case someone wants to run the server forever :)
|
||||
if (++_currentDuelId >= 2147483640)
|
||||
{
|
||||
_currentDuelId = 1;
|
||||
}
|
||||
return _currentDuelId;
|
||||
|
||||
}
|
||||
|
||||
public Duel getDuel(int duelId)
|
||||
@ -104,7 +96,7 @@ public final class DuelManager
|
||||
return;
|
||||
}
|
||||
}
|
||||
final int duelId = getNextDuelId();
|
||||
final int duelId = _currentDuelId.incrementAndGet();
|
||||
_duels.put(duelId, new Duel(playerA, playerB, partyDuel, duelId));
|
||||
}
|
||||
|
||||
|
@ -1762,7 +1762,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent monsters buffing players.
|
||||
// FIXME: Prevent monsters buffing players.
|
||||
if (isMonster() && !target.isMonster() && !skill.isBad() && skill.getName().contains("NPC"))
|
||||
{
|
||||
setTarget(this);
|
||||
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.instance;
|
||||
|
||||
import com.l2jserver.gameserver.enums.InstanceType;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExShowCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class CommissionManagerInstance extends L2Npc
|
||||
{
|
||||
public CommissionManagerInstance(L2NpcTemplate template)
|
||||
{
|
||||
super(template);
|
||||
setInstanceType(InstanceType.CommissionManagerInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBypassFeedback(L2PcInstance player, String command)
|
||||
{
|
||||
if (command.equalsIgnoreCase("show_commission"))
|
||||
{
|
||||
player.sendPacket(ExShowCommission.STATIC_PACKET);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.onBypassFeedback(player, command);
|
||||
}
|
||||
}
|
||||
}
|
@ -221,7 +221,6 @@ import com.l2jserver.gameserver.model.interfaces.IEventListener;
|
||||
import com.l2jserver.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcAuction;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcFreight;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcRefund;
|
||||
@ -256,7 +255,6 @@ import com.l2jserver.gameserver.model.variables.AccountVariables;
|
||||
import com.l2jserver.gameserver.model.variables.PlayerVariables;
|
||||
import com.l2jserver.gameserver.model.zone.L2ZoneType;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2BattalionZone;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
|
||||
import com.l2jserver.gameserver.network.L2GameClient;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -332,6 +330,7 @@ import com.l2jserver.gameserver.network.serverpackets.TradeOtherDone;
|
||||
import com.l2jserver.gameserver.network.serverpackets.TradeStart;
|
||||
import com.l2jserver.gameserver.network.serverpackets.UserInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.friend.L2FriendStatus;
|
||||
import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
@ -550,7 +549,6 @@ public final class L2PcInstance extends L2Playable
|
||||
private int _vitalityPoints = 140000;
|
||||
|
||||
private final PcInventory _inventory = new PcInventory(this);
|
||||
private final PcAuction _auctionInventory = new PcAuction(this);
|
||||
private final PcFreight _freight = new PcFreight(this);
|
||||
private PcWarehouse _warehouse;
|
||||
private PcRefund _refund;
|
||||
@ -679,7 +677,7 @@ public final class L2PcInstance extends L2Playable
|
||||
private boolean _exchangeRefusal = false; // Exchange refusal
|
||||
|
||||
private L2Party _party;
|
||||
PartyDistributionType _partyDistributionType;
|
||||
private PartyDistributionType _partyDistributionType;
|
||||
|
||||
// this is needed to find the inviting player for Party response
|
||||
// there can only be one active party request at once
|
||||
@ -694,6 +692,8 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
private L2ItemInstance _lure = null;
|
||||
|
||||
private volatile Map<Integer, ExResponseCommissionInfo> _lastCommissionInfos;
|
||||
|
||||
public boolean isSpawnProtected()
|
||||
{
|
||||
return _protectEndTime > GameTimeController.getInstance().getGameTicks();
|
||||
@ -723,17 +723,6 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
private volatile Map<Class<? extends AbstractRequest>, AbstractRequest> _requests;
|
||||
|
||||
private boolean _isEnchanting = false;
|
||||
private int _activeEnchantItemId = ID_NONE;
|
||||
private int _activeEnchantSupportItemId = ID_NONE;
|
||||
private int _activeEnchantAttrItemId = ID_NONE;
|
||||
private long _activeEnchantTimestamp = 0;
|
||||
|
||||
private int _firstCompoundOID = -1;
|
||||
private int _secondCompoundOID = -1;
|
||||
|
||||
private boolean _usingPrimeShop = false;
|
||||
|
||||
protected boolean _inventoryDisable = false;
|
||||
/** Player's cubics. */
|
||||
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>(); // TODO(Zoey76): This should be sorted in insert order.
|
||||
@ -2434,63 +2423,6 @@ public final class L2PcInstance extends L2Playable
|
||||
return getStat().getExp();
|
||||
}
|
||||
|
||||
public void setActiveEnchantAttrItemId(int objectId)
|
||||
{
|
||||
_activeEnchantAttrItemId = objectId;
|
||||
}
|
||||
|
||||
public int getActiveEnchantAttrItemId()
|
||||
{
|
||||
return _activeEnchantAttrItemId;
|
||||
}
|
||||
|
||||
public void setActiveEnchantItemId(int objectId)
|
||||
{
|
||||
// If we don't have a Enchant Item, we are not enchanting.
|
||||
if (objectId == ID_NONE)
|
||||
{
|
||||
setActiveEnchantSupportItemId(ID_NONE);
|
||||
setActiveEnchantTimestamp(0);
|
||||
setIsEnchanting(false);
|
||||
}
|
||||
_activeEnchantItemId = objectId;
|
||||
}
|
||||
|
||||
public int getActiveEnchantItemId()
|
||||
{
|
||||
return _activeEnchantItemId;
|
||||
}
|
||||
|
||||
public void setActiveEnchantSupportItemId(int objectId)
|
||||
{
|
||||
_activeEnchantSupportItemId = objectId;
|
||||
}
|
||||
|
||||
public int getActiveEnchantSupportItemId()
|
||||
{
|
||||
return _activeEnchantSupportItemId;
|
||||
}
|
||||
|
||||
public long getActiveEnchantTimestamp()
|
||||
{
|
||||
return _activeEnchantTimestamp;
|
||||
}
|
||||
|
||||
public void setActiveEnchantTimestamp(long val)
|
||||
{
|
||||
_activeEnchantTimestamp = val;
|
||||
}
|
||||
|
||||
public void setIsEnchanting(boolean val)
|
||||
{
|
||||
_isEnchanting = val;
|
||||
}
|
||||
|
||||
public boolean isEnchanting()
|
||||
{
|
||||
return _isEnchanting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fists weapon of the L2PcInstance (used when no weapon is equiped).
|
||||
* @param weaponItem The fists L2Weapon to set to the L2PcInstance
|
||||
@ -2858,11 +2790,6 @@ public final class L2PcInstance extends L2Playable
|
||||
return _inventory;
|
||||
}
|
||||
|
||||
public PcAuction getAuctionInventory()
|
||||
{
|
||||
return _auctionInventory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a ShortCut of the L2PcInstance _shortCuts.
|
||||
* @param objectId
|
||||
@ -3976,7 +3903,7 @@ public final class L2PcInstance extends L2Playable
|
||||
return null;
|
||||
}
|
||||
|
||||
if (getActiveEnchantItemId() == objectId)
|
||||
if (isProcessingItem(objectId))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
@ -5645,8 +5572,6 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
setPvpKills(getPvpKills() + 1);
|
||||
|
||||
L2BattalionZone.givereward(this);
|
||||
|
||||
// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
|
||||
UserInfo ui = new UserInfo(this, false);
|
||||
ui.addComponentType(UserInfoType.SOCIAL);
|
||||
@ -11364,7 +11289,7 @@ public final class L2PcInstance extends L2Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getActiveEnchantItemId() == objectId)
|
||||
if (isProcessingItem(objectId))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
@ -13983,7 +13908,7 @@ public final class L2PcInstance extends L2Playable
|
||||
sendPacket(sm);
|
||||
}
|
||||
|
||||
// Prevent falling in game graphics.
|
||||
// FIXME: Prevent falling in game graphics.
|
||||
sendPacket(new ValidateLocation(this));
|
||||
|
||||
setFalling();
|
||||
@ -15093,11 +15018,17 @@ public final class L2PcInstance extends L2Playable
|
||||
return getPlayerSide() == CastleSide.LIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum amount of points that player can use
|
||||
*/
|
||||
public int getMaxSummonPoints()
|
||||
{
|
||||
return (int) getStat().calcStat(Stats.MAX_SUMMON_POINTS, 0, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of points that player used
|
||||
*/
|
||||
public int getSummonPoints()
|
||||
{
|
||||
return getServitors().values().stream().mapToInt(L2Summon::getSummonPoints).sum();
|
||||
@ -15232,36 +15163,6 @@ public final class L2PcInstance extends L2Playable
|
||||
_vitalityPoints = points;
|
||||
}
|
||||
|
||||
public int getFirstCompoundOID()
|
||||
{
|
||||
return _firstCompoundOID;
|
||||
}
|
||||
|
||||
public void setFirstCompoundOID(int firstCompoundOID)
|
||||
{
|
||||
_firstCompoundOID = firstCompoundOID;
|
||||
}
|
||||
|
||||
public int getSecondCompoundOID()
|
||||
{
|
||||
return _secondCompoundOID;
|
||||
}
|
||||
|
||||
public void setSecondCompoundOID(int secondCompoundOID)
|
||||
{
|
||||
_secondCompoundOID = secondCompoundOID;
|
||||
}
|
||||
|
||||
public void setUsingPrimeShop(boolean isUsing)
|
||||
{
|
||||
_usingPrimeShop = isUsing;
|
||||
}
|
||||
|
||||
public boolean isUsingPrimeShop()
|
||||
{
|
||||
return _usingPrimeShop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prime shop points of the player.
|
||||
*/
|
||||
@ -15282,6 +15183,25 @@ public final class L2PcInstance extends L2Playable
|
||||
vars.storeMe();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last commission infos.
|
||||
* @return the last commission infos
|
||||
*/
|
||||
public Map<Integer, ExResponseCommissionInfo> getLastCommissionInfos()
|
||||
{
|
||||
if (_lastCommissionInfos == null)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (_lastCommissionInfos == null)
|
||||
{
|
||||
_lastCommissionInfos = new ConcurrentHashMap<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _lastCommissionInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the whisperers.
|
||||
* @return the whisperers
|
||||
|
@ -182,6 +182,7 @@ public class PcKnownList extends PlayableKnownList
|
||||
return 2900;
|
||||
}
|
||||
|
||||
// Old custom/wrong method.
|
||||
// if (knownlistSize <= 70)
|
||||
// {
|
||||
// return 2300;
|
||||
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.request;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaCancel;
|
||||
|
||||
/**
|
||||
* @author Sdw
|
||||
*/
|
||||
public class AdenaDistributionRequest extends AbstractRequest
|
||||
{
|
||||
private final L2PcInstance _distributor;
|
||||
private final List<L2PcInstance> _players;
|
||||
private final int _adenaObjectId;
|
||||
private final long _adenaCount;
|
||||
|
||||
public AdenaDistributionRequest(L2PcInstance activeChar, L2PcInstance distributor, List<L2PcInstance> players, int adenaObjectId, long adenaCount)
|
||||
{
|
||||
super(activeChar);
|
||||
_distributor = distributor;
|
||||
_adenaObjectId = adenaObjectId;
|
||||
_players = players;
|
||||
_adenaCount = adenaCount;
|
||||
}
|
||||
|
||||
public L2PcInstance getDistributor()
|
||||
{
|
||||
return _distributor;
|
||||
}
|
||||
|
||||
public List<L2PcInstance> getPlayers()
|
||||
{
|
||||
return _players;
|
||||
}
|
||||
|
||||
public int getAdenaObjectId()
|
||||
{
|
||||
return _adenaObjectId;
|
||||
}
|
||||
|
||||
public long getAdenaCount()
|
||||
{
|
||||
return _adenaCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsing(int objectId)
|
||||
{
|
||||
return objectId == _adenaObjectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeout()
|
||||
{
|
||||
super.onTimeout();
|
||||
_players.forEach(p ->
|
||||
{
|
||||
p.removeRequest(AdenaDistributionRequest.class);
|
||||
p.sendPacket(ExDivideAdenaCancel.STATIC_PACKET);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.request;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class CompoundRequest extends AbstractRequest
|
||||
{
|
||||
private int _itemOne;
|
||||
private int _itemTwo;
|
||||
|
||||
public CompoundRequest(L2PcInstance activeChar)
|
||||
{
|
||||
super(activeChar);
|
||||
}
|
||||
|
||||
public L2ItemInstance getItemOne()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_itemOne);
|
||||
}
|
||||
|
||||
public void setItemOne(int itemOne)
|
||||
{
|
||||
_itemOne = itemOne;
|
||||
}
|
||||
|
||||
public L2ItemInstance getItemTwo()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_itemTwo);
|
||||
}
|
||||
|
||||
public void setItemTwo(int itemTwo)
|
||||
{
|
||||
_itemTwo = itemTwo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemRequest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWorkWith(AbstractRequest request)
|
||||
{
|
||||
return !request.isItemRequest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsing(int objectId)
|
||||
{
|
||||
return (objectId > 0) && ((objectId == _itemOne) || (objectId == _itemTwo));
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.request;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantItemAttributeRequest extends AbstractRequest
|
||||
{
|
||||
private volatile int _enchantingItemObjectId;
|
||||
private volatile int _enchantingStoneObjectId;
|
||||
|
||||
public EnchantItemAttributeRequest(L2PcInstance activeChar, int enchantingStoneObjectId)
|
||||
{
|
||||
super(activeChar);
|
||||
_enchantingStoneObjectId = enchantingStoneObjectId;
|
||||
}
|
||||
|
||||
public L2ItemInstance getEnchantingItem()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_enchantingItemObjectId);
|
||||
}
|
||||
|
||||
public void setEnchantingItem(int objectId)
|
||||
{
|
||||
_enchantingItemObjectId = objectId;
|
||||
}
|
||||
|
||||
public L2ItemInstance getEnchantingStone()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_enchantingStoneObjectId);
|
||||
}
|
||||
|
||||
public void setEnchantingStone(int objectId)
|
||||
{
|
||||
_enchantingStoneObjectId = objectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemRequest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWorkWith(AbstractRequest request)
|
||||
{
|
||||
return !request.isItemRequest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsing(int objectId)
|
||||
{
|
||||
return (objectId > 0) && ((objectId == _enchantingItemObjectId) || (objectId == _enchantingStoneObjectId));
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.request;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class EnchantItemRequest extends AbstractRequest
|
||||
{
|
||||
private volatile int _enchantingItemObjectId;
|
||||
private volatile int _enchantingScrollObjectId;
|
||||
private volatile int _supportItemObjectId;
|
||||
|
||||
public EnchantItemRequest(L2PcInstance activeChar, int enchantingScrollObjectId)
|
||||
{
|
||||
super(activeChar);
|
||||
_enchantingScrollObjectId = enchantingScrollObjectId;
|
||||
}
|
||||
|
||||
public L2ItemInstance getEnchantingItem()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_enchantingItemObjectId);
|
||||
}
|
||||
|
||||
public void setEnchantingItem(int objectId)
|
||||
{
|
||||
_enchantingItemObjectId = objectId;
|
||||
}
|
||||
|
||||
public L2ItemInstance getEnchantingScroll()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_enchantingScrollObjectId);
|
||||
}
|
||||
|
||||
public void setEnchantingScroll(int objectId)
|
||||
{
|
||||
_enchantingScrollObjectId = objectId;
|
||||
}
|
||||
|
||||
public L2ItemInstance getSupportItem()
|
||||
{
|
||||
return getActiveChar().getInventory().getItemByObjectId(_supportItemObjectId);
|
||||
}
|
||||
|
||||
public void setSupportItem(int objectId)
|
||||
{
|
||||
_supportItemObjectId = objectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemRequest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWorkWith(AbstractRequest request)
|
||||
{
|
||||
return !request.isItemRequest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsing(int objectId)
|
||||
{
|
||||
return (objectId > 0) && ((objectId == _enchantingItemObjectId) || (objectId == _enchantingScrollObjectId) || (objectId == _supportItemObjectId));
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.request;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class PartyRequest extends AbstractRequest
|
||||
{
|
||||
private final L2PcInstance _targetPlayer;
|
||||
|
||||
public PartyRequest(L2PcInstance activeChar, L2PcInstance targetPlayer)
|
||||
{
|
||||
super(activeChar);
|
||||
Objects.requireNonNull(targetPlayer);
|
||||
_targetPlayer = targetPlayer;
|
||||
}
|
||||
|
||||
public L2PcInstance getTargetPlayer()
|
||||
{
|
||||
return _targetPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsing(int objectId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeout()
|
||||
{
|
||||
super.onTimeout();
|
||||
getActiveChar().removeRequest(getClass());
|
||||
_targetPlayer.removeRequest(getClass());
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.actor.request;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class PrimeShopRequest extends AbstractRequest
|
||||
{
|
||||
public PrimeShopRequest(L2PcInstance activeChar)
|
||||
{
|
||||
super(activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsing(int objectId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.commission;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import com.l2jserver.gameserver.model.ItemInfo;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class CommissionItem
|
||||
{
|
||||
private final long _commissionId;
|
||||
private final L2ItemInstance _itemInstance;
|
||||
private final ItemInfo _itemInfo;
|
||||
private final long _pricePerUnit;
|
||||
private final Instant _startTime;
|
||||
private final byte _durationInDays;
|
||||
private ScheduledFuture<?> _saleEndTask;
|
||||
|
||||
public CommissionItem(long commissionId, L2ItemInstance itemInstance, long pricePerUnit, Instant startTime, byte durationInDays)
|
||||
{
|
||||
_commissionId = commissionId;
|
||||
_itemInstance = itemInstance;
|
||||
_itemInfo = new ItemInfo(_itemInstance);
|
||||
_pricePerUnit = pricePerUnit;
|
||||
_startTime = startTime;
|
||||
_durationInDays = durationInDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commission id.
|
||||
* @return the commission id
|
||||
*/
|
||||
public long getCommissionId()
|
||||
{
|
||||
return _commissionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item instance.
|
||||
* @return the item instance
|
||||
*/
|
||||
public L2ItemInstance getItemInstance()
|
||||
{
|
||||
return _itemInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item info.
|
||||
* @return the item info
|
||||
*/
|
||||
public ItemInfo getItemInfo()
|
||||
{
|
||||
return _itemInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the price per unit.
|
||||
* @return the price per unit
|
||||
*/
|
||||
public long getPricePerUnit()
|
||||
{
|
||||
return _pricePerUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start time.
|
||||
* @return the start time
|
||||
*/
|
||||
public Instant getStartTime()
|
||||
{
|
||||
return _startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the duration in days.
|
||||
* @return the duration in days
|
||||
*/
|
||||
public byte getDurationInDays()
|
||||
{
|
||||
return _durationInDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the end time.
|
||||
* @return the end time
|
||||
*/
|
||||
public Instant getEndTime()
|
||||
{
|
||||
return _startTime.plus(_durationInDays, ChronoUnit.DAYS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sale end task.
|
||||
* @return the sale end task
|
||||
*/
|
||||
public ScheduledFuture<?> getSaleEndTask()
|
||||
{
|
||||
return _saleEndTask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sale end task.
|
||||
* @param saleEndTask the sale end task
|
||||
*/
|
||||
public void setSaleEndTask(ScheduledFuture<?> saleEndTask)
|
||||
{
|
||||
_saleEndTask = saleEndTask;
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.commission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public enum CommissionItemType
|
||||
{
|
||||
// Weapon
|
||||
ONE_HAND_SWORD(1),
|
||||
ONE_HAND_MAGIC_SWORD(2),
|
||||
DAGGER(3),
|
||||
RAPIER(4),
|
||||
TWO_HAND_SWORD(5),
|
||||
ANCIENT_SWORD(6),
|
||||
DUALSWORD(7),
|
||||
DUAL_DAGGER(8),
|
||||
BLUNT_WEAPON(9),
|
||||
ONE_HAND_MAGIC_BLUNT_WEAPON(10),
|
||||
TWO_HAND_BLUNT_WEAPON(11),
|
||||
TWO_HAND_MAGIC_BLUNT_WEAPON(12),
|
||||
DUAL_BLUNT_WEAPON(13),
|
||||
BOW(14),
|
||||
CROSSBOW(15),
|
||||
FIST_WEAPON(16),
|
||||
SPEAR(17),
|
||||
OTHER_WEAPON(18),
|
||||
// Armor
|
||||
HELMET(19),
|
||||
ARMOR_TOP(20),
|
||||
ARMOR_PANTS(21),
|
||||
FULL_BODY(22),
|
||||
GLOVES(23),
|
||||
FEET(24),
|
||||
SHIELD(25),
|
||||
SIGIL(26),
|
||||
UNDERWEAR(27),
|
||||
CLOAK(28),
|
||||
// Accessory
|
||||
RING(29),
|
||||
EARRING(30),
|
||||
NECKLACE(31),
|
||||
BELT(32),
|
||||
BRACELET(33),
|
||||
HAIR_ACCESSORY(34),
|
||||
// Supplies
|
||||
POTION(35),
|
||||
SCROLL_ENCHANT_WEAPON(36),
|
||||
SCROLL_ENCHANT_ARMOR(37),
|
||||
SCROLL_OTHER(38),
|
||||
SOULSHOT(39),
|
||||
SPIRITSHOT(40),
|
||||
// Pet Goods
|
||||
PET_EQUIPMENT(42),
|
||||
PET_SUPPLIES(43),
|
||||
// Misc.
|
||||
CRYSTAL(44),
|
||||
RECIPE(45),
|
||||
MAJOR_CRAFTING_INGREDIENTS(46),
|
||||
LIFE_STONE(47),
|
||||
SOUL_CRYSTAL(48),
|
||||
ATTRIBUTE_STONE(49),
|
||||
WEAPON_ENCHANT_STONE(50),
|
||||
ARMOR_ENCHANT_STONE(51),
|
||||
SPELLBOOK(52),
|
||||
GEMSTONE(53),
|
||||
POUCH(54),
|
||||
PIN(55),
|
||||
MAGIC_RUNE_CLIP(56),
|
||||
MAGIC_ORNAMENT(57),
|
||||
DYES(58),
|
||||
OTHER_ITEM(59);
|
||||
|
||||
private final int _clientId;
|
||||
|
||||
private CommissionItemType(int clientId)
|
||||
{
|
||||
_clientId = clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client id.
|
||||
* @return the client id
|
||||
*/
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the commission item type by the client id
|
||||
* @param clientId the client id
|
||||
* @return the commission item type if its found, {@code null} otherwise
|
||||
*/
|
||||
public static CommissionItemType findByClientId(int clientId)
|
||||
{
|
||||
for (CommissionItemType value : values())
|
||||
{
|
||||
if (value.getClientId() == clientId)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.commission;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public enum CommissionTreeType
|
||||
{
|
||||
WEAPON(
|
||||
0,
|
||||
CommissionItemType.ONE_HAND_SWORD,
|
||||
CommissionItemType.ONE_HAND_MAGIC_SWORD,
|
||||
CommissionItemType.DAGGER,
|
||||
CommissionItemType.RAPIER,
|
||||
CommissionItemType.TWO_HAND_SWORD,
|
||||
CommissionItemType.ANCIENT_SWORD,
|
||||
CommissionItemType.DUALSWORD,
|
||||
CommissionItemType.DUAL_DAGGER,
|
||||
CommissionItemType.BLUNT_WEAPON,
|
||||
CommissionItemType.ONE_HAND_MAGIC_BLUNT_WEAPON,
|
||||
CommissionItemType.TWO_HAND_BLUNT_WEAPON,
|
||||
CommissionItemType.TWO_HAND_MAGIC_BLUNT_WEAPON,
|
||||
CommissionItemType.DUAL_BLUNT_WEAPON,
|
||||
CommissionItemType.BOW,
|
||||
CommissionItemType.CROSSBOW,
|
||||
CommissionItemType.FIST_WEAPON,
|
||||
CommissionItemType.SPEAR,
|
||||
CommissionItemType.OTHER_WEAPON),
|
||||
ARMOR(1, CommissionItemType.HELMET, CommissionItemType.ARMOR_TOP, CommissionItemType.ARMOR_PANTS, CommissionItemType.FULL_BODY, CommissionItemType.GLOVES, CommissionItemType.FEET, CommissionItemType.SHIELD, CommissionItemType.SIGIL, CommissionItemType.UNDERWEAR, CommissionItemType.CLOAK),
|
||||
ACCESSORY(2, CommissionItemType.RING, CommissionItemType.EARRING, CommissionItemType.NECKLACE, CommissionItemType.BELT, CommissionItemType.BRACELET, CommissionItemType.HAIR_ACCESSORY),
|
||||
SUPPLIES(3, CommissionItemType.POTION, CommissionItemType.SCROLL_ENCHANT_WEAPON, CommissionItemType.SCROLL_ENCHANT_ARMOR, CommissionItemType.SCROLL_OTHER, CommissionItemType.SOULSHOT, CommissionItemType.SPIRITSHOT),
|
||||
PET_GOODS(4, CommissionItemType.PET_EQUIPMENT, CommissionItemType.PET_SUPPLIES),
|
||||
MISC(
|
||||
5,
|
||||
CommissionItemType.CRYSTAL,
|
||||
CommissionItemType.RECIPE,
|
||||
CommissionItemType.MAJOR_CRAFTING_INGREDIENTS,
|
||||
CommissionItemType.LIFE_STONE,
|
||||
CommissionItemType.SOUL_CRYSTAL,
|
||||
CommissionItemType.ATTRIBUTE_STONE,
|
||||
CommissionItemType.WEAPON_ENCHANT_STONE,
|
||||
CommissionItemType.ARMOR_ENCHANT_STONE,
|
||||
CommissionItemType.SPELLBOOK,
|
||||
CommissionItemType.GEMSTONE,
|
||||
CommissionItemType.POUCH,
|
||||
CommissionItemType.PIN,
|
||||
CommissionItemType.MAGIC_RUNE_CLIP,
|
||||
CommissionItemType.MAGIC_ORNAMENT,
|
||||
CommissionItemType.DYES,
|
||||
CommissionItemType.OTHER_ITEM);
|
||||
|
||||
private final int _clientId;
|
||||
private final Set<CommissionItemType> _commissionItemTypes;
|
||||
|
||||
private CommissionTreeType(int clientId, CommissionItemType... commissionItemTypes)
|
||||
{
|
||||
_clientId = clientId;
|
||||
_commissionItemTypes = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(commissionItemTypes)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client id.
|
||||
* @return the client id
|
||||
*/
|
||||
public int getClientId()
|
||||
{
|
||||
return _clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filter.
|
||||
* @return the filter
|
||||
*/
|
||||
public Set<CommissionItemType> getCommissionItemTypes()
|
||||
{
|
||||
return _commissionItemTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the commission tree type by the client id
|
||||
* @param clientId the client id
|
||||
* @return the commission tree type if its found, {@code null} otherwise
|
||||
*/
|
||||
public static CommissionTreeType findByClientId(int clientId)
|
||||
{
|
||||
for (CommissionTreeType value : values())
|
||||
{
|
||||
if (value.getClientId() == clientId)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -65,7 +65,7 @@ public class ConditionChangeWeapon extends Condition
|
||||
return false;
|
||||
}
|
||||
|
||||
if (effector.getActingPlayer().isEnchanting())
|
||||
if (effector.getActingPlayer().hasItemRequest())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -61,8 +61,6 @@ public class Message
|
||||
private boolean _hasAttachments;
|
||||
private Mail _attachments = null;
|
||||
private ScheduledFuture<?> _unloadTask = null;
|
||||
private int _systemMessage1 = 0;
|
||||
private int _systemMessage2 = 0;
|
||||
|
||||
private int _itemId;
|
||||
private int _enchantLvl;
|
||||
@ -97,8 +95,6 @@ public class Message
|
||||
_elementals[i] = Integer.parseInt(elemDef[i]);
|
||||
}
|
||||
}
|
||||
_systemMessage1 = rset.getInt("systemMessage1");
|
||||
_systemMessage2 = rset.getInt("systemMessage2");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -119,28 +115,6 @@ public class Message
|
||||
_reqAdena = reqAdena;
|
||||
}
|
||||
|
||||
/*
|
||||
* This constructor used for System Mails
|
||||
*/
|
||||
public Message(int receiverId, String subject, String content, int systemMessage1, int systemMessage2, MailType sendBySystem)
|
||||
{
|
||||
_messageId = IdFactory.getInstance().getNextId();
|
||||
_senderId = -1;
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
_content = content;
|
||||
_expiration = System.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_reqAdena = 0;
|
||||
_hasAttachments = false;
|
||||
_unread = true;
|
||||
_deletedBySender = true;
|
||||
_deletedByReceiver = false;
|
||||
_messageType = sendBySystem;
|
||||
_returned = false;
|
||||
_systemMessage1 = systemMessage1;
|
||||
_systemMessage2 = systemMessage2;
|
||||
}
|
||||
|
||||
/*
|
||||
* This constructor used for System Mails
|
||||
*/
|
||||
@ -235,7 +209,7 @@ public class Message
|
||||
_elementals[item.getAttackElementType()] = item.getAttackElementPower();
|
||||
}
|
||||
}
|
||||
else if (mailType == MailType.SYSTEM)
|
||||
else if (mailType == MailType.COMMISSION_ITEM_RETURNED)
|
||||
{
|
||||
final Mail attachement = createAttachments();
|
||||
attachement.addItem("CommissionReturnItem", item, null, null);
|
||||
@ -244,7 +218,7 @@ public class Message
|
||||
|
||||
public static final PreparedStatement getStatement(Message msg, Connection con) throws SQLException
|
||||
{
|
||||
PreparedStatement stmt = con.prepareStatement("INSERT INTO messages (messageId, senderId, receiverId, subject, content, expiration, reqAdena, hasAttachments, isUnread, isDeletedBySender, isDeletedByReceiver, sendBySystem, isReturned, itemId, enchantLvl, elementals, systemMessage1, systemMessage2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement stmt = con.prepareStatement("INSERT INTO messages (messageId, senderId, receiverId, subject, content, expiration, reqAdena, hasAttachments, isUnread, isDeletedBySender, isDeletedByReceiver, sendBySystem, isReturned, itemId, enchantLvl, elementals) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
stmt.setInt(1, msg._messageId);
|
||||
stmt.setInt(2, msg._senderId);
|
||||
@ -262,8 +236,6 @@ public class Message
|
||||
stmt.setInt(14, msg._itemId);
|
||||
stmt.setInt(15, msg._enchantLvl);
|
||||
stmt.setString(16, msg._elementals[0] + ";" + msg._elementals[1] + ";" + msg._elementals[2] + ";" + msg._elementals[3] + ";" + msg._elementals[4] + ";" + msg._elementals[5]);
|
||||
stmt.setInt(17, msg._systemMessage1);
|
||||
stmt.setInt(18, msg._systemMessage2);
|
||||
|
||||
return stmt;
|
||||
}
|
||||
@ -300,7 +272,7 @@ public class Message
|
||||
case NPC: // Handled by NpcName in client
|
||||
case BIRTHDAY: // Handled by Sysstring in client
|
||||
case COMMISSION_ITEM_SOLD: // Handled by Sysstring in client
|
||||
case SYSTEM: // Handled by Sysstring in client
|
||||
case COMMISSION_ITEM_RETURNED: // Handled by Sysstring in client
|
||||
case MENTOR_NPC: // Handled in client
|
||||
default:
|
||||
{
|
||||
@ -353,16 +325,6 @@ public class Message
|
||||
return _unread;
|
||||
}
|
||||
|
||||
public final int getSystemMessage1()
|
||||
{
|
||||
return _systemMessage1;
|
||||
}
|
||||
|
||||
public final int getSystemMessage2()
|
||||
{
|
||||
return _systemMessage2;
|
||||
}
|
||||
|
||||
public final void markAsRead()
|
||||
{
|
||||
if (_unread)
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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.model.itemcontainer;
|
||||
|
||||
import com.l2jserver.gameserver.enums.ItemLocation;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class PcAuction extends ItemContainer
|
||||
{
|
||||
private final L2PcInstance _owner;
|
||||
|
||||
public PcAuction(L2PcInstance owner)
|
||||
{
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "Auction";
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2PcInstance getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemLocation getBaseLocation()
|
||||
{
|
||||
return ItemLocation.AUCTION_HOUSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateCapacity(long slots)
|
||||
{
|
||||
return ((_items.size() + slots) <= 10);
|
||||
}
|
||||
}
|
@ -822,9 +822,9 @@ public class PcInventory extends Inventory
|
||||
getOwner().removeItemFromShortCut(item.getObjectId());
|
||||
|
||||
// Removes active Enchant Scroll
|
||||
if (item.getObjectId() == getOwner().getActiveEnchantItemId())
|
||||
if (getOwner().isProcessingItem(item.getObjectId()))
|
||||
{
|
||||
getOwner().setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
getOwner().removeRequestsThatProcessesItem(item.getObjectId());
|
||||
}
|
||||
|
||||
if (item.getId() == ADENA_ID)
|
||||
|
@ -34,6 +34,7 @@ import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItemType;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.events.ListenersContainer;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
@ -126,7 +127,6 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
private final int _time;
|
||||
private final int _autoDestroyTime;
|
||||
private final int _bodyPart;
|
||||
private final String _bodyPartName;
|
||||
private final int _referencePrice;
|
||||
private final int _crystalCount;
|
||||
private final boolean _sellable;
|
||||
@ -161,6 +161,10 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
private final int _reuseDelay;
|
||||
private final int _sharedReuseGroup;
|
||||
|
||||
private final CommissionItemType _commissionItemType;
|
||||
private final int _compoundItem;
|
||||
private final float _compoundChance;
|
||||
|
||||
/**
|
||||
* Constructor of the L2Item that fill class variables.<BR>
|
||||
* <BR>
|
||||
@ -179,7 +183,6 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
_time = set.getInt("time", -1);
|
||||
_autoDestroyTime = set.getInt("auto_destroy_time", -1) * 1000;
|
||||
_bodyPart = ItemTable.SLOTS.get(set.getString("bodypart", "none"));
|
||||
_bodyPartName = set.getString("bodypart", "none");
|
||||
_referencePrice = set.getInt("price", 0);
|
||||
_crystalType = set.getEnum("crystal_type", CrystalType.class, CrystalType.NONE);
|
||||
_crystalCount = set.getInt("crystal_count", 0);
|
||||
@ -206,6 +209,9 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
_defaultEnchantLevel = set.getInt("enchanted", 0);
|
||||
_reuseDelay = set.getInt("reuse_delay", 0);
|
||||
_sharedReuseGroup = set.getInt("shared_reuse_group", 0);
|
||||
_commissionItemType = set.getEnum("commissionItemType", CommissionItemType.class, CommissionItemType.OTHER_ITEM);
|
||||
_compoundItem = set.getInt("compoundItem", 0);
|
||||
_compoundChance = set.getFloat("compoundChance", 0);
|
||||
|
||||
String skills = set.getString("item_skill", null);
|
||||
if (skills != null)
|
||||
@ -932,6 +938,21 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
return _sharedReuseGroup;
|
||||
}
|
||||
|
||||
public CommissionItemType getCommissionItemType()
|
||||
{
|
||||
return _commissionItemType;
|
||||
}
|
||||
|
||||
public int getCompoundItem()
|
||||
{
|
||||
return _compoundItem;
|
||||
}
|
||||
|
||||
public float getCompoundChance()
|
||||
{
|
||||
return _compoundChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Usable in HTML windows.
|
||||
* @return the icon link in client files
|
||||
@ -941,14 +962,6 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
|
||||
return _icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return body part name
|
||||
*/
|
||||
public String getBodyPartName()
|
||||
{
|
||||
return _bodyPartName;
|
||||
}
|
||||
|
||||
public int getDefaultEnchantLevel()
|
||||
{
|
||||
return _defaultEnchantLevel;
|
||||
|
@ -862,9 +862,7 @@ public final class L2ItemInstance extends L2Object
|
||||
&& (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
|
||||
&& ((getItem().getType2() != L2Item.TYPE2_MONEY) || (getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR)) // not money, not shield
|
||||
&& ((pet == null) || (getObjectId() != pet.getControlObjectId())) // Not Control item of currently summoned pet
|
||||
&& (player.getActiveEnchantItemId() != getObjectId()) // Not momentarily used enchant scroll
|
||||
&& (player.getActiveEnchantSupportItemId() != getObjectId()) // Not momentarily used enchant support item
|
||||
&& (player.getActiveEnchantAttrItemId() != getObjectId()) // Not momentarily used enchant attribute item
|
||||
&& !(player.isProcessingItem(getObjectId())) // Not momentarily used enchant scroll
|
||||
&& (allowAdena || (getId() != Inventory.ADENA_ID)) // Not Adena
|
||||
&& ((player.getCurrentSkill() == null) || (player.getCurrentSkill().getSkill().getItemConsumeId() != getId())) && (!player.isCastingSimultaneouslyNow() || (player.getLastSimultaneousSkillCast() == null) || (player.getLastSimultaneousSkillCast().getItemConsumeId() != getId())) && (allowNonTradeable || (isTradeable() && (!((getItem().getItemType() == EtcItemType.PET_COLLAR) && player.havePetInvItems())))));
|
||||
}
|
||||
|
@ -47,8 +47,7 @@ public enum ZoneId
|
||||
NO_BOOKMARK,
|
||||
NO_ITEM_DROP,
|
||||
NO_RESTART,
|
||||
JUMP,
|
||||
BATTALION;
|
||||
JUMP;
|
||||
|
||||
public static int getZoneCount()
|
||||
{
|
||||
|
@ -1,268 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.model.zone.type;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.model.zone.L2ZoneRespawn;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* Another type of damage zone with skills
|
||||
* @author kerberos
|
||||
*/
|
||||
public class L2BattalionZone extends L2ZoneRespawn
|
||||
{
|
||||
private final static Skill NOBLESS_SKILL = SkillData.getInstance().getSkill(1323, 1);
|
||||
private final static String[] GRADE_NAMES =
|
||||
{
|
||||
"",
|
||||
"D",
|
||||
"C",
|
||||
"B",
|
||||
"A",
|
||||
"S",
|
||||
"S80",
|
||||
"S84",
|
||||
"R",
|
||||
"R95",
|
||||
"R99"
|
||||
};
|
||||
|
||||
public L2BattalionZone(int id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnter(L2Character character)
|
||||
{
|
||||
character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true);
|
||||
character.setInsideZone(ZoneId.BATTALION, true);
|
||||
character.setInsideZone(ZoneId.PVP, true);
|
||||
if (!Config.BTZ_STORE_ZONE)
|
||||
{
|
||||
character.setInsideZone(ZoneId.NO_STORE, true);
|
||||
}
|
||||
|
||||
if (character.isPlayer())
|
||||
{
|
||||
final L2PcInstance activeChar = character.getActingPlayer();
|
||||
if ((Config.BTZ_CLASSES != null) && Config.BTZ_CLASSES.contains("" + activeChar.getClassId().getId()))
|
||||
{
|
||||
activeChar.teleToLocation(83597, 147888, -3405);
|
||||
activeChar.sendMessage("Your class is not allowed in the Battalion zone.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (L2ItemInstance o : activeChar.getInventory().getItems())
|
||||
{
|
||||
if (o.isEquipable() && o.isEquipped() && !checkItem(o))
|
||||
{
|
||||
int slot = activeChar.getInventory().getSlotFromItem(o);
|
||||
activeChar.getInventory().unEquipItemInBodySlot(slot);
|
||||
activeChar.sendMessage(o.getName() + " unequiped because is not allowed inside this zone.");
|
||||
}
|
||||
}
|
||||
activeChar.sendMessage("You entered into the Battalion zone.");
|
||||
clear(activeChar);
|
||||
if (Config.BTZ_GIVE_NOBLES)
|
||||
{
|
||||
NOBLESS_SKILL.applyEffects(activeChar, activeChar);
|
||||
}
|
||||
if (Config.BTZ_PVP_ENABLED)
|
||||
{
|
||||
activeChar.updatePvPFlag(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExit(L2Character character)
|
||||
{
|
||||
character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false);
|
||||
character.setInsideZone(ZoneId.BATTALION, false);
|
||||
character.setInsideZone(ZoneId.PVP, false);
|
||||
if (!Config.BTZ_STORE_ZONE)
|
||||
{
|
||||
character.setInsideZone(ZoneId.NO_STORE, false);
|
||||
}
|
||||
|
||||
if (character.isPlayer())
|
||||
{
|
||||
final L2PcInstance activeChar = character.getActingPlayer();
|
||||
activeChar.sendMessage("You left from a Battalion zone.");
|
||||
|
||||
if (Config.BTZ_PVP_ENABLED)
|
||||
{
|
||||
activeChar.stopPvPFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDieInside(final L2Character character)
|
||||
{
|
||||
if (character.isPlayer())
|
||||
{
|
||||
final L2PcInstance activeChar = character.getActingPlayer();
|
||||
if (Config.BTZ_REVIVE)
|
||||
{
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(() ->
|
||||
{
|
||||
activeChar.doRevive();
|
||||
heal(activeChar);
|
||||
int[] loc = Config.BTZ_SPAWN_LOCATIONS[Rnd.get(Config.BTZ_SPAWN_LOCATIONS.length)];
|
||||
activeChar.teleToLocation(loc[0] + Rnd.get(-Config.BTZ_RADIUS, Config.BTZ_RADIUS), loc[1] + Rnd.get(-Config.BTZ_RADIUS, Config.BTZ_RADIUS), loc[2]);
|
||||
}, Config.BTZ_REVIVE_DELAY * 1000);
|
||||
|
||||
ExShowScreenMessage revive = new ExShowScreenMessage("You will be respawned in " + Config.BTZ_REVIVE_DELAY + " seconds.", 5000, true, 2); // 5 Seconds display
|
||||
activeChar.sendPacket(revive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReviveInside(L2Character character)
|
||||
{
|
||||
if (character.isPlayer())
|
||||
{
|
||||
final L2PcInstance activeChar = character.getActingPlayer();
|
||||
if (Config.BTZ_REVIVE_NOBLESS)
|
||||
{
|
||||
NOBLESS_SKILL.applyEffects(activeChar, activeChar);
|
||||
}
|
||||
if (Config.BTZ_REVIVE_HEAL)
|
||||
{
|
||||
heal(activeChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clear(L2PcInstance player)
|
||||
{
|
||||
if (Config.BTZ_REMOVE_BUFFS)
|
||||
{
|
||||
player.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
if (Config.BTZ_REMOVE_PETS)
|
||||
{
|
||||
L2Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.stopAllEffectsExceptThoseThatLastThroughDeath();
|
||||
pet.unSummon(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Config.BTZ_REMOVE_PETS)
|
||||
{
|
||||
L2Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.unSummon(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void heal(L2PcInstance activeChar)
|
||||
{
|
||||
activeChar.setCurrentHp(activeChar.getMaxHp());
|
||||
activeChar.setCurrentCp(activeChar.getMaxCp());
|
||||
activeChar.setCurrentMp(activeChar.getMaxMp());
|
||||
}
|
||||
|
||||
public static void givereward(L2PcInstance player)
|
||||
{
|
||||
if (player.isInsideZone(ZoneId.BATTALION))
|
||||
{
|
||||
SystemMessage systemMessage = null;
|
||||
|
||||
for (int[] reward : Config.BTZ_REWARDS)
|
||||
{
|
||||
final PcInventory inv = player.getInventory();
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(reward[0]).isStackable())
|
||||
{
|
||||
inv.addItem("L2MultiFunctionZone ", reward[0], reward[1], player, player);
|
||||
|
||||
if (reward[1] > 1)
|
||||
{
|
||||
systemMessage = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
|
||||
systemMessage.addItemName(reward[0]);
|
||||
systemMessage.addLong(reward[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
systemMessage = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
|
||||
systemMessage.addItemName(reward[0]);
|
||||
}
|
||||
player.sendPacket(systemMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < reward[1]; ++i)
|
||||
{
|
||||
inv.addItem("L2MultiFunctionZone ", reward[0], 1, player, player);
|
||||
systemMessage = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
|
||||
systemMessage.addItemName(reward[0]);
|
||||
player.sendPacket(systemMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkItem(L2ItemInstance item)
|
||||
{
|
||||
final int o = item.getItem().getCrystalType().ordinal();
|
||||
final int e = item.getEnchantLevel();
|
||||
|
||||
if ((Config.BTZ_ENCHANT != 0) && (e >= Config.BTZ_ENCHANT))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.BTZ_GRADES.contains(GRADE_NAMES[o]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.BTZ_ITEMS != null) && Config.BTZ_ITEMS.contains("" + item.getId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -37,15 +37,15 @@ import com.l2jserver.gameserver.network.clientpackets.appearance.RequestExCancel
|
||||
import com.l2jserver.gameserver.network.clientpackets.appearance.RequestExTryToPutShapeShiftingEnchantSupportItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.appearance.RequestExTryToPutShapeShiftingTargetItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.appearance.RequestShapeShiftingItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionBuyInfo;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionBuyItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionCancel;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionDelete;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionInfo;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionRegister;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionRegisteredItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.auctionhouse.RequestCommissionRegistrableItemList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionBuyInfo;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionBuyItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionCancel;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionDelete;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionInfo;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionRegister;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionRegisteredItem;
|
||||
import com.l2jserver.gameserver.network.clientpackets.commission.RequestCommissionRegistrableItemList;
|
||||
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantClose;
|
||||
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantPushOne;
|
||||
import com.l2jserver.gameserver.network.clientpackets.compound.RequestNewEnchantPushTwo;
|
||||
|
@ -26,6 +26,8 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.ItemLocation;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.L2Armor;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.L2Weapon;
|
||||
@ -433,7 +435,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (player.isEnchanting() || player.isProcessingTransaction())
|
||||
if (player.hasRequest(EnchantItemRequest.class, EnchantItemAttributeRequest.class) || player.isProcessingTransaction())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.L2Event;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
@ -54,7 +53,7 @@ public final class Logout extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
@ -67,13 +66,6 @@ public final class Logout extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_LOGOUT_ZONE)
|
||||
{
|
||||
player.sendMessage("You cannot logout while inside a Battalion zone.");
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow leaving if player is fighting
|
||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoom;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoomList;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.PartyRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExManagePartyRoomMember;
|
||||
import com.l2jserver.gameserver.network.serverpackets.JoinParty;
|
||||
@ -48,12 +49,19 @@ public final class RequestAnswerJoinParty extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance requestor = player.getActiveRequester();
|
||||
final PartyRequest request = player.getRequest(PartyRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
|
||||
final L2PcInstance requestor = request.getActiveChar();
|
||||
if (requestor == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = requestor.getParty();
|
||||
requestor.sendPacket(new JoinParty(_response));
|
||||
|
||||
switch (_response)
|
||||
@ -138,11 +146,11 @@ public final class RequestAnswerJoinParty extends L2GameClientPacket
|
||||
|
||||
if (requestor.isInParty())
|
||||
{
|
||||
requestor.getParty().setPendingInvitation(false); // if party is null, there is no need of decreasing
|
||||
party.setPendingInvitation(false); // if party is null, there is no need of decreasing
|
||||
}
|
||||
|
||||
player.setActiveRequester(null);
|
||||
requestor.onTransactionResponse();
|
||||
request.setProcessing(false);
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,6 @@ import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExShowCommission;
|
||||
import com.l2jserver.gameserver.util.GMAudit;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
@ -70,7 +69,6 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
||||
"_olympiad?command",
|
||||
"menu_select",
|
||||
"manor_menu_select",
|
||||
"showAuction",
|
||||
"pccafe"
|
||||
};
|
||||
|
||||
@ -289,15 +287,6 @@ public final class RequestBypassToServer extends L2GameClientPacket
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcManorBypass(activeChar, lastNpc, ask, state, time), lastNpc);
|
||||
}
|
||||
}
|
||||
else if (_command.equals("showAuction"))
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExShowCommission());
|
||||
}
|
||||
else if (_command.startsWith("pccafe"))
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
|
@ -88,7 +88,7 @@ public final class RequestCancelPostAttachment extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_CANCEL_DURING_AN_ITEM_ENHANCEMENT_OR_ATTRIBUTE_ENHANCEMENT);
|
||||
return;
|
||||
|
@ -15,6 +15,7 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
@ -36,7 +37,12 @@ public class RequestChangeAttributeCancel extends L2GameClientPacket
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExChangeAttributeFail;
|
||||
@ -56,30 +57,39 @@ public class RequestChangeAttributeItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
request.setProcessing(true);
|
||||
|
||||
L2ItemInstance item = player.getInventory().getItemByObjectId(_itemOID);
|
||||
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveTradeList() != null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CHANGE_ATTRIBUTES_WHILE_EXCHANGING);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item.isWeapon())
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExChangeAttributeItemList(player, _attributeOID));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_newAttributeID == -1)
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExChangeAttributeItemList(player, _attributeOID));
|
||||
return;
|
||||
}
|
||||
@ -123,7 +133,7 @@ public class RequestChangeAttributeItem extends L2GameClientPacket
|
||||
}
|
||||
player.sendPacket(iu);
|
||||
|
||||
player.setActiveEnchantAttrItemId(0);
|
||||
player.removeRequest(request.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,6 +27,7 @@ import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.enums.UserInfoType;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantResultType;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
@ -64,38 +65,44 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((activeChar == null) || (_objectId == 0))
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
request.setEnchantingItem(_objectId);
|
||||
request.setProcessing(true);
|
||||
|
||||
if (!activeChar.isOnline() || getClient().isDetached())
|
||||
{
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isProcessingTransaction() || activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_ENCHANT_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
|
||||
L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantItemId());
|
||||
L2ItemInstance support = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantSupportItemId());
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
final L2ItemInstance support = request.getSupportItem();
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// template for scroll
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
|
||||
// scroll not found in list
|
||||
if (scrollTemplate == null)
|
||||
{
|
||||
return;
|
||||
@ -107,7 +114,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
{
|
||||
if (support.getObjectId() != _supportId)
|
||||
{
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
|
||||
@ -117,27 +124,26 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
if (!scrollTemplate.isValid(item, supportTemplate))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
// fast auto-enchant cheat check
|
||||
if ((activeChar.getActiveEnchantTimestamp() == 0) || ((System.currentTimeMillis() - activeChar.getActiveEnchantTimestamp()) < 2000))
|
||||
if ((request.getTimestamp() == 0) || ((System.currentTimeMillis() - request.getTimestamp()) < 2000))
|
||||
{
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " use autoenchant program ", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
// attempting to destroy scroll
|
||||
scroll = activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item);
|
||||
if (scroll == null)
|
||||
if (activeChar.getInventory().destroyItem("Enchant", scroll.getObjectId(), 1, activeChar, item) == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT2);
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to enchant with a scroll he doesn't have", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
@ -145,12 +151,11 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
// attempting to destroy support if exist
|
||||
if (support != null)
|
||||
{
|
||||
support = activeChar.getInventory().destroyItem("Enchant", support.getObjectId(), 1, activeChar, item);
|
||||
if (support == null)
|
||||
if (activeChar.getInventory().destroyItem("Enchant", support.getObjectId(), 1, activeChar, item) == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT2);
|
||||
Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " tried to enchant with a support item he doesn't have", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
@ -163,7 +168,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
if ((item.getOwnerId() != activeChar.getObjectId()) || (item.isEnchantable() == 0))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
return;
|
||||
}
|
||||
@ -174,7 +179,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
case ERROR:
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
break;
|
||||
}
|
||||
@ -318,12 +323,11 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
count = 1;
|
||||
}
|
||||
|
||||
item = activeChar.getInventory().destroyItem("Enchant", item, activeChar, null);
|
||||
if (item == null)
|
||||
if (activeChar.getInventory().destroyItem("Enchant", item, activeChar, null) == null)
|
||||
{
|
||||
// unable to destroy item, cheater ?
|
||||
Util.handleIllegalPlayerAction(activeChar, "Unable to delete item on enchant failure from player " + activeChar.getName() + ", possible cheater !", Config.DEFAULT_PUNISH);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new EnchantResult(EnchantResult.ERROR, 0, 0));
|
||||
|
||||
if (Config.LOG_ITEM_ENCHANTS)
|
||||
@ -429,6 +433,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
|
||||
activeChar.sendPacket(new ItemList(activeChar, true));
|
||||
}
|
||||
|
||||
request.setProcessing(false);
|
||||
activeChar.broadcastUserInfo(UserInfoType.ENCHANTLEVEL);
|
||||
activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));
|
||||
activeChar.sendPacket(new ExAdenaInvenCount(activeChar));
|
||||
|
@ -20,6 +20,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -51,29 +52,39 @@ public class RequestExAddEnchantScrollItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_enchantObjectId);
|
||||
final L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(_scrollObjectId);
|
||||
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
|
||||
if ((scrollTemplate == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(0));
|
||||
return;
|
||||
}
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(_scrollObjectId));
|
||||
return;
|
||||
}
|
||||
|
||||
request.setEnchantingItem(_enchantObjectId);
|
||||
request.setEnchantingScroll(_scrollObjectId);
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(0));
|
||||
request.setEnchantingItem(L2PcInstance.ID_NONE);
|
||||
request.setEnchantingScroll(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
if ((scrollTemplate == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(0));
|
||||
request.setEnchantingScroll(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(new ExPutEnchantScrollItemResult(_scrollObjectId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.network.serverpackets.EnchantResult;
|
||||
|
||||
/**
|
||||
@ -37,12 +38,14 @@ public class RequestExCancelEnchantItem extends L2GameClientPacket
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar != null)
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
activeChar.sendPacket(new EnchantResult(2, 0, 0));
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new EnchantResult(2, 0, 0));
|
||||
activeChar.removeRequest(EnchantItemRequest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.model.Elementals;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExAttributeEnchantResult;
|
||||
@ -54,24 +55,32 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantItemAttributeRequest request = player.getRequest(EnchantItemAttributeRequest.class);
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
request.setProcessing(true);
|
||||
|
||||
if (_objectId == 0xFFFFFFFF)
|
||||
{
|
||||
// Player canceled enchant
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isOnline())
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_ADD_ELEMENTAL_POWER_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,16 +89,16 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
{
|
||||
// Cancel trade
|
||||
player.cancelActiveTrade();
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_TRADING);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
|
||||
final L2ItemInstance stone = player.getInventory().getItemByObjectId(player.getActiveEnchantAttrItemId());
|
||||
final L2ItemInstance stone = request.getEnchantingStone();
|
||||
if ((item == null) || (stone == null))
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
return;
|
||||
}
|
||||
@ -97,7 +106,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if (!item.isElementable())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ELEMENTAL_POWER_ENHANCER_USAGE_REQUIREMENT_IS_NOT_SUFFICIENT);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,14 +117,14 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
{
|
||||
if (item.getOwnerId() != player.getObjectId())
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
@ -139,7 +148,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if ((item.isWeapon() && (oldElement != null) && (oldElement.getElement() != elementToAdd) && (oldElement.getElement() != -2)) || (item.isArmor() && (item.getElemental(elementToAdd) == null) && (item.getElementals() != null) && (item.getElementals().length >= 3)))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ANOTHER_ELEMENTAL_POWER_HAS_ALREADY_BEEN_ADDED_THIS_ELEMENTAL_POWER_CANNOT_BE_ADDED);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,7 +159,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
{
|
||||
if (elm.getElement() == opositeElement)
|
||||
{
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to add oposite attribute to item!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
@ -167,7 +176,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if (powerToAdd <= 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -267,7 +276,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
iu.addModifiedItem(stone);
|
||||
}
|
||||
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(new ExAttributeEnchantResult(result, item.isWeapon(), elementToAdd, elementValue, newValue, successfulAttempts, failedAttempts));
|
||||
player.sendPacket(new UserInfo(player));
|
||||
player.sendPacket(iu);
|
||||
@ -290,7 +299,7 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
|
||||
if (powerToAdd <= 0)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ATTRIBUTE_ITEM_USAGE_HAS_BEEN_CANCELLED);
|
||||
player.setActiveEnchantAttrItemId(L2PcInstance.ID_NONE);
|
||||
player.removeRequest(EnchantItemAttributeRequest.class);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExRemoveEnchantSupportItemResult;
|
||||
|
||||
@ -39,21 +40,24 @@ public class RequestExRemoveEnchantSupportItem extends L2GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setActiveEnchantTimestamp(System.currentTimeMillis());
|
||||
|
||||
final L2ItemInstance supportItem = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantSupportItemId());
|
||||
|
||||
if ((supportItem == null) || (supportItem.getCount() < 1))
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.setActiveEnchantSupportItemId(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance supportItem = request.getSupportItem();
|
||||
if ((supportItem == null) || (supportItem.getCount() < 1))
|
||||
{
|
||||
request.setSupportItem(L2PcInstance.ID_NONE);
|
||||
}
|
||||
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(ExRemoveEnchantSupportItemResult.STATIC_PACKET);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantSupportItem;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
@ -52,34 +53,41 @@ public class RequestExTryToPutEnchantSupportItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_enchantObjectId);
|
||||
final L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantItemId());
|
||||
final L2ItemInstance support = activeChar.getInventory().getItemByObjectId(_supportObjectId);
|
||||
|
||||
if ((item == null) || (scroll == null) || (support == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantSupportItemId(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
final EnchantSupportItem supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
|
||||
|
||||
if ((scrollTemplate == null) || (supportTemplate == null) || !scrollTemplate.isValid(item, supportTemplate))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
activeChar.setActiveEnchantSupportItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(0));
|
||||
return;
|
||||
}
|
||||
activeChar.setActiveEnchantSupportItemId(support.getObjectId());
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(_supportObjectId));
|
||||
return;
|
||||
}
|
||||
|
||||
request.setEnchantingItem(_enchantObjectId);
|
||||
request.setSupportItem(_supportObjectId);
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
final L2ItemInstance support = request.getSupportItem();
|
||||
if ((item == null) || (scroll == null) || (support == null))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
request.setEnchantingItem(L2PcInstance.ID_NONE);
|
||||
request.setSupportItem(L2PcInstance.ID_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
|
||||
final EnchantSupportItem supportTemplate = EnchantItemData.getInstance().getSupportItem(support);
|
||||
if ((scrollTemplate == null) || (supportTemplate == null) || !scrollTemplate.isValid(item, supportTemplate))
|
||||
{
|
||||
// message may be custom
|
||||
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);
|
||||
request.setSupportItem(L2PcInstance.ID_NONE);
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(0));
|
||||
return;
|
||||
}
|
||||
|
||||
request.setSupportItem(support.getObjectId());
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(new ExPutEnchantSupportItemResult(_supportObjectId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -46,18 +47,21 @@ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if ((_objectId == 0) || (activeChar == null))
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
final EnchantItemRequest request = activeChar.getRequest(EnchantItemRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
|
||||
final L2ItemInstance scroll = activeChar.getInventory().getItemByObjectId(activeChar.getActiveEnchantItemId());
|
||||
request.setEnchantingItem(_objectId);
|
||||
|
||||
final L2ItemInstance item = request.getEnchantingItem();
|
||||
final L2ItemInstance scroll = request.getEnchantingScroll();
|
||||
if ((item == null) || (scroll == null))
|
||||
{
|
||||
return;
|
||||
@ -67,7 +71,7 @@ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket
|
||||
if ((scrollTemplate == null) || !scrollTemplate.isValid(item, null))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.DOES_NOT_FIT_STRENGTHENING_CONDITIONS_OF_THE_SCROLL);
|
||||
activeChar.setActiveEnchantItemId(L2PcInstance.ID_NONE);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
activeChar.sendPacket(new ExPutEnchantTargetItemResult(0));
|
||||
if (scrollTemplate == null)
|
||||
{
|
||||
@ -75,8 +79,7 @@ public class RequestExTryToPutEnchantTargetItem extends L2GameClientPacket
|
||||
}
|
||||
return;
|
||||
}
|
||||
activeChar.setIsEnchanting(true);
|
||||
activeChar.setActiveEnchantTimestamp(System.currentTimeMillis());
|
||||
request.setTimestamp(System.currentTimeMillis());
|
||||
activeChar.sendPacket(new ExPutEnchantTargetItemResult(_objectId));
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public final class RequestGetItemFromPet extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public final class RequestGiveItemToPet extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.l2jserver.gameserver.model.BlockList;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.PartyRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.AskJoinParty;
|
||||
@ -160,29 +161,27 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
if (!party.isLeader(requestor))
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.ONLY_THE_LEADER_CAN_GIVE_OUT_INVITATIONS);
|
||||
return;
|
||||
}
|
||||
if (party.getMemberCount() >= 9)
|
||||
else if (party.getMemberCount() >= 9)
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.THE_PARTY_IS_FULL);
|
||||
return;
|
||||
}
|
||||
if (party.getPendingInvitation() && !party.isInvitationRequestExpired())
|
||||
else if (party.getPendingInvitation() && !party.isInvitationRequestExpired())
|
||||
{
|
||||
requestor.sendPacket(SystemMessageId.WAITING_FOR_ANOTHER_REPLY);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isProcessingRequest())
|
||||
else if (!target.hasRequest(PartyRequest.class))
|
||||
{
|
||||
requestor.onTransactionRequest(target);
|
||||
// in case a leader change has happened, use party's mode
|
||||
final PartyRequest request = new PartyRequest(requestor, target);
|
||||
request.scheduleTimeout(30 * 1000);
|
||||
requestor.addRequest(request);
|
||||
target.addRequest(request);
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), party.getDistributionType()));
|
||||
party.setPendingInvitation(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
|
||||
sm.addString(target.getName());
|
||||
requestor.sendPacket(sm);
|
||||
}
|
||||
@ -194,17 +193,20 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
*/
|
||||
private void createNewParty(L2PcInstance target, L2PcInstance requestor)
|
||||
{
|
||||
PartyDistributionType partyDistributionType = PartyDistributionType.findById(_partyDistributionTypeId);
|
||||
final PartyDistributionType partyDistributionType = PartyDistributionType.findById(_partyDistributionTypeId);
|
||||
if (partyDistributionType == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.isProcessingRequest())
|
||||
if (!target.hasRequest(PartyRequest.class))
|
||||
{
|
||||
final PartyRequest request = new PartyRequest(requestor, target);
|
||||
request.scheduleTimeout(30 * 1000);
|
||||
requestor.addRequest(request);
|
||||
target.addRequest(request);
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), partyDistributionType));
|
||||
target.setActiveRequester(requestor);
|
||||
requestor.onTransactionRequest(target);
|
||||
|
||||
requestor.setPartyDistributionType(partyDistributionType);
|
||||
}
|
||||
else
|
||||
|
@ -93,7 +93,7 @@ public class RequestPackageSend extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
|
@ -91,7 +91,7 @@ public final class RequestPostAttachment extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_RECEIVE_MAIL_WHILE_ENCHANTING_AN_ITEM_BESTOWING_AN_ATTRIBUTE_OR_COMBINING_JEWELS);
|
||||
return;
|
||||
|
@ -26,7 +26,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.network.L2GameClient;
|
||||
import com.l2jserver.gameserver.network.L2GameClient.GameClientState;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -58,7 +57,7 @@ public final class RequestRestart extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
sendPacket(RestartResponse.valueOf(false));
|
||||
return;
|
||||
@ -90,13 +89,6 @@ public final class RequestRestart extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_RESTART_ZONE)
|
||||
{
|
||||
player.sendMessage("You cannot restart while inside a Battalion zone.");
|
||||
sendPacket(RestartResponse.valueOf(false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isBlockedFromExit())
|
||||
{
|
||||
sendPacket(RestartResponse.valueOf(false));
|
||||
|
@ -144,7 +144,7 @@ public final class RequestSendPost extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isEnchanting())
|
||||
if (activeChar.hasItemRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_SEND_MAIL_WHILE_ENCHANTING_AN_ITEM_BESTOWING_AN_ATTRIBUTE_OR_COMBINING_JEWELS);
|
||||
return;
|
||||
|
@ -109,7 +109,7 @@ public final class SendWareHouseDepositList extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getActiveEnchantItemId() != L2PcInstance.ID_NONE)
|
||||
if (player.hasItemRequest())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to use enchant Exploit!", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
|
@ -77,7 +77,7 @@ public final class TradeDone extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((trade.getOwner().getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (trade.getPartner().getActiveEnchantItemId() != L2PcInstance.ID_NONE))
|
||||
if ((trade.getOwner().hasItemRequest()) || (trade.getPartner().hasItemRequest()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -42,8 +42,6 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.items.type.ArmorType;
|
||||
import com.l2jserver.gameserver.model.items.type.WeaponType;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2BattalionZone;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExUseSharedGroupItem;
|
||||
@ -129,12 +127,6 @@ public final class UseItem extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isInsideZone(ZoneId.BATTALION) && !L2BattalionZone.checkItem(item))
|
||||
{
|
||||
getClient().getActiveChar().sendMessage("You cannot use " + item.getName() + " inside this zone.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getItem().getType2() == L2Item.TYPE2_QUEST)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS);
|
||||
|
@ -18,47 +18,131 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.adenadistribution;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.AdenaDistributionRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaCancel;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaDone;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestDivideAdena extends L2GameClientPacket
|
||||
{
|
||||
private long _count;
|
||||
private int _adenaObjId;
|
||||
private long _adenaCount;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
readD();
|
||||
_count = readQ();
|
||||
_adenaObjId = readD();
|
||||
_adenaCount = readQ();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final long count = activeChar.getAdena();
|
||||
if (_count > count)
|
||||
|
||||
final AdenaDistributionRequest request = player.getRequest(AdenaDistributionRequest.class);
|
||||
|
||||
if (request == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA);
|
||||
return;
|
||||
}
|
||||
final int membersCount = activeChar.getParty().getMemberCount();
|
||||
final long dividedCount = (long) Math.floor(_count / membersCount);
|
||||
activeChar.reduceAdena("AdenaDistribution", membersCount * dividedCount, null, false);
|
||||
for (L2PcInstance player : activeChar.getParty().getMembers())
|
||||
else if (request.getDistributor() != player)
|
||||
{
|
||||
player.addAdena("AdenaDistribution", dividedCount, null, player.getObjectId() != activeChar.getObjectId());
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (request.getAdenaObjectId() != _adenaObjId)
|
||||
{
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
if (party == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_IN_AN_ALLIANCE_OR_PARTY);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2CommandChannel commandChannel = party.getCommandChannel();
|
||||
|
||||
if ((commandChannel != null) && !commandChannel.isLeader(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_AN_ALLIANCE_LEADER_OR_PARTY_LEADER);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (!party.isLeader(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_A_PARTY_LEADER);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2PcInstance> targets = commandChannel != null ? commandChannel.getMembers() : party.getMembers();
|
||||
|
||||
if (player.getAdena() < targets.size())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getAdena() < request.getAdenaCount())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ADENA_IN_POSSESSION_HAS_BEEN_DECREASED_ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (targets.size() < request.getPlayers().size())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_DISTRIBUTION_PARTICIPANTS_HAVE_CHANGED_ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
else if (player.getAdena() < _adenaCount)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.DISTRIBUTION_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA_FOR_DISTRIBUTION);
|
||||
cancelDistribution(request);
|
||||
return;
|
||||
}
|
||||
|
||||
final long memberAdenaGet = (long) Math.floor(_adenaCount / targets.size());
|
||||
if (player.reduceAdena("Adena Distribution", memberAdenaGet * targets.size(), player, false))
|
||||
{
|
||||
for (L2PcInstance target : targets)
|
||||
{
|
||||
if ((target == null))
|
||||
{
|
||||
// TODO : handle that case here + regive adena OR filter with Objects::nonNull on memberCount ?
|
||||
// those sys msg exists and bother me ADENA_WAS_NOT_DISTRIBUTED_TO_S1 / YOU_DID_NOT_RECEIVE_ADENA_DISTRIBUTION
|
||||
continue;
|
||||
}
|
||||
target.addAdena("Adena Distribution", memberAdenaGet, player, false);
|
||||
target.sendPacket(new ExDivideAdenaDone(_adenaCount, memberAdenaGet, targets.size(), player.getName()));
|
||||
target.removeRequest(AdenaDistributionRequest.class);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cancelDistribution(request);
|
||||
}
|
||||
activeChar.sendPacket(new ExDivideAdenaDone(membersCount, _count, dividedCount, activeChar.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -66,4 +150,14 @@ public class RequestDivideAdena extends L2GameClientPacket
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelDistribution(AdenaDistributionRequest request)
|
||||
{
|
||||
request.getPlayers().stream().filter(Objects::nonNull).forEach(p ->
|
||||
{
|
||||
p.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
p.sendPacket(ExDivideAdenaCancel.STATIC_PACKET);
|
||||
p.removeRequest(AdenaDistributionRequest.class);
|
||||
});
|
||||
}
|
||||
}
|
@ -18,36 +18,45 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.adenadistribution;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.AdenaDistributionRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaCancel;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestDivideAdenaCancel extends L2GameClientPacket
|
||||
{
|
||||
private int _cancel;
|
||||
private boolean _cancel;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_cancel = readC();
|
||||
_cancel = readC() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_cancel == 0)
|
||||
|
||||
if (_cancel)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
activeChar.sendPacket(new ExDivideAdenaCancel());
|
||||
final AdenaDistributionRequest request = player.getRequest(AdenaDistributionRequest.class);
|
||||
request.getPlayers().stream().filter(Objects::nonNull).forEach(p ->
|
||||
{
|
||||
p.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_BEEN_CANCELLED);
|
||||
p.sendPacket(ExDivideAdenaCancel.STATIC_PACKET);
|
||||
p.removeRequest(AdenaDistributionRequest.class);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,41 +18,80 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.adenadistribution;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2CommandChannel;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.AdenaDistributionRequest;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.adenadistribution.ExDivideAdenaStart;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class RequestDivideAdenaStart extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
// Nothing to read
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (activeChar.getParty() == null)
|
||||
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
if (party == null)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_IN_AN_ALLIANCE_OR_PARTY);
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_IN_AN_ALLIANCE_OR_PARTY);
|
||||
return;
|
||||
}
|
||||
if (activeChar.getParty().getLeaderObjectId() != activeChar.getObjectId())
|
||||
|
||||
final L2CommandChannel commandChannel = party.getCommandChannel();
|
||||
|
||||
if ((commandChannel != null) && !commandChannel.isLeader(player))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_A_PARTY_LEADER);
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_AN_ALLIANCE_LEADER_OR_PARTY_LEADER);
|
||||
return;
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_STARTED);
|
||||
activeChar.sendPacket(new ExDivideAdenaStart());
|
||||
else if (!party.isLeader(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_YOU_ARE_NOT_A_PARTY_LEADER);
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2PcInstance> targets = commandChannel != null ? commandChannel.getMembers() : party.getMembers();
|
||||
|
||||
if (player.getAdena() < targets.size())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_PROCEED_AS_THERE_IS_INSUFFICIENT_ADENA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targets.stream().anyMatch(t -> t.hasRequest(AdenaDistributionRequest.class)))
|
||||
{
|
||||
// Handle that case ?
|
||||
return;
|
||||
}
|
||||
|
||||
final int adenaObjectId = player.getInventory().getAdenaInstance().getObjectId();
|
||||
|
||||
targets.forEach(t ->
|
||||
{
|
||||
t.sendPacket(SystemMessageId.ADENA_DISTRIBUTION_HAS_STARTED);
|
||||
t.addRequest(new AdenaDistributionRequest(t, player, targets, adenaObjectId, player.getAdena()));
|
||||
});
|
||||
|
||||
player.sendPacket(ExDivideAdenaStart.STATIC_PACKET);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionBuyInfo;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionBuyInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A1_REQUESTCOMMISSIONBUYINFO = "[C] D0:A1 RequestCommissionBuyInfo";
|
||||
|
||||
private long _auctionID;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_auctionID = readQ();
|
||||
readD(); // Category - unused
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
Auctions auction = am.getAuctionById(_auctionID);
|
||||
if (auction != null)
|
||||
{
|
||||
if (activeChar.getObjectId() == auction.getPlayerID())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ITEM_PURCHASE_HAS_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ExResponseCommissionBuyInfo(auction));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A1_REQUESTCOMMISSIONBUYINFO;
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.enums.MailType;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.instancemanager.MailManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Message;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionBuyItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A2_REQUESTCOMMISSIONREGISTRABLEITEMLIST = "[C] D0:A2 RequestCommissionRegistrableItemList";
|
||||
|
||||
private long _auctionID;
|
||||
private int _category;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_auctionID = readQ();
|
||||
_category = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
Auctions auction;
|
||||
if (am.getAuctionById(_auctionID) != null)
|
||||
{
|
||||
auction = am.getAuctionById(_auctionID);
|
||||
long fee = auction.getPrice();
|
||||
switch (auction.getDuration())
|
||||
{
|
||||
case 0:
|
||||
fee *= 0.005;
|
||||
break;
|
||||
case 1:
|
||||
fee *= 0.015;
|
||||
break;
|
||||
case 2:
|
||||
fee *= 0.025;
|
||||
break;
|
||||
case 3:
|
||||
fee *= 0.035;
|
||||
}
|
||||
if (fee < 10000)
|
||||
{
|
||||
fee = 1000;
|
||||
}
|
||||
long price = auction.getPrice() * auction.getCount();
|
||||
if ((player.getInventory().getItemByItemId(57) == null) || (player.getInventory().getItemByItemId(57).getCount() < price))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
return;
|
||||
}
|
||||
player.getInventory().destroyItemByItemId("BuyFromAuction", 57, price, null, null);
|
||||
player.getInventory().addItem("BuyFromAuction", auction.getItem().getId(), auction.getCount(), player, null);
|
||||
Message msg = new Message(auction.getPlayerID(), "The item you registered has been sold.", auction.getItemName() + " has been sold.", MailType.SYSTEM);
|
||||
if ((price - fee) > 0)
|
||||
{
|
||||
msg.createAttachments().addItem("BuyFromAuction", 57, (price - fee), null, null);
|
||||
}
|
||||
MailManager.getInstance().sendMessage(msg);
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_SUCCESSFULLY_PURCHASED_S2_OF_S1);
|
||||
sm.addLong(auction.getCount());
|
||||
sm.addString(auction.getItemName());
|
||||
player.sendPacket(sm);
|
||||
if (L2World.getInstance().getPlayer(auction.getPlayerID()) != null)
|
||||
{
|
||||
L2PcInstance seller = L2World.getInstance().getPlayer(auction.getPlayerID());
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_YOU_REGISTERED_HAS_BEEN_SOLD);
|
||||
seller.sendPacket(sm);
|
||||
}
|
||||
|
||||
am.deleteAuction(_auctionID);
|
||||
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A2_REQUESTCOMMISSIONREGISTRABLEITEMLIST;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
public final class RequestCommissionCancel extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A3_REQUESTCOMMISSIONCANCEL = "[C] D0:A3 RequestCommissionCancel";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A3_REQUESTCOMMISSIONCANCEL;
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionDelete;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionDelete extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9F_REQUESTCOMMISSIONDELETE = "[C] D0:9F RequestCommissionDelete";
|
||||
|
||||
long _auctionID;
|
||||
int _category;
|
||||
int _duration;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_auctionID = readQ();
|
||||
_category = readD();
|
||||
_duration = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
am.checkForAuctionsDeletion();
|
||||
Auctions auction = am.getAuctionById(_auctionID);
|
||||
if (auction != null)
|
||||
{
|
||||
player.addItem("DeleteAuction", auction.getItem(), null, false);
|
||||
player.getAuctionInventory().destroyItemByItemId("DeleteAuction", auction.getItem().getId(), auction.getCount(), player, null);
|
||||
am.deleteAuction(_auctionID);
|
||||
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_FOR_THE_ITEM_IS_SUCCESSFUL);
|
||||
player.sendPacket(new ExResponseCommissionDelete(true));
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
player.sendPacket(new ExResponseCommissionDelete(false));
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9F_REQUESTCOMMISSIONDELETE;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionInfo;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionInfo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9C_REQUESTCOMMISSIONINFO = "[C] D0:9C RequestCommissionInfo";
|
||||
|
||||
private int _itemOID;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemOID = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExResponseCommissionInfo(player, _itemOID, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9C_REQUESTCOMMISSIONINFO;
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionList extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A0_REQUESTCOMMISSIONLIST = "[C] D0:A0 RequestCommissionList";
|
||||
|
||||
private long _category;
|
||||
private int _type;
|
||||
private int _grade;
|
||||
private String _searchName;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_category = readQ();
|
||||
_type = readD();
|
||||
_grade = readD();
|
||||
_searchName = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
|
||||
if (_category == 0)
|
||||
{
|
||||
_category = 100;
|
||||
}
|
||||
else if (_category == 1)
|
||||
{
|
||||
_category = 101;
|
||||
}
|
||||
|
||||
if ((_category != 101) && (_category != 100) && ((_category % 10000) != 7297) && ((_category % 10000) != 4593) && ((_category % 10000) != 1889) && ((_category % 10000) != 9185) && ((_category % 10000) != 6481))
|
||||
{
|
||||
_category = am.getClientCategory((int) (_category / 1000));
|
||||
}
|
||||
else if ((_category != 101) && (_category != 100))
|
||||
{
|
||||
_category = am.getMainClientCategory((int) (_category / 1000));
|
||||
}
|
||||
|
||||
if (((_category > 60) && (_category < 66)) || (_category == 101))
|
||||
{
|
||||
if (am.getAuctionsSizeById(_category, _grade, _searchName) > 999)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_SEARCH_RESULT_EXCEEDED_THE_MAXIMUM_ALLOWED_RANGE_FOR_OUTPUT_PLEASE_SEARCH_BY_SELECTING_DETAILED_CATEGORY);
|
||||
}
|
||||
else if (am.getAuctionsSizeById(_category, _grade, _searchName) <= 0)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.CURRENTLY_THERE_ARE_NO_REGISTERED_ITEMS);
|
||||
}
|
||||
}
|
||||
else if (_category == 100)
|
||||
{
|
||||
if (am.getAuctionsSizeById(_grade, _searchName) > 999)
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THE_SEARCH_RESULT_EXCEEDED_THE_MAXIMUM_ALLOWED_RANGE_FOR_OUTPUT_PLEASE_SEARCH_BY_SELECTING_DETAILED_CATEGORY);
|
||||
}
|
||||
}
|
||||
|
||||
am.checkForAuctionsDeletion();
|
||||
activeChar.sendPacket(new ExResponseCommissionList(activeChar, _category, _type, _grade, _searchName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A0_REQUESTCOMMISSIONLIST;
|
||||
}
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionRegister;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionRegister extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9D_REQUESTCOMMISSIONREGISTER = "[C] D0:9D RequestCommissionRegister";
|
||||
|
||||
private int _itemOID;
|
||||
private String _itemName;
|
||||
private long _price;
|
||||
private long _count;
|
||||
private int _duration;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemOID = readD();
|
||||
_itemName = readS();
|
||||
_price = readQ();
|
||||
_count = readQ();
|
||||
_duration = readD();
|
||||
readQ(); // Unknown
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
long destroyPrice = _price;
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
am.checkForAuctionsDeletion();
|
||||
long timeToAdd = 0;
|
||||
switch (_duration)
|
||||
{
|
||||
case 0:
|
||||
timeToAdd = 86400000;
|
||||
destroyPrice *= 0.0001;
|
||||
break;
|
||||
case 1:
|
||||
timeToAdd = 259200000;
|
||||
destroyPrice *= 0.0003;
|
||||
break;
|
||||
case 2:
|
||||
timeToAdd = 432000000;
|
||||
destroyPrice *= 0.0005;
|
||||
break;
|
||||
case 3:
|
||||
timeToAdd = 604800000;
|
||||
destroyPrice *= 0.0007;
|
||||
}
|
||||
|
||||
if (destroyPrice < 1000)
|
||||
{
|
||||
destroyPrice = 1000;
|
||||
}
|
||||
|
||||
if ((player.getInventory().getItemByItemId(57) == null) || (player.getInventory().getItemByItemId(57).getCount() < destroyPrice))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getInventory().getItemByObjectId(_itemOID) == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.REGISTRATION_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getInventory().getItemByObjectId(_itemOID).isEquipped())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_THAT_IS_CURRENTLY_WORN_CANNOT_BE_REGISTERED);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
final int itemID = player.getInventory().getItemByObjectId(_itemOID).getId();
|
||||
final L2Item item = ItemTable.getInstance().getTemplate(itemID);
|
||||
|
||||
if (((player.getAuctionInventory().getSize() >= 10) && !player.isGM()) || ((player.getAuctionInventory().getSize() >= 99999) && player.isGM()) || !item.isTradeable() || !item.isSellable())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_CANNOT_BE_REGISTERED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
|
||||
reloadAuction(player, false);
|
||||
return;
|
||||
}
|
||||
|
||||
final int category = am.getCategoryByItem(player.getInventory().getItemByObjectId(_itemOID));
|
||||
player.getInventory().destroyItemByItemId("CreateAuction", 57, destroyPrice, null, null);
|
||||
player.getInventory().transferItem("CreateAuction", _itemOID, _count, player.getAuctionInventory(), player, null);
|
||||
final long finishTime = (System.currentTimeMillis() + timeToAdd) / 1000;
|
||||
|
||||
int auctionID = IdFactory.getInstance().getNextId();
|
||||
if (player.getAuctionInventory().getItemByObjectId(_itemOID) == null)
|
||||
{
|
||||
am.createAuction(auctionID, player.getObjectId(), _itemOID, player.getAuctionInventory().getItemByItemId(itemID), _itemName, _price, _count, _duration, finishTime, category);
|
||||
}
|
||||
else
|
||||
{
|
||||
am.createAuction(auctionID, player.getObjectId(), _itemOID, player.getAuctionInventory().getItemByObjectId(_itemOID), _itemName, _price, _count, _duration, finishTime, category);
|
||||
}
|
||||
am.insertAuction(am.getAuctionById(auctionID));
|
||||
player.sendPacket(SystemMessageId.THE_ITEM_HAS_BEEN_SUCCESSFULLY_REGISTERED);
|
||||
InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(player.getInventory().getItemByItemId(57));
|
||||
iu.addModifiedItem(player.getAuctionInventory().getItemByObjectId(_itemOID));
|
||||
player.sendPacket(iu);
|
||||
reloadAuction(player, true);
|
||||
}
|
||||
|
||||
private void reloadAuction(L2PcInstance player, boolean success)
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionRegister(success));
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
player.sendPacket(new ExResponseCommissionInfo(player, 0, success));
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9D_REQUESTCOMMISSIONREGISTER;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionRegisteredItem extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_A3_REQUESTCOMMISSIONREGISTEREDITEM = "[C] D0:A3 RequestCommissionRegisteredItem";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AuctionHouseManager am = AuctionHouseManager.getInstance();
|
||||
|
||||
am.checkForAuctionsDeletion();
|
||||
|
||||
player.sendPacket(new ExResponseCommissionList(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_A3_REQUESTCOMMISSIONREGISTEREDITEM;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.clientpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.auctionhouse.ExResponseCommissionItemList;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public final class RequestCommissionRegistrableItemList extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_9B_REQUESTCOMMISSIONREGISTRABLEITEMLIST = "[C] D0:9B RequestCommissionRegistrableItemList";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getClient().getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
player.sendPacket(new ExResponseCommissionItemList(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_9B_REQUESTCOMMISSIONREGISTRABLEITEMLIST;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItem;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionBuyInfo;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionBuyInfo extends L2GameClientPacket
|
||||
{
|
||||
private long _commissionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_commissionId = readQ();
|
||||
// readD(); // CommissionItemType
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getInventory().getSize(false) >= (player.getInventoryLimit() * 0.8)) || (player.getWeightPenalty() >= 3))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.IF_THE_WEIGHT_IS_80_OR_MORE_AND_THE_INVENTORY_NUMBER_IS_90_OR_MORE_PURCHASE_CANCELLATION_IS_NOT_POSSIBLE);
|
||||
player.sendPacket(ExResponseCommissionBuyInfo.FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
final CommissionItem commissionItem = CommissionManager.getInstance().getCommissionItem(_commissionId);
|
||||
if (commissionItem != null)
|
||||
{
|
||||
player.sendPacket(new ExResponseCommissionBuyInfo(commissionItem));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
|
||||
player.sendPacket(ExResponseCommissionBuyInfo.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionBuyItem extends L2GameClientPacket
|
||||
{
|
||||
private long _commissionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_commissionId = readQ();
|
||||
// readD(); // CommissionItemType
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().buyItem(player, _commissionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* This Packet doesn't seem to be doing anything.
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionCancel extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionDelete extends L2GameClientPacket
|
||||
{
|
||||
private long _commissionId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_commissionId = readQ();
|
||||
// readD(); // CommissionItemType
|
||||
// readD(); // CommissionDurationType
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().deleteItem(player, _commissionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionInfo extends L2GameClientPacket
|
||||
{
|
||||
private int _itemObjectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemObjectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||
if (itemInstance != null)
|
||||
{
|
||||
player.sendPacket(player.getLastCommissionInfos().getOrDefault(itemInstance.getId(), ExResponseCommissionInfo.EMPTY));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(ExResponseCommissionInfo.EMPTY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItemType;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionTreeType;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionList extends L2GameClientPacket
|
||||
{
|
||||
private int _treeViewDepth;
|
||||
private int _itemType;
|
||||
private int _type;
|
||||
private int _grade;
|
||||
private String _query;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_treeViewDepth = readD();
|
||||
_itemType = readD();
|
||||
_type = readD();
|
||||
_grade = readD();
|
||||
_query = readS();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
Predicate<L2Item> filter = i -> true;
|
||||
switch (_treeViewDepth)
|
||||
{
|
||||
case 1:
|
||||
final CommissionTreeType commissionTreeType = CommissionTreeType.findByClientId(_itemType);
|
||||
if (commissionTreeType != null)
|
||||
{
|
||||
filter = filter.and(i -> commissionTreeType.getCommissionItemTypes().contains(i.getCommissionItemType()));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
final CommissionItemType commissionItemType = CommissionItemType.findByClientId(_itemType);
|
||||
if (commissionItemType != null)
|
||||
{
|
||||
filter = filter.and(i -> i.getCommissionItemType() == commissionItemType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case 0: // General
|
||||
filter = filter.and(i -> true); // TODO: condition
|
||||
break;
|
||||
case 1: // Rare
|
||||
filter = filter.and(i -> true); // TODO: condition
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_grade)
|
||||
{
|
||||
case 0:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.NONE);
|
||||
break;
|
||||
case 1:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.D);
|
||||
break;
|
||||
case 2:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.C);
|
||||
break;
|
||||
case 3:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.B);
|
||||
break;
|
||||
case 4:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.A);
|
||||
break;
|
||||
case 5:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.S);
|
||||
break;
|
||||
case 6:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.S80);
|
||||
break;
|
||||
case 7:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.R);
|
||||
break;
|
||||
case 8:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.R95);
|
||||
break;
|
||||
case 9:
|
||||
filter = filter.and(i -> i.getCrystalType() == CrystalType.R99);
|
||||
break;
|
||||
}
|
||||
|
||||
filter = filter.and(i -> _query.isEmpty() || i.getName().toLowerCase().contains(_query.toLowerCase()));
|
||||
|
||||
CommissionManager.getInstance().showAuctions(player, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionRegister extends L2GameClientPacket
|
||||
{
|
||||
private int _itemObjectId;
|
||||
private long _pricePerUnit;
|
||||
private long _itemCount;
|
||||
private int _durationType; // -1 = None, 0 = 1 Day, 1 = 3 Days, 2 = 5 Days, 3 = 7 Days
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemObjectId = readD();
|
||||
readS(); // Item Name they use it for search we will use server side available names.
|
||||
_pricePerUnit = readQ();
|
||||
_itemCount = readQ();
|
||||
_durationType = readD();
|
||||
// readD(); // Unknown
|
||||
// readD(); // Unknown
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_durationType < 0) || (_durationType > 3))
|
||||
{
|
||||
_log.warning("Player " + player + " sent incorrect commission duration type: " + _durationType + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().registerItem(player, _itemObjectId, _itemCount, _pricePerUnit, (byte) ((_durationType * 2) + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionRegisteredItem extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
CommissionManager.getInstance().showPlayerAuctions(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.clientpackets.commission;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.CommissionManager;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExCloseCommission;
|
||||
import com.l2jserver.gameserver.network.serverpackets.commission.ExResponseCommissionItemList;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class RequestCommissionRegistrableItemList extends L2GameClientPacket
|
||||
{
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance player = getActiveChar();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CommissionManager.isPlayerAllowedToInteract(player))
|
||||
{
|
||||
player.sendPacket(ExCloseCommission.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExResponseCommissionItemList(Arrays.asList(player.getInventory().getAvailableItems(false, false, false))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
@ -19,35 +19,30 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantClose extends L2GameClientPacket
|
||||
public class RequestNewEnchantClose extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F8_REQUESTNEWENCHANTCLOSE = "[C] D0:F8 RequestNewEnchantClose";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
activeChar.setFirstCompoundOID(-1);
|
||||
activeChar.setSecondCompoundOID(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F8_REQUESTNEWENCHANTCLOSE;
|
||||
|
||||
activeChar.removeRequest(CompoundRequest.class);
|
||||
}
|
||||
}
|
||||
|
@ -19,56 +19,72 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantPushOne extends L2GameClientPacket
|
||||
public class RequestNewEnchantPushOne extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F4_REQUESTNEWENCHANTPUSHONE = "[C] D0:F4 RequestNewEnchantPushOne";
|
||||
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemId);
|
||||
if (item == null)
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
final int secondCompoundOID = activeChar.getSecondCompoundOID();
|
||||
final L2ItemInstance secondItem = activeChar.getInventory().getItemByObjectId(secondCompoundOID);
|
||||
if ((item.getItem().getBodyPart() != L2Item.SLOT_BROOCH_JEWEL) || ((secondItem != null) && ((secondItem.getObjectId() == item.getObjectId()) || (secondItem.getId() != item.getId()))) || ((item.getId() == 38931) || ((item.getId() % 10) == 4) || ((item.getId() % 10) == 9)))
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantOneFail());
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
final CompoundRequest request = new CompoundRequest(activeChar);
|
||||
if (!activeChar.addRequest(request))
|
||||
{
|
||||
activeChar.setFirstCompoundOID(_itemId);
|
||||
activeChar.sendPacket(new ExEnchantOneOK());
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F4_REQUESTNEWENCHANTPUSHONE;
|
||||
|
||||
// Make sure player owns this item.
|
||||
request.setItemOne(_objectId);
|
||||
final L2ItemInstance itemOne = request.getItemOne();
|
||||
if (itemOne == null)
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if ((itemOne.getItem().getCompoundItem() == 0) || (itemOne.getItem().getCompoundChance() == 0))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneOK.STATIC_PACKET);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ExEnchantOneOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -19,56 +19,86 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.L2Item;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantPushTwo extends L2GameClientPacket
|
||||
public class RequestNewEnchantPushTwo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F6_REQUESTNEWENCHANTPUSHTWO = "[C] D0:F6 RequestNewEnchantPushTwo";
|
||||
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_itemId);
|
||||
if (item == null)
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
final int firstCompoundOID = activeChar.getFirstCompoundOID();
|
||||
final L2ItemInstance firstItem = activeChar.getInventory().getItemByObjectId(firstCompoundOID);
|
||||
if ((item.getItem().getBodyPart() != L2Item.SLOT_BROOCH_JEWEL) || ((firstItem != null) && ((firstItem.getObjectId() == item.getObjectId()) || (firstItem.getId() != item.getId()))) || ((item.getId() == 38931) || ((item.getId() % 10) == 4) || ((item.getId() % 10) == 9)))
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantTwoFail());
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.setSecondCompoundOID(_itemId);
|
||||
activeChar.sendPacket(new ExEnchantTwoOK());
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F6_REQUESTNEWENCHANTPUSHTWO;
|
||||
|
||||
// Make sure player owns this item.
|
||||
request.setItemTwo(_objectId);
|
||||
final L2ItemInstance itemOne = request.getItemOne();
|
||||
final L2ItemInstance itemTwo = request.getItemTwo();
|
||||
if ((itemOne == null) || (itemTwo == null))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Lets prevent using same item twice
|
||||
if (itemOne.getObjectId() == itemTwo.getObjectId())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Combining only same items!
|
||||
if (itemOne.getItem().getId() != itemTwo.getItem().getId())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if ((itemOne.getItem().getCompoundItem() == 0) || (itemOne.getItem().getCompoundChance() == 0))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(ExEnchantTwoOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -19,38 +19,63 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneRemoveFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneRemoveOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantRemoveOne extends L2GameClientPacket
|
||||
public class RequestNewEnchantRemoveOne extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F5_REQUESTNEWENCHANTREMOVEONE = "[C] D0:F4 RequestNewEnchantRemoveOne";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
System.out.println(_C__D0_F5_REQUESTNEWENCHANTREMOVEONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F5_REQUESTNEWENCHANTREMOVEONE;
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = request.getItemOne();
|
||||
if ((item == null) || (item.getObjectId() != _objectId))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantOneRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
request.setItemOne(0);
|
||||
|
||||
activeChar.sendPacket(ExEnchantOneRemoveOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -19,38 +19,63 @@
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoRemoveFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantTwoRemoveOK;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantRemoveTwo extends L2GameClientPacket
|
||||
public class RequestNewEnchantRemoveTwo extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F7_REQUESTNEWENCHANTREMOVETWO = "[C] D0:F7 RequestNewEnchantRemoveTwo";
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int _itemId;
|
||||
private int _objectId;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
_itemId = readD();
|
||||
_objectId = readD();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
System.out.println(_C__D0_F7_REQUESTNEWENCHANTREMOVETWO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F7_REQUESTNEWENCHANTREMOVETWO;
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance item = request.getItemTwo();
|
||||
if ((item == null) || (item.getObjectId() != _objectId))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantTwoRemoveFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
request.setItemTwo(0);
|
||||
|
||||
activeChar.sendPacket(ExEnchantTwoRemoveOK.STATIC_PACKET);
|
||||
}
|
||||
}
|
||||
|
@ -18,89 +18,122 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets.compound;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.CompoundRequest;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExAdenaInvenCount;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantOneFail;
|
||||
import com.l2jserver.gameserver.network.serverpackets.compound.ExEnchantSucess;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public final class RequestNewEnchantTry extends L2GameClientPacket
|
||||
public class RequestNewEnchantTry extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__D0_F9_REQUESTNEWENCHANTTRY = "[C] D0:F9 RequestNewEnchantTry";
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runImpl()
|
||||
{
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
final L2PcInstance activeChar = getActiveChar();
|
||||
if (activeChar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance firstItem = activeChar.getInventory().getItemByObjectId(activeChar.getFirstCompoundOID());
|
||||
final L2ItemInstance secondItem = activeChar.getInventory().getItemByObjectId(activeChar.getSecondCompoundOID());
|
||||
if ((firstItem == null) || (secondItem == null))
|
||||
else if (activeChar.isInStoreMode())
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_DO_THAT_WHILE_IN_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
int levelOfStone = 0;
|
||||
if (firstItem.getId() < 38900)
|
||||
else if (activeChar.isProcessingTransaction() || activeChar.isProcessingRequest())
|
||||
{
|
||||
levelOfStone = (firstItem.getId() % 5) + 1;
|
||||
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_THIS_SYSTEM_DURING_TRADING_PRIVATE_STORE_AND_WORKSHOP_SETUP);
|
||||
activeChar.sendPacket(ExEnchantOneFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
final CompoundRequest request = activeChar.getRequest(CompoundRequest.class);
|
||||
if ((request == null) || request.isProcessing())
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantFail.STATIC_PACKET);
|
||||
return;
|
||||
}
|
||||
|
||||
request.setProcessing(true);
|
||||
|
||||
final L2ItemInstance itemOne = request.getItemOne();
|
||||
final L2ItemInstance itemTwo = request.getItemTwo();
|
||||
if ((itemOne == null) || (itemTwo == null))
|
||||
{
|
||||
activeChar.sendPacket(ExEnchantFail.STATIC_PACKET);
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Lets prevent using same item twice
|
||||
if (itemOne.getObjectId() == itemTwo.getObjectId())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Combining only same items!
|
||||
if (itemOne.getItem().getId() != itemTwo.getItem().getId())
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if ((itemOne.getItem().getCompoundItem() == 0) || (itemOne.getItem().getCompoundChance() == 0))
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
final double random = Rnd.nextDouble() * 100;
|
||||
|
||||
// Success
|
||||
if (random < itemOne.getItem().getCompoundChance())
|
||||
{
|
||||
iu.addRemovedItem(itemOne);
|
||||
iu.addRemovedItem(itemTwo);
|
||||
|
||||
if (activeChar.destroyItem("Compound-Item-One", itemOne, null, true) && activeChar.destroyItem("Compound-Item-Two", itemTwo, null, true))
|
||||
{
|
||||
final L2ItemInstance item = activeChar.addItem("Compound-Result", itemOne.getItem().getCompoundItem(), 1, null, true);
|
||||
activeChar.sendPacket(new ExEnchantSucess(item.getItem().getId()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
levelOfStone = (firstItem.getId() - 38926);
|
||||
iu.addRemovedItem(itemTwo);
|
||||
|
||||
// Upon fail we destroy the second item.
|
||||
if (activeChar.destroyItem("Compound-Item-Two-Fail", itemTwo, null, true))
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(itemOne.getItem().getId(), itemTwo.getItem().getId()));
|
||||
}
|
||||
}
|
||||
if ((levelOfStone == 0) || (levelOfStone == 5))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int percent = 0;
|
||||
switch (levelOfStone)
|
||||
{
|
||||
case 1:
|
||||
percent = Config.SECOND_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
case 2:
|
||||
percent = Config.THIRD_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
case 3:
|
||||
percent = Config.FOURTH_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
case 4:
|
||||
percent = Config.FITH_LEVEL_UPGRADE_CHANCE;
|
||||
break;
|
||||
}
|
||||
if (Rnd.get(100) <= percent)
|
||||
{
|
||||
int newItem = firstItem.getId() + 1;
|
||||
activeChar.destroyItem("FirstCompoundItem", firstItem, null, true);
|
||||
activeChar.destroyItem("SecondCompoundItem", secondItem, null, true);
|
||||
activeChar.addItem("CompoundItem", newItem, 1, null, true);
|
||||
activeChar.sendPacket(new ExEnchantSucess(newItem));
|
||||
}
|
||||
else
|
||||
{
|
||||
activeChar.sendPacket(new ExEnchantFail(firstItem.getId(), secondItem.getId()));
|
||||
activeChar.destroyItem("SecondCompoundItem", secondItem, null, true);
|
||||
}
|
||||
activeChar.setFirstCompoundOID(-1);
|
||||
activeChar.setSecondCompoundOID(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return _C__D0_F9_REQUESTNEWENCHANTTRY;
|
||||
|
||||
activeChar.sendPacket(iu);
|
||||
activeChar.sendPacket(new ExAdenaInvenCount(activeChar));
|
||||
activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));
|
||||
activeChar.removeRequest(request.getClass());
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.util.Calendar;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.data.xml.impl.PrimeShopData;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.request.PrimeShopRequest;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
|
||||
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
|
||||
@ -58,13 +59,13 @@ public final class RequestBRBuyProduct extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (activeChar.isUsingPrimeShop())
|
||||
if (activeChar.hasItemRequest() || activeChar.hasRequest(PrimeShopRequest.class))
|
||||
{
|
||||
activeChar.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.setUsingPrimeShop(true);
|
||||
activeChar.addRequest(new PrimeShopRequest(activeChar));
|
||||
|
||||
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
|
||||
if (validatePlayer(item, _count, activeChar))
|
||||
@ -104,7 +105,7 @@ public final class RequestBRBuyProduct extends L2GameClientPacket
|
||||
activeChar.sendPacket(new ExBRGamePoint(activeChar));
|
||||
}
|
||||
|
||||
activeChar.setUsingPrimeShop(false);
|
||||
activeChar.removeRequest(PrimeShopRequest.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,9 +18,7 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jserver.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jserver.gameserver.enums.ItemListType;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.ItemInfo;
|
||||
import com.l2jserver.gameserver.model.TradeItem;
|
||||
import com.l2jserver.gameserver.model.buylist.Product;
|
||||
@ -204,25 +202,16 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
}
|
||||
}
|
||||
|
||||
public void writeAuctionItem(Auctions auction)
|
||||
protected void writeCommissionItem(ItemInfo item)
|
||||
{
|
||||
writeQ(auction.getAuctionId()); // Auction id
|
||||
writeQ(auction.getPrice()); // Price
|
||||
writeD(auction.getCategory()); // Category
|
||||
writeD(auction.getDuration()); // Duration / maybe in days???
|
||||
writeD((int) auction.getFinishTime()); // Time when this item will vanish from auction (in seconds)(example (currentTime+60=after 1 minute))
|
||||
writeS(CharNameTable.getInstance().getNameById(auction.getPlayerID())); // Name
|
||||
writeD(0);
|
||||
ItemInfo it = new ItemInfo(auction.getItem());
|
||||
writeD(auction.getItem().getId()); // Item ID
|
||||
writeQ(auction.getItem().getCount()); // Count
|
||||
writeH(auction.getItem().getItem().getType2()); // item.getItem().getType2()
|
||||
writeD(auction.getItem().getItem().getBodyPart()); // item.getItem().getBodyPart()
|
||||
writeH(auction.getItem().getCustomType2()); // item.getCustomType2()
|
||||
writeH(0x00); // ???
|
||||
writeD(auction.getItem().getEnchantLevel());
|
||||
writeItemElemental(it);
|
||||
writeItemEnchantEffect(it);
|
||||
writeD(0x00); // Item remodel visual ID
|
||||
writeD(0); // Always 0
|
||||
writeD(item.getItem().getId());
|
||||
writeQ(item.getCount());
|
||||
writeH(item.getItem().getType2());
|
||||
writeQ(item.getItem().getBodyPart());
|
||||
writeH(item.getEnchant());
|
||||
writeH(item.getCustomType2());
|
||||
writeItemElementalAndEnchant(item);
|
||||
writeD(item.getVisualId());
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
|
||||
import com.l2jserver.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jserver.gameserver.instancemanager.FortManager;
|
||||
@ -32,7 +31,6 @@ import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.entity.Castle;
|
||||
import com.l2jserver.gameserver.model.entity.Fort;
|
||||
import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
|
||||
import com.l2jserver.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* @author UnAfraid, Nos
|
||||
@ -83,16 +81,6 @@ public class Die extends L2GameServerPacket
|
||||
_toFortress = ((clan != null) && (clan.getFortId() > 0)) || isInFortDefense;
|
||||
}
|
||||
|
||||
if (activeChar.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_REVIVE)
|
||||
{
|
||||
_toVillage = false;
|
||||
_toClanHall = false;
|
||||
_toCastle = false;
|
||||
_toOutpost = false;
|
||||
_useFeather = false;
|
||||
_toFortress = false;
|
||||
}
|
||||
|
||||
_isSweepable = activeChar.isAttackable() && activeChar.isSweepActive();
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,10 @@ public class ExReplyReceivedPost extends AbstractItemPacket
|
||||
writeC(0xFE);
|
||||
writeH(0xAC);
|
||||
writeD(_msg.getMailType().ordinal()); // GOD
|
||||
if (_msg.getMailType() == MailType.SYSTEM)
|
||||
if (_msg.getMailType() == MailType.COMMISSION_ITEM_RETURNED)
|
||||
{
|
||||
writeD(_msg.getSystemMessage1());
|
||||
writeD(_msg.getSystemMessage2());
|
||||
writeD(SystemMessageId.THE_REGISTRATION_PERIOD_FOR_THE_ITEM_YOU_REGISTERED_HAS_EXPIRED.getId());
|
||||
writeD(SystemMessageId.THE_AUCTION_HOUSE_REGISTRATION_PERIOD_HAS_EXPIRED_AND_THE_CORRESPONDING_ITEM_IS_BEING_FORWARDED.getId());
|
||||
}
|
||||
else if (_msg.getMailType() == MailType.COMMISSION_ITEM_SOLD)
|
||||
{
|
||||
|
@ -53,9 +53,9 @@ public class ExShowReceivedPostList extends L2GameServerPacket
|
||||
{
|
||||
writeD(SystemMessageId.THE_ITEM_YOU_REGISTERED_HAS_BEEN_SOLD.getId());
|
||||
}
|
||||
else if (msg.getMailType() == MailType.SYSTEM)
|
||||
else if (msg.getMailType() == MailType.COMMISSION_ITEM_RETURNED)
|
||||
{
|
||||
writeD(msg.getSystemMessage1());
|
||||
writeD(SystemMessageId.THE_REGISTRATION_PERIOD_FOR_THE_ITEM_YOU_REGISTERED_HAS_EXPIRED.getId());
|
||||
}
|
||||
writeD(msg.getId());
|
||||
writeS(msg.getSubject());
|
||||
@ -63,7 +63,7 @@ public class ExShowReceivedPostList extends L2GameServerPacket
|
||||
writeD(msg.isLocked() ? 0x01 : 0x00);
|
||||
writeD(msg.getExpirationSeconds());
|
||||
writeD(msg.isUnread() ? 0x01 : 0x00);
|
||||
writeD(((msg.getMailType() == MailType.COMMISSION_ITEM_SOLD) || (msg.getMailType() == MailType.SYSTEM)) ? 0 : 1);
|
||||
writeD(((msg.getMailType() == MailType.COMMISSION_ITEM_SOLD) || (msg.getMailType() == MailType.COMMISSION_ITEM_RETURNED)) ? 0 : 1);
|
||||
writeD(msg.hasAttachments() ? 0x01 : 0x00);
|
||||
writeD(msg.isReturned() ? 0x01 : 0x00);
|
||||
writeD(0x00); // SysString in some case it seems
|
||||
|
@ -21,16 +21,18 @@ package com.l2jserver.gameserver.network.serverpackets.adenadistribution;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ExDivideAdenaCancel extends L2GameServerPacket
|
||||
{
|
||||
public static final ExDivideAdenaCancel STATIC_PACKET = new ExDivideAdenaCancel();
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x15C);
|
||||
|
||||
writeC(0x00); // TODO: Find me
|
||||
}
|
||||
}
|
||||
|
@ -21,33 +21,34 @@ package com.l2jserver.gameserver.network.serverpackets.adenadistribution;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ExDivideAdenaDone extends L2GameServerPacket
|
||||
{
|
||||
private final int _friendsCount;
|
||||
private final long _count;
|
||||
private final long _dividedCount;
|
||||
private final String _name;
|
||||
private final long _adenaCount;
|
||||
private final long _distributedAdenaCount;
|
||||
private final int _memberCount;
|
||||
private final String _distributorName;
|
||||
|
||||
public ExDivideAdenaDone(int friendsCount, long count, long dividedCount, String name)
|
||||
public ExDivideAdenaDone(long adenaCount, long distributedAdenaCount, int memberCount, String distributorName)
|
||||
{
|
||||
_friendsCount = friendsCount;
|
||||
_count = count;
|
||||
_dividedCount = dividedCount;
|
||||
_name = name;
|
||||
_adenaCount = adenaCount;
|
||||
_distributedAdenaCount = distributedAdenaCount;
|
||||
_memberCount = memberCount;
|
||||
_distributorName = distributorName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x15D);
|
||||
writeC(0x01); // Always 1
|
||||
writeC(0x00); // Always 0
|
||||
writeD(_friendsCount); // Friends count
|
||||
writeQ(_dividedCount); // Divided count
|
||||
writeQ(_count); // Whole count
|
||||
writeS(_name); // Giver name
|
||||
|
||||
writeC(0x00); // TODO: Find me / type ??
|
||||
writeC(0x00); // TODO: Find me
|
||||
writeD(_memberCount);
|
||||
writeQ(_distributedAdenaCount);
|
||||
writeQ(_adenaCount);
|
||||
writeS(_distributorName);
|
||||
}
|
||||
}
|
||||
|
@ -21,16 +21,16 @@ package com.l2jserver.gameserver.network.serverpackets.adenadistribution;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
* @author Sdw
|
||||
*/
|
||||
public class ExDivideAdenaStart extends L2GameServerPacket
|
||||
{
|
||||
public static final ExDivideAdenaStart STATIC_PACKET = new ExDivideAdenaStart();
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x15B);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionBuyInfo extends L2GameServerPacket
|
||||
{
|
||||
private final Auctions _auction;
|
||||
|
||||
public ExResponseCommissionBuyInfo(Auctions auction)
|
||||
{
|
||||
_auction = auction;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF8);
|
||||
|
||||
writeD(0x01); // Unknown
|
||||
|
||||
final L2ItemInstance item = _auction.getItem();
|
||||
|
||||
writeQ(_auction.getPrice());
|
||||
writeD(_auction.getCategory());
|
||||
writeD(0x00); // Unkown
|
||||
writeD(item.getId());
|
||||
writeQ(item.getCount());
|
||||
writeH(item.getItem().getType2());
|
||||
writeD(item.getItem().getBodyPart());
|
||||
writeH(item.getEnchantLevel());
|
||||
writeH(item.getCustomType2());
|
||||
writeD(item.getAugmentation() != null ? item.getAugmentation().getAugmentationId() : 0x00);
|
||||
writeH(item.getAttackElementType());
|
||||
writeH(item.getAttackElementPower());
|
||||
for (byte d = 0; d < 6; d++)
|
||||
{
|
||||
writeH(item.getElementDefAttr(d));
|
||||
}
|
||||
|
||||
writeH(0); // unknown
|
||||
writeH(0); // unknown
|
||||
writeH(0); // unknown
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionBuyItem extends L2GameServerPacket
|
||||
{
|
||||
public static final ExResponseCommissionBuyItem STATIC_PACKET = new ExResponseCommissionBuyItem();
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF8);
|
||||
writeD(1); // unk
|
||||
writeD(0); // unk
|
||||
writeD(58); // Item ID
|
||||
writeQ(1); // count
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionDelete extends L2GameServerPacket
|
||||
{
|
||||
private final boolean success;
|
||||
|
||||
public ExResponseCommissionDelete(boolean _success)
|
||||
{
|
||||
success = _success;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xd3);
|
||||
writeD(success ? 0x01 : 0x00);
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionInfo extends L2GameServerPacket
|
||||
{
|
||||
L2PcInstance player;
|
||||
L2ItemInstance item;
|
||||
boolean success;
|
||||
|
||||
public ExResponseCommissionInfo(L2PcInstance _player, int _itemOID, boolean _success)
|
||||
{
|
||||
player = _player;
|
||||
item = player.getInventory().getItemByObjectId(_itemOID);
|
||||
success = _success;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF4);
|
||||
writeD(success ? 0x01 : 0x00); // TODO: Success
|
||||
writeD(0x00); // ItemID
|
||||
writeD(0x00); // TODO: Price
|
||||
writeQ(0x00); // TODO: Count
|
||||
writeD(0x00); // TODO: Duration
|
||||
writeD(-0x01); // TODO: Unknown
|
||||
writeD(0x00); // TODO: Unknown
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.AbstractItemPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionItemList extends AbstractItemPacket
|
||||
{
|
||||
private final L2PcInstance _player;
|
||||
|
||||
public ExResponseCommissionItemList(L2PcInstance player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF3);
|
||||
|
||||
writeD(_player.getInventory().getSize(false));
|
||||
|
||||
for (L2ItemInstance item : _player.getInventory().getItems())
|
||||
{
|
||||
if (!item.isSellable() || !item.isTradeable() || item.isEquipped() || (item.getId() == 57) || item.isQuestItem())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
writeItem(item);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,266 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager;
|
||||
import com.l2jserver.gameserver.instancemanager.AuctionHouseManager.Auctions;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.AbstractItemPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionList extends AbstractItemPacket
|
||||
{
|
||||
L2PcInstance _player;
|
||||
L2ItemInstance _item;
|
||||
long _category;
|
||||
int _type;
|
||||
int _grade;
|
||||
String _search;
|
||||
boolean _yourAuction;
|
||||
AuctionHouseManager _am;
|
||||
int _yourAuctionsSize = 0;
|
||||
int _categories[][] =
|
||||
{
|
||||
{
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18
|
||||
},
|
||||
{
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28
|
||||
},
|
||||
{
|
||||
29,
|
||||
30,
|
||||
31,
|
||||
32,
|
||||
33,
|
||||
34
|
||||
},
|
||||
{
|
||||
35,
|
||||
36,
|
||||
37,
|
||||
38,
|
||||
39,
|
||||
40
|
||||
},
|
||||
{
|
||||
41,
|
||||
42
|
||||
},
|
||||
{
|
||||
43,
|
||||
44,
|
||||
45,
|
||||
46,
|
||||
47,
|
||||
48,
|
||||
49,
|
||||
50,
|
||||
51,
|
||||
52,
|
||||
53,
|
||||
54,
|
||||
55,
|
||||
56,
|
||||
57,
|
||||
58
|
||||
}
|
||||
};
|
||||
|
||||
public ExResponseCommissionList(L2PcInstance player, long category, int type, int grade, String searchName)
|
||||
{
|
||||
_player = player;
|
||||
_category = category;
|
||||
_type = type;
|
||||
_grade = grade;
|
||||
_search = searchName;
|
||||
_yourAuction = false;
|
||||
_am = AuctionHouseManager.getInstance();
|
||||
}
|
||||
|
||||
public ExResponseCommissionList(L2PcInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_yourAuction = true;
|
||||
_am = AuctionHouseManager.getInstance();
|
||||
for (Auctions auction : _am.getAuctions())
|
||||
{
|
||||
if (auction.getPlayerID() == player.getObjectId())
|
||||
{
|
||||
_yourAuctionsSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF7);
|
||||
if (_yourAuction)
|
||||
{
|
||||
writeD(_yourAuctionsSize <= 0 ? -2 : 0x02);
|
||||
writeD((int) (System.currentTimeMillis() / 1000));
|
||||
writeD(0x00);
|
||||
writeD(_yourAuctionsSize);
|
||||
for (Auctions auction : _am.getAuctions())
|
||||
{
|
||||
if (auction.getPlayerID() == _player.getObjectId())
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
writeD((_search != null) && (_category == 100) && (_am.getAuctionsSizeById(_grade, _search) > 0) ? 3 : (_am.getAuctionsSizeById(_grade, _search) <= 0) || (_am.getAuctionsSizeById(_category, _grade, _search) <= 0) ? -1 : 3);
|
||||
writeD((int) (System.currentTimeMillis() / 1000));
|
||||
writeD(0x00);
|
||||
if (((_category > 60) && (_category < 66)) || (_category == 101))
|
||||
{
|
||||
writeD(_am.getAuctionsSizeById(_category, _grade, _search));
|
||||
for (Auctions auction : _am.getAuctions())
|
||||
{
|
||||
int cat = _category == 101 ? 0 : (int) (_category % 60);
|
||||
for (int ID : _categories[cat])
|
||||
{
|
||||
if ((_grade == -1) && _search.equals(""))
|
||||
{
|
||||
if (auction.getCategory() == ID)
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
else if (_grade != -1)
|
||||
{
|
||||
if (_search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == ID) && (_grade == auction.getItem().getItem().getCrystalType().getId()))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
if (!_search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == ID) && (_grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(_search))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == ID) && auction.getItem().getName().contains(_search))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_category < 60)
|
||||
{
|
||||
writeD(_am.getAuctionsSizeById(_category, _grade, _search)); // Auction count, maybe items putted in auction???
|
||||
for (Auctions auction : _am.getAuctions())
|
||||
{
|
||||
if ((_grade == -1) && _search.equals(""))
|
||||
{
|
||||
if (auction.getCategory() == _category)
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
else if (_grade != -1)
|
||||
{
|
||||
if (_search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == _category) && (_grade == auction.getItem().getItem().getCrystalType().getId()))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
if (!_search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == _category) && (_grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(_search))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_search.equals(""))
|
||||
{
|
||||
if ((auction.getCategory() == _category) && auction.getItem().getName().contains(_search))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_search != null)
|
||||
{
|
||||
writeD(_am.getAuctionsSizeById(_grade, _search)); // Auction count, maybe items putted in auction???
|
||||
for (Auctions auction : _am.getAuctions())
|
||||
{
|
||||
if (_grade == -1)
|
||||
{
|
||||
if (auction.getItem().getName().contains(_search))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
if (_grade != -1)
|
||||
{
|
||||
if ((_grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(_search))
|
||||
{
|
||||
writeAuctionItem(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author Erlandys
|
||||
*/
|
||||
public class ExResponseCommissionRegister extends L2GameServerPacket
|
||||
{
|
||||
private final boolean success;
|
||||
|
||||
public ExResponseCommissionRegister(boolean _success)
|
||||
{
|
||||
success = _success;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0xd3);
|
||||
writeD(success ? 1 : 0); // Success
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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.serverpackets.auctionhouse;
|
||||
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class ExShowCommission extends L2GameServerPacket
|
||||
{
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF2);
|
||||
writeD(0x01); // Just for showing window...
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.serverpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class ExCloseCommission extends L2GameServerPacket
|
||||
{
|
||||
public static final ExCloseCommission STATIC_PACKET = new ExCloseCommission();
|
||||
|
||||
private ExCloseCommission()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x112);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.serverpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItem;
|
||||
import com.l2jserver.gameserver.network.serverpackets.AbstractItemPacket;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class ExResponseCommissionBuyInfo extends AbstractItemPacket
|
||||
{
|
||||
public static final ExResponseCommissionBuyInfo FAILED = new ExResponseCommissionBuyInfo(null);
|
||||
|
||||
private final CommissionItem _commissionItem;
|
||||
|
||||
public ExResponseCommissionBuyInfo(CommissionItem commissionItem)
|
||||
{
|
||||
_commissionItem = commissionItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF8);
|
||||
writeD(_commissionItem != null ? 1 : 0);
|
||||
if (_commissionItem != null)
|
||||
{
|
||||
writeQ(_commissionItem.getPricePerUnit());
|
||||
writeQ(_commissionItem.getCommissionId());
|
||||
writeD(0); // CommissionItemType seems client does not really need it.
|
||||
writeCommissionItem(_commissionItem.getItemInfo());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.serverpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.model.ItemInfo;
|
||||
import com.l2jserver.gameserver.model.commission.CommissionItem;
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class ExResponseCommissionBuyItem extends L2GameServerPacket
|
||||
{
|
||||
public static final ExResponseCommissionBuyItem FAILED = new ExResponseCommissionBuyItem(null);
|
||||
|
||||
private final CommissionItem _commissionItem;
|
||||
|
||||
public ExResponseCommissionBuyItem(CommissionItem commissionItem)
|
||||
{
|
||||
_commissionItem = commissionItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF9);
|
||||
writeD(_commissionItem != null ? 1 : 0);
|
||||
if (_commissionItem != null)
|
||||
{
|
||||
final ItemInfo itemInfo = _commissionItem.getItemInfo();
|
||||
writeD(itemInfo.getEnchant());
|
||||
writeD(itemInfo.getItem().getId());
|
||||
writeQ(itemInfo.getCount());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server 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.serverpackets.commission;
|
||||
|
||||
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public class ExResponseCommissionDelete extends L2GameServerPacket
|
||||
{
|
||||
public static final ExResponseCommissionDelete SUCCEED = new ExResponseCommissionDelete(1);
|
||||
public static final ExResponseCommissionDelete FAILED = new ExResponseCommissionDelete(0);
|
||||
|
||||
private final int _result;
|
||||
|
||||
private ExResponseCommissionDelete(int result)
|
||||
{
|
||||
_result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeImpl()
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0xF6);
|
||||
writeD(_result);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user