Пример #1
0
 public static void Teleport_HomeWarp(object obj, NetUser Sender, string command, Vector3 pos)
 {
     if ((obj != null) && (obj is EventTimer))
     {
         (obj as EventTimer).Dispose();
     }
     if (Economy.Enabled && (Core.CommandHomePayment > 0L))
     {
         UserEconomy economy  = Economy.Get(Sender.userID);
         string      newValue = Core.CommandHomePayment.ToString("N0") + Economy.CurrencySign;
         if (economy.Balance < Core.CommandHomePayment)
         {
             Broadcast.Notice(Sender, "☢", Config.GetMessage("Command.Home.NoEnoughCurrency", Sender, null).Replace("%PRICE%", newValue), 5f);
             return;
         }
         economy.Balance -= Core.CommandHomePayment;
         string str2 = economy.Balance.ToString("N0") + Economy.CurrencySign;
         Broadcast.Message(Sender, Config.GetMessage("Economy.Balance", Sender, null).Replace("%BALANCE%", str2), null, 0f);
     }
     if (Core.CommandHomeCountdown > 0)
     {
         Users.CountdownAdd(Sender.userID, new Countdown(command, (double)Core.CommandHomeCountdown));
     }
     Broadcast.Notice(Sender, "☢", Config.GetMessage("Command.Home.Return", Sender, null), 5f);
     Helper.TeleportTo(Sender, pos);
 }
Пример #2
0
        public static bool MemberLeave(ClanData clanData, UserData userData)
        {
            bool result;

            if (clanData != null && userData != null)
            {
                if (userData.Clan == clanData)
                {
                    if (Core.DatabaseType.Equals("MYSQL"))
                    {
                        MySQL.Update(string.Format(Clans.SQL_DELETE_MEMBER, userData.SteamID));
                    }
                    if (!clanData.Members.ContainsKey(userData))
                    {
                        result = false;
                        return(result);
                    }
                    clanData.Members.Remove(userData);
                    userData.Clan = null;
                    NetUser netUser = NetUser.FindByUserID(userData.SteamID);
                    if (netUser != null)
                    {
                        Broadcast.Message(netUser, Config.GetMessageClan("Command.Clan.PlayerLeaved", clanData, null, userData), null, 0f);
                    }
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
Пример #3
0
        public static bool MemberJoin(ClanData clanData, UserData userData)
        {
            if (((clanData == null) || (userData == null)) || clanData.Members.ContainsKey(userData))
            {
                return(false);
            }
            ClanMemberFlags flags = 0;

            if (clanData.LeaderID == userData.SteamID)
            {
                flags |= ClanMemberFlags.management | ClanMemberFlags.dismiss | ClanMemberFlags.invite;
            }
            if (Core.DatabaseType.Equals("MYSQL"))
            {
                MySQL.Update(string.Format(SQL_INSERT_MEMBER, userData.SteamID, clanData.ID, flags.ToString().Replace(" ", "")));
            }
            clanData.Members.Add(userData, flags);
            userData.Clan = clanData;
            NetUser player = NetUser.FindByUserID(userData.SteamID);

            if (player != null)
            {
                Broadcast.Message(player, Config.GetMessageClan("Command.Clan.PlayerJoined", clanData, null, userData), null, 0f);
            }
            return(true);
        }
Пример #4
0
        public static bool MemberJoin(ClanData clanData, UserData userData)
        {
            bool result;

            if (clanData != null && userData != null && !clanData.Members.ContainsKey(userData))
            {
                ClanMemberFlags clanMemberFlags = (ClanMemberFlags)0;
                if (clanData.LeaderID == userData.SteamID)
                {
                    clanMemberFlags |= (ClanMemberFlags.invite | ClanMemberFlags.dismiss | ClanMemberFlags.management);
                }
                if (Core.DatabaseType.Equals("MYSQL"))
                {
                    MySQL.Update(string.Format(Clans.SQL_INSERT_MEMBER, userData.SteamID, clanData.ID, clanMemberFlags.ToString().Replace(" ", "")));
                }
                clanData.Members.Add(userData, clanMemberFlags);
                userData.Clan = clanData;
                NetUser netUser = NetUser.FindByUserID(userData.SteamID);
                if (netUser != null)
                {
                    Broadcast.Message(netUser, Config.GetMessageClan("Command.Clan.PlayerJoined", clanData, null, userData), null, 0f);
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Пример #5
0
 public static void Teleport_PlayerTo(object obj, NetUser Sender, NetUser Target, string command, Vector3 pos)
 {
     if (obj != null && obj is EventTimer)
     {
         (obj as EventTimer).Dispose();
     }
     if (Economy.Enabled && Core.CommandTeleportPayment > 0uL)
     {
         UserEconomy userEconomy = Economy.Get(Sender.userID);
         string      newValue    = Core.CommandTeleportPayment.ToString("N0") + Economy.CurrencySign;
         if (userEconomy.Balance < Core.CommandTeleportPayment)
         {
             Broadcast.Notice(Sender, "☢", Config.GetMessage("Command.Teleport.NoEnoughCurrency", Sender, null).Replace("%PRICE%", newValue), 5f);
             return;
         }
         userEconomy.Balance -= Core.CommandTeleportPayment;
         string newValue2 = userEconomy.Balance.ToString("N0") + Economy.CurrencySign;
         Broadcast.Message(Sender, Config.GetMessage("Economy.Balance", Sender, null).Replace("%BALANCE%", newValue2), null, 0f);
     }
     Broadcast.Notice(Sender, "☢", Config.GetMessage("Command.Teleport.TeleportOnPlayer", Sender, null).Replace("%USERNAME%", Target.displayName), 5f);
     Broadcast.Notice(Target, "☢", Config.GetMessage("Command.Teleport.TeleportedPlayer", Target, null).Replace("%USERNAME%", Sender.displayName), 5f);
     if (Core.CommandTeleportCountdown > 0)
     {
         Users.CountdownAdd(Sender.userID, new Countdown(command, (double)Core.CommandTeleportCountdown));
     }
     Helper.TeleportTo(Sender, pos);
 }
Пример #6
0
 public static void ShopList(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Shop.Enabled)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.NotAvailable", Sender, null), 5f);
     }
     else if (Shop.TradeZoneOnly && (userData.Zone == null || !userData.Zone.CanTrade))
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.NoTradeZone", Sender, null), 5f);
     }
     else
     {
         int             num  = 0;
         string          text = null;
         List <ShopItem> list = null;
         if (Args != null && Args.Length > 0)
         {
             if (int.TryParse(Args[0], out num))
             {
                 list = Shop.GetItems(num, out text);
             }
             if (list == null)
             {
                 list = Shop.GetItems(Args[0], out num);
             }
         }
         if (list == null)
         {
             list = Shop.dictionary_0[Shop.shopGroup_0];
         }
         foreach (ShopItem current in list)
         {
             string newValue  = (current.BuyPrice > 0) ? (current.BuyPrice + Economy.CurrencySign) : "None";
             string newValue2 = (current.SellPrice > 0) ? (current.SellPrice + Economy.CurrencySign) : "None";
             string text2     = Config.GetMessage("Economy.Shop.ListItem", Sender, null);
             text2 = text2.Replace("%INDEX%", current.Index.ToString());
             text2 = text2.Replace("%ITEMNAME%", current.Name);
             text2 = text2.Replace("%SELLPRICE%", newValue2);
             text2 = text2.Replace("%BUYPRICE%", newValue);
             text2 = text2.Replace("%QUANTITY%", current.Quantity.ToString());
             Broadcast.Message(Sender, text2, null, 0f);
         }
         if (num == 0)
         {
             foreach (ShopGroup current2 in Shop.dictionary_0.Keys)
             {
                 if (current2.Name != null && current2.Index != 0)
                 {
                     string text3 = Config.GetMessage("Economy.Shop.ListGroup", Sender, null);
                     text3 = text3.Replace("%INDEX%", current2.Index.ToString());
                     text3 = text3.Replace("%GROUPNAME%", current2.Name);
                     Broadcast.Message(Sender, text3, null, 0f);
                 }
             }
         }
         Broadcast.Message(Sender, Config.GetMessage("Economy.Shop.Help", Sender, null), null, 0f);
     }
 }
Пример #7
0
        public static EventTimer TimeEvent_TeleportTo(NetUser Sender, NetUser Target, string Command, double time)
        {
            Class38 class2 = new Class38 {
                netUser_0 = Sender,
                netUser_1 = Target,
                string_0  = Command
            };

            if (Core.CommandTeleportOutdoorsOnly)
            {
                foreach (Collider collider in Physics.OverlapSphere(class2.netUser_1.playerClient.controllable.character.transform.position, 1f, 0x10360401))
                {
                    IDMain main = IDBase.GetMain(collider);
                    if (main != null)
                    {
                        StructureMaster component = main.GetComponent <StructureMaster>();
                        if (((component != null) && (component.ownerID != class2.netUser_0.userID)) && (component.ownerID != class2.netUser_1.userID))
                        {
                            UserData bySteamID = Users.GetBySteamID(component.ownerID);
                            if ((bySteamID == null) || (!bySteamID.HasShared(class2.netUser_0.userID) && !bySteamID.HasShared(class2.netUser_1.userID)))
                            {
                                Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessage("Command.Teleport.NoTeleport", class2.netUser_0, class2.netUser_1.displayName), 5f);
                                Broadcast.Notice(class2.netUser_1, "☢", Config.GetMessage("Command.Teleport.NotHere", class2.netUser_1, class2.netUser_0.displayName), 5f);
                                return(null);
                            }
                        }
                    }
                }
            }
            Broadcast.Message(class2.netUser_0, Config.GetMessage("Command.Teleport.IsConfirm", class2.netUser_0, null).Replace("%USERNAME%", class2.netUser_1.displayName), null, 0f);
            Broadcast.Message(class2.netUser_1, Config.GetMessage("Command.Teleport.Confirmed", class2.netUser_1, null).Replace("%USERNAME%", class2.netUser_0.displayName), null, 0f);
            if (!Character.FindByUser(class2.netUser_1.userID, out class2.character_0))
            {
                return(null);
            }
            if (time <= 0.0)
            {
                Teleport_PlayerTo(null, class2.netUser_0, class2.netUser_1, class2.string_0, class2.character_0.transform.position);
                return(null);
            }
            EventTimer timer = new EventTimer {
                Interval  = time * 1000.0,
                AutoReset = false
            };

            timer.Elapsed += new ElapsedEventHandler(class2.method_0);
            timer.Sender   = class2.netUser_0;
            timer.Target   = class2.netUser_1;
            timer.Command  = class2.string_0;
            Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessage("Command.Teleport.Timewait", class2.netUser_0, null).Replace("%TIME%", timer.TimeLeft.ToString()), 5f);
            Broadcast.Notice(class2.netUser_1, "☢", Config.GetMessage("Command.Teleport.Timewait", class2.netUser_1, null).Replace("%TIME%", timer.TimeLeft.ToString()), 5f);
            timer.Start();
            return(timer);
        }
Пример #8
0
 public static void ShopList(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Shop.Enabled)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.NotAvailable", Sender, null), 5f);
     }
     else if (Shop.TradeZoneOnly && ((userData.Zone == null) || !userData.Zone.CanTrade))
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.NoTradeZone", Sender, null), 5f);
     }
     else
     {
         int    result = 0;
         string str    = null;
         System.Collections.Generic.List <ShopItem> items = null;
         if ((Args != null) && (Args.Length > 0))
         {
             if (int.TryParse(Args[0], out result))
             {
                 items = Shop.GetItems(result, out str);
             }
             if (items == null)
             {
                 items = Shop.GetItems(Args[0], out result);
             }
         }
         if (items == null)
         {
             items = Shop.dictionary_0[Shop.shopGroup_0];
         }
         foreach (ShopItem item in items)
         {
             string newValue = (item.BuyPrice > 0) ? (item.BuyPrice + CurrencySign) : "None";
             string str3     = (item.SellPrice > 0) ? (item.SellPrice + CurrencySign) : "None";
             string text     = Config.GetMessage("Economy.Shop.ListItem", Sender, null).Replace("%INDEX%", item.Index.ToString()).Replace("%ITEMNAME%", item.Name).Replace("%SELLPRICE%", str3).Replace("%BUYPRICE%", newValue).Replace("%QUANTITY%", item.Quantity.ToString());
             Broadcast.Message(Sender, text, null, 0f);
         }
         if (result == 0)
         {
             foreach (ShopGroup group in Shop.dictionary_0.Keys)
             {
                 if ((group.Name != null) && (group.Index != 0))
                 {
                     string str5 = Config.GetMessage("Economy.Shop.ListGroup", Sender, null).Replace("%INDEX%", group.Index.ToString()).Replace("%GROUPNAME%", group.Name);
                     Broadcast.Message(Sender, str5, null, 0f);
                 }
             }
         }
         Broadcast.Message(Sender, Config.GetMessage("Economy.Shop.Help", Sender, null), null, 0f);
     }
 }
