示例#1
0
        public StreakMessage(Server sv)
        {
            config = new ConfigurationManager(sv);

            // initialize default messages
            if (config.GetProperty <Dictionary <int, string> >("KillstreakMessages") == null)
            {
                var killstreakMessages = new Dictionary <int, string>()
                {
                    { -1, "Try not to kill yourself anymore" },
                    { 5, "Great job! You're on a ^55 killstreak!" },
                    { 10, "Amazing! ^510 kills ^7without dying!" },
                    { 25, "You better call in that nuke, ^525 killstreak^7!" }
                };
                config.AddProperty(new KeyValuePair <string, object>("KillstreakMessages", killstreakMessages));
            }

            if (config.GetProperty <Dictionary <int, string> >("DeathstreakMessages") == null)
            {
                var deathstreakMessages = new Dictionary <int, string>()
                {
                    { 5, "Pick it up soldier, you've died ^55 times ^7in a row..." },
                    { 10, "Seriously? ^510 deaths ^7without getting a kill?" },
                };
                config.AddProperty(new KeyValuePair <string, object>("DeathstreakMessages", deathstreakMessages));
            }
        }
示例#2
0
        public async Task OnEventAsync(Event E, Server S)
        {
            if (E.Type == Event.GType.Connect)
            {
                Player newPlayer = E.Origin;
                var    cfg       = Configs[S.GetHashCode()];
                if (newPlayer.Level >= Player.Permission.Trusted && !E.Origin.Masked)
                {
                    await E.Owner.Broadcast(ProcessAnnouncement(cfg.GetProperty <string>("PrivilegedAnnouncementMessage"), newPlayer));
                }

                await newPlayer.Tell(ProcessAnnouncement(cfg.GetProperty <string>("UserWelcomeMessage"), newPlayer));

                if (newPlayer.Level == Player.Permission.Flagged)
                {
                    await E.Owner.ToAdmins($"^1NOTICE: ^7Flagged player ^5{newPlayer.Name} ^7has joined!");
                }
                else
                {
                    await E.Owner.Broadcast(ProcessAnnouncement(cfg.GetProperty <string>("UserAnnouncementMessage"), newPlayer));
                }
            }

            if (E.Type == Event.GType.Start)
            {
                var cfg = new ConfigurationManager(S);
                Configs.Add(S.GetHashCode(), cfg);
                if (cfg.GetProperty <string>("UserWelcomeMessage") == null)
                {
                    string welcomeMsg = "Welcome ^5{{ClientName}}^7, this is your ^5{{TimesConnected}} ^7time connecting!";
                    cfg.AddProperty(new KeyValuePair <string, dynamic>("UserWelcomeMessage", welcomeMsg));
                }

                if (cfg.GetProperty <string>("PrivilegedAnnouncementMessage") == null)
                {
                    string annoucementMsg = "{{ClientLevel}} {{ClientName}} has joined the server";
                    cfg.AddProperty(new KeyValuePair <string, dynamic>("PrivilegedAnnouncementMessage", annoucementMsg));
                }

                if (cfg.GetProperty <string>("UserAnnouncementMessage") == null)
                {
                    string annoucementMsg = "^5{{ClientName}} ^7hails from ^5{{ClientLocation}}";
                    cfg.AddProperty(new KeyValuePair <string, dynamic>("UserAnnouncementMessage", annoucementMsg));
                }
            }
        }