Beispiel #1
0
 public void AddGod(ulong userID)
 {
     GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");
     if (!command.userIDs.Contains(userID))
     {
         command.userIDs.Add(userID);
     }
 }
Beispiel #2
0
 public void RemoveGod(ulong userID)
 {
     GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");
     if (command.userIDs.Contains(userID))
     {
         command.userIDs.Remove(userID);
     }
 }
Beispiel #3
0
 void OnFallDamage(FallDamageEvent falldamageevent)
 {
     if (Core.IsEnabled())
     {
         if (falldamageevent.Player != null)
         {
             GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");
             if (command.IsOn(falldamageevent.Player.UID))
             {
                 falldamageevent.Cancel();
             }
         }
     }
 }
Beispiel #4
0
        public static bool IsFriend(HurtEvent e) // ref
        {
            //Server.GetServer().Broadcast("1");
            GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");

            //Server.GetServer().Broadcast("2");
            //Server.GetServer().Broadcast("2 " + command.IsOn(e.victim.userID));
            Fougerite.Player victim = Fougerite.Server.Cache[e.DamageEvent.victim.userID];
            if (victim != null)
            {
                if (command.IsOn(victim.UID))
                {
                    //Server.GetServer().Broadcast("3");
                    return(true);
                }
                //Server.GetServer().Broadcast("4");
                Fougerite.Player attacker = Fougerite.Server.Cache[e.DamageEvent.attacker.userID];
                if (attacker != null)
                {
                    FriendsCommand command2 = (FriendsCommand)ChatCommand.GetCommand("friends");
                    bool           b        = Core.config.GetBoolSetting("Settings", "friendly_fire");
                    //Server.GetServer().Broadcast("5 " + b);
                    try
                    {
                        //Server.GetServer().Broadcast("6");
                        FriendList list = (FriendList)command2.GetFriendsLists()[attacker.UID];
                        //Server.GetServer().Broadcast("7 " + list);
                        if (list == null || b ||
                            (DataStore.GetInstance().ContainsKey("HGIG", attacker.SteamID) &&
                             DataStore.GetInstance().ContainsKey("HGIG", victim.SteamID)))
                        {
                            //Server.GetServer().Broadcast("8");
                            return(false);
                        }
                        //Server.GetServer().Broadcast("9");
                        return(list.isFriendWith(victim.UID));
                    }
                    catch
                    {
                        //Server.GetServer().Broadcast("end");
                        return(command.IsOn(victim.UID));
                    }
                }
            }
            return(false);
        }