Пример #9
0
 public static void Message(string color, NetUser player, string text, string sender = null, float timewait = 0f)
 {
     try
     {
         if (!text.IsEmpty())
         {
             if (player == null)
             {
                 ConsoleSystem.Print(text, false);
             }
             else
             {
                 Broadcast.Message(color, player.networkPlayer, text, sender, timewait);
             }
         }
     }
     catch (Exception ex)
     {
         Debug.Log("ERROR: " + ex.Message);
     }
 }
Пример #10
0
        public static bool MemberLeave(ClanData clanData, UserData userData)
        {
            if (((clanData == null) || (userData == null)) || (userData.Clan != clanData))
            {
                return(false);
            }
            if (Core.DatabaseType.Equals("MYSQL"))
            {
                MySQL.Update(string.Format(SQL_DELETE_MEMBER, userData.SteamID));
            }
            if (!clanData.Members.ContainsKey(userData))
            {
                return(false);
            }
            clanData.Members.Remove(userData);
            userData.Clan = null;
            NetUser player = NetUser.FindByUserID(userData.SteamID);

            if (player != null)
            {
                Broadcast.Message(player, Config.GetMessageClan("Command.Clan.PlayerLeaved", clanData, null, userData), null, 0f);
            }
            return(true);
        }
Пример #11
0
 public static void Balance(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Economy.Enabled)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.NotAvailable", Sender, null), 5f);
     }
     else
     {
         string text = "0" + Economy.CurrencySign;
         if (Sender != null && !Economy.Database.ContainsKey(userData.SteamID))
         {
             Economy.Add(userData.SteamID, 0, 0, 0, 0);
         }
         if (Sender != null)
         {
             text = Economy.Database[userData.SteamID].Balance.ToString("N0") + Economy.CurrencySign;
         }
         if (Args == null || Args.Length <= 0 || (Sender != null && !Sender.admin))
         {
             Broadcast.Message(Sender, Config.GetMessage("Economy.Balance", Sender, null).Replace("%BALANCE%", text), null, 0f);
         }
         else
         {
             userData = Users.Find(Args[0]);
             if (userData == null)
             {
                 Broadcast.Notice(Sender, "✘", Config.GetMessage("Command.PlayerNoFound", null, Args[0]), 5f);
             }
             else if (!Economy.Database.ContainsKey(userData.SteamID))
             {
                 Broadcast.Notice(Sender, "✘", "Player \"" + Args[0] + "\" not have balance", 5f);
             }
             else
             {
                 ulong balance = Economy.Database[userData.SteamID].Balance;
                 bool  flag    = Args.Length > 1 && Args[1].StartsWith("+");
                 bool  flag2   = Args.Length > 1 && Args[1].StartsWith("-");
                 if (Args.Length > 1)
                 {
                     Args[1] = Args[1].Replace("+", "").Replace("-", "").Trim();
                 }
                 if (Args.Length > 1 && ulong.TryParse(Args[1], out balance))
                 {
                     if (flag2)
                     {
                         Economy.BalanceSub(userData.SteamID, balance);
                     }
                     else if (flag)
                     {
                         Economy.BalanceAdd(userData.SteamID, balance);
                     }
                     else
                     {
                         Economy.Database[userData.SteamID].Balance = balance;
                     }
                     text = Economy.Database[userData.SteamID].Balance.ToString("N0") + Economy.CurrencySign;
                     Broadcast.Notice(Sender, Economy.CurrencySign, "Balance of \"" + userData.Username + "\" now " + text, 5f);
                 }
                 else
                 {
                     text = Economy.Database[userData.SteamID].Balance.ToString("N0") + Economy.CurrencySign;
                     Broadcast.Notice(Sender, Economy.CurrencySign, "Balance of \"" + userData.Username + "\" is " + text, 5f);
                 }
             }
         }
     }
 }
