LogChangeProperty() public static method

public static LogChangeProperty ( Mobile from, object o, string name, string value ) : void
from Mobile
o object
name string
value string
return void
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile      targ        = (Mobile)targeted;
                    LokaiSkills lokaiSkills = LokaiSkillUtilities.XMLGetSkills(targ);

                    for (int i = 0; i < lokaiSkills.Length; ++i)
                    {
                        lokaiSkills[i].Base = m_Value;
                    }

                    CommandLogging.LogChangeProperty(from, targ, "EveryLokaiSkill.Base", m_Value.ToString());
                }
                else
                {
                    from.SendMessage("That does not have Lokai Skills!");
                }
            }
Beispiel #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile        targ   = (Mobile)targeted;
                    Server.Skills skills = targ.Skills;

                    for (int i = 0; i < skills.Length; ++i)
                    {
                        skills[i].Base = m_Value;
                    }

                    CommandLogging.LogChangeProperty(from, targ, "EverySkill.Base", m_Value.ToString());
                }
                else
                {
                    from.SendMessage("That does not have skills!");
                }
            }
Beispiel #3
0
        public static string SetDirect(
            Mobile m, object logObject, object obj, PropertyInfo prop, string givenName, object toSet, bool shouldLog)
        {
            try
            {
                if (toSet is AccessLevel)
                {
                    AccessLevel newLevel = (AccessLevel)toSet;
                    AccessLevel reqLevel = AccessLevel.Administrator;

                    if (newLevel == AccessLevel.Administrator)
                    {
                        reqLevel = AccessLevel.Developer;
                    }
                    else if (newLevel >= AccessLevel.Developer)
                    {
                        reqLevel = AccessLevel.Owner;
                    }

                    if (m.AccessLevel < reqLevel)
                    {
                        return("You do not have access to that level.");
                    }
                }

                if (shouldLog)
                {
                    CommandLogging.LogChangeProperty(m, logObject, givenName, toSet == null ? "(-null-)" : toSet.ToString());
                }

                object oldValue = prop.GetValue(obj, null);
                prop.SetValue(obj, toSet, null);

                EventSink.InvokeOnPropertyChanged(new OnPropertyChangedEventArgs(m, obj, prop, oldValue, toSet));

                return("Property has been set.");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return("An exception was caught, the property may not be set.");
            }
        }
Beispiel #4
0
        public static string SetDirect(Mobile from, object logObject, object obj, PropertyInfo prop, string givenName, object toSet, bool shouldLog)
        {
            try
            {
                if (toSet is AccessLevel && from.AccessLevel < AccessLevel.Administrator)
                {
                    return("Only Administrators or higher may change AccessLevels.");
                }

                if (shouldLog)
                {
                    CommandLogging.LogChangeProperty(from, logObject, givenName, toSet == null ? "(-null-)" : toSet.ToString());
                }

                prop.SetValue(obj, toSet, null);
                return("Property has been set.");
            }
            catch
            {
                return("An exception was caught, the property may not be set.");
            }
        }
Beispiel #5
0
        public static string SetDirect(Mobile from, object logObject, object obj, PropertyInfo prop, string givenName,
                                       object toSet, bool shouldLog)
        {
            try
            {
                if (toSet is AccessLevel newLevel)
                {
                    AccessLevel reqLevel = AccessLevel.Administrator;

                    if (newLevel == AccessLevel.Administrator)
                    {
                        reqLevel = AccessLevel.Developer;
                    }
                    else if (newLevel >= AccessLevel.Developer)
                    {
                        reqLevel = AccessLevel.Owner;
                    }

                    if (from.AccessLevel < reqLevel)
                    {
                        return("You do not have access to that level.");
                    }
                }

                if (shouldLog)
                {
                    CommandLogging.LogChangeProperty(from, logObject, givenName,
                                                     toSet?.ToString() ?? "(-null-)");
                }

                prop.SetValue(obj, toSet, null);
                return("Property has been set.");
            }
            catch
            {
                return("An exception was caught, the property may not be set.");
            }
        }
Beispiel #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile targ)
                {
                    var skill = targ.Skills[m_Skill];

                    if (skill == null)
                    {
                        return;
                    }

                    if (m_Set)
                    {
                        skill.Base = m_Value;
                        CommandLogging.LogChangeProperty(from, targ, $"{m_Skill}.Base", m_Value.ToString());
                    }

                    from.SendMessage("{0} : {1} (Base: {2})", m_Skill, skill.Value, skill.Base);
                }
                else
                {
                    from.SendMessage("That does not have skills!");
                }
            }