Beispiel #5
0
        public static bool IsFriend(HurtEvent e) // ref
        {
            GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");

            Fougerite.Player victim = e.Victim as Fougerite.Player;
            if (victim != null)
            {
                if (command.IsOn(victim.UID))
                {
                    FallDamage dmg = victim.FallDamage;
                    if (dmg != null)
                    {
                        dmg.ClearInjury();
                    }
                    return(true);
                }
                Fougerite.Player attacker = e.Attacker as Fougerite.Player;
                if (attacker != null)
                {
                    FriendsCommand command2 = (FriendsCommand)ChatCommand.GetCommand("amigos");
                    if (command2.ContainsException(attacker.UID) && command2.ContainsException(victim.UID))
                    {
                        return(false);
                    }
                    bool b = Core.config.GetBoolSetting("Settings", "friendly_fire");
                    try
                    {
                        FriendList list = (FriendList)command2.GetFriendsLists()[attacker.UID];
                        if (list == null || b)
                        {
                            return(false);
                        }
                        return(list.isFriendWith(victim.UID));
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
Beispiel #6
0
        public static bool IsFriend(DamageEvent e) // ref
        {
            GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");

            try
            {
                FriendsCommand command2 = (FriendsCommand)ChatCommand.GetCommand("friends");
                FriendList     list     = (FriendList)command2.GetFriendsLists()[e.attacker.userID];
                if (Core.config.GetSetting("Settings", "friendly_fire").ToLower() == "true")
                {
                    return(command.IsOn(e.victim.userID));
                }
                if (list == null)
                {
                    return(command.IsOn(e.victim.userID));
                }
                return(list.isFriendWith(e.victim.userID) || command.IsOn(e.victim.userID));
            }
            catch
            {
                return(command.IsOn(e.victim.userID));
            }
        }
Beispiel #7
0
        private static void InitializeCommands()
        {
            ChatCommand.AddCommand("/about", new AboutCommand());
            ChatCommand.AddCommand("/addfriend", new AddFriendCommand());
            AddAdminCommand command = new AddAdminCommand();

            command.AdminFlags = "CanAddAdmin";
            ChatCommand.AddCommand("/addadmin", command);
            AddFlagCommand command2 = new AddFlagCommand();

            command2.AdminFlags = "CanAddFlags";
            ChatCommand.AddCommand("/addflag", command2);
            AnnounceCommand command3 = new AnnounceCommand();

            command3.AdminFlags = "CanAnnounce";
            ChatCommand.AddCommand("/announce", command3);
            BanCommand command4 = new BanCommand();

            command4.AdminFlags = "CanBan";
            ChatCommand.AddCommand("/ban", command4);
            ChatCommand.AddCommand("/friends", new FriendsCommand());
            GetFlagsCommand command5 = new GetFlagsCommand();

            command5.AdminFlags = "CanGetFlags";
            ChatCommand.AddCommand("/getflags", command5);
            GiveItemCommand command6 = new GiveItemCommand();

            command6.AdminFlags = "CanGiveItem";
            ChatCommand.AddCommand("/give", command6);
            GodModeCommand command7 = new GodModeCommand();

            command7.AdminFlags = "CanGodMode";
            ChatCommand.AddCommand("/god", command7);
            ChatCommand.AddCommand("/help", new HelpCommand());
            ChatCommand.AddCommand("/history", new HistoryCommand());
            SpawnItemCommand command8 = new SpawnItemCommand();

            command8.AdminFlags = "CanSpawnItem";
            ChatCommand.AddCommand("/i", command8);
            InstaKOCommand command9 = new InstaKOCommand();

            command9.AdminFlags = "CanInstaKO";
            ChatCommand.AddCommand("/instako", command9);
            KickCommand command10 = new KickCommand();

            command10.AdminFlags = "CanKick";
            ChatCommand.AddCommand("/kick", command10);
            KillCommand command11 = new KillCommand();

            command11.AdminFlags = "CanKill";
            ChatCommand.AddCommand("/kill", command11);
            LoadoutCommand command12 = new LoadoutCommand();

            command12.AdminFlags = "CanLoadout";
            ChatCommand.AddCommand("/loadout", command12);
            ChatCommand.AddCommand("/motd", new MOTDCommand());
            MuteCommand command13 = new MuteCommand();

            command13.AdminFlags = "CanMute";
            ChatCommand.AddCommand("/mute", command13);
            ChatCommand.AddCommand("/location", new LocationCommand());
            ChatCommand.AddCommand("/ping", new PingCommand());
            ChatCommand.AddCommand("/players", new PlayersCommand());
            ChatCommand.AddCommand("/pm", new PrivateMessagesCommand());
            ReloadCommand command14 = new ReloadCommand();

            command14.AdminFlags = "CanReload";
            ChatCommand.AddCommand("/reload", command14);
            RemoveAdminCommand command15 = new RemoveAdminCommand();

            command15.AdminFlags = "CanDeleteAdmin";
            ChatCommand.AddCommand("/unadmin", command15);
            ChatCommand.AddCommand("/r", new ReplyCommand());
            ChatCommand.AddCommand("/rules", new RulesCommand());
            SaveAllCommand command16 = new SaveAllCommand();

            command16.AdminFlags = "CanSaveAll";
            ChatCommand.AddCommand("/saveall", command16);
            MasterAdminCommand command17 = new MasterAdminCommand();

            command17.AdminFlags = "RCON";
            ChatCommand.AddCommand("/setmasteradmin", command17);
            ChatCommand.AddCommand("/share", new ShareCommand());
            ChatCommand.AddCommand("/starter", new StarterCommand());
            TeleportHereCommand command18 = new TeleportHereCommand();

            command18.AdminFlags = "CanTeleport";
            ChatCommand.AddCommand("/tphere", command18);
            TeleportToCommand command19 = new TeleportToCommand();

            command19.AdminFlags = "CanTeleport";
            ChatCommand.AddCommand("/tpto", command19);
            UnbanCommand command20 = new UnbanCommand();

            command20.AdminFlags = "CanUnban";
            ChatCommand.AddCommand("/unban", command20);
            ChatCommand.AddCommand("/unfriend", new UnfriendCommand());
            RemoveFlagsCommand command21 = new RemoveFlagsCommand();

            command21.AdminFlags = "CanUnflag";
            ChatCommand.AddCommand("/unflag", command21);
            UnmuteCommand command22 = new UnmuteCommand();

            command22.AdminFlags = "CanUnmute";
            ChatCommand.AddCommand("/unmute", command22);
            ChatCommand.AddCommand("/unshare", new UnshareCommand());
            WhiteListAddCommand command23 = new WhiteListAddCommand();

            command23.AdminFlags = "CanWhiteList";
            ChatCommand.AddCommand("/addwl", command23);
            ShutDownCommand command24 = new ShutDownCommand();

            command24.AdminFlags = "CanShutdown";
            ChatCommand.AddCommand("/shutdown", command24);
            InstaKOAllCommand command25 = new InstaKOAllCommand();

            command25.AdminFlags = "CanInstaKOAll";
            ChatCommand.AddCommand("/instakoall", command25);
        }
Beispiel #8
0
        public bool HasGod(ulong userID)
        {
            GodModeCommand command = (GodModeCommand)ChatCommand.GetCommand("god");

            return(command.userIDs.Contains(userID));
        }