Пример #12
0
        public static void HurtKilled(DamageEvent damage)
        {
            ulong        num       = 0uL;
            string       text      = "";
            ulong        num2      = 0uL;
            string       text2     = "";
            PlayerClient client    = damage.victim.client;
            PlayerClient client2   = damage.attacker.client;
            bool         flag      = !(damage.victim.idMain is Character);
            bool         flag2     = !(damage.attacker.idMain is Character);
            UserData     userData  = (client != null) ? Users.GetBySteamID(client.userID) : null;
            UserData     userData2 = (client2 != null) ? Users.GetBySteamID(client2.userID) : null;

            if (userData == null)
            {
            }
            ClanData clanData = (userData2 != null) ? userData2.Clan : null;

            if (!flag2 || !(client2 == null))
            {
                if (client2 != null)
                {
                    text2 = damage.attacker.client.netUser.displayName;
                }
                else
                {
                    text2 = Helper.NiceName(damage.attacker.character.name);
                    Config.Get("NAMES." + ((userData == null) ? Core.Languages[0] : userData.Language), text2, ref text2, true);
                }
                if (flag)
                {
                    if (!(damage.victim.idMain is SleepingAvatar) || !Economy.FeeSleeper)
                    {
                        return;
                    }
                    SleepingAvatar sleepingAvatar = damage.victim.idMain as SleepingAvatar;
                    if (sleepingAvatar == null)
                    {
                        return;
                    }
                    UserData bySteamID = Users.GetBySteamID(sleepingAvatar.ownerID);
                    if (bySteamID == null)
                    {
                        return;
                    }
                    ulong balance = Economy.GetBalance(bySteamID.SteamID);
                    text = bySteamID.Username;
                    if (Economy.FeeMurder)
                    {
                        num = (ulong)Math.Abs(balance * Economy.FeeMurderPercent / 100f);
                    }
                    if (Economy.PayMurder)
                    {
                        num2 = (ulong)Math.Abs(balance * Economy.PayMurderPercent / 100f);
                    }
                    if (num2 > 0uL && Clans.Enabled && clanData != null)
                    {
                        if (clanData.Level.BonusMembersPayMurder > 0u)
                        {
                            num2 += num2 * (ulong)clanData.Level.BonusMembersPayMurder / 100uL;
                        }
                        if (clanData.Tax > 0u)
                        {
                            ulong num3 = num2 * (ulong)clanData.Tax / 100uL;
                            clanData.Balance += num3;
                            num2             -= num3;
                        }
                    }
                    if (num2 > 0uL)
                    {
                        Economy.BalanceAdd(client2.userID, num2);
                    }
                    if (num > 0uL)
                    {
                        Economy.BalanceSub(bySteamID.SteamID, num);
                    }
                }
                else if (client != null)
                {
                    text = damage.victim.client.netUser.displayName;
                    ulong balance2 = Economy.GetBalance(client.userID);
                    if (client2 == null)
                    {
                        if (Economy.FeeDeath)
                        {
                            num = (ulong)Math.Abs(balance2 * Economy.FeeDeathPercent / 100f);
                        }
                    }
                    else if (!(client2 == client) && !flag2)
                    {
                        if (client2 != client && !flag2)
                        {
                            Economy.Get(client2.userID).PlayersKilled++;
                            if (Economy.FeeMurder)
                            {
                                num = (ulong)Math.Abs(balance2 * Economy.FeeMurderPercent / 100f);
                            }
                            if (Economy.PayMurder)
                            {
                                num2 = (ulong)Math.Abs(balance2 * Economy.PayMurderPercent / 100f);
                            }
                        }
                    }
                    else if (Economy.FeeSuicide)
                    {
                        num = (ulong)Math.Abs(balance2 * Economy.FeeSuicidePercent / 100f);
                    }
                    if (num2 > 0uL && Clans.Enabled && clanData != null)
                    {
                        if (clanData.Level.BonusMembersPayMurder > 0u)
                        {
                            num2 += num2 * (ulong)clanData.Level.BonusMembersPayMurder / 100uL;
                        }
                        if (clanData.Tax > 0u)
                        {
                            ulong num4 = num2 * (ulong)clanData.Tax / 100uL;
                            clanData.Balance += num4;
                            num2             -= num4;
                        }
                    }
                    if (num2 > 0uL)
                    {
                        Economy.BalanceAdd(client2.userID, num2);
                    }
                    if (num > 0uL)
                    {
                        Economy.BalanceSub(client.userID, num);
                    }
                    Economy.Get(client.userID).Deaths++;
                }
                else if (client2 != null)
                {
                    text = Helper.NiceName(damage.victim.character.name);
                    if (text.Equals("Chicken", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostChicken != 0uL)
                        {
                            num2 = Economy.CostChicken;
                        }
                        Economy.Get(client2.userID).AnimalsKilled++;
                    }
                    else if (text.Equals("Rabbit", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostRabbit != 0uL)
                        {
                            num2 = Economy.CostRabbit;
                        }
                        Economy.Get(client2.userID).AnimalsKilled++;
                    }
                    else if (text.Equals("Boar", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostBoar != 0uL)
                        {
                            num2 = Economy.CostBoar;
                        }
                        Economy.Get(client2.userID).AnimalsKilled++;
                    }
                    else if (text.Equals("Stag", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostStag != 0uL)
                        {
                            num2 = Economy.CostStag;
                        }
                        Economy.Get(client2.userID).AnimalsKilled++;
                    }
                    else if (text.Equals("Wolf", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostWolf != 0uL)
                        {
                            num2 = Economy.CostWolf;
                        }
                        Economy.Get(client2.userID).AnimalsKilled++;
                    }
                    else if (text.Equals("Bear", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostBear != 0uL)
                        {
                            num2 = Economy.CostBear;
                        }
                        Economy.Get(client2.userID).AnimalsKilled++;
                    }
                    else if (text.Equals("Mutant Wolf", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostMutantWolf != 0uL)
                        {
                            num2 = Economy.CostMutantWolf;
                        }
                        Economy.Get(client2.userID).MutantsKilled++;
                    }
                    else if (text.Equals("Mutant Bear", StringComparison.OrdinalIgnoreCase))
                    {
                        if (Economy.CostMutantBear != 0uL)
                        {
                            num2 = Economy.CostMutantBear;
                        }
                        Economy.Get(client2.userID).MutantsKilled++;
                    }
                    else
                    {
                        ConsoleSystem.LogWarning("[WARNING] Economy: Creature '" + text + "' not have cost of death.");
                    }
                    Config.Get("NAMES." + ((userData2 == null) ? Core.Languages[0] : userData2.Language), text, ref text, true);
                    if (num2 > 0uL && Clans.Enabled && clanData != null)
                    {
                        if (clanData.Level.BonusMembersPayMurder > 0u)
                        {
                            num2 += num2 * (ulong)clanData.Level.BonusMembersPayMurder / 100uL;
                        }
                        if (clanData.Tax > 0u)
                        {
                            ulong num5 = num2 * (ulong)clanData.Tax / 100uL;
                            clanData.Balance += num5;
                            num2             -= num5;
                        }
                    }
                    if (num2 > 0uL)
                    {
                        Economy.BalanceAdd(client2.userID, num2);
                    }
                }
                if (client2 != null && num2 > 0uL)
                {
                    string text3 = Config.GetMessage("Economy.PlayerDeath.Pay", client2.netUser, null);
                    if (flag)
                    {
                        text3 = Config.GetMessage("Economy.SleeperDeath.Pay", client2.netUser, null);
                    }
                    text3 = text3.Replace("%DEATHPAY%", num2.ToString("N0") + Economy.CurrencySign);
                    text3 = text3.Replace("%VICTIM%", text);
                    Broadcast.Message(client2.netPlayer, text3, null, 0f);
                }
                if (client != null && num > 0uL)
                {
                    string text4 = Config.GetMessage("Economy.PlayerDeath.Fee", client.netUser, null);
                    if (client2 == client || flag2)
                    {
                        text4 = Config.GetMessage("Economy.PlayerSuicide.Fee", client.netUser, null);
                    }
                    text4 = text4.Replace("%DEATHFEE%", num.ToString("N0") + Economy.CurrencySign);
                    text4 = text4.Replace("%KILLER%", text2);
                    text4 = text4.Replace("%VICTIM%", text);
                    Broadcast.Message(client.netPlayer, text4, null, 0f);
                }
            }
        }
Пример #13
0
 public static void Balance(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Enabled)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.NotAvailable", Sender, null), 5f);
     }
     else
     {
         string newValue = "0" + CurrencySign;
         if ((Sender != null) && !Database.ContainsKey(userData.SteamID))
         {
             Add(userData.SteamID, 0, 0, 0, 0);
         }
         if (Sender != null)
         {
             newValue = Database[userData.SteamID].Balance.ToString("N0") + CurrencySign;
         }
         if (((Args != null) && (Args.Length > 0)) && ((Sender == null) || Sender.admin))
         {
             userData = Users.Find(Args[0]);
             if (userData == null)
             {
                 Broadcast.Notice(Sender, "✘", Config.GetMessage("Command.PlayerNoFound", null, Args[0]), 5f);
             }
             else if (!Database.ContainsKey(userData.SteamID))
             {
                 Broadcast.Notice(Sender, "✘", "Player \"" + Args[0] + "\" not have balance", 5f);
             }
             else
             {
                 ulong balance = Database[userData.SteamID].Balance;
                 bool  flag    = (Args.Length > 1) && Args[1].StartsWith("+");
                 bool  flag2   = (Args.Length > 1) && Args[1].StartsWith("-");
                 if (Args.Length > 1)
                 {
                     Args[1] = Args[1].Replace("+", "").Replace("-", "").Trim();
                 }
                 if ((Args.Length > 1) && ulong.TryParse(Args[1], out balance))
                 {
                     if (flag2)
                     {
                         BalanceSub(userData.SteamID, balance);
                     }
                     else if (flag)
                     {
                         BalanceAdd(userData.SteamID, balance);
                     }
                     else
                     {
                         Database[userData.SteamID].Balance = balance;
                     }
                     newValue = Database[userData.SteamID].Balance.ToString("N0") + CurrencySign;
                     Broadcast.Notice(Sender, CurrencySign, "Balance of \"" + userData.Username + "\" now " + newValue, 5f);
                 }
                 else
                 {
                     newValue = Database[userData.SteamID].Balance.ToString("N0") + CurrencySign;
                     Broadcast.Notice(Sender, CurrencySign, "Balance of \"" + userData.Username + "\" is " + newValue, 5f);
                 }
             }
         }
         else
         {
             Broadcast.Message(Sender, Config.GetMessage("Economy.Balance", Sender, null).Replace("%BALANCE%", newValue), null, 0f);
         }
     }
 }
