L2JMobius

Crusader Error on Comission Manager

Paiplayer · 3 · 897

Offline Paiplayer

  • Knight
  • ***
    • Posts: 74
This is a core error, maybe is affecting other versions of Mobius.

Context: I'm talking about the file /L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/instancemanager/ItemCommissionManager.java

When a player set up a Commission using registerItem function at line 213 the seller pay the registrationFee at line 259 .

But when someone buys the item ( buyItem at line 387 ) as the server calculates the amount earned by the seller and send it by mail between the lines 430 and 440 the registrationFee is discounted once more!

There's a fix to this specific function:

Code: [Select]
if (deleteItemFromDB(commissionId))
{
final float discountFee = (float) commissionItem.getDiscountInPercentage() / 100;
final long discountedPrice =  totalPrice - Math.round((long) (totalPrice * discountFee));
final Message mail = new Message(itemInstance.getOwnerId(), itemInstance, MailType.COMMISSION_ITEM_SOLD);
final Mail attachement = mail.createAttachments();
attachement.addItem("Commission Item Sold", Inventory.ADENA_ID, discountedPrice, player, null);
MailManager.getInstance().sendMessage(mail);

player.sendPacket(new ExResponseCommissionBuyItem(commissionItem));
player.getInventory().addItem("Commission Buy Item", commissionItem.getItemInstance(), player, null);
}
Want a developer? Check here or call me on Discord: PaiPlayer#5051


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16125
What about SALE_FEE_PER_DAY ?

Code: [Select]
Index: java/org/l2jmobius/gameserver/instancemanager/ItemCommissionManager.java
===================================================================
--- java/org/l2jmobius/gameserver/instancemanager/ItemCommissionManager.java (revision 11838)
+++ java/org/l2jmobius/gameserver/instancemanager/ItemCommissionManager.java (working copy)
@@ -70,7 +70,6 @@
  private static final int MAX_ITEMS_REGISTRED_PER_PLAYER = 10;
  private static final long MIN_REGISTRATION_AND_SALE_FEE = 1000;
  private static final double REGISTRATION_FEE_PER_DAY = 0.0001;
- private static final double SALE_FEE_PER_DAY = 0.005;
  private static final int[] DURATION =
  {
  1,
@@ -431,16 +430,15 @@
  if (deleteItemFromDB(commissionId))
  {
  final float discountFee = (float) commissionItem.getDiscountInPercentage() / 100;
-
- final long saleFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, (totalPrice * SALE_FEE_PER_DAY) * Math.min(commissionItem.getDurationInDays(), 7));
- final long addDiscount = (long) (saleFee * discountFee);
+ final long discountedPrice = totalPrice - Math.round((long) (totalPrice * discountFee));
  final Message mail = new Message(itemInstance.getOwnerId(), itemInstance, MailType.COMMISSION_ITEM_SOLD);
  final Mail attachement = mail.createAttachments();
- attachement.addItem("Commission Item Sold", Inventory.ADENA_ID, (totalPrice - saleFee) + addDiscount, player, null);
+ attachement.addItem("Commission Item Sold", Inventory.ADENA_ID, discountedPrice, player, null);
  MailManager.getInstance().sendMessage(mail);
 
  player.sendPacket(new ExResponseCommissionBuyItem(commissionItem));
  player.getInventory().addItem("Commission Buy Item", commissionItem.getItemInstance(), player, null);
+
  // Notify to scripts.
  if (EventDispatcher.getInstance().hasListener(EventType.ON_PLAYER_AUCTION_WIN))
  {


Offline Paiplayer

  • Knight
  • ***
    • Posts: 74
Mobius, cancel this changes, please. It was a misunderstood of mine. The original script is correct: Commission Manager will take a percentage on item posting then 0,5% per day when selled.

For instance: an item set to be selled by 100M will take 10k fee (cap) when posted and, when selled, 500k per day set in the duration.
Want a developer? Check here or call me on Discord: PaiPlayer#5051