- Added all referenced libraries for eclipse to perform as it should.

- Renamed AuctionManager into ClanHallAuctionManager.
 - Created Comission (Auction house) system.
 - Reworked vitality system from account based to subclass based.
This commit is contained in:
erlandys56 2015-01-24 21:21:32 +00:00
parent 1c6301c46d
commit ebe4ba005d
46 changed files with 2684 additions and 213 deletions

View File

@ -6,6 +6,9 @@
<classpathentry kind="lib" path="dist/libs/L2J_GeoDriver.jar" />
<classpathentry kind="lib" path="dist/libs/mail-1.5.2.jar"/>
<classpathentry kind="lib" path="dist/libs/mmocore.jar"/>
<classpathentry kind="lib" path="dist/libs/mysql-connector-java-5.1.34-bin.jar"/>
<classpathentry kind="lib" path="dist/libs/java-engine-1.8.jar"/>
<classpathentry kind="lib" path="dist/libs/ecj-4.4.jar"/>
<classpathentry kind="lib" path="dist/libs/weupnp-0.1.3.jar"/>
<classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts"/>
<classpathentry kind="src" path="java"/>

View File

@ -0,0 +1,13 @@
<html><head>
<body>
Talking Island Auction House Manager:<br>
Welcome, adventurer.<br1>
Are you familiar with our services?<br>
We are sales intermediaries. We enable you to view and purchase goods from all over the continent at rock bottom prices!<br1>
And, if you have items you want to sell, we can handle those transactions for you.<br>
Leave the worry and the paperwork to us! All you need to is pay us a small transaction fee, and we'll take care of the rest.<br1>
<font color="LEVEL">When an item sells, we'll transfer the proceeds to you, minus a slight transaction fee, of course.</font><br>
What do you think? You interested?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h showAuction">"Yes, I am!"</Button>
</body>
</html>

View File

