コード例 #1
0
    void Start()
    {
        rayCast          = GameObject.Find("PointerController").GetComponent <RayCast>();
        inputManager     = GameObject.Find("InputManager").GetComponent <InputManager>();
        modHandler       = GameObject.Find("ModHandler").GetComponent <ModHandler>();
        movableUIHandler = movableUI.GetComponent <MovableUIHandler>();

        networkManager    = GameObject.Find("NetworkManager").GetComponent <ServerNetworkManager>();
        pointerController = GameObject.Find("PointerController");

        isOnDrag = isClicked = false;
        canClick = true;
    }
コード例 #2
0
ファイル: ModEntry.cs プロジェクト: huancz/SkillPrestige
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // init mod
            LoadSprites();
            PrestigeSaveData.Instance.Read();
            ModHandler.Initialise();

            // register commands
            if (ModEntry.Config.TestingMode)
            {
                RegisterTestingCommands();
            }
            RegisterCommands();
        }
コード例 #3
0
        private void GameUpdate(object sender, EventArgs args)
        {
            if (_isFirstUpdate)
            {
                ModHandler.RegisterLoadedMods();
                if (Options.Instance.TestingMode)
                {
                    RegisterTestingCommands();
                }
                RegisterCommands();
                _isFirstUpdate = false;
            }

            CheckForLevelUpMenu();
        }
コード例 #4
0
        public async Task WarnUser(SocketGuildUser user, [Remainder] string reason = null)
        {
            if (!await IsActionable(user, Context.User as SocketGuildUser))
            {
                return;
            }

            //Log this to some config file?
            var config     = ModHandler.GetActionConfig(Context.Guild.Id);
            var userConfig = ModHandler.GetActionUser(Context.Guild.Id, user.Id);

            var warns  = userConfig.WarnUser(Context.User.Id, reason);
            var caseId = config.AddLogAction(user.Id, Context.User.Id, ActionConfig.Log.LogAction.Warn, reason);

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));

            ModHandler.Save(userConfig, ActionConfig.ActionUser.DocumentName(user.Id, Context.Guild.Id));

            await ReplyAsync($"#{caseId} {user.Mention} was warned by {Context.User.Mention} for {reason ?? "N/A"}");

            await ModHandler.LogMessageAsync(Context, $"#{caseId} {user.Mention} was warned by {Context.User.Mention}", user, reason);

            //TODO: Separate actions for below.
            if (warns > config.MaxWarnings)
            {
                if (config.MaxWarningsAction == Models.ActionConfig.Action.Kick)
                {
                    await user.KickAsync("Exceeded maimum warnings.");
                    await ReplyAsync($"{user.Mention} was kicked for exceeding the max warning count");
                }
                else if (config.MaxWarningsAction == Models.ActionConfig.Action.Ban)
                {
                    await Context.Guild.AddBanAsync(user, 0, "Exceeded maximum warnings.");
                    await ReplyAsync($"{user.Mention} was banned for exceeding the max warning count");
                }
                else if (config.MaxWarningsAction == Models.ActionConfig.Action.SoftBan)
                {
                    await SoftBanUser(user, "Exceeded maximum warnings.");
                    await ReplyAsync($"{user.Mention} was soft-banned for `{config.SoftBanLength.GetReadableLength()}` for exceeding the max warning count");
                }
                else if (config.MaxWarningsAction == Models.ActionConfig.Action.Mute)
                {
                    await MuteUser(user, "Exceeded maximum warnings");
                    await ReplyAsync($"{user.Mention} was muted for `{config.SoftBanLength.GetReadableLength()}` for exceeding the max warning count");
                }
            }
        }
コード例 #5
0
    void Start()
    {
        scrollViewHeight = scrollView.GetComponent <RectTransform>().rect.height;
        rightSideHeight  = rightSide.GetComponent <RectTransform>().rect.height;

        leftPartUIItemHeight  = leftPartUIItem.GetComponent <RectTransform>().rect.height;
        rightPartUIItemHeight = rightPartUIItem.GetComponent <RectTransform>().rect.height;

        inputManager  = GameObject.Find("InputManager").GetComponent <InputManager>();
        modHandler    = GameObject.Find("ModHandler").GetComponent <ModHandler>();
        rayCast       = GameObject.Find("PointerController").GetComponent <RayCast>();
        dragFurniture = GameObject.Find("EditionHandler").GetComponent <DragFurniture>();

        scrollStack = 0;

        CreateUI();
    }
コード例 #6
0
        public async Task KickUser(SocketGuildUser user, [Remainder] string reason = null)
        {
            if (!await IsActionable(user, Context.User as SocketGuildUser))
            {
                return;
            }

            await user.KickAsync(reason);

            var config = ModHandler.GetActionConfig(Context.Guild.Id);
            var caseId = config.AddLogAction(user.Id, Context.User.Id, ActionConfig.Log.LogAction.Kick, reason);

            await ReplyAsync($"#{caseId} {user.Mention} was kicked by {Context.User.Mention} for {reason ?? "N/A"}");

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));
            await ModHandler.LogMessageAsync(Context, $"#{caseId} {user.Mention} was kicked by {Context.User.Mention}", user, reason);
        }
