Adaptation of World Exchange for main version.

This commit is contained in:
MobiusDevelopment 2022-10-28 04:17:45 +00:00
parent 63ba79e6d8
commit 34622f362f
31 changed files with 2390 additions and 9 deletions

View File

@ -0,0 +1,12 @@
DROP TABLE IF EXISTS `world_exchange_items`;
CREATE TABLE `world_exchange_items` (
`world_exchange_id` INT NOT NULL DEFAULT 0,
`item_object_id` INT NOT NULL DEFAULT 0,
`item_status` smallint(6) NOT NULL,
`category_id` smallint(6) NOT NULL,
`price` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`old_owner_id` INT NOT NULL DEFAULT 0,
`start_time` bigint(13) unsigned NOT NULL DEFAULT '0',
`end_time` bigint(13) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`world_exchange_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

View File

@ -0,0 +1,56 @@
# ---------------------------------------------------------------------------
# World Exchange Settings
# ---------------------------------------------------------------------------
# Enable World Exchange icon.
# Default: False
# Needs proper WorldExchangeSortType
EnableWorldExchange = False
# World Exchange Default Language
# Use "en" if you dont use multilang
# or you don't have ItemNameLocalisation.xml file at data/lang/"lang"
# Usage: Sorting items by name.
# Default: en
WorldExchangeDefaultLanguage = en
# Time in MS - every N ms will check all bid status and update if needed.
# Default: 30 second (30 000 ms)
BidItemsIntervalStatusCheck = 30000
# Sale tax
# Default: 5% (0.05)
# Carefully - hard coded value (in client).
LCoinFee = 0.05
# Max sale tax
# Default: 20 000 / On Chinese 500 000 / no limit -1
# Carefully - need to change GamePlayData.
MaxLCoinFee = 20000
# Registration Fee
# Default: 100% (100.0)
# Carefully - hard coded value (in client).
AdenaFee = 100.0
# Max Registration Fee
# Default: -1 (no limit) / On Chinese 20 000
# Carefully - need to change GamePlayData.
MaxAdenaFee = -1
# Bid items will save with Global Variable when set to false.
# If true - on every bid item change.
# Default: False
DBLazy = False
# Time, how long item will be registered in World Exchange.
# Default: 14 Days
ItemSellPeriod = 14
# Time, how long player can payment from sold item.
# Default: 120 Days
PaymentTakePeriod = 120
# Time, how long player can take back item if not sold.
# Default: 120 Days
ItemBackPeriod = 120

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/ItemNameLocalisation.xsd">
<!-- Only used by World Trade-->
<item id="1" name="Κοντό Ξίφος" />
<item id="2" name="Μακρύ Ξίφος" />
<item id="3" name="Ευρύ Ξίφος" />
</list>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="list" type="listType" />
<xs:complexType name="itemType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="id" use="optional" />
<xs:attribute type="xs:string" name="name" use="optional" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="listType">
<xs:sequence>
<xs:element type="itemType" name="item" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -111,6 +111,7 @@ public class Config
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
private static final String HEXID_FILE = "./config/hexid.txt";
private static final String IPCONFIG_FILE = "./config/ipconfig.xml";
private static final String WORLD_EXCHANGE_FILE = "./config/WorldExchange.ini";
// --------------------------------------------------
// Custom Config File Definitions
@ -892,6 +893,19 @@ public class Config
public static boolean ENABLE_CMD_LINE_LOGIN;
public static boolean ONLY_CMD_LINE_LOGIN;
// World Exchange
public static boolean ENABLE_WORLD_EXCHANGE;
public static String WORLD_EXCHANGE_DEFAULT_LANG;
public static long WORLD_EXCHANGE_SAVE_INTERVAL;
public static double WORLD_EXCHANGE_LCOIN_TAX;
public static long WORLD_EXCHANGE_MAX_LCOIN_TAX;
public static double WORLD_EXCHANGE_ADENA_FEE;
public static long WORLD_EXCHANGE_MAX_ADENA_FEE;
public static boolean WORLD_EXCHANGE_LAZY_UPDATE;
public static int WORLD_EXCHANGE_ITEM_SELL_PERIOD;
public static int WORLD_EXCHANGE_ITEM_BACK_PERIOD;
public static int WORLD_EXCHANGE_PAYMENT_TAKE_PERIOD;
// GrandBoss Settings
// Antharas
@ -1997,6 +2011,20 @@ public class Config
TELNET_PASSWORD = telnetConfig.getString("Password", "");
TELNET_HOSTS = Arrays.asList(telnetConfig.getString("ListOfHosts", "127.0.0.1,::1").split(","));
// Load World Exchange config file (if exists)
final PropertiesParser worldExchangeconfig = new PropertiesParser(WORLD_EXCHANGE_FILE);
ENABLE_WORLD_EXCHANGE = worldExchangeconfig.getBoolean("EnableWorldExchange", true);
WORLD_EXCHANGE_DEFAULT_LANG = worldExchangeconfig.getString("WorldExchangeDefaultLanguage", "en");
WORLD_EXCHANGE_SAVE_INTERVAL = worldExchangeconfig.getLong("BidItemsIntervalStatusCheck", 30000);
WORLD_EXCHANGE_LCOIN_TAX = worldExchangeconfig.getDouble("LCoinFee", 0.05);
WORLD_EXCHANGE_MAX_LCOIN_TAX = worldExchangeconfig.getLong("MaxLCoinFee", 20000);
WORLD_EXCHANGE_ADENA_FEE = worldExchangeconfig.getDouble("AdenaFee", 100.0);
WORLD_EXCHANGE_MAX_ADENA_FEE = worldExchangeconfig.getLong("MaxAdenaFee", -1);
WORLD_EXCHANGE_LAZY_UPDATE = worldExchangeconfig.getBoolean("DBLazy", false);
WORLD_EXCHANGE_ITEM_SELL_PERIOD = worldExchangeconfig.getInt("ItemSellPeriod", 14);
WORLD_EXCHANGE_ITEM_BACK_PERIOD = worldExchangeconfig.getInt("ItemBackPeriod", 120);
WORLD_EXCHANGE_PAYMENT_TAKE_PERIOD = worldExchangeconfig.getInt("PaymentTakePeriod", 120);
// Load Training Camp config file (if exists)
final PropertiesParser trainingCampConfig = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
TRAINING_CAMP_ENABLE = trainingCampConfig.getBoolean("TrainingCampEnable", false);

View File

@ -155,6 +155,7 @@ import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.instancemanager.events.EventDropManager;
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
@ -294,6 +295,7 @@ public class GameServer
AppearanceItemData.getInstance();
AlchemyData.getInstance();
ItemCommissionManager.getInstance();
WorldExchangeManager.getInstance();
LuckyGameData.getInstance();
AttendanceRewardData.getInstance();

View File

@ -29,5 +29,6 @@ public enum ItemLocation
REFUND,
MAIL,
FREIGHT,
COMMISSION
COMMISSION,
EXCHANGE
}

View File

@ -0,0 +1,54 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.enums;
/**
* @author Index
*/
public enum WorldExchangeItemMainType
{
EQUIPMENT(0),
ARTIFACT(1),
ENCHANT(8),
CONSUMABLE(20),
ETC(4),
COLLECTION(5);
private final int _id;
private WorldExchangeItemMainType(int id)
{
_id = id;
}
public int getId()
{
return _id;
}
public static WorldExchangeItemMainType getWorldExchangeItemMainType(int id)
{
for (WorldExchangeItemMainType type : values())
{
if (type.getId() == id)
{
return type;
}
}
return null;
}
}

View File

@ -0,0 +1,52 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.enums;
/**
* @author Index
*/
public enum WorldExchangeItemStatusType
{
WORLD_EXCHANGE_REGISTERED(0),
WORLD_EXCHANGE_SOLD(1),
WORLD_EXCHANGE_OUT_TIME(2),
WORLD_EXCHANGE_NONE(3);
private final int _id;
private WorldExchangeItemStatusType(int id)
{
_id = id;
}
public int getId()
{
return _id;
}
public static WorldExchangeItemStatusType getWorldExchangeItemStatusType(int id)
{
for (WorldExchangeItemStatusType type : values())
{
if (type.getId() == id)
{
return type;
}
}
return null;
}
}

View File

@ -0,0 +1,73 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.enums;
/**
* @author Index
*/
public enum WorldExchangeItemSubType
{
WEAPON(0),
ARMOR(1),
ACCESSORY(2),
ETC(3),
ARTIFACT_B1(4),
ARTIFACT_C1(5),
ARTIFACT_D1(6),
ARTIFACT_A1(7),
ENCHANT_SCROLL(8),
BLESS_ENCHANT_SCROLL(9),
MULTI_ENCHANT_SCROLL(10),
ANCIENT_ENCHANT_SCROLL(11),
SPIRITSHOT(12),
SOULSHOT(13),
BUFF(14),
VARIATION_STONE(15),
DYE(16),
SOUL_CRYSTAL(17),
SKILLBOOK(18),
ETC_ENCHANT(19),
POTION_AND_ETC_SCROLL(20),
TICKET(21),
CRAFT(22),
INC_ENCHANT_PROP(23),
ETC_SUB_TYPE(24);
private final int _id;
private WorldExchangeItemSubType(int id)
{
_id = id;
}
public int getId()
{
return _id;
}
public static WorldExchangeItemSubType getWorldExchangeItemSubType(int id)
{
for (WorldExchangeItemSubType type : values())
{
if (type.getId() == id)
{
return type;
}
}
return null;
}
}

View File

@ -0,0 +1,55 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.enums;
/**
* @author Index
*/
public enum WorldExchangeSortType
{
NONE(0),
ITEM_NAME_ASCE(2),
ITEM_NAME_DESC(3),
// ENCHANT_ASCE(2),
// ENCHANT_DESC(3),
PRICE_ASCE(4),
PRICE_DESC(5);
private final int _id;
private WorldExchangeSortType(int id)
{
_id = id;
}
public int getId()
{
return _id;
}
public static WorldExchangeSortType getWorldExchangeSortType(int id)
{
for (WorldExchangeSortType type : values())
{
if (type.getId() == id)
{
return type;
}
}
return NONE;
}
}

View File

@ -142,6 +142,11 @@ public class DailyTaskManager
{
GlobalVariablesManager.getInstance().storeMe();
if (Config.WORLD_EXCHANGE_LAZY_UPDATE)
{
WorldExchangeManager.getInstance().storeMe();
}
if (Olympiad.getInstance().inCompPeriod())
{
Olympiad.getInstance().saveOlympiadStatus();

View File

@ -0,0 +1,123 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.model.holders;
import org.l2jmobius.gameserver.enums.WorldExchangeItemStatusType;
import org.l2jmobius.gameserver.enums.WorldExchangeItemSubType;
import org.l2jmobius.gameserver.model.ItemInfo;
import org.l2jmobius.gameserver.model.item.instance.Item;
/**
* @author Index
*/
public class WorldExchangeHolder
{
private final long _worldExchangeId;
private final Item _itemInstance;
private final ItemInfo _itemInfo;
private final long _price;
private final int _oldOwnerId;
private WorldExchangeItemStatusType _storeType;
private final WorldExchangeItemSubType _category;
private final long _startTime;
private long _endTime;
private boolean _hasChanges;
public WorldExchangeHolder(long worldExchangeId, Item itemInstance, ItemInfo itemInfo, long price, int oldOwnerId, WorldExchangeItemStatusType storeType, WorldExchangeItemSubType category, long startTime, long endTime, boolean hasChanges)
{
_worldExchangeId = worldExchangeId;
_itemInstance = itemInstance;
_itemInfo = itemInfo;
_price = price;
_oldOwnerId = oldOwnerId;
_storeType = storeType;
_category = category;
_startTime = startTime;
_endTime = endTime;
_hasChanges = hasChanges;
}
public long getWorldExchangeId()
{
return _worldExchangeId;
}
public Item getItemInstance()
{
return _itemInstance;
}
public ItemInfo getItemInfo()
{
return _itemInfo;
}
public long getPrice()
{
return _price;
}
public int getOldOwnerId()
{
return _oldOwnerId;
}
public WorldExchangeItemStatusType getStoreType()
{
return _storeType;
}
public void setStoreType(WorldExchangeItemStatusType storeType)
{
_storeType = storeType;
}
public WorldExchangeItemSubType getCategory()
{
return _category;
}
public long getStartTime()
{
return _startTime;
}
public long getEndTime()
{
return _endTime;
}
public void setEndTime(long endTime)
{
_endTime = endTime;
}
public boolean hasChanges()
{
if (_hasChanges) // TODO: Fix logic.
{
_hasChanges = false;
return true;
}
return false;
}
public void setHasChanges(boolean hasChanges)
{
_hasChanges = hasChanges;
}
}

View File

@ -184,6 +184,11 @@ import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationClose
import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationOpenUi;
import org.l2jmobius.gameserver.network.clientpackets.variation.RequestConfirmGemStone;
import org.l2jmobius.gameserver.network.clientpackets.variation.RequestRefine;
import org.l2jmobius.gameserver.network.clientpackets.worldexchange.ExWorldExchangeBuyItem;
import org.l2jmobius.gameserver.network.clientpackets.worldexchange.ExWorldExchangeItemList;
import org.l2jmobius.gameserver.network.clientpackets.worldexchange.ExWorldExchangeRegisterItem;
import org.l2jmobius.gameserver.network.clientpackets.worldexchange.ExWorldExchangeSettleList;
import org.l2jmobius.gameserver.network.clientpackets.worldexchange.ExWorldExchangeSettleRecvResult;
/**
* @author Sdw
@ -769,11 +774,11 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_BALROGWAR_SHOW_RANKING(0x23B, null, ConnectionState.IN_GAME),
EX_BALROGWAR_GET_REWARD(0x23C, null, ConnectionState.IN_GAME),
EX_USER_RESTART_LOCKER_UPDATE(0x23D, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_ITEM_LIST(0x23E, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_REGI_ITEM(0x23F, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_BUY_ITEM(0x240, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_SETTLE_LIST(0x241, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT(0x242, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_ITEM_LIST(0x23E, ExWorldExchangeItemList::new, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_REGI_ITEM(0x23F, ExWorldExchangeRegisterItem::new, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_BUY_ITEM(0x240, ExWorldExchangeBuyItem::new, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_SETTLE_LIST(0x241, ExWorldExchangeSettleList::new, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT(0x242, ExWorldExchangeSettleRecvResult::new, ConnectionState.IN_GAME),
EX_READY_ITEM_AUTO_PEEL(0x243, ExRequestReadyItemAutoPeel::new, ConnectionState.IN_GAME),
EX_REQUEST_ITEM_AUTO_PEEL(0x244, ExRequestItemAutoPeel::new, ConnectionState.IN_GAME),
EX_STOP_ITEM_AUTO_PEEL(0x245, ExRequestStopItemAutoPeel::new, ConnectionState.IN_GAME),
@ -781,7 +786,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_VARIATION_CLOSE_UI(0x247, ExVariationCloseUi::new, ConnectionState.IN_GAME),
EX_APPLY_VARIATION_OPTION(0x248, ExApplyVariationOption::new, ConnectionState.IN_GAME),
EX_REQUEST_AUDIO_LOG_SAVE(0x249, null, ConnectionState.IN_GAME),
EX_BR_VERSION(0x24A, null, ConnectionState.IN_GAME),
EX_BR_VERSION(0x24A, RequestBRVersion::new, ConnectionState.AUTHENTICATED, ConnectionState.CONNECTED),
// 388
EX_WRANKING_FESTIVAL_INFO(0x24B, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_OPEN(0x24C, null, ConnectionState.IN_GAME),

View File

@ -44,6 +44,7 @@ import org.l2jmobius.gameserver.instancemanager.PetitionManager;
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
@ -708,6 +709,9 @@ public class EnterWorld implements IClientIncomingPacket
player.getInventory().unEquipItemInBodySlot(Inventory.PAPERDOLL_LHAND);
}
// World Trade.
WorldExchangeManager.getInstance().checkPlayerSellAlarm(player);
if (Config.ENABLE_ATTENDANCE_REWARDS)
{
ThreadPool.schedule(() ->

View File

@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.clientpackets;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.serverpackets.ExBRVersion;
/**
* @author Index
*/
public class RequestBRVersion implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
return true;
}
@Override
public void run(GameClient client)
{
client.sendPacket(new ExBRVersion());
}
}

View File

@ -0,0 +1,56 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.clientpackets.worldexchange;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author Index
*/
public class ExWorldExchangeBuyItem implements IClientIncomingPacket
{
private long _worldExchangeIndex;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_worldExchangeIndex = packet.readQ();
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_WORLD_EXCHANGE)
{
return;
}
final Player player = client.getPlayer();
if (player == null)
{
return;
}
WorldExchangeManager.getInstance().buyItem(player, _worldExchangeIndex);
}
}

View File

@ -0,0 +1,84 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.clientpackets.worldexchange;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.enums.WorldExchangeItemSubType;
import org.l2jmobius.gameserver.enums.WorldExchangeSortType;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.WorldExchangeHolder;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.worldexchange.WorldExchangeItemList;
/**
* @author Index
*/
public class ExWorldExchangeItemList implements IClientIncomingPacket
{
private int _category;
private int _sortType;
private final List<Integer> _itemIdList = new ArrayList<>();
@Override
public boolean read(GameClient client, PacketReader packet)
{
_category = packet.readH();
_sortType = packet.readC();
packet.readD(); // page
int size = packet.readD();
for (int i = 0; i < size; i++)
{
_itemIdList.add(packet.readD());
}
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_WORLD_EXCHANGE)
{
return;
}
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final String lang = Config.MULTILANG_ENABLE ? player.getLang() != null ? player.getLang() : Config.WORLD_EXCHANGE_DEFAULT_LANG : Config.WORLD_EXCHANGE_DEFAULT_LANG;
if (_itemIdList.isEmpty())
{
final List<WorldExchangeHolder> holders = WorldExchangeManager.getInstance().getItemBids(player.getObjectId(), WorldExchangeItemSubType.getWorldExchangeItemSubType(_category), WorldExchangeSortType.getWorldExchangeSortType(_sortType), lang);
player.sendPacket(new WorldExchangeItemList(holders, WorldExchangeItemSubType.getWorldExchangeItemSubType(_category)));
}
else
{
WorldExchangeManager.getInstance().addCategoryType(_itemIdList, _category);
final List<WorldExchangeHolder> holders = WorldExchangeManager.getInstance().getItemBids(_itemIdList, WorldExchangeSortType.getWorldExchangeSortType(_sortType), lang);
player.sendPacket(new WorldExchangeItemList(holders, WorldExchangeItemSubType.getWorldExchangeItemSubType(_category)));
}
}
}

View File

@ -0,0 +1,60 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.clientpackets.worldexchange;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author Index
*/
public class ExWorldExchangeRegisterItem implements IClientIncomingPacket
{
private long _price;
private int _itemId;
private long _amount;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_price = packet.readQ();
_itemId = packet.readD();
_amount = packet.readQ();
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_WORLD_EXCHANGE)
{
return;
}
final Player player = client.getPlayer();
if (player == null)
{
return;
}
WorldExchangeManager.getInstance().registerItemBid(player, _itemId, _amount, _price);
}
}

View File

@ -0,0 +1,56 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.clientpackets.worldexchange;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.worldexchange.WorldExchangeItemList;
import org.l2jmobius.gameserver.network.serverpackets.worldexchange.WorldExchangeSettleList;
/**
* @author Index
*/
public class ExWorldExchangeSettleList implements IClientIncomingPacket
{
@Override
public boolean read(GameClient client, PacketReader packet)
{
packet.readC();
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_WORLD_EXCHANGE)
{
return;
}
final Player player = client.getPlayer();
if (player == null)
{
return;
}
player.sendPacket(WorldExchangeItemList.EMPTY_LIST);
player.sendPacket(new WorldExchangeSettleList(player));
}
}

View File

@ -0,0 +1,56 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.clientpackets.worldexchange;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
/**
* @author Index
*/
public class ExWorldExchangeSettleRecvResult implements IClientIncomingPacket
{
private long _worldExchangeIndex;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_worldExchangeIndex = packet.readQ();
return true;
}
@Override
public void run(GameClient client)
{
if (!Config.ENABLE_WORLD_EXCHANGE)
{
return;
}
final Player player = client.getPlayer();
if (player == null)
{
return;
}
WorldExchangeManager.getInstance().getItemStatusAndMakeAction(player, _worldExchangeIndex);
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
/**
* @author Index
*/
public class ExBRVersion implements IClientOutgoingPacket
{
public ExBRVersion()
{
}
@Override
public boolean write(PacketWriter packet)
{
if (!Config.ENABLE_WORLD_EXCHANGE)
{
return false;
}
OutgoingPackets.EX_BR_VERSION.writeId(packet);
packet.writeC(1);
return true;
}
}

View File

@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets.worldexchange;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class WorldExchangeBuyItem implements IClientOutgoingPacket
{
public static final WorldExchangeBuyItem FAIL = new WorldExchangeBuyItem(-1, -1L, (byte) 0);
private final int _itemObjectId;
private final long _itemAmount;
private final byte _type;
public WorldExchangeBuyItem(int itemObjectId, long itemAmount, byte type)
{
_itemObjectId = itemObjectId;
_itemAmount = itemAmount;
_type = type;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_WORLD_EXCHANGE_BUY_ITEM.writeId(packet);
packet.writeD(_itemObjectId);
packet.writeQ(_itemAmount);
packet.writeC(_type);
return true;
}
}

View File

@ -0,0 +1,126 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets.worldexchange;
import java.util.Collections;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.AttributeType;
import org.l2jmobius.gameserver.enums.WorldExchangeItemSubType;
import org.l2jmobius.gameserver.model.VariationInstance;
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import org.l2jmobius.gameserver.model.holders.WorldExchangeHolder;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class WorldExchangeItemList implements IClientOutgoingPacket
{
public static final WorldExchangeItemList EMPTY_LIST = new WorldExchangeItemList(Collections.emptyList(), null);
private final List<WorldExchangeHolder> _holders;
private final WorldExchangeItemSubType _type;
public WorldExchangeItemList(List<WorldExchangeHolder> holders, WorldExchangeItemSubType type)
{
_holders = holders;
_type = type;
}
@Override
public boolean write(PacketWriter packet)
{
if (_holders.isEmpty())
{
packet.writeH(0); // Category
packet.writeC(0); // SortType
packet.writeD(0); // Page
packet.writeD(0); // ItemIDList
return false;
}
OutgoingPackets.EX_WORLD_EXCHANGE_ITEM_LIST.writeId(packet);
packet.writeH(_type.getId());
packet.writeC(0);
packet.writeD(0);
packet.writeD(_holders.size());
for (WorldExchangeHolder holder : _holders)
{
getItemInfo(packet, holder);
}
return true;
}
private void getItemInfo(PacketWriter packet, WorldExchangeHolder holder)
{
packet.writeQ(holder.getWorldExchangeId());
packet.writeQ(holder.getPrice());
packet.writeD((int) (holder.getEndTime() / 1000L));
Item item = holder.getItemInstance();
packet.writeD(item.getId());
packet.writeQ(item.getCount());
packet.writeD(item.getEnchantLevel() < 1 ? 0 : item.getEnchantLevel());
VariationInstance iv = item.getAugmentation();
packet.writeD(iv != null ? iv.getOption1Id() : 0);
packet.writeD(iv != null ? iv.getOption2Id() : 0);
packet.writeD(-1);
packet.writeH(item.getAttackAttribute() != null ? item.getAttackAttribute().getType().getClientId() : 0);
packet.writeH(item.getAttackAttribute() != null ? item.getAttackAttribute().getValue() : 0);
packet.writeH(item.getDefenceAttribute(AttributeType.FIRE));
packet.writeH(item.getDefenceAttribute(AttributeType.WATER));
packet.writeH(item.getDefenceAttribute(AttributeType.WIND));
packet.writeH(item.getDefenceAttribute(AttributeType.EARTH));
packet.writeH(item.getDefenceAttribute(AttributeType.HOLY));
packet.writeH(item.getDefenceAttribute(AttributeType.DARK));
packet.writeD(item.getVisualId());
final List<EnsoulOption> soul = (List<EnsoulOption>) holder.getItemInfo().getSoulCrystalOptions();
try
{
packet.writeD(soul != null ? soul.get(0).getId() : 0);
}
catch (IndexOutOfBoundsException ignored)
{
packet.writeD(0);
}
try
{
packet.writeD(soul != null ? soul.get(1).getId() : 0);
}
catch (IndexOutOfBoundsException ignored)
{
packet.writeD(0);
}
final List<EnsoulOption> specialSoul = (List<EnsoulOption>) holder.getItemInfo().getSoulCrystalSpecialOptions();
try
{
packet.writeD(specialSoul != null ? specialSoul.get(0).getId() : 0);
}
catch (IndexOutOfBoundsException ignored)
{
packet.writeD(0);
}
packet.writeH(0); // isBlessed
}
}

View File

@ -0,0 +1,51 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets.worldexchange;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class WorldExchangeRegisterItem implements IClientOutgoingPacket
{
public static final WorldExchangeRegisterItem FAIL = new WorldExchangeRegisterItem(-1, -1L, (byte) 0);
private final int _itemObjectId;
private final long _itemAmount;
private final byte _type;
public WorldExchangeRegisterItem(int itemObjectId, long itemAmount, byte type)
{
_itemObjectId = itemObjectId;
_itemAmount = itemAmount;
_type = type;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_WORLD_EXCHANGE_REGI_ITEM.writeId(packet);
packet.writeD(_itemObjectId);
packet.writeQ(_itemAmount);
packet.writeC(_type);
return true;
}
}

View File

@ -0,0 +1,45 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets.worldexchange;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class WorldExchangeSellCompleteAlarm implements IClientOutgoingPacket
{
private final int _itemId;
private final long _amount;
public WorldExchangeSellCompleteAlarm(int itemId, long amount)
{
_itemId = itemId;
_amount = amount;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_WORLD_EXCHANGE_SELL_COMPLETE_ALARM.writeId(packet);
packet.writeD(_itemId);
packet.writeQ(_amount);
return true;
}
}

View File

@ -0,0 +1,134 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets.worldexchange;
import java.util.List;
import java.util.Map;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.enums.AttributeType;
import org.l2jmobius.gameserver.enums.WorldExchangeItemStatusType;
import org.l2jmobius.gameserver.instancemanager.WorldExchangeManager;
import org.l2jmobius.gameserver.model.VariationInstance;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
import org.l2jmobius.gameserver.model.holders.WorldExchangeHolder;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class WorldExchangeSettleList implements IClientOutgoingPacket
{
private final Player _player;
public WorldExchangeSettleList(Player player)
{
_player = player;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_WORLD_EXCHANGE_SETTLE_LIST.writeId(packet);
final Map<WorldExchangeItemStatusType, List<WorldExchangeHolder>> holders = WorldExchangeManager.getInstance().getPlayerBids(_player.getObjectId());
if (holders.isEmpty())
{
packet.writeD(0); // RegiItemDataList
packet.writeD(0); // RecvItemDataList
packet.writeD(0); // TimeOutItemDataList
return false;
}
packet.writeD(holders.get(WorldExchangeItemStatusType.WORLD_EXCHANGE_REGISTERED).size());
for (WorldExchangeHolder holder : holders.get(WorldExchangeItemStatusType.WORLD_EXCHANGE_REGISTERED))
{
getItemInfo(packet, holder);
}
packet.writeD(holders.get(WorldExchangeItemStatusType.WORLD_EXCHANGE_SOLD).size());
for (WorldExchangeHolder holder : holders.get(WorldExchangeItemStatusType.WORLD_EXCHANGE_SOLD))
{
getItemInfo(packet, holder);
}
packet.writeD(holders.get(WorldExchangeItemStatusType.WORLD_EXCHANGE_OUT_TIME).size());
for (WorldExchangeHolder holder : holders.get(WorldExchangeItemStatusType.WORLD_EXCHANGE_OUT_TIME))
{
getItemInfo(packet, holder);
}
return true;
}
private void getItemInfo(PacketWriter packet, WorldExchangeHolder holder)
{
packet.writeQ(holder.getWorldExchangeId());
packet.writeQ(holder.getPrice());
packet.writeD((int) (holder.getEndTime() / 1000L));
Item item = holder.getItemInstance();
packet.writeD(item.getId());
packet.writeQ(item.getCount());
packet.writeD(item.getEnchantLevel() < 1 ? 0 : item.getEnchantLevel());
VariationInstance iv = item.getAugmentation();
packet.writeD(iv != null ? iv.getOption1Id() : 0);
packet.writeD(iv != null ? iv.getOption2Id() : 0);
packet.writeD(-1); // IntensiveItemClassID
packet.writeH(item.getAttackAttribute() != null ? item.getAttackAttribute().getType().getClientId() : 0);
packet.writeH(item.getAttackAttribute() != null ? item.getAttackAttribute().getValue() : 0);
packet.writeH(item.getDefenceAttribute(AttributeType.FIRE));
packet.writeH(item.getDefenceAttribute(AttributeType.WATER));
packet.writeH(item.getDefenceAttribute(AttributeType.WIND));
packet.writeH(item.getDefenceAttribute(AttributeType.EARTH));
packet.writeH(item.getDefenceAttribute(AttributeType.HOLY));
packet.writeH(item.getDefenceAttribute(AttributeType.DARK));
packet.writeD(item.getVisualId());
final List<EnsoulOption> soul = (List<EnsoulOption>) holder.getItemInfo().getSoulCrystalOptions();
try
{
packet.writeD(soul.get(0).getId());
}
catch (IndexOutOfBoundsException ignored)
{
packet.writeD(0);
}
try
{
packet.writeD(soul.get(1).getId());
}
catch (IndexOutOfBoundsException ignored)
{
packet.writeD(0);
}
final List<EnsoulOption> specialSoul = (List<EnsoulOption>) holder.getItemInfo().getSoulCrystalSpecialOptions();
try
{
packet.writeD(specialSoul.get(0).getId());
}
catch (IndexOutOfBoundsException ignored)
{
packet.writeD(0);
}
packet.writeH(0); // isBlessed
}
}

View File

@ -0,0 +1,50 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 org.l2jmobius.gameserver.network.serverpackets.worldexchange;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author Index
*/
public class WorldExchangeSettleRecvResult implements IClientOutgoingPacket
{
public static final WorldExchangeSettleRecvResult FAIL = new WorldExchangeSettleRecvResult(-1, -1L, (byte) 0);
private final int _itemObjectId;
private final long _itemAmount;
private final byte _type;
public WorldExchangeSettleRecvResult(int itemObjectId, long itemAmount, byte type)
{
_itemObjectId = itemObjectId;
_itemAmount = itemAmount;
_type = type;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT.writeId(packet);
packet.writeD(_itemObjectId);
packet.writeQ(_itemAmount);
packet.writeC(_type);
return true;
}
}

View File

@ -50,6 +50,6 @@ public enum WorldExchangeSortType
return type;
}
}
return null;
return NONE;
}
}

View File

@ -969,7 +969,7 @@ public class WorldExchangeManager implements IXmlReader
public void storeMe()
{
if (!Config.WORLD_EXCHANGE_LAZY_UPDATE)
if (!Config.ENABLE_WORLD_EXCHANGE || !Config.WORLD_EXCHANGE_LAZY_UPDATE)
{
return;
}