Пример #1
0
        bool cmdToggle(VPServices app, Avatar who, string data, string key)
        {
            string msg    = null;
            bool   toggle;

            if ( data != "" )
            {
                // Try to parse user given boolean; reject command on failure
                if ( !VPServices.TryParseBool(data, out toggle) )
                    return false;
            }
            else
                toggle = !who.GetSettingBool(key);

            who.SetSetting(key, toggle);
            switch (key)
            {
                case SettingGreetMe:
                    msg = toggle ? msgGreetMe : msgGreetMeNot;
                    break;

                case SettingShowGreets:
                    msg = toggle ? msgShowGreets : msgHideGreets;
                    break;
            }

            app.Notify(who.Session, msg);
            return Log.Debug(Name, "Toggled greet-me for {0} to {1}", who.Name, toggle);
        }
Пример #2
0
 void onEnter(Instance sender, Avatar user)
 {
     if ( user.GetSettingBool(keyMode) )
         app.Warn(user.Session, msgReminder);
 }
Пример #3
0
 public bool CanGreet(Avatar who)
 {
     return who.GetSettingBool(SettingGreetMe, true);
 }
Пример #4
0
        bool cmdTogglePVP(VPServices app, Avatar who, string data)
        {
            var  lastSwitch = who.GetSettingDateTime(keyLastSwitch);
            bool toggle     = false;

            // Reject if too soon
            if ( lastSwitch.SecondsToNow() < 60 )
            {
                var timeLeft = 60 - lastSwitch.SecondsToNow();
                app.Warn(who.Session, msgTooSoon, timeLeft);
                return true;
            }

            if ( data != "" )
            {
                // Try to parse user given boolean; silently ignore on failure
                if ( !VPServices.TryParseBool(data, out toggle) )
                    return false;
            }
            else
                toggle = !who.GetSettingBool(keyMode);

            // Set new boolean, timeout and if new, health
            who.SetSetting(keyMode, toggle);
            who.SetSetting(keyLastSwitch, DateTime.Now);
            initialHealth(who);

            var verb = toggle ? "enabled" : "disabled";
            app.NotifyAll(msgToggle, verb, who.Name);
            return true;
        }