- 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

@@ -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