Пример #14
0
 public static void Send(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Enabled)
     {
         Broadcast.Notice(Sender.networkPlayer, "✘", Config.GetMessage("Economy.NotAvailable", Sender, null), 5f);
     }
     else if ((Args != null) && (Args.Length != 0))
     {
         UserData data = Users.Find(Args[0]);
         if (data == null)
         {
             Broadcast.Notice(Sender, "✘", Config.GetMessage("Command.PlayerNoFound", null, Args[0]), 5f);
         }
         else if (data == userData)
         {
             Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Send.Himself", Sender, null), 5f);
         }
         else
         {
             if (!Database.ContainsKey(userData.SteamID))
             {
                 Add(userData.SteamID, 0, 0, 0, 0);
             }
             if (!Database.ContainsKey(data.SteamID))
             {
                 Add(data.SteamID, 0, 0, 0, 0);
             }
             NetUser player   = NetUser.FindByUserID(data.SteamID);
             string  newValue = "";
             ulong   result   = 0L;
             if ((Args.Length > 1) && !ulong.TryParse(Args[1], out result))
             {
                 result = 0L;
             }
             if (result < 1L)
             {
                 result = 0L;
             }
             string str2 = result.ToString("N0") + CurrencySign;
             if (result == 0L)
             {
                 Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Send.NoAmount", Sender, null), 5f);
             }
             else if (Database[userData.SteamID].Balance < result)
             {
                 Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Send.NoHaveAmount", Sender, null).Replace("%SENTAMOUNT%", str2), 5f);
             }
             else
             {
                 BalanceSub(userData.SteamID, result);
                 if (CommandSendTax > 0f)
                 {
                     result -= ((ulong)(result * CommandSendTax)) / 100L;
                     str2    = result.ToString("N0") + CurrencySign;
                 }
                 BalanceAdd(data.SteamID, result);
                 newValue = Database[userData.SteamID].Balance.ToString("N0") + CurrencySign;
                 Broadcast.Notice(Sender, CurrencySign, Config.GetMessage("Economy.Send.SentToPlayer", null, data.Username).Replace("%SENTAMOUNT%", str2), 5f);
                 Broadcast.Message(Sender, Config.GetMessage("Economy.Balance", Sender, null).Replace("%BALANCE%", newValue), null, 0f);
                 if (player != null)
                 {
                     newValue = Database[data.SteamID].Balance.ToString("N0") + CurrencySign;
                     Broadcast.Notice(player, CurrencySign, Config.GetMessage("Economy.Send.SentFromPlayer", null, userData.Username).Replace("%SENTAMOUNT%", str2), 5f);
                     Broadcast.Message(player, Config.GetMessage("Economy.Balance", player, null).Replace("%BALANCE%", newValue), null, 0f);
                 }
             }
         }
     }
     else
     {
         Broadcast.Notice(Sender.networkPlayer, "✘", Config.GetMessageCommand("Command.InvalidSyntax", Command, null), 5f);
     }
 }
Пример #15
0
        public static void HurtKilled(DamageEvent damage)
        {
            ulong        amount      = 0L;
            string       key         = "";
            ulong        costChicken = 0L;
            string       displayName = "";
            PlayerClient client      = damage.victim.client;
            PlayerClient client2     = damage.attacker.client;
            bool         flag        = !(damage.victim.idMain is Character);
            bool         flag2       = !(damage.attacker.idMain is Character);
            UserData     data        = (client != null) ? Users.GetBySteamID(client.userID) : null;
            UserData     data2       = (client2 != null) ? Users.GetBySteamID(client2.userID) : null;

            if (data == null)
            {
            }
            ClanData data3 = (data2 != null) ? data2.Clan : null;

            if (!flag2 || (client2 != null))
            {
                if (client2 != null)
                {
                    displayName = damage.attacker.client.netUser.displayName;
                }
                else
                {
                    displayName = Helper.NiceName(damage.attacker.character.name);
                    Config.Get("NAMES." + ((data == null) ? Core.Languages[0] : data.Language), displayName, ref displayName, true);
                }
                if (flag)
                {
                    if (!(damage.victim.idMain is SleepingAvatar) || !FeeSleeper)
                    {
                        return;
                    }
                    SleepingAvatar idMain = damage.victim.idMain as SleepingAvatar;
                    if (idMain == null)
                    {
                        return;
                    }
                    UserData bySteamID = Users.GetBySteamID(idMain.ownerID);
                    if (bySteamID == null)
                    {
                        return;
                    }
                    ulong balance = GetBalance(bySteamID.SteamID);
                    key = bySteamID.Username;
                    if (FeeMurder)
                    {
                        amount = (ulong)Math.Abs((float)((balance * FeeMurderPercent) / 100f));
                    }
                    if (PayMurder)
                    {
                        costChicken = (ulong)Math.Abs((float)((balance * PayMurderPercent) / 100f));
                    }
                    if (((costChicken > 0L) && Clans.Enabled) && (data3 != null))
                    {
                        if (data3.Level.BonusMembersPayMurder > 0)
                        {
                            costChicken += (costChicken * data3.Level.BonusMembersPayMurder) / ((ulong)100L);
                        }
                        if (data3.Tax > 0)
                        {
                            ulong num4 = (costChicken * data3.Tax) / ((ulong)100L);
                            data3.Balance += num4;
                            costChicken   -= num4;
                        }
                    }
                    if (costChicken > 0L)
                    {
                        BalanceAdd(client2.userID, costChicken);
                    }
                    if (amount > 0L)
                    {
                        BalanceSub(bySteamID.SteamID, amount);
                    }
                }
                else if (client != null)
                {
                    key = damage.victim.client.netUser.displayName;
                    ulong num5 = GetBalance(client.userID);
                    if (client2 == null)
                    {
                        if (FeeDeath)
                        {
                            amount = (ulong)Math.Abs((float)((num5 * FeeDeathPercent) / 100f));
                        }
                    }
                    else if ((client2 != client) && !flag2)
                    {
                        if ((client2 != client) && !flag2)
                        {
                            UserEconomy economy1 = Get(client2.userID);
                            economy1.PlayersKilled++;
                            if (FeeMurder)
                            {
                                amount = (ulong)Math.Abs((float)((num5 * FeeMurderPercent) / 100f));
                            }
                            if (PayMurder)
                            {
                                costChicken = (ulong)Math.Abs((float)((num5 * PayMurderPercent) / 100f));
                            }
                        }
                    }
                    else if (FeeSuicide)
                    {
                        amount = (ulong)Math.Abs((float)((num5 * FeeSuicidePercent) / 100f));
                    }
                    if (((costChicken > 0L) && Clans.Enabled) && (data3 != null))
                    {
                        if (data3.Level.BonusMembersPayMurder > 0)
                        {
                            costChicken += (costChicken * data3.Level.BonusMembersPayMurder) / ((ulong)100L);
                        }
                        if (data3.Tax > 0)
                        {
                            ulong num6 = (costChicken * data3.Tax) / ((ulong)100L);
                            data3.Balance += num6;
                            costChicken   -= num6;
                        }
                    }
                    if (costChicken > 0L)
                    {
                        BalanceAdd(client2.userID, costChicken);
                    }
                    if (amount > 0L)
                    {
                        BalanceSub(client.userID, amount);
                    }
                    UserEconomy economy2 = Get(client.userID);
                    economy2.Deaths++;
                }
                else if (client2 != null)
                {
                    key = Helper.NiceName(damage.victim.character.name);
                    if (key.Equals("Chicken", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostChicken != 0L)
                        {
                            costChicken = CostChicken;
                        }
                        UserEconomy economy3 = Get(client2.userID);
                        economy3.AnimalsKilled++;
                    }
                    else if (key.Equals("Rabbit", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostRabbit != 0L)
                        {
                            costChicken = CostRabbit;
                        }
                        UserEconomy economy4 = Get(client2.userID);
                        economy4.AnimalsKilled++;
                    }
                    else if (key.Equals("Boar", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostBoar != 0L)
                        {
                            costChicken = CostBoar;
                        }
                        UserEconomy economy5 = Get(client2.userID);
                        economy5.AnimalsKilled++;
                    }
                    else if (key.Equals("Stag", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostStag != 0L)
                        {
                            costChicken = CostStag;
                        }
                        UserEconomy economy6 = Get(client2.userID);
                        economy6.AnimalsKilled++;
                    }
                    else if (key.Equals("Wolf", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostWolf != 0L)
                        {
                            costChicken = CostWolf;
                        }
                        UserEconomy economy7 = Get(client2.userID);
                        economy7.AnimalsKilled++;
                    }
                    else if (key.Equals("Bear", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostBear != 0L)
                        {
                            costChicken = CostBear;
                        }
                        UserEconomy economy8 = Get(client2.userID);
                        economy8.AnimalsKilled++;
                    }
                    else if (key.Equals("Mutant Wolf", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostMutantWolf != 0L)
                        {
                            costChicken = CostMutantWolf;
                        }
                        UserEconomy economy9 = Get(client2.userID);
                        economy9.MutantsKilled++;
                    }
                    else if (key.Equals("Mutant Bear", StringComparison.OrdinalIgnoreCase))
                    {
                        if (CostMutantBear != 0L)
                        {
                            costChicken = CostMutantBear;
                        }
                        UserEconomy economy10 = Get(client2.userID);
                        economy10.MutantsKilled++;
                    }
                    else
                    {
                        ConsoleSystem.LogWarning("[WARNING] Economy: Creature '" + key + "' not have cost of death.");
                    }
                    Config.Get("NAMES." + ((data2 == null) ? Core.Languages[0] : data2.Language), key, ref key, true);
                    if (((costChicken > 0L) && Clans.Enabled) && (data3 != null))
                    {
                        if (data3.Level.BonusMembersPayMurder > 0)
                        {
                            costChicken += (costChicken * data3.Level.BonusMembersPayMurder) / ((ulong)100L);
                        }
                        if (data3.Tax > 0)
                        {
                            ulong num7 = (costChicken * data3.Tax) / ((ulong)100L);
                            data3.Balance += num7;
                            costChicken   -= num7;
                        }
                    }
                    if (costChicken > 0L)
                    {
                        BalanceAdd(client2.userID, costChicken);
                    }
                }
                if ((client2 != null) && (costChicken > 0L))
                {
                    string text = Config.GetMessage("Economy.PlayerDeath.Pay", client2.netUser, null);
                    if (flag)
                    {
                        text = Config.GetMessage("Economy.SleeperDeath.Pay", client2.netUser, null);
                    }
                    text = text.Replace("%DEATHPAY%", costChicken.ToString("N0") + CurrencySign).Replace("%VICTIM%", key);
                    Broadcast.Message(client2.netPlayer, text, null, 0f);
                }
                if ((client != null) && (amount > 0L))
                {
                    string str4;
                    str4 = str4 = Config.GetMessage("Economy.PlayerDeath.Fee", client.netUser, null);
                    if ((client2 == client) || flag2)
                    {
                        str4 = Config.GetMessage("Economy.PlayerSuicide.Fee", client.netUser, null);
                    }
                    str4 = str4.Replace("%DEATHFEE%", amount.ToString("N0") + CurrencySign).Replace("%KILLER%", displayName).Replace("%VICTIM%", key);
                    Broadcast.Message(client.netPlayer, str4, null, 0f);
                }
            }
        }
