- 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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user