RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Alphas Gold Ledger 2.0 rc1

Monoxide-

Traveler
I'm assuming that there is no Gold Ledger for 2.1 yet I've been trying to figure this out for a couple of hours now anyway someone could give me a little help converting this or maybe i'm missing a script I'm not exactly sure if i need the [grab script for this to work Thank you!!
 

Monoxide-

Traveler
Well I tried downloading one of Xanthos Utilities but It gave me like a million more errors :/ is there more then one version for his Utilities or a certain one thats needed for this script in general? I'm also assuming that the Utilities script doesn't go in the scripts section but I can't think of anywhere else to put it I put it in Data and i got the same 2 errors Maybe server?
 

prplbeast

Sorceror
Just so everyone knows. this even works with the newest SVN running SA client. if anyone has trouble getting this to work just pm me and i will help them. Really glad to see this is still being used.
 

clark71822

Sorceror
I have two bows that use gold as ammo. How would I go about having it use gold from the ledger instead of having to have gold in your pack?
 

Iraq-

Sorceror
I have two bows that use gold as ammo. How would I go about having it use gold from the ledger instead of having to have gold in your pack?

You would first look in the backpack for a gold ledger, if found you would then check the amount of gold in the ledger, if GoldAmount > GoldAmmoCost you would return true that they have the ammo, and then you would do GoldAmount-=GoldAmmoCost to consume the ammo(gold from ledger), and then shoot the arrow..

If no Ledger, or if not enough gold in ledger, you would just use the normal gold in pack.
 

clark71822

Sorceror
Ok, so would I need to add an override for the OnFired method for this, or would I be better off writing a new method?
 

KnitePrince

Sorceror
Ive been using this quite a while, and just had a player complain because when they buy something it says 596233 was withdrawn from your gold ledger... that number is what they have LEFT not the amount the item cost...
I can fix this by replacing ;

buyer.SendMessage(2125, "{0} gold has been withdrawn from your gold ledger.", (totalCost - goldint).ToString( "#,0" ));
with the message ;
"{0} gold remains in your gold ledger."

but would prefer to make it work correctly... this is how it is currently set;

#region Alpha Gold Ledger #3
else if( ledger != null )
{
if( (goldint + ledger.Gold) >= totalCost )
{
ledger.Gold -= (totalCost - goldint);
bought = true;
buyer.SendMessage(2125, "{0} gold has been withdrawn from your gold ledger.", (totalCost - goldint).ToString( "#,0" ));
cont.ConsumeTotal( typeof( Gold ), goldint);
}
else if( ledger.Gold >= totalCost )
{
ledger.Gold -= totalCost;
bought = true;
buyer.SendMessage(2125, "{0} gold has been withdrawn from your gold ledger.", totalCost.ToString( "#,0" ));
}
}
#endregion

I searched the entire thread and didnt see another post about this... is this something unique I have managed to do unwittingly or has no one else noticed? (or are they all smart enough to fix it without asking?)
 

Teagan

Sorceror
Off to resurrect an old thread. Used winmerge to merge the necessary files together, but I keep getting an error. I get a feeling it's something simple...
Using 2.0 Final Repack. Love the script when I played on other shards.

RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
Errors:
+ Customs/Xanthos/Claim System/Claim.cs:
CS0101: Line 22: The namespace 'Xanthos.Claim' already contains a definition
for 'Claim'
CS0102: Line 38: The type 'Xanthos.Claim.Claim' already contains a definitio
n for 'ClaimOption'
CS0102: Line 377: The type 'Xanthos.Claim.Claim' already contains a definiti
on for 'SetLootBagTarget'
CS0102: Line 398: The type 'Xanthos.Claim.Claim' already contains a definiti
on for 'ClaimCmdTarget'
+ Customs/Xanthos/Claim System/ClaimConfig.cs:
CS0101: Line 25: The namespace 'Xanthos.Claim' already contains a definition
for 'ClaimConfig'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Teagan

Sorceror
Hm, confuses me about how that happened.
Should I merge the two claim.cs files and the two claimconfig.cs files together or overwrite the files in the Xanthos folder?
 

Teagan

Sorceror
After getting a long list of errors from removing an extra set and merging all new files together, I am down to one error. GoldBag.cs I got from page 2 or 3 and merged with the Xanthos bag script.
I hope this is the last error I would get...

RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Customs/Xanthos/Claim System/GoldBag.cs:
CS0101: Line 444: The namespace 'Server.Items' already contains a definition
for 'GiveGold'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Iraq-

Sorceror
You have two GiveGold methods.

If you can't find the 2nd

You could rename it (and all calls to it (use Replace All ) ) and be good to go.
 

Teagan

Sorceror
OK, I am confused, found the other instance for GiveGold.

The bit calling for GiveGold in the GoldBag.cs is :
Code:
    public class GiveGold
    {
        public static void GoldTransfer(Mobile m, Container c, BaseCreature creature)
        {
            if (creature.IsBonded)
                return;
 
            if (m.Map != creature.Map || !m.InRange(creature, 12))
                return;
 
            string nametitle = null;
            if (creature.Title != null)
                nametitle = creature.Name + " " + creature.Title;
 
            else
                nametitle = creature.Name;
 
            Item item = m.Backpack.FindItemByType(typeof(GoldLedger));
            GoldLedger ledger = item as GoldLedger;
 
            if (ledger == null)
                return;
 
            if (!ledger.GoldAutoLoot || !m.Alive || !GoldLedger.GoldAutoLootAvailable)
                return;
 
            TransferGold(m, c, ledger, nametitle);
        }
 
        public static void TransferGold(Mobile m, Container c, GoldLedger ledger, string nametitle)
        {
            Item[] items = c.FindItemsByType(typeof(Gold));
 
            foreach (Gold ngold in items)
            {
                Gold gold = ngold as Gold;
 
                if (gold != null)
                {
                    if (ledger.Gold < 999999999)
                    {
                        double maxWeight = (WeightOverloading.GetMaxWeight(m));
                        if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                        {
                            int golda = gold.Amount;
                            if ((gold.Amount + ledger.Gold) > 999999999)
                                golda = (999999999 - ledger.Gold);
                            double maxgold = golda;
                            if (ledger.d_WeightScale > 0)
                                maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                            if (golda > maxgold)
                                golda = (int)maxgold;
                            int GoldID = 0;
                            if (golda == 1)
                                GoldID = gold.ItemID;
                            else if (golda > 1 && golda < 6)
                                GoldID = gold.ItemID + 1;
                            else if (golda >= 6)
                                GoldID = gold.ItemID + 2;
                            if (golda < gold.Amount)
                                gold.Amount -= golda;
                            else
                                gold.Delete();
                            ledger.Gold += golda;
                            if (ledger.b_open && golda > 0)
                            {
                                m.CloseGump(typeof(GoldLedgerGump));
                                m.SendGump(new GoldLedgerGump(ledger));
                            }
 
                            if (golda > 0)
                            {
                                m.SendMessage(2125, "You loot {0} gold from {1} and deposit it into your gold ledger.", golda.ToString("#,0"), nametitle);
                                Effects.SendMovingEffect(c, m, GoldID, 5, 50, true, false);
                                m.PlaySound(0x2E6);
                            }
                        }
                    }
                }
            }
        }
 
        public static void GoldSweep(Mobile m, Gold gold)
        {
            Item item = m.Backpack.FindItemByType(typeof(GoldLedger));
 
            GoldLedger ledger = item as GoldLedger;
 
            if (ledger == null)
                return;
 
            if (!ledger.GoldSweeper || !GoldLedger.GoldSweeperAvailable || !gold.Movable)
                return;
 
            if (gold != null)
            {
                if (ledger.Gold < 999999999)
                {
                    double maxWeight = (WeightOverloading.GetMaxWeight(m));
                    if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                    {
                        int golda = gold.Amount;
                        if ((gold.Amount + ledger.Gold) > 999999999)
                            golda = (999999999 - ledger.Gold);
                        double maxgold = golda;
                        if (ledger.d_WeightScale > 0)
                            maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                        if (golda > maxgold)
                            golda = (int)maxgold;
                        int GoldID = 0;
                        if (golda == 1)
                            GoldID = gold.ItemID;
                        else if (golda > 1 && golda < 6)
                            GoldID = gold.ItemID + 1;
                        else if (golda >= 6)
                            GoldID = gold.ItemID + 2;
                        if (golda < gold.Amount)
                            gold.Amount -= golda;
                        else
                            gold.Delete();
                        ledger.Gold += golda;
                        if (ledger.b_open && golda > 0)
                        {
                            m.CloseGump(typeof(GoldLedgerGump));
                            m.SendGump(new GoldLedgerGump(ledger));
                        }
 
                        if (golda > 0)
                        {
                            m.SendMessage(2125, "You deposit {0} gold into your gold ledger.", golda.ToString("#,0"));
                            if (!m.Mounted)
                                m.Animate(32, 5, 1, true, false, 0);
                            Effects.SendMovingEffect(gold, m, GoldID, 5, 50, true, false);
                            m.PlaySound(0x2E6);
                        }
                    }
                }
            }
        }
    }

The other instance is in Alpha's Gold Ledger.cs :
Code:
    public class GiveGold
    {
        public static void GoldTransfer(Mobile m, Container c, BaseCreature creature)
        {
            if (creature.IsBonded)
                return;

            if (m.Map != creature.Map || !m.InRange(creature, 12))
                return;

            string nametitle = null;
            if (creature.Title != null)
                nametitle = creature.Name + " " + creature.Title;

            else
                nametitle = creature.Name;

            Item item = m.Backpack.FindItemByType(typeof(GoldLedger));
            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
                return;

            if (!ledger.GoldAutoLoot || !m.Alive || !GoldLedger.GoldAutoLootAvailable)
                return;

            TransferGold(m, c, ledger, nametitle);
        }

        public static void TransferGold(Mobile m, Container c, GoldLedger ledger, string nametitle)
        {
            Item[] items = c.FindItemsByType(typeof(Gold));

            foreach (Gold ngold in items)
            {
                Gold gold = ngold as Gold;

                if (gold != null)
                {
                    if (ledger.Gold < 999999999)
                    {
                        double maxWeight = (WeightOverloading.GetMaxWeight(m));
                        if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                        {
                            int golda = gold.Amount;
                            if ((gold.Amount + ledger.Gold) > 999999999)
                                golda = (999999999 - ledger.Gold);
                            double maxgold = golda;
                            if (ledger.d_WeightScale > 0)
                                maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                            if (golda > maxgold)
                                golda = (int)maxgold;
                            int GoldID = 0;
                            if (golda == 1)
                                GoldID = gold.ItemID;
                            else if (golda > 1 && golda < 6)
                                GoldID = gold.ItemID + 1;
                            else if (golda >= 6)
                                GoldID = gold.ItemID + 2;
                            if (golda < gold.Amount)
                                gold.Amount -= golda;
                            else
                                gold.Delete();
                            ledger.Gold += golda;
                            if (ledger.b_open && golda > 0)
                            {
                                m.CloseGump(typeof(GoldLedgerGump));
                                m.SendGump(new GoldLedgerGump(ledger));
                            }

                            if (golda > 0)
                            {
                                m.SendMessage(2125, "You loot {0} gold from {1} and deposit it into your gold ledger.", golda.ToString("#,0"), nametitle);
                                Effects.SendMovingEffect(c, m, GoldID, 5, 50, true, false);
                                m.PlaySound(0x2E6);
                            }
                        }
                    }
                }
            }
        }

        public static void GoldSweep(Mobile m, Gold gold)
        {
            Item item = m.Backpack.FindItemByType(typeof(GoldLedger));

            GoldLedger ledger = item as GoldLedger;

            if (ledger == null)
                return;

            if (!ledger.GoldSweeper || !GoldLedger.GoldSweeperAvailable || !gold.Movable)
                return;

            if (gold != null)
            {
                if (ledger.Gold < 999999999)
                {
                    double maxWeight = (WeightOverloading.GetMaxWeight(m));
                    if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                    {
                        int golda = gold.Amount;
                        if ((gold.Amount + ledger.Gold) > 999999999)
                            golda = (999999999 - ledger.Gold);
                        double maxgold = golda;
                        if (ledger.d_WeightScale > 0)
                            maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                        if (golda > maxgold)
                            golda = (int)maxgold;
                        int GoldID = 0;
                        if (golda == 1)
                            GoldID = gold.ItemID;
                        else if (golda > 1 && golda < 6)
                            GoldID = gold.ItemID + 1;
                        else if (golda >= 6)
                            GoldID = gold.ItemID + 2;
                        if (golda < gold.Amount)
                            gold.Amount -= golda;
                        else
                            gold.Delete();
                        ledger.Gold += golda;
                        if (ledger.b_open && golda > 0)
                        {
                            m.CloseGump(typeof(GoldLedgerGump));
                            m.SendGump(new GoldLedgerGump(ledger));
                        }

                        if (golda > 0)
                        {
                            m.SendMessage(2125, "You deposit {0} gold into your gold ledger.", golda.ToString("#,0"));
                            if (!m.Mounted)
                                m.Animate(32, 5, 1, true, false, 0);
                            Effects.SendMovingEffect(gold, m, GoldID, 5, 50, true, false);
                            m.PlaySound(0x2E6);
                        }
                    }
                }
            }
        }
    }

I delete one GiveGold string and I get a list of errors. Same with copying one over the other.
What am I doing wrong? [/noob question]
 

JamzeMcC

Squire
If you need both instances of the GiveGold, Rename one of them slightly and then in the same script, make sure you rename all of the uses. Maybe rename it to GiveGold1 or some such thing
 

Iraq-

Sorceror
That's why Xanthos used his own namespace, to avoid these conflicts. Renaming 1 of them to something similar will work. ^
 
Top