Nabolas

Member
ServUO Version
Publish 57
Ultima Expansion
Endless Journey
I am trying to utilize both the daat99's Master Looter + Ledger system Upgraded and Heritage Achievement System

Both systems are working great except for the [loot command with the master looter. The achievement system doesn't recognize loot/gold when using the [loot command. When manually looting corpses the player gets credit towards the achievement, just not when they loot using [loot command.

I think I have narrowed it down to the MasterLooterUtils.cs

I do think this is the section that handles the gold part of the [loot command.
MasterLooterUtils.cs:
        public static bool GivePlayerGold( PlayerMobile player, int amount )
        {
            return GivePlayerGold(player, amount, true);
        }
        public static bool GivePlayerGold(PlayerMobile player, int amount, bool informPlayer)
        {
            if (amount < 0 || player == null)
                return false;

            MasterLooterBackpack masterLooterBackpack = GetMasterLooter(player);
            if (masterLooterBackpack != null)
            {
                // Deposit the entire amount into the player's MasterLooterBackpack account
                //masterLooterBackpack.AddGoldAmount((ulong)amount, player);
                
                // Create a new Gold item with the reward amount
                Gold goldReward = new Gold(amount);
                // Use TryDropItem to add the gold to the backpack, triggering AddCurrency
                masterLooterBackpack.TryDropItem(player, goldReward, false);
            }
            else
            {
                // If the player doesn't have a MasterLooterBackpack, add the gold to their regular backpack
                Container backpack = player.Backpack;
                if (backpack != null)
                {
                    Gold gold = new Gold(amount);
                    if (!backpack.TryDropItem(player, gold, false))
                    {
                        gold.Delete(); // Clean up if unable to add to backpack
                        return false;
                    }
                }
                else
                {
                    // Handle case where the player doesn't have a backpack
                    // This might involve creating one or handling the gold differently
                    return false;
                }
            }

            //if (informPlayer)
            //    player.SendMessage(1173, "You received " + amount + " gold.");

            return true;
        }
 

Attachments

  • MasterLooterBackpack.cs
    21 KB · Views: 0
  • MasterLooterContextMenus.cs
    1.6 KB · Views: 0
  • MasterLooterGoldLedgerDeed.cs
    1.6 KB · Views: 0
  • MasterLooterGumps.cs
    11.3 KB · Views: 0
  • MasterLooterTargets.cs
    3.7 KB · Views: 1
  • MasterLooterTokenLedgerDeed.cs
    1.6 KB · Views: 0
  • MasterLooterUtils.cs
    8 KB · Views: 1
I personally do not use this for Unchained but after giving a quick look you could just add the main codes from the EventSink from the achievement (when looting) to

Daat99MasterLootersUtils
Right after the items are being sent to the backpack/or master lootbag
 
Getting this crash each time a player places the master looter backpack into another bag/backpack inside their main backpack.

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Daat99MasterLooterSystem.MasterLooterLedgerGump..ctor(MasterLooterBackpack backpack)
at Daat99MasterLooterSystem.MasterLooterLedgerGump.SendGump(Mobile from, MasterLooterBackpack backpack)
at Server.Network.PacketHandlers.ContextMenuResponse(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
 

Attachments

  • MasterLooterBackpack.cs
    21.9 KB · Views: 2
  • MasterLooterGumps.cs
    11.3 KB · Views: 1

Active Shards

Donations

Total amount
$80.00
Goal
$1,000.00
Back