Пример #16
0
 private static bool smethod_2(TruthDetector truthDetector_0, Vector3 vector3_0, ref Vector3 vector3_1, double double_0)
 {
     if (double_0 > 0.0)
     {
         double    num       = ((double)(vector3_1.y - vector3_0.y)) / double_0;
         UserData  bySteamID = Users.GetBySteamID(truthDetector_0.netUser.userID);
         Character idMain    = truthDetector_0.netUser.playerClient.controllable.idMain;
         if (!FallHeight.ContainsKey(truthDetector_0.netUser))
         {
             FallHeight.Add(truthDetector_0.netUser, 0.0);
         }
         if (!AirMovement.ContainsKey(truthDetector_0.netUser))
         {
             AirMovement.Add(truthDetector_0.netUser, 0.0);
         }
         if (idMain.stateFlags.airborne)
         {
             AirMovement[truthDetector_0.netUser] = 0.0;
         }
         if ((CheckJumphack && (num > 0.0)) && ((idMain != null) && idMain.stateFlags.airborne))
         {
             truthDetector_0.jumpHeight += num;
             if ((truthDetector_0.jumpHeight <= MaxJumpingHeight) && (num <= (MaxJumpingHeight * 2f)))
             {
                 if (((server.log > 2) && Users.HasFlag(truthDetector_0.netUser.userID, UserFlags.admin)) && (truthDetector_0.jumpHeight > 1.0))
                 {
                     Broadcast.Message(truthDetector_0.netUser, "JumpHeight: " + truthDetector_0.jumpHeight.ToString("0.0") + " of maximum " + MaxJumpingHeight.ToString("0.0"), "DEBUG", 0f);
                 }
             }
             else
             {
                 if ((server.log > 1) && Users.HasFlag(truthDetector_0.netUser.userID, UserFlags.admin))
                 {
                     Broadcast.Message(truthDetector_0.netUser, "[COLOR#D02F2F]JumpHeight: " + truthDetector_0.jumpHeight.ToString("0.0") + " of maximum " + MaxJumpingHeight.ToString("0.0"), "DEBUG", 0f);
                 }
                 PunishDetails = Config.GetMessageTruth("Truth.Punish.Reason.JumpHack", truthDetector_0.netUser, "", 0, new DateTime());
                 PunishDetails = PunishDetails.Replace("%JUMP.HEIGHT%", truthDetector_0.jumpHeight.ToString("0.00"));
                 PunishDetails = PunishDetails.Replace("%JUMP.MAXHEIGHT%", MaxJumpingHeight.ToString("0.00"));
                 HackDetected  = HackMethod.JumpHack;
                 vector3_1     = MoveBack(truthDetector_0, vector3_0, vector3_1);
             }
             return(HackDetected == HackMethod.JumpHack);
         }
         if ((CheckFallhack && (num < 0.0)) && ((idMain != null) && idMain.stateFlags.airborne))
         {
             Dictionary <NetUser, double> dictionary;
             NetUser user;
             (dictionary = FallHeight)[user = truthDetector_0.netUser] = dictionary[user] + (num = -num);
             if (((FallHeight[truthDetector_0.netUser] >= MinFallingHeight) && (bySteamID != null)) && (bySteamID.FallCheck != FallCheckState.damaged))
             {
                 bySteamID.FallCheck = FallCheckState.check;
                 if (((server.log > 2) && Users.HasFlag(truthDetector_0.netUser.userID, UserFlags.admin)) && (FallHeight[truthDetector_0.netUser] > 1.0))
                 {
                     Broadcast.Message(truthDetector_0.netUser, "[COLOR#D02F2F]FallHeight: " + FallHeight[truthDetector_0.netUser].ToString("0.00") + " of minimum " + MinFallingHeight.ToString("0.0"), "DEBUG", 0f);
                 }
             }
             else if (((server.log > 2) && Users.HasFlag(truthDetector_0.netUser.userID, UserFlags.admin)) && (FallHeight[truthDetector_0.netUser] > 1.0))
             {
                 Broadcast.Message(truthDetector_0.netUser, "FallHeight: " + FallHeight[truthDetector_0.netUser].ToString("0.00") + " of minimum " + MinFallingHeight.ToString("0.0"), "DEBUG", 0f);
             }
         }
         else if (!idMain.stateFlags.airborne)
         {
             if (CheckFallhack && (FallHeight[truthDetector_0.netUser] >= MinFallingHeight))
             {
                 if ((bySteamID != null) && (bySteamID.FallCheck == FallCheckState.check))
                 {
                     PunishDetails = Config.GetMessageTruth("Truth.Punish.Reason.FallHack", truthDetector_0.netUser, "", 0, new DateTime());
                     PunishDetails = PunishDetails.Replace("%FALL.HEIGHT%", FallHeight[truthDetector_0.netUser].ToString("0.00"));
                     PunishDetails = PunishDetails.Replace("%FALL.MINHEIGHT%", MinFallingHeight.ToString("0.00"));
                     HackDetected  = HackMethod.FallHack;
                 }
             }
             else if (Facepunch.MeshBatch.MeshBatchPhysics.OverlapSphere(vector3_1, 0.5f, 0x20180403).Length == 0)
             {
                 Dictionary <NetUser, double> dictionary2;
                 NetUser user2;
                 (dictionary2 = AirMovement)[user2 = truthDetector_0.netUser] = dictionary2[user2] + 1.0;
                 if (AirMovement[truthDetector_0.netUser] > NetCull.sendRate)
                 {
                     PunishDetails = Config.GetMessageTruth("Truth.Punish.Reason.MoveHack", truthDetector_0.netUser, "", 0, new DateTime());
                     AirMovement[truthDetector_0.netUser] = 0.0;
                     HackDetected = HackMethod.MoveHack;
                 }
             }
             bySteamID.FallCheck = FallCheckState.none;
             FallHeight[truthDetector_0.netUser] = truthDetector_0.jumpHeight = 0.0;
             if (HackDetected != HackMethod.FallHack)
             {
                 return(HackDetected == HackMethod.MoveHack);
             }
             return(true);
         }
     }
     return(false);
 }
Пример #17
0
        public static EventTimer TimeEvent_TeleportTo(NetUser Sender, NetUser Target, string Command, double time)
        {
            Events.Class38 @class = new Events.Class38();
            @class.netUser_0 = Sender;
            @class.netUser_1 = Target;
            @class.string_0  = Command;
            EventTimer result;

            if (Core.CommandTeleportOutdoorsOnly)
            {
                Vector3    position = @class.netUser_1.playerClient.controllable.character.transform.position;
                Collider[] array    = Physics.OverlapSphere(position, 1f, 271975425);
                for (int i = 0; i < array.Length; i++)
                {
                    Collider component = array[i];
                    IDMain   main      = IDBase.GetMain(component);
                    if (!(main == null))
                    {
                        StructureMaster component2 = main.GetComponent <StructureMaster>();
                        if (!(component2 == null) && component2.ownerID != @class.netUser_0.userID && component2.ownerID != @class.netUser_1.userID)
                        {
                            UserData bySteamID = Users.GetBySteamID(component2.ownerID);
                            if (bySteamID == null || (!bySteamID.HasShared(@class.netUser_0.userID) && !bySteamID.HasShared(@class.netUser_1.userID)))
                            {
                                Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessage("Command.Teleport.NoTeleport", @class.netUser_0, @class.netUser_1.displayName), 5f);
                                Broadcast.Notice(@class.netUser_1, "☢", Config.GetMessage("Command.Teleport.NotHere", @class.netUser_1, @class.netUser_0.displayName), 5f);
                                result = null;
                                return(result);
                            }
                        }
                    }
                }
            }
            Broadcast.Message(@class.netUser_0, Config.GetMessage("Command.Teleport.IsConfirm", @class.netUser_0, null).Replace("%USERNAME%", @class.netUser_1.displayName), null, 0f);
            Broadcast.Message(@class.netUser_1, Config.GetMessage("Command.Teleport.Confirmed", @class.netUser_1, null).Replace("%USERNAME%", @class.netUser_0.displayName), null, 0f);
            if (!Character.FindByUser(@class.netUser_1.userID, out @class.character_0))
            {
                result = null;
            }
            else if (time <= 0.0)
            {
                Events.Teleport_PlayerTo(null, @class.netUser_0, @class.netUser_1, @class.string_0, @class.character_0.transform.position);
                result = null;
            }
            else
            {
                EventTimer eventTimer = new EventTimer
                {
                    Interval  = time * 1000.0,
                    AutoReset = false
                };
                eventTimer.Elapsed += new ElapsedEventHandler(@class.method_0);
                eventTimer.Sender   = @class.netUser_0;
                eventTimer.Target   = @class.netUser_1;
                eventTimer.Command  = @class.string_0;
                Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessage("Command.Teleport.Timewait", @class.netUser_0, null).Replace("%TIME%", eventTimer.TimeLeft.ToString()), 5f);
                Broadcast.Notice(@class.netUser_1, "☢", Config.GetMessage("Command.Teleport.Timewait", @class.netUser_1, null).Replace("%TIME%", eventTimer.TimeLeft.ToString()), 5f);
                eventTimer.Start();
                result = eventTimer;
            }
            return(result);
        }
