示例#1
0
        // Function from file: false_alarm.dm
        public override void announce(  )
        {
            ByTable           events_list = null;
            RoundEventControl E           = null;
            Type    _event        = null;
            dynamic event_control = null;
            dynamic Event         = null;

            events_list = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSevent.control, typeof(RoundEventControl)))
            {
                E = _a;


                if (Lang13.Bool(E.holidayID) || E.wizardevent)
                {
                    continue;
                }

                if (E.earliest_start >= Game13.time)
                {
                    continue;
                }
                _event = E.typepath;

                if (Convert.ToDouble(Lang13.Initial(_event, "announceWhen")) <= 0)
                {
                    continue;
                }
                events_list.Add(E);
            }
            event_control = Rand13.PickFromTable(events_list);

            if (Lang13.Bool(event_control))
            {
                Event = Lang13.Call(event_control.typepath);
                GlobalFuncs.message_admins("False Alarm: " + Event);
                ((RoundEvent)Event).kill();
                Event.announce();
            }
            return;
        }
示例#2
0
        // Function from file: events.dm
        public void toggleWizardmode(  )
        {
            RoundEventControl E = null;

            this.wizardmode = !this.wizardmode;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.SSevent.control, typeof(RoundEventControl)))
            {
                E = _a;

                E.weight = Lang13.Initial(E, "weight");

                if (E.wizardevent && !this.wizardmode || !E.wizardevent && this.wizardmode)
                {
                    E.weight = 0;
                }
            }
            GlobalFuncs.message_admins("Summon Events has been " + (this.wizardmode ? "enabled, events will occur every " + GlobalVars.SSevent.frequency_lower / 600 + " to " + GlobalVars.SSevent.frequency_upper / 600 + " minutes" : "disabled") + "!");
            GlobalFuncs.log_game("Summon Events was " + (this.wizardmode ? "enabled" : "disabled") + "!");
            return;
        }
示例#3
0
        // Function from file: events.dm
        public void spawnEvent(  )
        {
            double            sum_of_weights = 0;
            RoundEventControl E  = null;
            RoundEventControl E2 = null;


            if (!GlobalVars.config.allow_random_events)
            {
                return;
            }
            sum_of_weights = 0;

            foreach (dynamic _a in Lang13.Enumerate(this.control, typeof(RoundEventControl)))
            {
                E = _a;


                if (E.occurrences >= E.max_occurrences)
                {
                    continue;
                }

                if (E.earliest_start >= Game13.time)
                {
                    continue;
                }

                if (E.gamemode_blacklist.len != 0 && E.gamemode_blacklist.Contains(GlobalVars.ticker.mode.config_tag))
                {
                    continue;
                }

                if (E.gamemode_whitelist.len != 0 && !E.gamemode_whitelist.Contains(GlobalVars.ticker.mode.config_tag))
                {
                    continue;
                }

                if (Lang13.Bool(E.holidayID))
                {
                    if (!Lang13.Bool(this.holidays) || !Lang13.Bool(this.holidays[E.holidayID]))
                    {
                        continue;
                    }
                }

                if (Convert.ToDouble(E.weight) < 0)
                {
                    if (E.runEvent() == 26)
                    {
                        E.max_occurrences = 0;
                        continue;
                    }

                    if (E.alertadmins)
                    {
                        GlobalFuncs.message_admins("Random Event triggering: " + E.name + " (" + E.typepath + ")");
                    }
                    GlobalFuncs.log_game("Random Event triggering: " + E.name + " (" + E.typepath + ")");
                    return;
                }
                sum_of_weights += Convert.ToDouble(E.weight);
            }
            sum_of_weights = Rand13.Int(0, ((int)(sum_of_weights)));

            foreach (dynamic _b in Lang13.Enumerate(this.control, typeof(RoundEventControl)))
            {
                E2 = _b;


                if (E2.occurrences >= E2.max_occurrences)
                {
                    continue;
                }

                if (E2.earliest_start >= Game13.time)
                {
                    continue;
                }

                if (E2.gamemode_blacklist.len != 0 && E2.gamemode_blacklist.Contains(GlobalVars.ticker.mode.config_tag))
                {
                    continue;
                }

                if (E2.gamemode_whitelist.len != 0 && !E2.gamemode_whitelist.Contains(GlobalVars.ticker.mode.config_tag))
                {
                    continue;
                }

                if (Lang13.Bool(E2.holidayID))
                {
                    if (!Lang13.Bool(this.holidays) || !Lang13.Bool(this.holidays[E2.holidayID]))
                    {
                        continue;
                    }
                }
                sum_of_weights -= Convert.ToDouble(E2.weight);

                if (sum_of_weights <= 0)
                {
                    if (E2.runEvent() == 26)
                    {
                        E2.max_occurrences = 0;
                        continue;
                    }

                    if (E2.alertadmins)
                    {
                        GlobalFuncs.message_admins("Random Event triggering: " + E2.name + " (" + E2.typepath + ")");
                    }
                    GlobalFuncs.log_game("Random Event triggering: " + E2.name + " (" + E2.typepath + ")");
                    return;
                }
            }
            return;
        }