コード例 #7
0
 private void GameLoaded(object sender, EventArgs args)
 {
     Logger.LogInformation("Detected game load.");
     if (Type.GetType("AllProfessions.AllProfessions, AllProfessions") != null)
     {
         Logger.LogCriticalWarning("Conflict Detected. This mod cannot work with AllProfessions. Skill Prestige disabled.");
         Logger.LogDisplay("Skill Prestige Mod: If you wish to use this mod in place of AllProfessions, remove the AllProfessions mod and run the player_resetallprofessions command.");
         DeregisterGameEvents();
         return;
     }
     ModHandler.RegisterLoadedMods();
     // ReSharper disable once ConditionIsAlwaysTrueOrFalse - constant is manually changed for testing.
     if (Options.Instance.TestingMode)
     {
         RegisterTestingCommands();
     }
     RegisterCommands();
 }
コード例 #8
0
        public async Task BanUser(SocketGuildUser user, [Remainder] string reason = null)
        {
            if (!await IsActionable(user, Context.User as SocketGuildUser))
            {
                return;
            }

            //Setting for prune days is needed
            //Log this to some config file?
            await user.Guild.AddBanAsync(user, 0, reason);

            var config = ModHandler.GetActionConfig(Context.Guild.Id);
            var caseId = config.AddLogAction(user.Id, Context.User.Id, ActionConfig.Log.LogAction.Ban, reason);

            await ReplyAsync($"#{caseId} {user.Mention} was banned by {Context.User.Mention} for {reason ?? "N/A"}");

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));
            await ModHandler.LogMessageAsync(Context, $"#{caseId} {user.Mention} was banned by {Context.User.Mention} for {reason ?? "N/A"}", user, reason);
        }
コード例 #9
0
        public async Task Prune(ulong userID)
        {
            await Context.Message.DeleteAsync().ConfigureAwait(false);

            var enumerable = await GetmessagesAsync();

            var newlist = enumerable.Where(x => x.Author.Id == userID).ToList();

            try
            {
                await ModHandler.LogMessageAsync(Context, $"Cleared **{newlist.Count}** Messages in {Context.Channel.Name} for user with ID: {userID}", userID);

                await(Context.Channel as ITextChannel).DeleteMessagesAsync(newlist).ConfigureAwait(false);
            }
            catch
            {
                //
            }

            await ReplyAsync($"Cleared Messages (Count = {newlist.Count})");
        }
コード例 #10
0
        public async Task Prune(SocketGuildUser user)
        {
            await Context.Message.DeleteAsync().ConfigureAwait(false);

            //var enumerable = await Context.Channel.GetMessagesAsync().Flatten().ConfigureAwait(false);
            var enumerable = await GetmessagesAsync();

            var newlist = enumerable.Where(x => x.Author == user).ToList();

            try
            {
                await ModHandler.LogMessageAsync(Context, $"Cleared **{newlist.Count}** Messages in {Context.Channel.Name} for {user.Mention}", user);

                await(Context.Channel as ITextChannel).DeleteMessagesAsync(newlist).ConfigureAwait(false);
            }
            catch
            {
                //
            }

            await ReplyAsync($"Cleared **{user.Username}'s** Messages (Count = {newlist.Count})");
        }
コード例 #11
0
        public async Task ModLogAsync(ActionConfig.Log.LogAction actionType, SocketGuildUser user = null)
        {
            var config = ModHandler.GetActionConfig(Context.Guild.Id);

            EmbedFieldBuilder[] matchedLogs;
            string headerText;

            if (user != null)
            {
                matchedLogs = config.LogActions.Where(x => x.Action == actionType && x.Target == user.Id).Select(a => new EmbedFieldBuilder
                {
                    Name  = $"#{a.CaseId} - {a.TimeStamp.ToShortDateString()} {a.TimeStamp.ToShortTimeString()}",
                    Value = $"**Moderator**\n" +
                            $"{Context.Guild.GetUser(a.Moderator)?.Mention ?? Context.Guild.GetUserDisplayName(a.Moderator)}\n" +
                            $"{ModeratorTime(a.Duration)}" +
                            $"**Reason**\n" +
                            $"{a.Reason ?? "N/A"}".FixLength(1023)
                }).ToArray();
                headerText = $"{actionType}(s) for {user.GetDisplayName()} Count = {matchedLogs.Length}";
            }
            else
            {
                matchedLogs = config.LogActions.Where(x => x.Action == actionType).Select(a => new EmbedFieldBuilder
                {
                    Name  = $"#{a.CaseId} - {Context.Guild.GetUserDisplayName(a.Target)} {a.TimeStamp.ToShortDateString()} {a.TimeStamp.ToShortTimeString()}",
                    Value =
                        $"**Moderator**\n" +
                        $"{Context.Guild.GetUser(a.Moderator)?.Mention ?? Context.Guild.GetUserDisplayName(a.Moderator)}\n" +
                        $"**User**\n" +
                        $"{Context.Guild.GetUser(a.Target)?.Mention ?? Context.Guild.GetUserDisplayName(a.Target)}\n" +
                        $"{ModeratorTime(a.Duration)}" +
                        $"**Reason**\n" +
                        $"{a.Reason ?? "N/A"}".FixLength(1023)
                }).ToArray();
                headerText = $"{actionType}(s) Count = {matchedLogs.Length}";
            }

            await SendModLogMessage(matchedLogs, headerText);
        }
コード例 #12
0
 void Start()
 {
     laserLine  = GetComponent <LineRenderer>();
     rayCast    = GameObject.Find("PointerController").GetComponent <RayCast>();
     modHandler = GameObject.Find("ModHandler").GetComponent <ModHandler>();
 }