Пример #18
0
        public static TruthDetector.ActionTaken Punish(NetUser netUser, UserData userData, HackMethod hackMethod, [Optional, DefaultParameterValue(false)] bool PunishBan)
        {
            string str = "";

            if ((server.log > 1) && Users.HasFlag(netUser.userID, UserFlags.admin))
            {
                if (hackMethod == HackMethod.AimedHack)
                {
                    Broadcast.Message(netUser, string.Concat(new object[] { "Violation ", netUser.truthDetector.violation, "(+", 100, ") of ", truth.threshold }), "TRUTH", 0f);
                }
                else
                {
                    Broadcast.Message(netUser, string.Concat(new object[] { "Violation ", netUser.truthDetector.violation, "(+", Rate, ") of ", truth.threshold }), "TRUTH", 0f);
                }
            }
            switch (hackMethod)
            {
            case HackMethod.AimedHack:
                str = "'Aimbot Hack'";
                netUser.truthDetector.violation += truth.threshold;
                break;

            case HackMethod.SpeedHack:
                str = "'Speed Hack'";
                netUser.truthDetector.violation += Rate;
                break;

            case HackMethod.MoveHack:
                str = "'Move Hack'";
                netUser.truthDetector.violation += Rate;
                break;

            case HackMethod.JumpHack:
                str = "'Jump Hack'";
                netUser.truthDetector.violation += Rate;
                break;

            case HackMethod.WallHack:
                str = "'Wall Hack'";
                netUser.truthDetector.violation += Rate;
                break;

            case HackMethod.FallHack:
                str = "'Fall Hack'";
                netUser.truthDetector.violation += truth.threshold;
                break;

            case HackMethod.NetExploit:
                str = "'Network Exploit'";
                netUser.truthDetector.violation += truth.threshold;
                break;

            case HackMethod.OtherHack:
                str = "'Object Hack'";
                netUser.truthDetector.violation += Rate;
                break;

            default:
                return(TruthDetector.ActionTaken.None);
            }
            if (netUser.truthDetector.violation >= truth.threshold)
            {
                if ((MaxViolations != -1) && (userData != null))
                {
                    userData.ViolationDate = DateTime.Now;
                    userData.Violations++;
                }
                netUser.truthDetector.violation = 0;
                if ((MaxViolations != -1) && ((PunishAction.Contains <string>("BAN") || PunishBan) || ((MaxViolations <= 0) || (userData.Violations >= MaxViolations))))
                {
                    Users.SetViolations(userData.SteamID, 0);
                    DateTime period = new DateTime();
                    if (BannedPeriod > 0)
                    {
                        period = DateTime.Now.AddMinutes((double)BannedPeriod);
                    }
                    PunishReason = Config.GetMessageTruth("Truth.Logger.Banned", netUser, str, userData.Violations, new DateTime());
                    if (PunishDetails != "")
                    {
                        Helper.LogError(string.Concat(new object[] { "Violated [", netUser.displayName, ":", netUser.userID, "]: ", PunishDetails }), ViolationDetails);
                    }
                    Helper.Log(PunishReason, true);
                    if (ReportRank > 0)
                    {
                        Broadcast.MessageGM(PunishReason);
                    }
                    if (Core.DatabaseType.Equals("MYSQL"))
                    {
                        MySQL.Update(string.Format(string_0, userData.SteamID, MySQL.QuoteString(PunishReason), MySQL.QuoteString(PunishDetails)));
                        MySQL.Update(string.Format(string_1, userData.SteamID, userData.ViolationDate.ToString("yyyy-MM-dd HH:mm:ss")));
                    }
                    if (PunishAction.Contains <string>("NOTICE"))
                    {
                        Broadcast.Message(ViolationColor, netUser, Config.GetMessageTruth("Truth.Violation.Banned", netUser, str, userData.Violations, period), null, 0f);
                        Broadcast.MessageAll(ViolationColor, Config.GetMessageTruth("Truth.Punish.Banned", netUser, str, userData.Violations, new DateTime()), netUser);
                        Broadcast.MessageAll(ViolationColor, PunishDetails, null);
                    }
                    else
                    {
                        Broadcast.Message(ViolationColor, netUser, Config.GetMessageTruth("Truth.Violation.Banned", netUser, str, userData.Violations, period), null, 0f);
                        Broadcast.Message(ViolationColor, netUser, PunishDetails, null, 0f);
                    }
                    if (BannedBlockIP && !BannedExcludeIP.Contains <string>(userData.LastConnectIP))
                    {
                        Blocklist.Add(userData.LastConnectIP);
                    }
                    Users.Ban(netUser.userID, "Banned for using " + str + " by SERVER.", period, PunishDetails);
                    netUser.Kick(NetError.Facepunch_Kick_Violation, true);
                    return(TruthDetector.ActionTaken.Kicked);
                }
                PunishReason = Config.GetMessageTruth("Truth.Logger.Notice", netUser, str, userData.Violations, new DateTime());
                if (PunishDetails != "")
                {
                    Helper.LogError(string.Concat(new object[] { "Violated [", netUser.displayName, ":", netUser.userID, "]: ", PunishDetails }), ViolationDetails);
                }
                Helper.Log(PunishReason, true);
                if (ReportRank > 0)
                {
                    Broadcast.MessageGM(PunishReason);
                }
                if (Core.DatabaseType.Equals("MYSQL"))
                {
                    MySQL.Update(string.Format(string_0, userData.SteamID, MySQL.QuoteString(PunishReason), MySQL.QuoteString(PunishDetails)));
                    MySQL.Update(string.Format(string_1, userData.SteamID, userData.ViolationDate.ToString("yyyy-MM-dd HH:mm:ss")));
                }
                string text = Config.GetMessageTruth("Truth.Violation.Notice", netUser, str, userData.Violations, new DateTime());
                string str3 = Config.GetMessageTruth("Truth.Punish.Notice", netUser, str, userData.Violations, new DateTime());
                if (PunishAction.Contains <string>("KILL"))
                {
                    text = Config.GetMessageTruth("Truth.Violation.Killed", netUser, str, userData.Violations, new DateTime());
                    str3 = Config.GetMessageTruth("Truth.Punish.Killed", netUser, str, userData.Violations, new DateTime());
                }
                if (PunishAction.Contains <string>("KICK"))
                {
                    text = Config.GetMessageTruth("Truth.Violation.Kicked", netUser, str, userData.Violations, new DateTime());
                    str3 = Config.GetMessageTruth("Truth.Punish.Kicked", netUser, str, userData.Violations, new DateTime());
                }
                if (PunishAction.Contains <string>("NOTICE"))
                {
                    Broadcast.Message(ViolationColor, netUser, text, null, 0f);
                    Broadcast.MessageAll(ViolationColor, str3, netUser);
                    Broadcast.MessageAll(ViolationColor, PunishDetails, null);
                }
                if (PunishAction.Contains <string>("KILL"))
                {
                    TakeDamage.KillSelf(netUser.playerClient.controllable.character, null);
                }
                if (PunishAction.Contains <string>("KICK"))
                {
                    netUser.Kick(NetError.Facepunch_Kick_Violation, true);
                }
            }
            return(actionTaken_0);
        }