@ -22,8 +22,8 @@ import java.util.StringTokenizer;
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -98,9 +98,9 @@ public class AdminClanHall implements IAdminCommandHandler
if (!clanhall.isSiegableHall())
{
ClanHallManager.getInstance().setOwner(clanhall.getId(), clan);
if (AuctionManager.getInstance().getAuction(clanhall.getId()) != null)
if (ClanHallAuctionManager.getInstance().getAuction(clanhall.getId()) != null)
{
AuctionManager.getInstance().getAuction(clanhall.getId()).deleteAuctionFromDB();
ClanHallAuctionManager.getInstance().getAuction(clanhall.getId()).deleteAuctionFromDB();
}
}
else
@ -116,7 +116,7 @@ public class AdminClanHall implements IAdminCommandHandler
if (!ClanHallManager.getInstance().isFree(clanhall.getId()))
{
ClanHallManager.getInstance().setFree(clanhall.getId());
AuctionManager.getInstance().initNPC(clanhall.getId());
ClanHallAuctionManager.getInstance().initNPC(clanhall.getId());
}
else
{

View File

@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS `auctions_info` (
`auctionID` int(11) NOT NULL DEFAULT '0',
`sellerID` int(11) NOT NULL DEFAULT '0',
`itemName` varchar(50) DEFAULT NULL,
`itemOID` int(11) NOT NULL,
`price` bigint(20) NOT NULL,
`count` bigint(20) unsigned NOT NULL DEFAULT '0',
`category` int(3) NOT NULL,
`duration` int(11) NOT NULL,
`finishTime` bigint(13) NOT NULL,
`itemID` int(13) NOT NULL,
PRIMARY KEY (`sellerID`,`auctionID`)
);

View File

@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `character_subclasses` (
`class_id` int(2) NOT NULL DEFAULT 0,
`exp` bigint(20) NOT NULL DEFAULT 0,
`sp` bigint(10) NOT NULL DEFAULT 0,
`vitality_points` int(10) NOT NULL DEFAULT '140000',
`level` int(2) NOT NULL DEFAULT 40,
`class_index` int(1) NOT NULL DEFAULT 0,
`dual_class` BOOLEAN NOT NULL DEFAULT FALSE,

View File

@ -52,7 +52,7 @@ CREATE TABLE IF NOT EXISTS `characters` (
`clan_create_expiry_time` bigint(13) unsigned NOT NULL DEFAULT '0',
`death_penalty_level` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`bookmarkslot` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`vitality_points` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`vitality_points` int(10) NOT NULL DEFAULT '140000',
`createDate` date NOT NULL DEFAULT '0000-00-00',
`language` VARCHAR(2) DEFAULT NULL,
PRIMARY KEY (`charId`),

View File

@ -16,5 +16,7 @@ CREATE TABLE IF NOT EXISTS `messages` (
`itemId` INT(11) NOT NULL DEFAULT '0',
`enchantLvl` INT(3) NOT NULL DEFAULT '0',
`elementals` VARCHAR(25),
`systemMessage1` INT(10) NOT NULL DEFAULT '-1',
`systemMessage2` INT(10) NOT NULL DEFAULT '-1',
PRIMARY KEY (`messageId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -103,6 +103,7 @@ import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
import com.l2jserver.gameserver.instancemanager.CastleManager;
import com.l2jserver.gameserver.instancemanager.CastleManorManager;
import com.l2jserver.gameserver.instancemanager.ClanEntryManager;
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallManager;
import com.l2jserver.gameserver.instancemanager.CoupleManager;
import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
@ -239,6 +240,7 @@ public class GameServer
FishingMonstersData.getInstance();
FishingRodsData.getInstance();
HennaData.getInstance();
AuctionManager.getInstance();
printSection("Characters");
ClassListData.getInstance();
@ -266,7 +268,7 @@ public class GameServer
ClanTable.getInstance();
CHSiegeManager.getInstance();
ClanHallManager.getInstance();
AuctionManager.getInstance();
ClanHallAuctionManager.getInstance();
ClanEntryManager.getInstance();
printSection("Geodata");

View File

@ -35,8 +35,8 @@ import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager;
import com.l2jserver.gameserver.enums.UserInfoType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
import com.l2jserver.gameserver.instancemanager.FortManager;
import com.l2jserver.gameserver.instancemanager.FortSiegeManager;
import com.l2jserver.gameserver.instancemanager.SiegeManager;
@ -246,7 +246,7 @@ public class ClanTable
}
}
Auction auction = AuctionManager.getInstance().getAuction(clan.getAuctionBiddedAt());
Auction auction = ClanHallAuctionManager.getInstance().getAuction(clan.getAuctionBiddedAt());
if (auction != null)
{
auction.cancelBid(clan.getId());

View File

@ -30,5 +30,6 @@ public enum ItemLocation
LEASE,
REFUND,
MAIL,
FREIGHT
FREIGHT,
AUCTION
}

View File

@ -27,7 +27,7 @@ public enum MailType
NEWS_INFORMER,
NPC,
BIRTHDAY,
COMMISSION_ITEM_RETURNED,
SYSTEM,
COMMISSION_ITEM_SOLD,
MENTOR_NPC,
PRIME_SHOP_GIFT

View File

@ -0,0 +1,190 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.instancemanager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.model.entity.Auction;
/**
* Zoey76: TODO: Rewrite it and unharcode it.
*/
public final class ClanHallAuctionManager
{
protected static final Logger _log = Logger.getLogger(ClanHallAuctionManager.class.getName());
private final List<Auction> _auctions = new ArrayList<>();
private static final String[] ITEM_INIT_DATA =
{
"(22, 0, 'NPC', 'NPC Clan', 'ClanHall', 22, 0, 'Moonstone Hall', 1, 20000000, 0, 1073037600000)",
"(23, 0, 'NPC', 'NPC Clan', 'ClanHall', 23, 0, 'Onyx Hall', 1, 20000000, 0, 1073037600000)",
"(24, 0, 'NPC', 'NPC Clan', 'ClanHall', 24, 0, 'Topaz Hall', 1, 20000000, 0, 1073037600000)",
"(25, 0, 'NPC', 'NPC Clan', 'ClanHall', 25, 0, 'Ruby Hall', 1, 20000000, 0, 1073037600000)",
"(26, 0, 'NPC', 'NPC Clan', 'ClanHall', 26, 0, 'Crystal Hall', 1, 20000000, 0, 1073037600000)",
"(27, 0, 'NPC', 'NPC Clan', 'ClanHall', 27, 0, 'Onyx Hall', 1, 20000000, 0, 1073037600000)",
"(28, 0, 'NPC', 'NPC Clan', 'ClanHall', 28, 0, 'Sapphire Hall', 1, 20000000, 0, 1073037600000)",
"(29, 0, 'NPC', 'NPC Clan', 'ClanHall', 29, 0, 'Moonstone Hall', 1, 20000000, 0, 1073037600000)",
"(30, 0, 'NPC', 'NPC Clan', 'ClanHall', 30, 0, 'Emerald Hall', 1, 20000000, 0, 1073037600000)",
"(31, 0, 'NPC', 'NPC Clan', 'ClanHall', 31, 0, 'The Atramental Barracks', 1, 8000000, 0, 1073037600000)",
"(32, 0, 'NPC', 'NPC Clan', 'ClanHall', 32, 0, 'The Scarlet Barracks', 1, 8000000, 0, 1073037600000)",
"(33, 0, 'NPC', 'NPC Clan', 'ClanHall', 33, 0, 'The Viridian Barracks', 1, 8000000, 0, 1073037600000)",
"(36, 0, 'NPC', 'NPC Clan', 'ClanHall', 36, 0, 'The Golden Chamber', 1, 50000000, 0, 1106827200000)",
"(37, 0, 'NPC', 'NPC Clan', 'ClanHall', 37, 0, 'The Silver Chamber', 1, 50000000, 0, 1106827200000)",
"(38, 0, 'NPC', 'NPC Clan', 'ClanHall', 38, 0, 'The Mithril Chamber', 1, 50000000, 0, 1106827200000)",
"(39, 0, 'NPC', 'NPC Clan', 'ClanHall', 39, 0, 'Silver Manor', 1, 50000000, 0, 1106827200000)",
"(40, 0, 'NPC', 'NPC Clan', 'ClanHall', 40, 0, 'Gold Manor', 1, 50000000, 0, 1106827200000)",
"(41, 0, 'NPC', 'NPC Clan', 'ClanHall', 41, 0, 'The Bronze Chamber', 1, 50000000, 0, 1106827200000)",
"(42, 0, 'NPC', 'NPC Clan', 'ClanHall', 42, 0, 'The Golden Chamber', 1, 50000000, 0, 1106827200000)",
"(43, 0, 'NPC', 'NPC Clan', 'ClanHall', 43, 0, 'The Silver Chamber', 1, 50000000, 0, 1106827200000)",
"(44, 0, 'NPC', 'NPC Clan', 'ClanHall', 44, 0, 'The Mithril Chamber', 1, 50000000, 0, 1106827200000)",
"(45, 0, 'NPC', 'NPC Clan', 'ClanHall', 45, 0, 'The Bronze Chamber', 1, 50000000, 0, 1106827200000)",
"(46, 0, 'NPC', 'NPC Clan', 'ClanHall', 46, 0, 'Silver Manor', 1, 50000000, 0, 1106827200000)",
"(47, 0, 'NPC', 'NPC Clan', 'ClanHall', 47, 0, 'Moonstone Hall', 1, 50000000, 0, 1106827200000)",
"(48, 0, 'NPC', 'NPC Clan', 'ClanHall', 48, 0, 'Onyx Hall', 1, 50000000, 0, 1106827200000)",
"(49, 0, 'NPC', 'NPC Clan', 'ClanHall', 49, 0, 'Emerald Hall', 1, 50000000, 0, 1106827200000)",
"(50, 0, 'NPC', 'NPC Clan', 'ClanHall', 50, 0, 'Sapphire Hall', 1, 50000000, 0, 1106827200000)",
"(51, 0, 'NPC', 'NPC Clan', 'ClanHall', 51, 0, 'Mont Chamber', 1, 50000000, 0, 1106827200000)",
"(52, 0, 'NPC', 'NPC Clan', 'ClanHall', 52, 0, 'Astaire Chamber', 1, 50000000, 0, 1106827200000)",
"(53, 0, 'NPC', 'NPC Clan', 'ClanHall', 53, 0, 'Aria Chamber', 1, 50000000, 0, 1106827200000)",
"(54, 0, 'NPC', 'NPC Clan', 'ClanHall', 54, 0, 'Yiana Chamber', 1, 50000000, 0, 1106827200000)",
"(55, 0, 'NPC', 'NPC Clan', 'ClanHall', 55, 0, 'Roien Chamber', 1, 50000000, 0, 1106827200000)",
"(56, 0, 'NPC', 'NPC Clan', 'ClanHall', 56, 0, 'Luna Chamber', 1, 50000000, 0, 1106827200000)",
"(57, 0, 'NPC', 'NPC Clan', 'ClanHall', 57, 0, 'Traban Chamber', 1, 50000000, 0, 1106827200000)",
"(58, 0, 'NPC', 'NPC Clan', 'ClanHall', 58, 0, 'Eisen Hall', 1, 20000000, 0, 1106827200000)",
"(59, 0, 'NPC', 'NPC Clan', 'ClanHall', 59, 0, 'Heavy Metal Hall', 1, 20000000, 0, 1106827200000)",
"(60, 0, 'NPC', 'NPC Clan', 'ClanHall', 60, 0, 'Molten Ore Hall', 1, 20000000, 0, 1106827200000)",
"(61, 0, 'NPC', 'NPC Clan', 'ClanHall', 61, 0, 'Titan Hall', 1, 20000000, 0, 1106827200000)"
};
// @formatter:off
private static final int[] ItemInitDataId =
{
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61
};
// @formatter:on
protected ClanHallAuctionManager()
{
load();
}
public void reload()
{
_auctions.clear();
load();
}
private final void load()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM auction ORDER BY id"))
{
while (rs.next())
{
_auctions.add(new Auction(rs.getInt("id")));
}
_log.info(getClass().getSimpleName() + ": Loaded: " + _auctions.size() + " auction(s)");
}
catch (Exception e)
{
_log.log(Level.WARNING, getClass().getSimpleName() + ": Exception: AuctionManager.load(): " + e.getMessage(), e);
}
}
public final Auction getAuction(int auctionId)
{
int index = getAuctionIndex(auctionId);
if (index >= 0)
{
return _auctions.get(index);
}
return null;
}
public final int getAuctionIndex(int auctionId)
{
Auction auction;
for (int i = 0; i < _auctions.size(); i++)
{
auction = _auctions.get(i);
if ((auction != null) && (auction.getId() == auctionId))
{
return i;
}
}
return -1;
}
public final List<Auction> getAuctions()
{
return _auctions;
}
/**
* Init Clan NPC aution
* @param id
*/
public void initNPC(int id)
{
int i;
for (i = 0; i < ItemInitDataId.length; i++)
{
if (ItemInitDataId[i] == id)
{
break;
}
}
if ((i >= ItemInitDataId.length) || (ItemInitDataId[i] != id))
{
_log.warning(getClass().getSimpleName() + ": Clan Hall auction not found for Id :" + id);
return;
}
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("INSERT INTO `auction` VALUES " + ITEM_INIT_DATA[i]);
_auctions.add(new Auction(id));
_log.info(getClass().getSimpleName() + ": Created auction for ClanHall: " + id);
}
catch (Exception e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Exception: Auction.initNPC(): " + e.getMessage(), e);
}
}
public static final ClanHallAuctionManager getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final ClanHallAuctionManager _instance = new ClanHallAuctionManager();
}
}

View File

@ -100,10 +100,10 @@ public final class ClanHallManager
}
_freeClanHall.put(id, ch);
Auction auc = AuctionManager.getInstance().getAuction(id);
Auction auc = ClanHallAuctionManager.getInstance().getAuction(id);
if ((auc == null) && (lease > 0))
{
AuctionManager.getInstance().initNPC(id);
ClanHallAuctionManager.getInstance().initNPC(id);
}
}
_log.info(getClass().getSimpleName() + ": Loaded: " + getClanHalls().size() + " clan halls");

View File

@ -30,7 +30,7 @@ import javolution.util.FastMap;
import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallManager;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.ClanPrivilege;
@ -172,7 +172,7 @@ public final class L2AuctioneerInstance extends L2Npc
}
String filename = "data/html/auction/AgitAuctionInfo.htm";
Auction a = AuctionManager.getInstance().getAuction(auctionId);
Auction a = ClanHallAuctionManager.getInstance().getAuction(auctionId);
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player.getHtmlPrefix(), filename);
@ -224,7 +224,7 @@ public final class L2AuctioneerInstance extends L2Npc
bid = Math.min(Long.parseLong(st.nextToken()), MAX_ADENA);
}
AuctionManager.getInstance().getAuction(auctionId).setBid(player, bid);
ClanHallAuctionManager.getInstance().getAuction(auctionId).setBid(player, bid);
}
catch (Exception e)
{
@ -260,10 +260,10 @@ public final class L2AuctioneerInstance extends L2Npc
{
String filename = "data/html/auction/AgitBid1.htm";
long minimumBid = AuctionManager.getInstance().getAuction(Integer.parseInt(val)).getHighestBidderMaxBid();
long minimumBid = ClanHallAuctionManager.getInstance().getAuction(Integer.parseInt(val)).getHighestBidderMaxBid();
if (minimumBid == 0)
{
minimumBid = AuctionManager.getInstance().getAuction(Integer.parseInt(val)).getStartingBid();
minimumBid = ClanHallAuctionManager.getInstance().getAuction(Integer.parseInt(val)).getStartingBid();
}
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
@ -283,7 +283,7 @@ public final class L2AuctioneerInstance extends L2Npc
}
else if (actualCommand.equalsIgnoreCase("list"))
{
List<Auction> auctions = AuctionManager.getInstance().getAuctions();
List<Auction> auctions = ClanHallAuctionManager.getInstance().getAuctions();
SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd");
/** Limit for make new page, prevent client crash **/
int limit = 15;
@ -394,7 +394,7 @@ public final class L2AuctioneerInstance extends L2Npc
}
String biders = "";
Map<Integer, Bidder> bidders = AuctionManager.getInstance().getAuction(auctionId).getBidders();
Map<Integer, Bidder> bidders = ClanHallAuctionManager.getInstance().getAuction(auctionId).getBidders();
for (Bidder b : bidders.values())
{
biders += "<tr>" + "<td>" + b.getClanName() + "</td><td>" + b.getName() + "</td><td>" + b.getTimeBid().get(Calendar.YEAR) + "/" + (b.getTimeBid().get(Calendar.MONTH) + 1) + "/" + b.getTimeBid().get(Calendar.DATE) + "</td><td>" + b.getBid() + "</td>" + "</tr>";
@ -418,7 +418,7 @@ public final class L2AuctioneerInstance extends L2Npc
String filename = "data/html/auction/AgitBidInfo.htm";
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player.getHtmlPrefix(), filename);
Auction a = AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt());
Auction a = ClanHallAuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt());
if (a != null)
{
html.replace("%AGIT_NAME%", a.getItemName());
@ -443,13 +443,13 @@ public final class L2AuctioneerInstance extends L2Npc
player.sendPacket(html);
return;
}
else if ((player.getClan() != null) && (AuctionManager.getInstance().getAuction(player.getClan().getHideoutId()) != null))
else if ((player.getClan() != null) && (ClanHallAuctionManager.getInstance().getAuction(player.getClan().getHideoutId()) != null))
{
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm");
String filename = "data/html/auction/AgitSaleInfo.htm";
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player.getHtmlPrefix(), filename);
Auction a = AuctionManager.getInstance().getAuction(player.getClan().getHideoutId());
Auction a = ClanHallAuctionManager.getInstance().getAuction(player.getClan().getHideoutId());
if (a != null)
{
html.replace("%AGIT_NAME%", a.getItemName());
@ -513,7 +513,7 @@ public final class L2AuctioneerInstance extends L2Npc
}
else if (actualCommand.equalsIgnoreCase("cancelBid"))
{
long bid = AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()).getBidders().get(player.getClanId()).getBid();
long bid = ClanHallAuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()).getBidders().get(player.getClanId()).getBid();
String filename = "data/html/auction/AgitBidCancel.htm";
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player.getHtmlPrefix(), filename);
@ -526,9 +526,9 @@ public final class L2AuctioneerInstance extends L2Npc
}
else if (actualCommand.equalsIgnoreCase("doCancelBid"))
{
if (AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()) != null)
if (ClanHallAuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()) != null)
{
AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()).cancelBid(player.getClanId());
ClanHallAuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt()).cancelBid(player.getClanId());
player.sendPacket(SystemMessageId.YOU_HAVE_CANCELED_YOUR_BID);
}
return;
@ -555,9 +555,9 @@ public final class L2AuctioneerInstance extends L2Npc
}
else if (actualCommand.equalsIgnoreCase("doCancelAuction"))
{
if (AuctionManager.getInstance().getAuction(player.getClan().getHideoutId()) != null)
if (ClanHallAuctionManager.getInstance().getAuction(player.getClan().getHideoutId()) != null)
{
AuctionManager.getInstance().getAuction(player.getClan().getHideoutId()).cancelAuction();
ClanHallAuctionManager.getInstance().getAuction(player.getClan().getHideoutId()).cancelAuction();
player.sendMessage("Your auction has been canceled");
}
return;
@ -611,7 +611,7 @@ public final class L2AuctioneerInstance extends L2Npc
String filename = "data/html/auction/AgitBid2.htm";
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile(player.getHtmlPrefix(), filename);
Auction a = AuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt());
Auction a = ClanHallAuctionManager.getInstance().getAuction(player.getClan().getAuctionBiddedAt());
if (a != null)
{
html.replace("%AGIT_AUCTION_BID%", String.valueOf(a.getBidders().get(player.getClanId()).getBid()));

View File

@ -218,6 +218,7 @@ import com.l2jserver.gameserver.model.interfaces.IEventListener;
import com.l2jserver.gameserver.model.interfaces.ILocational;
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
import com.l2jserver.gameserver.model.itemcontainer.PcAuction;
import com.l2jserver.gameserver.model.itemcontainer.PcFreight;
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.model.itemcontainer.PcRefund;
@ -375,9 +376,9 @@ public final class L2PcInstance extends L2Playable
private static final String DELETE_TP_BOOKMARK = "DELETE FROM character_tpbookmark WHERE charId=? AND Id=?";
// Character Subclass SQL String Definitions:
private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index,dual_class FROM character_subclasses WHERE charId=? ORDER BY class_index ASC";
private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,vitality_points,level,class_index,dual_class FROM character_subclasses WHERE charId=? ORDER BY class_index ASC";
private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (charId,class_id,exp,sp,level,class_index,dual_class) VALUES (?,?,?,?,?,?,?)";
private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=?,dual_class=? WHERE charId=? AND class_index =?";
private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,vitality_points=?,level=?,class_id=?,dual_class=? WHERE charId=? AND class_index =?";
private static final String DELETE_CHAR_SUBCLASS = "DELETE FROM character_subclasses WHERE charId=? AND class_index=?";
// Character Henna SQL String Definitions:
@ -583,6 +584,7 @@ public final class L2PcInstance extends L2Playable
protected boolean _recoTwoHoursGiven = false;
private final PcInventory _inventory = new PcInventory(this);
private final PcAuction _auctionInventory = new PcAuction(this);
private final PcFreight _freight = new PcFreight(this);
private PcWarehouse _warehouse;
private PcRefund _refund;
@ -2886,6 +2888,11 @@ public final class L2PcInstance extends L2Playable
return _inventory;
}
public PcAuction getAuctionInventory()
{
return _auctionInventory;
}
/**
* Delete a ShortCut of the L2PcInstance _shortCuts.
* @param objectId
@ -7195,6 +7202,8 @@ public final class L2PcInstance extends L2Playable
// Set Teleport Bookmark Slot
player.setBookMarkSlot(rset.getInt("BookmarkSlot"));
player._vitPoints = rset.getInt("vitality_points");
// character creation Time
player.getCreateDate().setTime(rset.getDate("createDate"));
@ -7378,6 +7387,7 @@ public final class L2PcInstance extends L2Playable
subClass.setLevel(rset.getByte("level"));
subClass.setExp(rset.getLong("exp"));
subClass.setSp(rset.getLong("sp"));
subClass.setVitalityPoints(rset.getInt("vitality_points"));
subClass.setClassIndex(rset.getInt("class_index"));
// Enforce the correct indexing of _subClasses against their class indexes.
@ -7653,7 +7663,7 @@ public final class L2PcInstance extends L2Playable
statement.setString(45, getName());
statement.setLong(46, 0); // unset
statement.setInt(47, getBookMarkSlot());
statement.setInt(48, 0); // unset
statement.setInt(48, _vitPoints); // unset
statement.setString(49, getLang());
int factionId = 0;
@ -7691,11 +7701,12 @@ public final class L2PcInstance extends L2Playable
{
statement.setLong(1, subClass.getExp());
statement.setLong(2, subClass.getSp());
statement.setInt(3, subClass.getLevel());
statement.setInt(4, subClass.getClassId());
statement.setBoolean(5, subClass.isDualClass());
statement.setInt(6, getObjectId());
statement.setInt(7, subClass.getClassIndex());
statement.setInt(3, subClass.getVitalityPoints());
statement.setInt(4, subClass.getLevel());
statement.setInt(5, subClass.getClassId());
statement.setBoolean(6, subClass.isDualClass());
statement.setInt(7, getObjectId());
statement.setInt(8, subClass.getClassIndex());
statement.execute();
statement.clearParameters();
}
@ -12861,11 +12872,6 @@ public final class L2PcInstance extends L2Playable
return _agathionId;
}
public int getVitalityPoints()
{
return getStat().getVitalityPoints();
}
public void setVitalityPoints(int points, boolean quiet)
{
getStat().setVitalityPoints(points, quiet);
@ -14858,4 +14864,29 @@ public final class L2PcInstance extends L2Playable
{
return getServitors().values().stream().mapToInt(L2Summon::getSummonPoints).sum();
}
int _vitPoints = 140000;
/*
* Return current vitality points in integer format
*/
public int getVitalityPoints()
{
if (getClassId().getId() == getBaseClass())
{
return _vitPoints;
}
return getSubClasses().get(getClassIndex()).getVitalityPoints();
}
public void setVitalityPoints(int points)
{
if (getClassId().getId() == getBaseClass())
{
_vitPoints = points;
return;
}
getSubClasses().get(getClassIndex()).setVitalityPoints(points);
}
}

View File

@ -655,31 +655,18 @@ public class PcStat extends PlayableStat
return val;
}
/*
* Return current vitality points in integer format
*/
public int getVitalityPoints()
{
return getActiveChar().getAccountVariables().getInt(VITALITY_VARIABLE, Config.STARTING_VITALITY_POINTS);
}
public void setVitalityPoints(int points)
{
getActiveChar().getAccountVariables().set(VITALITY_VARIABLE, points);
}
/*
* Set current vitality points to this value if quiet = true - does not send system messages
*/
public void setVitalityPoints(int points, boolean quiet)
{
points = Math.min(Math.max(points, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
if (points == getVitalityPoints())
if (points == getActiveChar().getVitalityPoints())
{
return;
}
if (points < getVitalityPoints())
if (points < getActiveChar().getVitalityPoints())
{
getActiveChar().sendPacket(SystemMessageId.YOUR_VITALITY_HAS_DECREASED);
}
@ -688,7 +675,7 @@ public class PcStat extends PlayableStat
getActiveChar().sendPacket(SystemMessageId.YOUR_VITALITY_HAS_INCREASED);
}
setVitalityPoints(points);
getActiveChar().setVitalityPoints(points);
if (points == 0)
{
@ -700,7 +687,7 @@ public class PcStat extends PlayableStat
}
final L2PcInstance player = getActiveChar();
player.sendPacket(new ExVitalityPointInfo(getVitalityPoints()));
player.sendPacket(new ExVitalityPointInfo(getActiveChar().getVitalityPoints()));
if (player.isInParty())
{
final PartySmallWindowUpdate partyWindow = new PartySmallWindowUpdate(player, false);
@ -751,19 +738,19 @@ public class PcStat extends PlayableStat
if (points > 0)
{
points = Math.min(getVitalityPoints() + points, MAX_VITALITY_POINTS);
points = Math.min(getActiveChar().getVitalityPoints() + points, MAX_VITALITY_POINTS);
}
else
{
points = Math.max(getVitalityPoints() + points, MIN_VITALITY_POINTS);
points = Math.max(getActiveChar().getVitalityPoints() + points, MIN_VITALITY_POINTS);
}
if (Math.abs(points - getVitalityPoints()) <= 1e-6)
if (Math.abs(points - getActiveChar().getVitalityPoints()) <= 1e-6)
{
return;
}
setVitalityPoints(points);
getActiveChar().setVitalityPoints(points);
}
public double getVitalityMultiplier()

View File

@ -35,6 +35,8 @@ public final class SubClass
private long _sp = 0;
private byte _level = Config.BASE_SUBCLASS_LEVEL;
private int _classIndex = 1;
private int _vitalityPoints = 140000;
private boolean _dualClass = false;
public SubClass()
@ -68,6 +70,11 @@ public final class SubClass
return _level;
}
public int getVitalityPoints()
{
return _vitalityPoints;
}
/**
* First Sub-Class is index 1.
* @return int _classIndex
@ -126,6 +133,11 @@ public final class SubClass
_level = levelValue;
}
public void setVitalityPoints(int vit)
{
_vitalityPoints = vit;
}
public void incLevel()
{
if (!_dualClass && (getLevel() == _maxLevel))

View File

@ -36,7 +36,7 @@ import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
import com.l2jserver.gameserver.enums.AuctionItemType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2World;
@ -421,7 +421,7 @@ public class Auction
/** Remove auctions */
public void deleteAuctionFromDB()
{
AuctionManager.getInstance().getAuctions().remove(this);
ClanHallAuctionManager.getInstance().getAuctions().remove(this);
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM auction WHERE itemId=?"))
{
@ -449,8 +449,8 @@ public class Auction
/**
* If seller haven't sell ClanHall, auction removed, THIS MUST BE CONFIRMED
*/
int aucId = AuctionManager.getInstance().getAuctionIndex(_id);
AuctionManager.getInstance().getAuctions().remove(aucId);
int aucId = ClanHallAuctionManager.getInstance().getAuctionIndex(_id);
ClanHallAuctionManager.getInstance().getAuctions().remove(aucId);
return;
}
if (_sellerId > 0)
@ -506,7 +506,7 @@ public class Auction
/** Confirm an auction */
public void confirmAuction()
{
AuctionManager.getInstance().getAuctions().add(this);
ClanHallAuctionManager.getInstance().getAuctions().add(this);
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO auction (id, sellerId, sellerName, sellerClanName, itemType, itemId, itemObjectId, itemName, itemQuantity, startingBid, currentBid, endDate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"))
{

View File

@ -61,6 +61,8 @@ public class Message
private boolean _hasAttachments;
private Mail _attachments = null;
private ScheduledFuture<?> _unloadTask = null;
private int _systemMessage1 = 0;
private int _systemMessage2 = 0;
private int _itemId;
private int _enchantLvl;
@ -95,6 +97,8 @@ public class Message
_elementals[i] = Integer.parseInt(elemDef[i]);
}
}
_systemMessage1 = rset.getInt("systemMessage1");
_systemMessage2 = rset.getInt("systemMessage2");
}
/*
@ -115,6 +119,28 @@ public class Message
_reqAdena = reqAdena;
}
/*
* This constructor used for System Mails
*/
public Message(int receiverId, String subject, String content, int systemMessage1, int systemMessage2, MailType sendBySystem)
{
_messageId = IdFactory.getInstance().getNextId();
_senderId = -1;
_receiverId = receiverId;
_subject = subject;
_content = content;
_expiration = System.currentTimeMillis() + (EXPIRATION * 3600000);
_reqAdena = 0;
_hasAttachments = false;
_unread = true;
_deletedBySender = true;
_deletedByReceiver = false;
_messageType = sendBySystem;
_returned = false;
_systemMessage1 = systemMessage1;
_systemMessage2 = systemMessage2;
}
/*
* This constructor used for System Mails
*/
@ -209,7 +235,7 @@ public class Message
_elementals[item.getAttackElementType()] = item.getAttackElementPower();
}
}
else if (mailType == MailType.COMMISSION_ITEM_RETURNED)
else if (mailType == MailType.SYSTEM)
{
final Mail attachement = createAttachments();
attachement.addItem("CommissionReturnItem", item, null, null);
@ -218,7 +244,7 @@ public class Message
public static final PreparedStatement getStatement(Message msg, Connection con) throws SQLException
{
PreparedStatement stmt = con.prepareStatement("INSERT INTO messages (messageId, senderId, receiverId, subject, content, expiration, reqAdena, hasAttachments, isUnread, isDeletedBySender, isDeletedByReceiver, sendBySystem, isReturned, itemId, enchantLvl, elementals) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PreparedStatement stmt = con.prepareStatement("INSERT INTO messages (messageId, senderId, receiverId, subject, content, expiration, reqAdena, hasAttachments, isUnread, isDeletedBySender, isDeletedByReceiver, sendBySystem, isReturned, itemId, enchantLvl, elementals, systemMessage1, systemMessage2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
stmt.setInt(1, msg._messageId);
stmt.setInt(2, msg._senderId);
@ -236,6 +262,8 @@ public class Message
stmt.setInt(14, msg._itemId);
stmt.setInt(15, msg._enchantLvl);
stmt.setString(16, msg._elementals[0] + ";" + msg._elementals[1] + ";" + msg._elementals[2] + ";" + msg._elementals[3] + ";" + msg._elementals[4] + ";" + msg._elementals[5]);
stmt.setInt(17, msg._systemMessage1);
stmt.setInt(18, msg._systemMessage2);
return stmt;
}
@ -272,7 +300,7 @@ public class Message
case NPC: // Handled by NpcName in client
case BIRTHDAY: // Handled by Sysstring in client
case COMMISSION_ITEM_SOLD: // Handled by Sysstring in client
case COMMISSION_ITEM_RETURNED: // Handled by Sysstring in client
case SYSTEM: // Handled by Sysstring in client
case MENTOR_NPC: // Handled in client
default:
{
@ -325,6 +353,16 @@ public class Message
return _unread;
}
public final int getSystemMessage1()
{
return _systemMessage1;
}
public final int getSystemMessage2()
{
return _systemMessage2;
}
public final void markAsRead()
{
if (_unread)

View File

@ -26,7 +26,7 @@ import java.util.logging.Logger;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallAuctionManager;
import com.l2jserver.gameserver.instancemanager.ClanHallManager;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.StatsSet;
@ -181,7 +181,7 @@ public final class AuctionableHall extends ClanHall
{
if (ClanHallManager.getInstance().loaded())
{
AuctionManager.getInstance().initNPC(getId());
ClanHallAuctionManager.getInstance().initNPC(getId());
ClanHallManager.getInstance().setFree(getId());
Clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.THE_CLAN_HALL_FEE_IS_ONE_WEEK_OVERDUE_THEREFORE_THE_CLAN_HALL_OWNERSHIP_HAS_BEEN_REVOKED));
}

View File

@ -0,0 +1,55 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.model.itemcontainer;
import com.l2jserver.gameserver.enums.ItemLocation;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
/**
* @author Erlandys
*/
public class PcAuction extends ItemContainer
{
private final L2PcInstance _owner;
public PcAuction(L2PcInstance owner)
{
_owner = owner;
}
@Override
public String getName()
{
return "Auction";
}
@Override
public L2PcInstance getOwner()
{
return _owner;
}
@Override
public ItemLocation getBaseLocation()
{
return ItemLocation.AUCTION;
}
@Override
public boolean validateCapacity(long slots)
{
return ((_items.size() + slots) <= 10);
}
}

View File

@ -125,6 +125,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
private final int _time;
private final int _autoDestroyTime;
private final int _bodyPart;
private final String _bodyPartName;
private final int _referencePrice;
private final int _crystalCount;
private final boolean _sellable;
@ -177,6 +178,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
_time = set.getInt("time", -1);
_autoDestroyTime = set.getInt("auto_destroy_time", -1) * 1000;
_bodyPart = ItemTable._slots.get(set.getString("bodypart", "none"));
_bodyPartName = set.getString("bodypart", "none");
_referencePrice = set.getInt("price", 0);
_crystalType = set.getEnum("crystal_type", CrystalType.class, CrystalType.NONE);
_crystalCount = set.getInt("crystal_count", 0);
@ -939,6 +941,14 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
return _icon;
}
/**
* @return body part name
*/
public String getBodyPartName()
{
return _bodyPartName;
}
public int getDefaultEnchantLevel()
{
return _defaultEnchantLevel;

View File

@ -1341,31 +1341,31 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
// msg = new RequestInzonePartyInfoHistory();
break;
case 0x98:
// msg = new RequestCommissionRegistrableItemList();
msg = new RequestCommissionRegistrableItemList();
break;
case 0x99:
// msg = new RequestCommissionInfo();
msg = new RequestCommissionInfo();
break;
case 0x9A:
// msg = new RequestCommissionRegister();
msg = new RequestCommissionRegister();
break;
case 0x9B:
// msg = new RequestCommissionCancel();
msg = new RequestCommissionCancel();
break;
case 0x9C:
// msg = new RequestCommissionDelete();
msg = new RequestCommissionDelete();
break;
case 0x9D:
// msg = new RequestCommissionList();
msg = new RequestCommissionList();
break;
case 0x9E:
// msg = new RequestCommissionBuyInfo();
msg = new RequestCommissionBuyInfo();
break;
case 0x9F:
// msg = new RequestCommissionBuyItem();
msg = new RequestCommissionBuyItem();
break;
case 0xA0:
// msg = new RequestCommissionRegisteredItem();
msg = new RequestCommissionRegisteredItem();
break;
case 0xA1:
// msg = new RequestCallToChangeClass();

View File

@ -45,6 +45,7 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.ConfirmDlg;
import com.l2jserver.gameserver.network.serverpackets.ExShowCommission;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.util.GMAudit;
import com.l2jserver.gameserver.util.Util;
@ -67,7 +68,8 @@ public final class RequestBypassToServer extends L2GameClientPacket
"_diary",
"_olympiad?command",
"menu_select",
"manor_menu_select"
"manor_menu_select",
"showAuction"
};
// S
@ -285,6 +287,15 @@ public final class RequestBypassToServer extends L2GameClientPacket
EventDispatcher.getInstance().notifyEventAsync(new OnNpcManorBypass(activeChar, lastNpc, ask, state, time), lastNpc);
}
}
else if (_command.startsWith("showAuction"))
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
player.sendPacket(new ExShowCommission());
}
else
{
final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);

View File

@ -0,0 +1,71 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.AuctionManager.Auctions;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionBuyInfo;
/**
* @author Erlandys
*/
public final class RequestCommissionBuyInfo extends L2GameClientPacket
{
private static final String _C__D0_A1_REQUESTCOMMISSIONBUYINFO = "[C] D0:A1 RequestCommissionBuyInfo";
private long _auctionID;
@Override
protected void readImpl()
{
_auctionID = readQ();
readD(); // Category - unused
}
@Override
protected void runImpl()
{
L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
{
return;
}
AuctionManager am = AuctionManager.getInstance();
Auctions auction = am.getAuctionById(_auctionID);
if (auction != null)
{
if (activeChar.getObjectId() == auction.getPlayerID())
{
activeChar.sendPacket(SystemMessageId.ITEM_PURCHASE_HAS_FAILED);
}
else
{
activeChar.sendPacket(new ExResponseCommissionBuyInfo(auction));
}
}
else
{
activeChar.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
}
}
@Override
public String getType()
{
return _C__D0_A1_REQUESTCOMMISSIONBUYINFO;
}
}

View File

@ -0,0 +1,122 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.enums.MailType;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.AuctionManager.Auctions;
import com.l2jserver.gameserver.instancemanager.MailManager;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Message;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionItemList;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionList;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
/**
* @author Erlandys
*/
public final class RequestCommissionBuyItem extends L2GameClientPacket
{
private static final String _C__D0_A2_REQUESTCOMMISSIONREGISTRABLEITEMLIST = "[C] D0:A2 RequestCommissionRegistrableItemList";
private long _auctionID;
private int _category;
@Override
protected void readImpl()
{
_auctionID = readQ();
_category = readD();
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
AuctionManager am = AuctionManager.getInstance();
Auctions auction;
if (am.getAuctionById(_auctionID) != null)
{
auction = am.getAuctionById(_auctionID);
long fee = auction.getPrice();
switch (auction.getDuration())
{
case 0:
fee *= 0.005;
break;
case 1:
fee *= 0.015;
break;
case 2:
fee *= 0.025;
break;
case 3:
fee *= 0.035;
}
if (fee < 10000)
{
fee = 1000;
}
long price = auction.getPrice() * auction.getCount();
if ((player.getInventory().getItemByItemId(57) == null) || (player.getInventory().getItemByItemId(57).getCount() < price))
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
player.sendPacket(new ExResponseCommissionItemList(player));
return;
}
player.getInventory().destroyItemByItemId("BuyFromAuction", 57, price, null, null);
player.getInventory().addItem("BuyFromAuction", auction.getItem().getId(), auction.getCount(), player, null);
Message msg = new Message(auction.getPlayerID(), "The item you registered has been sold.", auction.getItemName() + " has been sold.", MailType.SYSTEM);
if ((price - fee) > 0)
{
msg.createAttachments().addItem("BuyFromAuction", 57, (price - fee), null, null);
}
MailManager.getInstance().sendMessage(msg);
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_SUCCESSFULLY_PURCHASED_S2_OF_S1);
sm.addLong(auction.getCount());
sm.addString(auction.getItemName());
player.sendPacket(sm);
if (L2World.getInstance().getPlayer(auction.getPlayerID()) != null)
{
L2PcInstance seller = L2World.getInstance().getPlayer(auction.getPlayerID());
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_YOU_REGISTERED_HAS_BEEN_SOLD);
seller.sendPacket(sm);
}
am.deleteAuction(_auctionID);
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
player.sendPacket(new ExResponseCommissionItemList(player));
}
else
{
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
player.sendPacket(new ExResponseCommissionList(player, _category, -1, -1, ""));
player.sendPacket(new ExResponseCommissionItemList(player));
}
}
@Override
public String getType()
{
return _C__D0_A2_REQUESTCOMMISSIONREGISTRABLEITEMLIST;
}
}

View File

@ -0,0 +1,43 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
public final class RequestCommissionCancel extends L2GameClientPacket
{
private static final String _C__D0_A3_REQUESTCOMMISSIONCANCEL = "[C] D0:A3 RequestCommissionCancel";
@Override
protected void readImpl()
{
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
}
@Override
public String getType()
{
return _C__D0_A3_REQUESTCOMMISSIONCANCEL;
}
}

View File

@ -0,0 +1,79 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.AuctionManager.Auctions;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionDelete;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionItemList;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionList;
/**
* @author Erlandys
*/
public final class RequestCommissionDelete extends L2GameClientPacket
{
private static final String _C__D0_9F_REQUESTCOMMISSIONDELETE = "[C] D0:9F RequestCommissionDelete";
long _auctionID;
int _category;
int _duration;
@Override
protected void readImpl()
{
_auctionID = readQ();
_category = readD();
_duration = readD();
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
AuctionManager am = AuctionManager.getInstance();
am.checkForAuctionsDeletion();
Auctions auction = am.getAuctionById(_auctionID);
if (auction != null)
{
player.addItem("DeleteAuction", auction.getItem(), null, false);
player.getAuctionInventory().destroyItemByItemId("DeleteAuction", auction.getItem().getId(), auction.getCount(), player, null);
am.deleteAuction(_auctionID);
player.sendPacket(SystemMessageId.CANCELLATION_OF_SALE_FOR_THE_ITEM_IS_SUCCESSFUL);
player.sendPacket(new ExResponseCommissionDelete(true));
player.sendPacket(new ExResponseCommissionList(player));
player.sendPacket(new ExResponseCommissionItemList(player));
}
else
{
player.sendPacket(SystemMessageId.ITEM_PURCHASE_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
player.sendPacket(new ExResponseCommissionDelete(false));
player.sendPacket(new ExResponseCommissionList(player));
player.sendPacket(new ExResponseCommissionItemList(player));
}
}
@Override
public String getType()
{
return _C__D0_9F_REQUESTCOMMISSIONDELETE;
}
}

View File

@ -0,0 +1,51 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionInfo;
/**
* @author Erlandys
*/
public final class RequestCommissionInfo extends L2GameClientPacket
{
private static final String _C__D0_9C_REQUESTCOMMISSIONINFO = "[C] D0:9C RequestCommissionInfo";
int _itemOID;
@Override
protected void readImpl()
{
_itemOID = readD();
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
player.sendPacket(new ExResponseCommissionInfo(player, _itemOID, true));
}
@Override
public String getType()
{
return _C__D0_9C_REQUESTCOMMISSIONINFO;
}
}

View File

@ -0,0 +1,99 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionList;
/**
* @author Erlandys
*/
public final class RequestCommissionList extends L2GameClientPacket
{
private static final String _C__D0_A0_REQUESTCOMMISSIONLIST = "[C] D0:A0 RequestCommissionList";
private long _category;
private int _type;
private int _grade;
private String _searchName;
@Override
protected void readImpl()
{
_category = readQ();
_type = readD();
_grade = readD();
_searchName = readS();
}
@Override
protected void runImpl()
{
L2PcInstance activeChar = getClient().getActiveChar();
if (activeChar == null)
{
return;
}
AuctionManager am = AuctionManager.getInstance();
if (_category == 0)
{
_category = 100;
}
else if (_category == 1)
{
_category = 101;
}
if ((_category != 101) && (_category != 100) && ((_category % 10000) != 7297) && ((_category % 10000) != 4593) && ((_category % 10000) != 1889) && ((_category % 10000) != 9185) && ((_category % 10000) != 6481))
{
_category = am.convertCategory((int) (_category / 1000));
}
else if ((_category != 101) && (_category != 100))
{
_category = am.convertMassCategory((int) (_category / 1000));
}
if (((_category > 60) && (_category < 66)) || (_category == 101))
{
if (am.getAuctionsSizeById(_category, _grade, _searchName) > 999)
{
activeChar.sendPacket(SystemMessageId.THE_SEARCH_RESULT_EXCEEDED_THE_MAXIMUM_ALLOWED_RANGE_FOR_OUTPUT_PLEASE_SEARCH_BY_SELECTING_DETAILED_CATEGORY);
}
else if (am.getAuctionsSizeById(_category, _grade, _searchName) <= 0)
{
activeChar.sendPacket(SystemMessageId.CURRENTLY_THERE_ARE_NO_REGISTERED_ITEMS);
}
}
else if (_category == 100)
{
if (am.getAuctionsSizeById(_grade, _searchName) > 999)
{
activeChar.sendPacket(SystemMessageId.THE_SEARCH_RESULT_EXCEEDED_THE_MAXIMUM_ALLOWED_RANGE_FOR_OUTPUT_PLEASE_SEARCH_BY_SELECTING_DETAILED_CATEGORY);
}
}
am.checkForAuctionsDeletion();
activeChar.sendPacket(new ExResponseCommissionList(activeChar, _category, _type, _grade, _searchName));
}
@Override
public String getType()
{
return _C__D0_A0_REQUESTCOMMISSIONLIST;
}
}

View File

@ -0,0 +1,155 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionInfo;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionItemList;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionList;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionRegister;
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
/**
* @author Erlandys
*/
public final class RequestCommissionRegister extends L2GameClientPacket
{
private static final String _C__D0_9D_REQUESTCOMMISSIONREGISTER = "[C] D0:9D RequestCommissionRegister";
int _itemOID;
String _itemName;
long _price;
long _count;
int _duration;
@Override
protected void readImpl()
{
_itemOID = readD();
_itemName = readS();
_price = readQ();
_count = readQ();
_duration = readD();
readQ(); // Unknown
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
long destroyPrice = _price;
AuctionManager am = AuctionManager.getInstance();
am.checkForAuctionsDeletion();
long timeToAdd = 0;
switch (_duration)
{
case 0:
timeToAdd = 86400000;
destroyPrice *= 0.0001;
break;
case 1:
timeToAdd = 259200000;
destroyPrice *= 0.0003;
break;
case 2:
timeToAdd = 432000000;
destroyPrice *= 0.0005;
break;
case 3:
timeToAdd = 604800000;
destroyPrice *= 0.0007;
}
if (destroyPrice < 1000)
{
destroyPrice = 1000;
}
if ((player.getInventory().getItemByItemId(57) == null) || (player.getInventory().getItemByItemId(57).getCount() < destroyPrice))
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
reloadAuction(player, false);
return;
}
if (player.getInventory().getItemByObjectId(_itemOID) == null)
{
player.sendPacket(SystemMessageId.REGISTRATION_IS_NOT_AVAILABLE_BECAUSE_THE_CORRESPONDING_ITEM_DOES_NOT_EXIST);
reloadAuction(player, false);
return;
}
if (player.getInventory().getItemByObjectId(_itemOID).isEquipped())
{
player.sendPacket(SystemMessageId.THE_ITEM_THAT_IS_CURRENTLY_WORN_CANNOT_BE_REGISTERED);
reloadAuction(player, false);
return;
}
int itemID = player.getInventory().getItemByObjectId(_itemOID).getId();
L2Item item = ItemTable.getInstance().getTemplate(itemID);
if (((player.getAuctionInventory().getSize() >= 10) && !player.isGM()) || ((player.getAuctionInventory().getSize() >= 99999) && player.isGM()) || !item.isTradeable() || !item.isSellable())
{
player.sendPacket(SystemMessageId.THE_ITEM_CANNOT_BE_REGISTERED_BECAUSE_REQUIREMENTS_ARE_NOT_MET);
reloadAuction(player, false);
return;
}
int category = am.getCategoryByItem(player.getInventory().getItemByObjectId(_itemOID));
player.getInventory().destroyItemByItemId("CreateAuction", 57, destroyPrice, null, null);
player.getInventory().transferItem("CreateAuction", _itemOID, _count, player.getAuctionInventory(), player, null);
long finishTime = (System.currentTimeMillis() + timeToAdd) / 1000;
int auctionID = IdFactory.getInstance().getNextId();
if (player.getAuctionInventory().getItemByObjectId(_itemOID) == null)
{
am.createAuction(auctionID, player.getObjectId(), _itemOID, player.getAuctionInventory().getItemByItemId(itemID), _itemName, _price, _count, _duration, finishTime, category);
}
else
{
am.createAuction(auctionID, player.getObjectId(), _itemOID, player.getAuctionInventory().getItemByObjectId(_itemOID), _itemName, _price, _count, _duration, finishTime, category);
}
am.insertAuction(am.getAuctionById(auctionID));
player.sendPacket(SystemMessageId.THE_ITEM_HAS_BEEN_SUCCESSFULLY_REGISTERED);
InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(player.getInventory().getItemByItemId(57));
iu.addModifiedItem(player.getAuctionInventory().getItemByObjectId(_itemOID));
player.sendPacket(iu);
reloadAuction(player, true);
}
private void reloadAuction(L2PcInstance player, boolean success)
{
player.sendPacket(new ExResponseCommissionRegister(success));
player.sendPacket(new ExResponseCommissionList(player));
player.sendPacket(new ExResponseCommissionInfo(player, 0, success));
player.sendPacket(new ExResponseCommissionItemList(player));
}
@Override
public String getType()
{
return _C__D0_9D_REQUESTCOMMISSIONREGISTER;
}
}

View File

@ -0,0 +1,53 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionList;
/**
* @author Erlandys
*/
public final class RequestCommissionRegisteredItem extends L2GameClientPacket
{
private static final String _C__D0_A3_REQUESTCOMMISSIONREGISTEREDITEM = "[C] D0:A3 RequestCommissionRegisteredItem";
@Override
protected void readImpl()
{
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
AuctionManager am = AuctionManager.getInstance();
am.checkForAuctionsDeletion();
player.sendPacket(new ExResponseCommissionList(player));
}
@Override
public String getType()
{
return _C__D0_A3_REQUESTCOMMISSIONREGISTEREDITEM;
}
}

View File

@ -0,0 +1,48 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.clientpackets;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.ExResponseCommissionItemList;
/**
* @author Erlandys
*/
public final class RequestCommissionRegistrableItemList extends L2GameClientPacket
{
private static final String _C__D0_9B_REQUESTCOMMISSIONREGISTRABLEITEMLIST = "[C] D0:9B RequestCommissionRegistrableItemList";
@Override
protected void readImpl()
{
}
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if (player == null)
{
return;
}
player.sendPacket(new ExResponseCommissionItemList(player));
}
@Override
public String getType()
{
return _C__D0_9B_REQUESTCOMMISSIONREGISTRABLEITEMLIST;
}
}

View File

@ -18,7 +18,9 @@
*/
package com.l2jserver.gameserver.network.serverpackets;
import com.l2jserver.gameserver.data.sql.impl.CharNameTable;
import com.l2jserver.gameserver.enums.ItemListType;
import com.l2jserver.gameserver.instancemanager.AuctionManager.Auctions;
import com.l2jserver.gameserver.model.ItemInfo;
import com.l2jserver.gameserver.model.TradeItem;
import com.l2jserver.gameserver.model.buylist.Product;
@ -117,6 +119,28 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
}
}
public void writeAuctionItem(Auctions auction)
{
writeQ(auction.getAuctionId()); // Auction id
writeQ(auction.getPrice()); // Price
writeD(auction.getCategory()); // Category
writeD(auction.getDuration()); // Duration / maybe in days???
writeD((int) auction.getFinishTime()); // Time when this item will vanish from auction (in seconds)(example (currentTime+60=after 1 minute))
writeS(CharNameTable.getInstance().getNameById(auction.getPlayerID())); // Name
writeD(0);
ItemInfo it = new ItemInfo(auction.getItem());
writeD(auction.getItem().getId()); // Item ID
writeQ(auction.getItem().getCount()); // Count
writeH(auction.getItem().getItem().getType2()); // item.getItem().getType2()
writeD(auction.getItem().getItem().getBodyPart()); // item.getItem().getBodyPart()
writeH(auction.getItem().getCustomType2()); // item.getCustomType2()
writeH(0x00); // ???
writeD(auction.getItem().getEnchantLevel());
writeItemElemental(it);
writeItemEnchantEffect(it);
writeD(0x00); // Item remodel visual ID
}
protected static final int calculateMask(ItemInfo item)
{
int mask = 0;

View File

@ -236,7 +236,7 @@ public class CharSelectionInfo extends L2GameServerPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level FROM character_subclasses WHERE charId=? && class_id=? ORDER BY charId"))
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? && class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
statement.setInt(2, activeClassId);
@ -247,6 +247,7 @@ public class CharSelectionInfo extends L2GameServerPacket
charInfopackage.setExp(charList.getLong("exp"));
charInfopackage.setSp(charList.getInt("sp"));
charInfopackage.setLevel(charList.getInt("level"));
charInfopackage.setVitalityPoints(charList.getInt("vitality_points"));
}
}
}

View File

@ -55,10 +55,10 @@ public class ExReplyReceivedPost extends AbstractItemPacket
writeC(0xFE);
writeH(0xAC);
writeD(_msg.getMailType().ordinal()); // GOD
if (_msg.getMailType() == MailType.COMMISSION_ITEM_RETURNED)
if (_msg.getMailType() == MailType.SYSTEM)
{
writeD(SystemMessageId.THE_REGISTRATION_PERIOD_FOR_THE_ITEM_YOU_REGISTERED_HAS_EXPIRED.getId());
writeD(SystemMessageId.THE_AUCTION_HOUSE_REGISTRATION_PERIOD_HAS_EXPIRED_AND_THE_CORRESPONDING_ITEM_IS_BEING_FORWARDED.getId());
writeD(_msg.getSystemMessage1());
writeD(_msg.getSystemMessage2());
}
else if (_msg.getMailType() == MailType.COMMISSION_ITEM_SOLD)
{

View File

@ -0,0 +1,63 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
import com.l2jserver.gameserver.instancemanager.AuctionManager.Auctions;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Erlandys
*/
public class ExResponseCommissionBuyInfo extends L2GameServerPacket
{
Auctions _auction;
public ExResponseCommissionBuyInfo(Auctions auction)
{
_auction = auction;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xF8);
writeD(0x01); // Unknown
L2ItemInstance item = _auction.getItem();
writeQ(_auction.getPrice());
writeD(_auction.getCategory());
writeD(0x00); // Unkown
writeD(item.getId());
writeQ(item.getCount());
writeH(item.getItem().getType2());
writeD(item.getItem().getBodyPart());
writeH(item.getEnchantLevel());
writeH(item.getCustomType2());
writeD(item.getAugmentation() != null ? item.getAugmentation().getAugmentationId() : 0x00);
writeH(item.getAttackElementType());
writeH(item.getAttackElementPower());
for (byte d = 0; d < 6; d++)
{
writeH(item.getElementDefAttr(d));
}
writeH(0); // unknown
writeH(0); // unknown
writeH(0); // unknown
}
}

View File

@ -0,0 +1,41 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
/**
* @author Erlandys
*/
public class ExResponseCommissionBuyItem extends L2GameServerPacket
{
L2PcInstance player;
public ExResponseCommissionBuyItem(L2PcInstance _player)
{
player = _player;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xF8);
writeD(1); // unk
writeD(0); // unk
writeD(58); // Item ID
writeQ(1); // count
}
}

View File

@ -0,0 +1,35 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
/**
* @author Erlandys
*/
public class ExResponseCommissionDelete extends L2GameServerPacket
{
boolean success;
public ExResponseCommissionDelete(boolean _success)
{
success = _success;
}
@Override
protected final void writeImpl()
{
writeC(0xd3);
writeD(success ? 0x01 : 0x00);
}
}

View File

@ -0,0 +1,49 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Erlandys
*/
public class ExResponseCommissionInfo extends L2GameServerPacket
{
L2PcInstance player;
L2ItemInstance item;
boolean success;
public ExResponseCommissionInfo(L2PcInstance _player, int _itemOID, boolean _success)
{
player = _player;
item = player.getInventory().getItemByObjectId(_itemOID);
success = _success;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xF4);
writeD(success ? 0x01 : 0x00); // TODO: Success
writeD(0x00); // ItemID
writeD(0x00); // TODO: Price
writeQ(0x00); // TODO: Count
writeD(0x00); // TODO: Duration
writeD(-0x01); // TODO: Unknown
writeD(0x00); // TODO: Unknown
}
}

View File

@ -0,0 +1,49 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Erlandys
*/
public class ExResponseCommissionItemList extends AbstractItemPacket
{
L2PcInstance _player;
public ExResponseCommissionItemList(L2PcInstance player)
{
_player = player;
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xF3);
writeD(_player.getInventory().getSize(false));
for (L2ItemInstance item : _player.getInventory().getItems())
{
if (!item.isSellable() || !item.isTradeable() || item.isEquipped() || (item.getId() == 57) || item.isQuestItem())
{
continue;
}
writeItem(item);
}
}
}

View File

@ -0,0 +1,265 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
import com.l2jserver.gameserver.instancemanager.AuctionManager;
import com.l2jserver.gameserver.instancemanager.AuctionManager.Auctions;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
/**
* @author Erlandys
*/
public class ExResponseCommissionList extends AbstractItemPacket
{
L2PcInstance _player;
L2ItemInstance _item;
long _category;
int _type;
int _grade;
String _search;
boolean _yourAuction;
AuctionManager _am;
int _yourAuctionsSize = 0;
int _categories[][] =
{
{
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18
},
{
19,
20,
21,
22,
23,
24,
25,
26,
27,
28
},
{
29,
30,
31,
32,
33,
34
},
{
35,
36,
37,
38,
39,
40
},
{
41,
42
},
{
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58
}
};
public ExResponseCommissionList(L2PcInstance player, long category, int type, int grade, String searchName)
{
_player = player;
_category = category;
_type = type;
_grade = grade;
_search = searchName;
_yourAuction = false;
_am = AuctionManager.getInstance();
}
public ExResponseCommissionList(L2PcInstance player)
{
_player = player;
_yourAuction = true;
_am = AuctionManager.getInstance();
for (Auctions auction : _am.getAuctions())
{
if (auction.getPlayerID() == player.getObjectId())
{
_yourAuctionsSize++;
}
}
}
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xF7);
if (_yourAuction)
{
writeD(_yourAuctionsSize <= 0 ? -2 : 0x02);
writeD((int) (System.currentTimeMillis() / 1000));
writeD(0x00);
writeD(_yourAuctionsSize);
for (Auctions auction : _am.getAuctions())
{
if (auction.getPlayerID() == _player.getObjectId())
{
writeAuctionItem(auction);
}
}
}
else
{
writeD((_search != null) && (_category == 100) && (_am.getAuctionsSizeById(_grade, _search) > 0) ? 3 : (_am.getAuctionsSizeById(_grade, _search) <= 0) || (_am.getAuctionsSizeById(_category, _grade, _search) <= 0) ? -1 : 3);
writeD((int) (System.currentTimeMillis() / 1000));
writeD(0x00);
if (((_category > 60) && (_category < 66)) || (_category == 101))
{
writeD(_am.getAuctionsSizeById(_category, _grade, _search));
for (Auctions auction : _am.getAuctions())
{
int cat = _category == 101 ? 0 : (int) (_category % 60);
for (int ID : _categories[cat])
{
if ((_grade == -1) && _search.equals(""))
{
if (auction.getCategory() == ID)
{
writeAuctionItem(auction);
}
}
else if (_grade != -1)
{
if (_search.equals(""))
{
if ((auction.getCategory() == ID) && (_grade == auction.getItem().getItem().getCrystalType().getId()))
{
writeAuctionItem(auction);
}
}
if (!_search.equals(""))
{
if ((auction.getCategory() == ID) && (_grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(_search))
{
writeAuctionItem(auction);
}
}
}
else if (!_search.equals(""))
{
if ((auction.getCategory() == ID) && auction.getItem().getName().contains(_search))
{
writeAuctionItem(auction);
}
}
}
}
}
else if (_category < 60)
{
writeD(_am.getAuctionsSizeById(_category, _grade, _search)); // Auction count, maybe items putted in auction???
for (Auctions auction : _am.getAuctions())
{
if ((_grade == -1) && _search.equals(""))
{
if (auction.getCategory() == _category)
{
writeAuctionItem(auction);
}
}
else if (_grade != -1)
{
if (_search.equals(""))
{
if ((auction.getCategory() == _category) && (_grade == auction.getItem().getItem().getCrystalType().getId()))
{
writeAuctionItem(auction);
}
}
if (!_search.equals(""))
{
if ((auction.getCategory() == _category) && (_grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(_search))
{
writeAuctionItem(auction);
}
}
}
else if (!_search.equals(""))
{
if ((auction.getCategory() == _category) && auction.getItem().getName().contains(_search))
{
writeAuctionItem(auction);
}
}
}
}
else
{
if (_search != null)
{
writeD(_am.getAuctionsSizeById(_grade, _search)); // Auction count, maybe items putted in auction???
for (Auctions auction : _am.getAuctions())
{
if (_grade == -1)
{
if (auction.getItem().getName().contains(_search))
{
writeAuctionItem(auction);
}
}
if (_grade != -1)
{
if ((_grade == auction.getItem().getItem().getCrystalType().getId()) && auction.getItem().getName().contains(_search))
{
writeAuctionItem(auction);
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,35 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
/**
* @author Erlandys
*/
public class ExResponseCommissionRegister extends L2GameServerPacket
{
boolean success;
public ExResponseCommissionRegister(boolean _success)
{
success = _success;
}
@Override
protected final void writeImpl()
{
writeC(0xd3);
writeD(success ? 1 : 0); // Success
}
}

View File

@ -0,0 +1,29 @@
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.network.serverpackets;
/**
* @author mrTJO
*/
public class ExShowCommission extends L2GameServerPacket
{
@Override
protected void writeImpl()
{
writeC(0xFE);
writeH(0xF2);
writeD(0x01); // Just for showing window...
}
}

View File

@ -53,9 +53,9 @@ public class ExShowReceivedPostList extends L2GameServerPacket
{
writeD(SystemMessageId.THE_ITEM_YOU_REGISTERED_HAS_BEEN_SOLD.getId());
}
else if (msg.getMailType() == MailType.COMMISSION_ITEM_RETURNED)
else if (msg.getMailType() == MailType.SYSTEM)
{
writeD(SystemMessageId.THE_REGISTRATION_PERIOD_FOR_THE_ITEM_YOU_REGISTERED_HAS_EXPIRED.getId());
writeD(msg.getSystemMessage1());
}
writeD(msg.getId());
writeS(msg.getSubject());
@ -63,7 +63,7 @@ public class ExShowReceivedPostList extends L2GameServerPacket
writeD(msg.isLocked() ? 0x01 : 0x00);
writeD(msg.getExpirationSeconds());
writeD(msg.isUnread() ? 0x01 : 0x00);
writeD(((msg.getMailType() == MailType.COMMISSION_ITEM_SOLD) || (msg.getMailType() == MailType.COMMISSION_ITEM_RETURNED)) ? 0 : 1);
writeD(((msg.getMailType() == MailType.COMMISSION_ITEM_SOLD) || (msg.getMailType() == MailType.SYSTEM)) ? 0 : 1);
writeD(msg.hasAttachments() ? 0x01 : 0x00);
writeD(msg.isReturned() ? 0x01 : 0x00);
writeD(0x00); // SysString in some case it seems