Setting a higher accesslevel on spawning / modifying XMLSpawners

Hello,
Can anyone guide me in the right direction to make spawning and using props on XMLSpawners administrators only?
Thanks in advance.
 
Somewhat solved this, went into XmlSpawner2.cs, and set access level higher. just wondering if there's a way to make it so only a certain access level can [add xmlspawner

Begins around Line 996
Ends around Line 1975
 

Attachments

  • XmlSpawner2.cs
    368.3 KB · Views: 3

DragnMaw

Rookie
I could be wrong, since I've never played around with Access Levels, but on line 7815 is the start of the "Constructable" part of xmlspawner. Ever tried setting an Access Level on it?
 
I could be wrong, since I've never played around with Access Levels, but on line 7815 is the start of the "Constructable" part of xmlspawner. Ever tried setting an Access Level on it?
Thank you @DragnMaw. You think there's a way to rid this message? or change it to something else?

XmlSpawner2.cs:
        #region Constructors

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner()
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnRange = defSpawnRange;

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, 0, defMinDelay, defMaxDelay, defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, defTeam, defHomeRange, defRelativeHome, new SpawnObject[0], defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, string creatureName)
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnRange = homeRange;
            SpawnObject[] so = new SpawnObject[1];
            so[0] = new SpawnObject(creatureName, amount);

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, amount, TimeSpan.FromMinutes(minDelay), TimeSpan.FromMinutes(maxDelay), defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, team, homeRange, defRelativeHome, so, defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, int spawnRange, string creatureName)
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnRange = spawnRange;
            SpawnObject[] so = new SpawnObject[1];
            so[0] = new SpawnObject(creatureName, amount);

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, amount, TimeSpan.FromMinutes(minDelay), TimeSpan.FromMinutes(maxDelay), defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, team, homeRange, defRelativeHome, so, defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner(string creatureName)
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnObject[] so = new SpawnObject[1];
            so[0] = new SpawnObject(creatureName, 1);
            SpawnRange = defSpawnRange;

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, 1, defMinDelay, defMaxDelay, defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, defTeam, defHomeRange, defRelativeHome, so, defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        public XmlSpawner(Guid uniqueId, int x, int y, int width, int height, string name, int maxCount, TimeSpan minDelay, TimeSpan maxDelay, TimeSpan duration,
            int proximityRange, int proximityTriggerSound, int amount, int team, int homeRange, bool isRelativeHomeRange, SpawnObject[] spawnObjects,
            TimeSpan minRefractory, TimeSpan maxRefractory, TimeSpan todstart, TimeSpan todend, Item objectPropertyItem, string objectPropertyName, string proximityMessage,
            string itemTriggerName, string noitemTriggerName, string speechTrigger, string mobTriggerName, string mobPropertyName, string playerPropertyName, double triggerProbability,
            Item setPropertyItem, bool isGroup, TODModeType todMode, int killReset, bool externalTriggering, int sequentialSpawning, string regionName,
            bool allowghost, bool allownpc, bool spawnontrigger, string configfile, TimeSpan despawnTime, string skillTrigger, bool smartSpawning, WayPoint wayPoint)
            : base(BaseItemId)
        {
            m_UniqueId = uniqueId.ToString();
            InitSpawn(x, y, width, height, name, maxCount, minDelay, maxDelay, duration,
                proximityRange, proximityTriggerSound, amount, team, homeRange, isRelativeHomeRange, spawnObjects, minRefractory, maxRefractory, todstart, todend,
                objectPropertyItem, objectPropertyName, proximityMessage, itemTriggerName, noitemTriggerName, speechTrigger, mobTriggerName, mobPropertyName, playerPropertyName,
                triggerProbability, setPropertyItem, isGroup, todMode, killReset, externalTriggering, sequentialSpawning, regionName, allowghost, allownpc, spawnontrigger, configfile,
                despawnTime, skillTrigger, smartSpawning, wayPoint);
        }


        public void InitSpawn(int x, int y, int width, int height, string name, int maxCount, TimeSpan minDelay, TimeSpan maxDelay, TimeSpan duration,
            int proximityRange, int proximityTriggerSound, int amount, int team, int homeRange, bool isRelativeHomeRange, SpawnObject[] objectsToSpawn,
            TimeSpan minRefractory, TimeSpan maxRefractory, TimeSpan todstart, TimeSpan todend, Item objectPropertyItem, string objectPropertyName, string proximityMessage,
            string itemTriggerName, string noitemTriggerName, string speechTrigger, string mobTriggerName, string mobPropertyName, string playerPropertyName, double triggerProbability,
            Item setPropertyItem, bool isGroup, TODModeType todMode, int killReset, bool externalTriggering, int sequentialSpawning, string regionName, bool allowghost, bool allownpc, bool spawnontrigger,
            string configfile, TimeSpan despawnTime, string skillTrigger, bool smartSpawning, WayPoint wayPoint)
        {

            Visible = false;
            Movable = false;
            m_X = x;
            m_Y = y;
            m_Width = width;
            m_Height = height;

            // init spawn range if compatible
            if (width == height)
                m_SpawnRange = width / 2;
            else
                m_SpawnRange = -1;
            m_Running = true;
            m_Group = isGroup;

            if ((name != null) && (name.Length > 0))
                Name = name;
            else
                Name = "Spawner";

            m_MinDelay = minDelay;
            m_MaxDelay = maxDelay;

            // duration and proximity range parameter
            m_MinRefractory = minRefractory;
            m_MaxRefractory = maxRefractory;
            m_TODStart = todstart;
            m_TODEnd = todend;
            m_TODMode = todMode;
            m_KillReset = killReset;
            m_Duration = duration;
            m_DespawnTime = despawnTime;
            m_ProximityRange = proximityRange;
            m_ProximityTriggerSound = proximityTriggerSound;
            m_proximityActivated = false;
            m_durActivated = false;
            m_refractActivated = false;
            m_Count = maxCount;
            m_Team = team;
            m_StackAmount = amount;
            m_HomeRange = homeRange;
            m_HomeRangeIsRelative = isRelativeHomeRange;
            m_ObjectPropertyItem = objectPropertyItem;
            m_ObjectPropertyName = objectPropertyName;
            m_ProximityTriggerMessage = proximityMessage;
            m_ItemTriggerName = itemTriggerName;
            m_NoItemTriggerName = noitemTriggerName;
            m_SpeechTrigger = speechTrigger;
            SkillTrigger = skillTrigger;        // note this will register the skill as well
            m_MobTriggerName = mobTriggerName;
            m_MobPropertyName = mobPropertyName;
            m_PlayerPropertyName = playerPropertyName;
            m_TriggerProbability = triggerProbability;
            m_SetPropertyItem = setPropertyItem;
            m_ExternalTriggering = externalTriggering;
            m_ExternalTrigger = false;
            m_SequentialSpawning = sequentialSpawning;
            RegionName = regionName;
            m_AllowGhostTriggering = allowghost;
            m_AllowNPCTriggering = allownpc;
            m_SpawnOnTrigger = spawnontrigger;
            m_SmartSpawning = smartSpawning;
            ConfigFile = configfile;
            m_WayPoint = wayPoint;

            // set the totalitem property to -1 so that it doesnt show up in the item count of containers
            //TotalItems = -1;
            //UpdateTotal(this, TotalType.Items, -1);

            // Create the array of spawned objects
            m_SpawnObjects = new List<XmlSpawner.SpawnObject>();

            // Assign the list of objects to spawn
            SpawnObjects = objectsToSpawn;

            // Kick off the process
            DoTimer(TimeSpan.FromSeconds(1));
        }

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

        #endregion
XmlSpawnerAccessLevel.png
 

DragnMaw

Rookie
The way you implemented that, likely prevents ANYONE from placing an XmlSpawner, but if not and Administrators can still place, unlikely. Anything that has a class, but is not marked constructable, if you try to add it to the game, it will give that message. Its an error message built in.
 
The way you implemented that, likely prevents ANYONE from placing an XmlSpawner, but if not and Administrators can still place, unlikely. Anything that has a class, but is not marked constructable, if you try to add it to the game, it will give that message. Its an error message built in.
Administrators can place them. How would you have written it up? I know little to nothing about this coding stuff.
 

DragnMaw

Rookie
Strange... Guess it did work. I would have expected it to look like the [AccessLevel.Administrator] on the line above just like earlier in the file... If it works it works I guess lol