Exemplo n.º 1
0
 protected override void Load()
 {
     Logger.Log("Plugin loaded Correctly. Fixed by educatalan02 - Support: " + Discord);
     Logger.Log("Version: " + Assembly.GetName().Version);
     Plugin.Instance             = this;
     U.Events.OnPlayerConnected += OnConnected;
 }
Exemplo n.º 2
0
        protected override void Load()
        {
            Instance = this;

            ValidGroups = Configuration.Instance.Groups;

            foreach (DutyGroups Group in ValidGroups.ToList())
            {
                RocketPermissionsGroup g = R.Permissions.GetGroup(Group.GroupID);
                if (g == null)
                {
                    Logger.LogWarning("Permission group " + Group.GroupID + " does not exist! No command related to that group will execute.");
                    ValidGroups.Remove(Group);
                }
            }


            Logger.LogWarning("Loading event \"Player Connected\"...");
            U.Events.OnPlayerConnected += PlayerConnected;
            Logger.LogWarning("Loading event \"Player Disconnected\"...");
            U.Events.OnPlayerDisconnected += PlayerDisconnected;

            Logger.LogWarning("");
            Logger.LogWarning("Duty has been successfully loaded!");
        }
Exemplo n.º 3
0
        protected override void Unload()
        {
            Instance = null;

            Logger.LogWarning("Unloading on player connect event...");
            U.Events.OnPlayerConnected -= PlayerConnected;
            Logger.LogWarning("Unloading on player disconnect event...");
            U.Events.OnPlayerConnected -= PlayerDisconnected;

            Logger.LogWarning("");
            Logger.LogWarning("Duty has been unloaded!");
        }
Exemplo n.º 4
0
        internal DatabaseManager()
        {
            Path = Directory.GetCurrentDirectory() + "\\Databases\\CyTic.SkinChanger.db";
            bool flag = !Directory.Exists(Directory.GetCurrentDirectory() + "\\Databases");

            if (flag)
            {
                Directory.CreateDirectory(Directory.GetCurrentDirectory() + "\\Databases");
            }
            LiteDatabase liteDatabase = new LiteDatabase(Path, null);

            skinsCollection = liteDatabase.GetCollection <SkinCollection>("PlayerSkins");
            Logger.Log("LiteDB loaded.", ConsoleColor.Green);
        }
Exemplo n.º 5
0
 protected override void Load()
 {
     UnturnedPlayerEvents.OnPlayerChatted += Events_PlayerChatted;
     Logger.Log("Successfully loaded CGames v1.0");
     if (Configuration.Instance.Use_Feex_Points == true)
     {
         if (IsDependencyLoaded("FeexRanks"))
         {
             Logger.Log("CGames successfully loaded with FeexRanks", ConsoleColor.Magenta);
         }
         else
         {
             Logger.LogWarning("You don't have FeexRanks enabled to use the point system!");
         }
     }
 }
Exemplo n.º 6
0
        private void Events_OnPlayerConnected(UnturnedPlayer player)
        {
            string IP = player.IP;

            if (Configuration.Instance.UseIPHUB)
            {
                using (var webClient = new WebClient())
                {
                    webClient.Headers.Add("X-Key: " + Configuration.Instance.IPHUBAPIKey);
                    try
                    {
                        var     response = webClient.DownloadString("http://v2.api.iphub.info/ip/" + IP);
                        JObject parsed   = JObject.Parse(response);
                        int     Block    = parsed.GetValue("block").Value <int>();
                        switch (Block)
                        {
                        case 0:
                            Logger.Log(player.CharacterName + " has safe IP.", ConsoleColor.Green);
                            break;

                        case 1:
                        case 2:
                            Logger.Log(player.CharacterName + " has Proxy/VPN. Terminating connection...", ConsoleColor.Red);
                            player.Kick("Using VPN.");
                            return;
                        }
                    }
                    catch (WebException ex)
                    {
                        Logger.LogError("Error while using IPHUB: " + ex.Message);
                    }
                }
            }
            if (Database.IsBanned(player, out string reason))
            {
                Logger.Log(player.CharacterName + " is banned. Terminating connection...");
                player.Kick("General ban: " + reason);
            }
            else if (Database.IsIpBanned(player, out string reasona))
            {
                Logger.Log(player.CharacterName + " is IP banned. Terminating connection...");
                player.Kick("General IPban: " + reasona);
            }
        }
