Addition of World Exchange system.
Contributed by Index.
This commit is contained in:
parent
8ed56a4f88
commit
c9c4e2bf94
12
L2J_Mobius_Essence_6.2_Vanguard/dist/db_installer/sql/game/world_exchange_items.sql
vendored
Normal file
12
L2J_Mobius_Essence_6.2_Vanguard/dist/db_installer/sql/game/world_exchange_items.sql
vendored
Normal 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;
|
55
L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/WorldExchange.ini
vendored
Normal file
55
L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/WorldExchange.ini
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# World Exchange Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Replace clan icon with World Exchange icon.
|
||||
# Default: True
|
||||
EnableWorldExchange = True
|
||||
|
||||
# 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
|
8
L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/lang/el/ItemNamesLocalisation.xml
vendored
Normal file
8
L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/lang/el/ItemNamesLocalisation.xml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?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-->
|
||||
<blessed name="Ευλογημένο" />
|
||||
<item id="1" name="Κοντό Ξίφος" />
|
||||
<item id="2" name="Μακρύ Ξίφος" />
|
||||
<item id="3" name="Ευρύ Ξίφος" />
|
||||
</list>
|
25
L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/xsd/ItemNameLocalisation.xsd
vendored
Normal file
25
L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/xsd/ItemNameLocalisation.xsd
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?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="blessedType">
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute type="xs:string" name="name" />
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
<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="blessedType" name="blessed" />
|
||||
<xs:element type="itemType" name="item" maxOccurs="unbounded" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
@ -116,6 +116,7 @@ public class Config
|
||||
private static final String IPCONFIG_FILE = "./config/ipconfig.xml";
|
||||
private static final String MAGIC_LAMP_FILE = "./config/MagicLamp.ini";
|
||||
private static final String RANDOM_CRAFT_FILE = "./config/RandomCraft.ini";
|
||||
private static final String WORLD_EXCHANGE_FILE = "./config/WorldExchange.ini";
|
||||
|
||||
// --------------------------------------------------
|
||||
// Custom Config File Definitions
|
||||
@ -928,6 +929,19 @@ public class Config
|
||||
public static int RANDOM_CRAFT_CREATE_FEE;
|
||||
public static boolean DROP_RANDOM_CRAFT_MATERIALS;
|
||||
|
||||
// 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;
|
||||
|
||||
// HuntPass
|
||||
public static boolean ENABLE_HUNT_PASS;
|
||||
public static int HUNT_PASS_PERIOD;
|
||||
@ -2066,6 +2080,20 @@ public class Config
|
||||
RANDOM_CRAFT_CREATE_FEE = randomCraftconfig.getInt("RandomCraftCreateFee", 300000);
|
||||
DROP_RANDOM_CRAFT_MATERIALS = randomCraftconfig.getBoolean("DropRandomCraftMaterials", true);
|
||||
|
||||
// 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);
|
||||
|
@ -163,6 +163,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;
|
||||
@ -316,6 +317,7 @@ public class GameServer
|
||||
PcCafePointsManager.getInstance();
|
||||
AppearanceItemData.getInstance();
|
||||
ItemCommissionManager.getInstance();
|
||||
WorldExchangeManager.getInstance();
|
||||
LuckyGameData.getInstance();
|
||||
AttendanceRewardData.getInstance();
|
||||
MagicLampData.getInstance();
|
||||
|
@ -29,5 +29,6 @@ public enum ItemLocation
|
||||
REFUND,
|
||||
MAIL,
|
||||
FREIGHT,
|
||||
COMMISSION
|
||||
COMMISSION,
|
||||
EXCHANGE
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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 null;
|
||||
}
|
||||
}
|
@ -149,6 +149,11 @@ public class DailyTaskManager
|
||||
{
|
||||
GlobalVariablesManager.getInstance().storeMe();
|
||||
|
||||
if (Config.WORLD_EXCHANGE_LAZY_UPDATE)
|
||||
{
|
||||
WorldExchangeManager.getInstance().storeMe();
|
||||
}
|
||||
|
||||
if (Olympiad.getInstance().inCompPeriod())
|
||||
{
|
||||
Olympiad.getInstance().saveOlympiadStatus();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
}
|
||||
}
|
@ -2501,6 +2501,11 @@ public class Item extends WorldObject
|
||||
}
|
||||
|
||||
public void setVisualId(int visualId)
|
||||
{
|
||||
setVisualId(visualId, true);
|
||||
}
|
||||
|
||||
public void setVisualId(int visualId, boolean announce)
|
||||
{
|
||||
getVariables().set(ItemVariables.VISUAL_ID, visualId);
|
||||
|
||||
@ -2508,7 +2513,7 @@ public class Item extends WorldObject
|
||||
if (visualId == 0)
|
||||
{
|
||||
ItemAppearanceTaskManager.getInstance().remove(this);
|
||||
onVisualLifeTimeEnd();
|
||||
onVisualLifeTimeEnd(announce);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2535,6 +2540,11 @@ public class Item extends WorldObject
|
||||
}
|
||||
|
||||
public void onVisualLifeTimeEnd()
|
||||
{
|
||||
onVisualLifeTimeEnd(true);
|
||||
}
|
||||
|
||||
public void onVisualLifeTimeEnd(boolean announce)
|
||||
{
|
||||
final ItemVariables vars = getVariables();
|
||||
vars.remove(ItemVariables.VISUAL_ID);
|
||||
@ -2550,13 +2560,16 @@ public class Item extends WorldObject
|
||||
player.broadcastUserInfo(UserInfoType.APPAREANCE);
|
||||
player.sendInventoryUpdate(iu);
|
||||
|
||||
if (isEnchanted())
|
||||
if (announce)
|
||||
{
|
||||
player.sendPacket(new SystemMessage(SystemMessageId.S1_S2_HAS_BEEN_RESTORED_TO_ITS_PREVIOUS_APPEARANCE_AS_ITS_TEMPORARY_MODIFICATION_HAS_EXPIRED).addInt(_enchantLevel).addItemName(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new SystemMessage(SystemMessageId.S1_HAS_BEEN_RESTORED_TO_ITS_PREVIOUS_APPEARANCE_AS_ITS_TEMPORARY_MODIFICATION_HAS_EXPIRED).addItemName(this));
|
||||
if (isEnchanted())
|
||||
{
|
||||
player.sendPacket(new SystemMessage(SystemMessageId.S1_S2_HAS_BEEN_RESTORED_TO_ITS_PREVIOUS_APPEARANCE_AS_ITS_TEMPORARY_MODIFICATION_HAS_EXPIRED).addInt(_enchantLevel).addItemName(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendPacket(new SystemMessage(SystemMessageId.S1_HAS_BEEN_RESTORED_TO_ITS_PREVIOUS_APPEARANCE_AS_ITS_TEMPORARY_MODIFICATION_HAS_EXPIRED).addItemName(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,6 +195,11 @@ import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationOpenU
|
||||
import org.l2jmobius.gameserver.network.clientpackets.variation.RequestRefine;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.vip.ExRequestVipInfo;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.vip.RequestVipLuckGameInfo;
|
||||
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;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.enchant.RequestExRemoveEnchantSupportItem;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.variation.RequestConfirmGemStone;
|
||||
|
||||
@ -781,18 +786,18 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
EX_BALROGWAR_SHOW_RANKING(0x23A, null, ConnectionState.IN_GAME),
|
||||
EX_BALROGWAR_GET_REWARD(0x23B, null, ConnectionState.IN_GAME),
|
||||
EX_USER_RESTART_LOCKER_UPDATE(0x23C, null, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_ITEM_LIST(0x23D, null, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_REGI_ITEM(0x23E, null, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_BUY_ITEM(0x23F, null, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_SETTLE_LIST(0x240, null, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT(0x241, null, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_ITEM_LIST(0x23D, ExWorldExchangeItemList::new, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_REGI_ITEM(0x23E, ExWorldExchangeRegisterItem::new, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_BUY_ITEM(0x23F, ExWorldExchangeBuyItem::new, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_SETTLE_LIST(0x240, ExWorldExchangeSettleList::new, ConnectionState.IN_GAME),
|
||||
EX_WORLD_EXCHANGE_SETTLE_RECV_RESULT(0x241, ExWorldExchangeSettleRecvResult::new, ConnectionState.IN_GAME),
|
||||
EX_READY_ITEM_AUTO_PEEL(0x242, null, ConnectionState.IN_GAME),
|
||||
EX_REQUEST_ITEM_AUTO_PEEL(0x243, null, ConnectionState.IN_GAME),
|
||||
EX_STOP_ITEM_AUTO_PEEL(0x244, null, ConnectionState.IN_GAME),
|
||||
EX_VARIATION_OPEN_UI(0x245, ExVariationOpenUi::new, ConnectionState.IN_GAME),
|
||||
EX_VARIATION_CLOSE_UI(0x246, ExVariationCloseUi::new, ConnectionState.IN_GAME),
|
||||
EX_APPLY_VARIATION_OPTION(0x247, ExApplyVariationOption::new, ConnectionState.IN_GAME),
|
||||
EX_BR_VERSION(0x248, null, ConnectionState.IN_GAME),
|
||||
EX_BR_VERSION(0x248, RequestBRVersion::new, ConnectionState.AUTHENTICATED, ConnectionState.CONNECTED),
|
||||
EX_MAX(0x249, null, ConnectionState.IN_GAME);
|
||||
|
||||
public static final ExIncomingPackets[] PACKET_ARRAY;
|
||||
|
@ -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;
|
||||
@ -711,6 +712,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(() ->
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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(item.isBlessed() ? 1 : 0);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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(item.isBlessed() ? 1 : 0);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user