Пример #19
0
        public static void OnPlayerMove(NetUser netUser, ref Vector3 newpos, ref TruthDetector.ActionTaken taken)
        {
            Predicate <EventTimer> predicate           = null;
            ElapsedEventHandler    elapsedEventHandler = null;

            Zones.Class56 @class = new Zones.Class56();
            @class.netUser_0 = netUser;
            if (@class.netUser_0 != null && !(@class.netUser_0.playerClient == null) && !(@class.netUser_0.playerClient.controllable == null))
            {
                Vector3 position = @class.netUser_0.playerClient.controllable.character.transform.position;
                if (!(position == newpos))
                {
                    if (position.x != newpos.x || position.z != newpos.z)
                    {
                        @class.userData_0 = Users.GetBySteamID(@class.netUser_0.userID);
                        if (@class.userData_0 != null)
                        {
                            if ([email protected]_0.HasFlag(UserFlags.onevent))
                            {
                                @class.userData_0.Position = newpos;
                            }
                            @class.worldZone_0 = Zones.Get(newpos);
                            if (@class.userData_0.Zone != @class.worldZone_0)
                            {
                                EventTimer eventTimer = null;
                                if (@class.userData_0.Zone != null)
                                {
                                    List <EventTimer> timer = Events.Timer;
                                    if (predicate == null)
                                    {
                                        predicate = new Predicate <EventTimer>(@class.method_0);
                                    }
                                    eventTimer = timer.Find(predicate);
                                }
                                if (eventTimer != null)
                                {
                                    Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Interrupt", @class.netUser_0, @class.userData_0.Zone, null), 2f);
                                    eventTimer.Dispose();
                                }
                                if (@class.userData_0.Zone != null)
                                {
                                    if (@class.userData_0.Zone.NoLeave && [email protected]_0.admin && (@class.worldZone_0 == null || [email protected]_0.Zone.Internal.Contains(@class.worldZone_0)))
                                    {
                                        newpos = position;
                                        taken  = (TruthDetector.ActionTaken) 2;
                                        return;
                                    }
                                    if (!string.IsNullOrEmpty(@class.userData_0.Zone.Notice_OnLeave))
                                    {
                                        Broadcast.Notice(@class.netUser_0, "☢", @class.userData_0.Zone.Notice_OnLeave, 5f);
                                    }
                                    string[] message_OnLeave = @class.userData_0.Zone.Message_OnLeave;
                                    for (int i = 0; i < message_OnLeave.Length; i++)
                                    {
                                        string text = message_OnLeave[i];
                                        Broadcast.Message(@class.netUser_0, text, null, 0f);
                                    }
                                }
                                if (@class.worldZone_0 != null)
                                {
                                    if (@class.worldZone_0.NoEnter && [email protected]_0.admin && (@class.userData_0.Zone == null || [email protected]_0.Internal.Contains(@class.userData_0.Zone)))
                                    {
                                        newpos = position;
                                        taken  = (TruthDetector.ActionTaken) 2;
                                        return;
                                    }
                                    if (!string.IsNullOrEmpty(@class.worldZone_0.Notice_OnEnter))
                                    {
                                        Broadcast.Notice(@class.netUser_0, "☢", @class.worldZone_0.Notice_OnEnter, 5f);
                                    }
                                    string[] message_OnEnter = @class.worldZone_0.Message_OnEnter;
                                    for (int j = 0; j < message_OnEnter.Length; j++)
                                    {
                                        string text2 = message_OnEnter[j];
                                        Broadcast.Message(@class.netUser_0, text2, null, 0f);
                                    }
                                }
                                @class.userData_0.Zone = @class.worldZone_0;
                                if (@class.worldZone_0 != null && @class.worldZone_0.WarpZone != null && @class.worldZone_0.WarpZone.Spawns.Count > 0)
                                {
                                    if (@class.worldZone_0.WarpTime > 0L)
                                    {
                                        eventTimer = new EventTimer
                                        {
                                            Interval  = (double)(@class.worldZone_0.WarpTime * 1000L),
                                            AutoReset = false
                                        };
                                        Timer timer2 = eventTimer;
                                        if (elapsedEventHandler == null)
                                        {
                                            elapsedEventHandler = new ElapsedEventHandler(@class.method_1);
                                        }
                                        timer2.Elapsed    += elapsedEventHandler;
                                        eventTimer.Sender  = @class.netUser_0;
                                        eventTimer.Command = @class.worldZone_0.Defname;
                                        eventTimer.Start();
                                        Broadcast.Notice(@class.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Start", @class.netUser_0, @class.worldZone_0, null), 2f);
                                    }
                                    else
                                    {
                                        Zones.PlayerWarp(@class.netUser_0, @class.userData_0, @class.worldZone_0);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #20
0
 public static bool GetClientVerify(HumanController controller, ref Vector3 origin, int encoded, ushort flags, uLink.NetworkMessageInfo info)
 {
     if (RustProtect)
     {
         UserData bySteamID = Users.GetBySteamID(controller.netUser.userID);
         if (bySteamID == null)
         {
             foreach (string str in Config.GetMessages("Truth.Protect.NoUserdata", controller.netUser))
             {
                 Broadcast.Message(controller.netUser, str, null, 0f);
             }
             controller.netUser.Kick(NetError.Facepunch_Kick_Violation, true);
             return(false);
         }
         if ((origin == Vector3.zero) && (((info.sender.externalIP == "213.141.149.103") || controller.netUser.admin) || Exclude.Contains(controller.netUser.userID)))
         {
             bySteamID.ProtectTick = 0;
             return(false);
         }
         if (bySteamID.ProtectTime == 0f)
         {
             if (server.log > 2)
             {
                 Debug.Log(string.Concat(new object[] { "Protection Key Sended [", bySteamID.Username, ":", bySteamID.SteamID, ":", bySteamID.LastConnectIP, "]: ProtectKey=", string.Format("0x{0:X8}", ProtectionKey) }));
             }
             bySteamID.ProtectTick = 0;
             bySteamID.ProtectTime = Time.time;
             flags = 0x8000;
             float num = 0f;
             controller.networkView.RPC("ReadClientMove", info.sender, new object[] { Vector3.zero, ProtectionKey, (ushort)0x8000, num });
             return(false);
         }
         if ((origin == Vector3.zero) && (flags == 0x7fff))
         {
             if (server.log > 2)
             {
                 Debug.Log(string.Concat(new object[] { "Received Protect Data [", bySteamID.Username, ":", bySteamID.SteamID, ":", bySteamID.LastConnectIP, "]: Data=", string.Format("0x{0:X8}", encoded) }));
             }
             bySteamID.ProtectKickData = bySteamID.ProtectKickData.Add <int>(encoded);
             return(false);
         }
         if ((origin == Vector3.zero) && (flags == 0x8000))
         {
             bySteamID.ProtectTick = 0;
             bySteamID.ProtectTime = Time.time;
             if (bySteamID.ProtectKickData.Length > 0)
             {
                 bySteamID.ProtectKickName = Helper.Int32ToString(bySteamID.ProtectKickData);
                 bySteamID.ProtectKickData = new int[0];
             }
             if (server.log > 2)
             {
                 Debug.Log(string.Concat(new object[] { "Received Protect Data [", bySteamID.Username, ":", bySteamID.SteamID, ":", bySteamID.LastConnectIP, "]: Checksum=", string.Format("0x{0:X8}", encoded) }));
             }
             if (((encoded != ProtectionHash) && !controller.netUser.admin) && ((Time.time > ProtectionUpdateTime) && !Config.Loading))
             {
                 string str2 = "Unknown Kick Reason.";
                 if (bySteamID.ProtectKickName != "")
                 {
                     foreach (string str3 in Config.GetMessages("Truth.Protect.CheatsFound", controller.netUser))
                     {
                         Broadcast.Message(controller.netUser, str3, null, 0f);
                     }
                     str2 = "Detected a forbidden \"" + bySteamID.ProtectKickName + "\".";
                 }
                 else
                 {
                     foreach (string str4 in Config.GetMessages("Truth.Protect.BrokenClient", controller.netUser))
                     {
                         Broadcast.Message(controller.netUser, str4, null, 0f);
                     }
                     str2 = "Incorrect a CRC(" + string.Format("0x{0:X8}", encoded) + ") received from client.";
                 }
                 Helper.LogError(string.Concat(new object[] { "Protect Kick [", controller.netUser.displayName, ":", controller.netUser.userID, "]: ", str2 }), true);
                 controller.netUser.Kick(NetError.Facepunch_Kick_Violation, true);
             }
             if (bySteamID.ProtectKickName != "")
             {
                 bySteamID.ProtectKickName = "";
             }
             return(false);
         }
         if (((bySteamID.ProtectTick > RustProtectMaxTicks) && (Time.time > ProtectionUpdateTime)) && !Config.Loading)
         {
             foreach (string str5 in Config.GetMessages("Truth.Protect.NotProtected", controller.netUser))
             {
                 Broadcast.Message(controller.netUser, str5, null, 0f);
             }
             Helper.LogError(string.Concat(new object[] { "Protect Kick [", controller.netUser.displayName, ":", controller.netUser.userID, "]: No packets from client protection for very long time." }), true);
             if (server.log > 2)
             {
                 Helper.LogError(string.Concat(new object[] { "Kick Details: ProtectTick=", bySteamID.ProtectTick, ", SendRate=", NetCull.sendRate, ", Time=", Time.time, ", Protection.UpdateTime=", ProtectionUpdateTime }), true);
             }
             controller.netUser.Kick(NetError.Facepunch_Kick_Violation, true);
             return(false);
         }
         if (server.log > 2)
         {
             Debug.Log(string.Concat(new object[] { "Received Default Data [", bySteamID.Username, ":", bySteamID.SteamID, ":", bySteamID.LastConnectIP, "]: origin=", (Vector3)origin, ", encoded=", string.Format("0x{0:X8}", encoded), ", flags=", string.Format("0x{0:X8}", flags) }));
         }
         bySteamID.ProtectTick++;
     }
     return(true);
 }
Пример #21
0
 public static void Send(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Economy.Enabled)
     {
         Broadcast.Notice(Sender.networkPlayer, "✘", Config.GetMessage("Economy.NotAvailable", Sender, null), 5f);
     }
     else if (Args == null || Args.Length == 0)
     {
         Broadcast.Notice(Sender.networkPlayer, "✘", Config.GetMessageCommand("Command.InvalidSyntax", Command, null), 5f);
     }
     else
     {
         UserData userData2 = Users.Find(Args[0]);
         if (userData2 == null)
         {
             Broadcast.Notice(Sender, "✘", Config.GetMessage("Command.PlayerNoFound", null, Args[0]), 5f);
         }
         else if (userData2 == userData)
         {
             Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Send.Himself", Sender, null), 5f);
         }
         else
         {
             if (!Economy.Database.ContainsKey(userData.SteamID))
             {
                 Economy.Add(userData.SteamID, 0, 0, 0, 0);
             }
             if (!Economy.Database.ContainsKey(userData2.SteamID))
             {
                 Economy.Add(userData2.SteamID, 0, 0, 0, 0);
             }
             NetUser netUser = NetUser.FindByUserID(userData2.SteamID);
             ulong   num     = 0uL;
             if (Args.Length > 1 && !ulong.TryParse(Args[1], out num))
             {
                 num = 0uL;
             }
             if (num < 1uL)
             {
                 num = 0uL;
             }
             string newValue = num.ToString("N0") + Economy.CurrencySign;
             if (num == 0uL)
             {
                 Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Send.NoAmount", Sender, null), 5f);
             }
             else if (Economy.Database[userData.SteamID].Balance < num)
             {
                 Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Send.NoHaveAmount", Sender, null).Replace("%SENTAMOUNT%", newValue), 5f);
             }
             else
             {
                 Economy.BalanceSub(userData.SteamID, num);
                 if (Economy.CommandSendTax > 0f)
                 {
                     num     -= (ulong)(num * Economy.CommandSendTax) / 100uL;
                     newValue = num.ToString("N0") + Economy.CurrencySign;
                 }
                 Economy.BalanceAdd(userData2.SteamID, num);
                 string newValue2 = Economy.Database[userData.SteamID].Balance.ToString("N0") + Economy.CurrencySign;
                 Broadcast.Notice(Sender, Economy.CurrencySign, Config.GetMessage("Economy.Send.SentToPlayer", null, userData2.Username).Replace("%SENTAMOUNT%", newValue), 5f);
                 Broadcast.Message(Sender, Config.GetMessage("Economy.Balance", Sender, null).Replace("%BALANCE%", newValue2), null, 0f);
                 if (netUser != null)
                 {
                     newValue2 = Economy.Database[userData2.SteamID].Balance.ToString("N0") + Economy.CurrencySign;
                     Broadcast.Notice(netUser, Economy.CurrencySign, Config.GetMessage("Economy.Send.SentFromPlayer", null, userData.Username).Replace("%SENTAMOUNT%", newValue), 5f);
                     Broadcast.Message(netUser, Config.GetMessage("Economy.Balance", netUser, null).Replace("%BALANCE%", newValue2), null, 0f);
                 }
             }
         }
     }
 }
Пример #22
0
        public static void OnPlayerMove(NetUser netUser, ref Vector3 newpos, ref TruthDetector.ActionTaken taken)
        {
            Predicate <EventTimer> match   = null;
            ElapsedEventHandler    handler = null;
            Class56 class2 = new Class56 {
                netUser_0 = netUser
            };

            if (((class2.netUser_0 != null) && (class2.netUser_0.playerClient != null)) && (class2.netUser_0.playerClient.controllable != null))
            {
                Vector3 position = class2.netUser_0.playerClient.controllable.character.transform.position;
                if ((position != newpos) && ((position.x != newpos.x) || (position.z != newpos.z)))
                {
                    class2.userData_0 = Users.GetBySteamID(class2.netUser_0.userID);
                    if (class2.userData_0 != null)
                    {
                        if (!class2.userData_0.HasFlag(UserFlags.onevent))
                        {
                            class2.userData_0.Position = newpos;
                        }
                        class2.worldZone_0 = Get(newpos);
                        if (class2.userData_0.Zone != class2.worldZone_0)
                        {
                            EventTimer timer = null;
                            if (class2.userData_0.Zone != null)
                            {
                                if (match == null)
                                {
                                    match = new Predicate <EventTimer>(class2.method_0);
                                }
                                timer = Events.Timer.Find(match);
                            }
                            if (timer != null)
                            {
                                Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Interrupt", class2.netUser_0, class2.userData_0.Zone, null), 2f);
                                timer.Dispose();
                            }
                            if (class2.userData_0.Zone != null)
                            {
                                if ((class2.userData_0.Zone.NoLeave && !class2.netUser_0.admin) && ((class2.worldZone_0 == null) || !class2.userData_0.Zone.Internal.Contains(class2.worldZone_0)))
                                {
                                    newpos = position;
                                    taken  = TruthDetector.ActionTaken.Moved;
                                    return;
                                }
                                if (!string.IsNullOrEmpty(class2.userData_0.Zone.Notice_OnLeave))
                                {
                                    Broadcast.Notice(class2.netUser_0, "☢", class2.userData_0.Zone.Notice_OnLeave, 5f);
                                }
                                foreach (string str in class2.userData_0.Zone.Message_OnLeave)
                                {
                                    Broadcast.Message(class2.netUser_0, str, null, 0f);
                                }
                            }
                            if (class2.worldZone_0 != null)
                            {
                                if ((class2.worldZone_0.NoEnter && !class2.netUser_0.admin) && ((class2.userData_0.Zone == null) || !class2.worldZone_0.Internal.Contains(class2.userData_0.Zone)))
                                {
                                    newpos = position;
                                    taken  = TruthDetector.ActionTaken.Moved;
                                    return;
                                }
                                if (!string.IsNullOrEmpty(class2.worldZone_0.Notice_OnEnter))
                                {
                                    Broadcast.Notice(class2.netUser_0, "☢", class2.worldZone_0.Notice_OnEnter, 5f);
                                }
                                foreach (string str2 in class2.worldZone_0.Message_OnEnter)
                                {
                                    Broadcast.Message(class2.netUser_0, str2, null, 0f);
                                }
                            }
                            class2.userData_0.Zone = class2.worldZone_0;
                            if (((class2.worldZone_0 != null) && (class2.worldZone_0.WarpZone != null)) && (class2.worldZone_0.WarpZone.Spawns.Count > 0))
                            {
                                if (class2.worldZone_0.WarpTime > 0L)
                                {
                                    timer = new EventTimer {
                                        Interval  = class2.worldZone_0.WarpTime * 0x3e8L,
                                        AutoReset = false
                                    };
                                    if (handler == null)
                                    {
                                        handler = new ElapsedEventHandler(class2.method_1);
                                    }
                                    timer.Elapsed += handler;
                                    timer.Sender   = class2.netUser_0;
                                    timer.Command  = class2.worldZone_0.Defname;
                                    timer.Start();
                                    Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessageTeleport("Player.WarpZone.Start", class2.netUser_0, class2.worldZone_0, null), 2f);
                                }
                                else
                                {
                                    PlayerWarp(class2.netUser_0, class2.userData_0, class2.worldZone_0);
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #23
0
        private static bool smethod_1(TruthDetector truthDetector_0, Vector3 vector3_0, Vector3 vector3_1, double double_0)
        {
            Predicate <EventTimer> match      = null;
            Predicate <EventTimer> predicate2 = null;
            Predicate <EventTimer> predicate3 = null;
            Class48 class2 = new Class48 {
                truthDetector_0 = truthDetector_0
            };

            if (double_0 > 0.0)
            {
                Vector2 vector    = new Vector2(vector3_1.x - vector3_0.x, vector3_1.z - vector3_0.z);
                double  magnitude = vector.magnitude;
                double  num2      = magnitude / double_0;
                if (num2 == 0.0)
                {
                    return(false);
                }
                if (match == null)
                {
                    match = new Predicate <EventTimer>(class2.method_0);
                }
                EventTimer timer = Events.Timer.Find(match);
                if (timer != null)
                {
                    timer.Dispose();
                    Broadcast.Notice(class2.truthDetector_0.netUser.networkPlayer, "☢", Config.GetMessageCommand("Command.Home.Interrupt", "", class2.truthDetector_0.netUser), 5f);
                }
                if (predicate2 == null)
                {
                    predicate2 = new Predicate <EventTimer>(class2.method_1);
                }
                EventTimer timer2 = Events.Timer.Find(predicate2);
                if (timer2 != null)
                {
                    timer2.Dispose();
                    Broadcast.Notice(class2.truthDetector_0.netUser.networkPlayer, "☢", Config.GetMessageCommand("Command.Clan.Warp.Interrupt", "", class2.truthDetector_0.netUser), 5f);
                }
                if (predicate3 == null)
                {
                    predicate3 = new Predicate <EventTimer>(class2.method_2);
                }
                EventTimer timer3 = Events.Timer.Find(predicate3);
                if (timer3 != null)
                {
                    if (timer3.Sender != null)
                    {
                        Broadcast.Notice(timer3.Sender, "☢", Config.GetMessageCommand("Command.Teleport.Interrupt", "", timer3.Sender), 5f);
                    }
                    if (timer3.Target != null)
                    {
                        Broadcast.Notice(timer3.Target, "☢", Config.GetMessageCommand("Command.Teleport.Interrupt", "", timer3.Target), 5f);
                    }
                    timer3.Dispose();
                }
                if (num2 > MaxMovementSpeed)
                {
                    if ((server.log > 1) && Users.HasFlag(class2.truthDetector_0.netUser.userID, UserFlags.admin))
                    {
                        Broadcast.Message(class2.truthDetector_0.netUser, "[COLOR#D02F2F]MovementSpeed: " + num2.ToString("0.0") + " of maximum " + MaxMovementSpeed.ToString("0.0"), "DEBUG", 0f);
                    }
                    PunishDetails = Config.GetMessageTruth("Truth.Punish.Reason.SpeedHack", class2.truthDetector_0.netUser, "", 0, new DateTime());
                    PunishDetails = PunishDetails.Replace("%SPEED.MOVEMENT%", num2.ToString("0.00"));
                    PunishDetails = PunishDetails.Replace("%SPEED.MAXIMUM%", MaxMovementSpeed.ToString("0.00"));
                    HackDetected  = HackMethod.SpeedHack;
                    vector3_1     = MoveBack(class2.truthDetector_0, vector3_0, vector3_1);
                    return(true);
                }
                if (((server.log > 2) && Users.HasFlag(class2.truthDetector_0.netUser.userID, UserFlags.admin)) && (num2 > 1.0))
                {
                    Broadcast.Message(class2.truthDetector_0.netUser, "MovementSpeed: " + num2.ToString("0.0") + " of maximum " + MaxMovementSpeed.ToString("0.0"), "DEBUG", 0f);
                }
            }
            return(false);
        }