Exemplo n.º 7
0
        protected override void Load()
        {
            instance = this;

            Logger.Log("Loading MaxskillsButWithoutOverkill. Skills that will not be maxskilled:\n");

            foreach (string s in Configuration.Instance.ignoreTheseSkills)
            {
                Logger.Log("\t" + s + "\n");
            }

            skills = typeof(UnturnedSkill).GetFields(BindingFlags.Static | BindingFlags.Public);

            skillCtor = typeof(UnturnedSkill).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null,
                                                             new Type[] { typeof(byte), typeof(byte) }, null);

            if (Configuration.Instance.enableMaxskillsByDefault)
            {
                UnturnedPlayerEvents.OnPlayerRevive += OnRevive;
                U.Events.OnPlayerConnected          += OnConnect;
            }
        }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer unturnedPlayer = (UnturnedPlayer)caller;

            if (unturnedPlayer.Features.VanishMode)
            {
                unturnedPlayer.Features.VanishMode = false;
                Logger.Log(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("vanish_off_console"));
                UnturnedChat.Say(caller, AdvancedGodVanish.Instance.Translate("Vanish_off_Private"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOffPrivateColor, Color.red));
                if (AdvancedGodVanish.Instance.Configuration.Instance.AnnouncerEnabled)
                {
                    UnturnedChat.Say(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("Vanish_off_Public"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOffPublicColor, Color.red));
                    if (AdvancedGodVanish.Instance.Configuration.Instance.LoggingEnabled)
                    {
                        using (StreamWriter streamWriter = File.AppendText(directory + "/GodVanishLog.txt"))
                        {
                            streamWriter.WriteLine("[Vanish]player.CharacterName[" + unturnedPlayer.DisplayName + "]" + AdvancedGodVanish.Instance.Translate("vanish_off_console") + " Steam64ID: " + unturnedPlayer.CSteamID + streamWriter.NewLine);
                            streamWriter.Close();
                        }
                    }
                }
                return;
            }
            unturnedPlayer.Features.VanishMode = true;
            Logger.LogWarning(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("vanish_on_console"));
            if (AdvancedGodVanish.Instance.Configuration.Instance.AnnouncerEnabled)
            {
                UnturnedChat.Say(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("Vanish_on_Public"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOnPublicColor, Color.red));
                UnturnedChat.Say(caller, AdvancedGodVanish.Instance.Translate("Vanish_on_Private"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOnPrivateColor, Color.red));
                if (AdvancedGodVanish.Instance.Configuration.Instance.LoggingEnabled)
                {
                    using (StreamWriter streamWriter2 = File.AppendText(directory + "/GodVanishLog.txt"))
                    {
                        streamWriter2.WriteLine("[Vanish]" + unturnedPlayer.CharacterName + "[" + unturnedPlayer.DisplayName + "]" + AdvancedGodVanish.Instance.Translate("vanish_on_console") + " Steam64ID: " + unturnedPlayer.CSteamID + streamWriter2.NewLine);
                        streamWriter2.Close();
                    }
                }
            }
        }
