Hi everyone, i am trying to make the Fire Painting (Will generate a random .1 Scrolls of Transcendence once per week).

It load, it show the amount of scrolls in it, when double clicking it say that one scroll is added to my backpack... BUT no scroll is really added.

Anyone could help maybe?

Thanks!
 

Attachments

  • FirePainting.cs
    4.7 KB · Views: 5
Well not sure how much this helps but after quickly looking at it I managed to get SOTS to drop from it but two issues.

1. It does not reset the painting back to 0
and
2. It does not spawn with any skill points just a random SOT with 0 points but maybe it will help you along in the right direction.

Code:
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.Mobiles;

namespace Server.Items
{
    [FlipableAttribute(0x4C28, 0x4C29)]
    public class FirePainting : Item, ISecurable
    {
        private static readonly TimeSpan m_SpawnTime = TimeSpan.FromHours(24.0);
        private int m_Scroll;
        private DateTime m_NextSpawnTime;
        private SpawnTimer m_SpawnTimer;
        private SecureLevel m_Level;
        [Constructable]
        public FirePainting()
            : base(0x4C28)
        {
            this.Weight = 1.0;
            this.LootType = LootType.Blessed;

            this.m_Scroll = 0;
            this.StartSpawnTimer(TimeSpan.FromMinutes(1.0));
        }

        public FirePainting(Serial serial)
            : base(serial)
        {
        }

        public override int LabelNumber
        {
            get
            {
                return 1154182;
            }
        }// Fire Painting

        [CommandProperty(AccessLevel.GameMaster)]
        public SecureLevel Level
        {
            get
            {
                return this.m_Level;
            }
            set
            {
                this.m_Level = value;
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public int Scroll
        {
            get
            {
                return this.m_Scroll;
            }
            set
            {
                if (value >= 1)
                {
                    this.m_Scroll = 1;

                    this.StopSpawnTimer();
                }
                else
                {
                    if (value <= 0)
                        this.m_Scroll = 0;
                    else
                        this.m_Scroll = value;

                    this.StartSpawnTimer(m_SpawnTime);
                }

                this.InvalidateProperties();
            }
        }
        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            list.Add(1154179, this.Scroll.ToString()); // Scrolls of Transcendence: ~1_COUNT~
        }

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            SetSecureLevelEntry.AddTo(from, this, list);
        }
       
         #region Scroll of Transcendence
        private ScrollofTranscendence CreateRandomSoT(bool felucca)
        {
            int level = 1; 

            return ScrollofTranscendence.CreateRandom(level, level);
        }

        #endregion

        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(this.GetWorldLocation(), 2))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (this.Scroll > 0)
            {
                from.AddToBackpack(new ScrollofTranscendence());
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1151658); // You remove a Scroll of Transcendence and put it in your pack.
            }
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.WriteEncodedInt((int)0); // version

            writer.WriteEncodedInt((int)this.m_Scroll);
            writer.WriteDeltaTime((DateTime)this.m_NextSpawnTime);
            writer.WriteEncodedInt((int)this.m_Level);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            this.m_Scroll = reader.ReadEncodedInt();
            this.m_NextSpawnTime = reader.ReadDeltaTime();
            this.m_Level = (SecureLevel)reader.ReadEncodedInt();

            if (this.m_Scroll < 10)
                this.StartSpawnTimer(this.m_NextSpawnTime - DateTime.UtcNow);
        }

        private void StartSpawnTimer(TimeSpan delay)
        {
            this.StopSpawnTimer();

            this.m_SpawnTimer = new SpawnTimer(this, delay);
            this.m_SpawnTimer.Start();

            this.m_NextSpawnTime = DateTime.UtcNow + delay;
        }

        private void StopSpawnTimer()
        {
            if (this.m_SpawnTimer != null)
            {
                this.m_SpawnTimer.Stop();
                this.m_SpawnTimer = null;
            }
        }

        private class SpawnTimer : Timer
        {
            private readonly FirePainting m_Fire;
            public SpawnTimer(FirePainting fire, TimeSpan delay)
                : base(delay)
            {
                this.m_Fire = fire;

                this.Priority = TimerPriority.OneMinute;
            }

            protected override void OnTick()
            {
                if (this.m_Fire.Deleted)
                    return;

                this.m_Fire.m_SpawnTimer = null;
                this.m_Fire.Scroll++;
            }
        }
    }

}
 
Back