Exemplo n.º 9
0
        public void Execute(IRocketPlayer caller, params string[] command)
        {
            try
            {
                UnturnedPlayer player = (UnturnedPlayer)caller;
                if (command.Length == 0)
                {
                    List <string> playerPermits = MySQLPermitsPlugin.Instance.DatabaseManager.GetPlayerPermits(player);
                    UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permits_list", string.Join(", ", playerPermits.ToArray())), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                }
                else if (command.Length == 2)
                {
                    UnturnedPlayer target = UnturnedPlayer.FromName(command[1]);
                    switch (command[0])
                    {
                    case "check":
                        if (!caller.HasPermission("permits.check"))
                        {
                            UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_NoPermissions")); return;
                        }
                        if (!MySQLPermitsPlugin.Instance.DatabaseManager.HasPermit(target.Id))
                        {
                            UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_check_hasNotPermtis", target.DisplayName), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                            return;
                        }
                        UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_check_List", target.DisplayName, string.Join(", ", MySQLPermitsPlugin.Instance.DatabaseManager.GetPlayerPermits(target).ToArray())), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                        break;

                    default:
                        UnturnedChat.Say(caller, "Please /permit check <player>", UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.yellow));
                        break;
                    }
                }
                else if (command.Length == 3)
                {
                    UnturnedPlayer target = UnturnedPlayer.FromName(command[1]);
                    if (target == null)
                    {
                        UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("comamnd_permit_playerNotFound"), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                        return;
                    }
                    string permitName = command[2].ToLower();
                    if (!MySQLPermitsPlugin.Instance.IsValidPermitName(permitName))
                    {
                        UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_add_remove_permitNotFound"), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                        return;
                    }

                    switch (command[0])
                    {
                    case "add":
                        if (!caller.HasPermission("permits.add"))
                        {
                            UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_NoPermissions")); return;
                        }
                        if (MySQLPermitsPlugin.Instance.DatabaseManager.HasPermit(target.Id, permitName))
                        {
                            UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("comamnd_permit_add_alreadyHasPermit", target.DisplayName, MySQLPermitsPlugin.Instance.GetPermit(permitName)), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                            return;
                        }
                        MySQLPermitsPlugin.Instance.DatabaseManager.AddPermit(target, MySQLPermitsPlugin.Instance.GetPermit(permitName));
                        UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_add", target.DisplayName, MySQLPermitsPlugin.Instance.GetPermit(permitName)), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                        break;

                    case "remove":
                        if (!caller.HasPermission("permits.remove"))
                        {
                            UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_NoPermissions")); return;
                        }
                        if (!MySQLPermitsPlugin.Instance.DatabaseManager.HasPermit(target.Id, permitName))
                        {
                            UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_remove_DoesNotHavePermit", target.DisplayName, MySQLPermitsPlugin.Instance.GetPermit(permitName)), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                            return;
                        }
                        MySQLPermitsPlugin.Instance.DatabaseManager.RemovePermit(target, permitName);
                        UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_remove", MySQLPermitsPlugin.Instance.GetPermit(permitName), target.DisplayName), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                        break;

                    default:
                        UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permit_admin_usage"), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                        break;
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, MySQLPermitsPlugin.Instance.Translate("command_permits_usage"), UnturnedChat.GetColorFromName(MySQLPermitsPlugin.Instance.Configuration.Instance.MessageColor, Color.blue));
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Exemplo n.º 10
0
        public void Events_PlayerChatted(UnturnedPlayer player, ref Color color, string message, EChatMode chatMode, ref bool cancel)
        {
            int j;
            int reward_money  = 0;
            int reward_points = 0;

            if (Int32.TryParse(message, out j))
            {
                if (j == gameanswer && gameinp == true)
                {
                    gameanswer = 0;
                    gameinp    = false;
                    UnturnedChat.Say(Translations.Instance.Translate("Answered", player.DisplayName));
                    if (player.HasPermission("cgames.extra"))
                    {
                        if (rInt == 1)
                        {
                            if (Configuration.Instance.Custom_Extra_Amount_Enabled == true)
                            {
                                reward_money = Configuration.Instance.Extra_Amount_For_Sum;
                            }
                            else
                            {
                                reward_money = Configuration.Instance.Default_Amount_For_Sum * 2;
                            }
                        }
                        else if (rInt == 2)
                        {
                            if (Configuration.Instance.Custom_Extra_Amount_Enabled == true)
                            {
                                reward_money = Configuration.Instance.Extra_Amount_For_Minus;
                            }
                            else
                            {
                                reward_money = Configuration.Instance.Default_Amount_For_Minus * 2;
                            }
                        }
                        else if (rInt == 3)
                        {
                            if (Configuration.Instance.Custom_Extra_Amount_Enabled == true)
                            {
                                reward_money = Configuration.Instance.Extra_Amount_For_Multiplication;
                            }
                            else
                            {
                                reward_money = Configuration.Instance.Default_Amount_For_Multiplication * 2;
                            }
                        }
                        else if (rInt == 4)
                        {
                            if (Configuration.Instance.Custom_Extra_Amount_Enabled == true)
                            {
                                reward_money = Configuration.Instance.Extra_Amount_For_Division;
                            }
                            else
                            {
                                reward_money = Configuration.Instance.Default_Amount_For_Division * 2;
                            }
                        }
                    }
                    else
                    {
                        if (rInt == 1)
                        {
                            reward_money = Configuration.Instance.Default_Amount_For_Sum;
                        }
                        else if (rInt == 2)
                        {
                            reward_money = Configuration.Instance.Default_Amount_For_Minus;
                        }
                        else if (rInt == 3)
                        {
                            reward_money = Configuration.Instance.Default_Amount_For_Multiplication;
                        }
                        else if (rInt == 4)
                        {
                            reward_money = Configuration.Instance.Default_Amount_For_Division;
                        }
                    }
                    if (Configuration.Instance.Use_Feex_Points == true)
                    {
                        if (IsDependencyLoaded("FeexRanks"))
                        {
                            if (rInt == 1)
                            {
                                reward_points = Configuration.Instance.Feex_Points_For_Sum;
                            }
                            else if (rInt == 2)
                            {
                                reward_points = Configuration.Instance.Feex_Points_For_Minus;
                            }
                            else if (rInt == 3)
                            {
                                reward_points = Configuration.Instance.Feex_Points_For_Multiplication;
                            }
                            else if (rInt == 4)
                            {
                                reward_points = Configuration.Instance.Feex_Points_For_Division;
                            }
                            FeexRanks.Instance.UpdatePoints(player, reward_points);
                            UnturnedChat.Say(player, Translations.Instance.Translate("AnsweredU2", reward_money, reward_points));
                        }
                        else
                        {
                            Logger.LogWarning("You don't have FeexRanks enabled to use the point system!");
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(player, Translations.Instance.Translate("AnsweredU1", reward_money));
                    }
                    Uconomy.Instance.Database.IncreaseBalance(player.CSteamID.ToString(), reward_money);
                }
            }
        }
Exemplo n.º 11
0
 // logging for buys.
 private void Instance_OnShopBuy(decimal curBallance, UnturnedPlayer player, ushort numItems, ShopObject sObject, ItemType type, decimal newCost, decimal totalCost, short totalItems)
 {
     Logger.Log(string.Format("Player {0} [{1}] ({2}) at location: {3}, has bought {4} items, with type: {5}, with id: {6}({7}), for {8} credits. Players balance is now {9} credits.",
                              player.CharacterName, player.SteamName, player.CSteamID, player.IsInVehicle ? player.CurrentVehicle.transform.position.ToString() : player.Position.ToString(), totalItems, type.ToString(), sObject.ItemName, sObject.ItemID, Math.Round(totalCost, 4), Math.Round(curBallance, 2)));
 }