示例#1
0
 public static void BalanceSub(ulong steam_id, ulong amount)
 {
     if (!Economy.Database.ContainsKey(steam_id))
     {
         Economy.Add(steam_id, 0, 0, 0, 0);
     }
     if (Economy.Database[steam_id].Balance <= amount)
     {
         amount = 0uL;
     }
     else
     {
         amount = Economy.Database[steam_id].Balance - amount;
     }
     Economy.Database[steam_id].Balance = amount;
     Economy.SQL_Update(steam_id);
 }
示例#2
0
        public static void BalanceAdd(ulong steam_id, ulong amount)
        {
            if (!Economy.Database.ContainsKey(steam_id))
            {
                Economy.Add(steam_id, 0, 0, 0, 0);
            }
            ulong num = Economy.Database[steam_id].Balance;

            if (num + amount < num)
            {
                num = 18446744073709551615uL;
            }
            else
            {
                num += amount;
            }
            Economy.Database[steam_id].Balance = num;
            Economy.SQL_Update(steam_id);
        }
示例#3
0
 public static void ShopSell(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Shop.Enabled || !Shop.CanSell)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.Sell.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 if (Args == null || Args.Length == 0)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessageCommand("Command.InvalidSyntax", Command, null), 5f);
     }
     else
     {
         int       item_index = 0;
         Inventory component  = Sender.playerClient.controllable.GetComponent <Inventory>();
         if (!Args[0].Equals("ALL", StringComparison.OrdinalIgnoreCase))
         {
             ShopItem shopItem;
             if (int.TryParse(Args[0], out item_index))
             {
                 shopItem = Shop.FindItem(item_index);
             }
             else
             {
                 shopItem = Shop.FindItem(Args[0]);
             }
             if (shopItem != null)
             {
                 if (shopItem.BuyPrice != -1)
                 {
                     int num  = shopItem.BuyPrice / shopItem.Quantity;
                     int num2 = shopItem.Quantity;
                     if (Args.Length > 1 && !int.TryParse(Args[1], out num2))
                     {
                         num2 = shopItem.Quantity;
                     }
                     if (num2 < 1)
                     {
                         num2 = shopItem.Quantity;
                     }
                     int num3 = Helper.InventoryItemCount(component, shopItem.itemData);
                     if (num3 == 0)
                     {
                         Broadcast.Notice(Sender, Economy.CurrencySign, Config.GetMessage("Economy.Shop.Sell.NotEnoughItem", Sender, null).Replace("%ITEMNAME%", shopItem.Name), 5f);
                         return;
                     }
                     if (num2 > num3)
                     {
                         num2 = num3;
                     }
                     num3 = Helper.InventoryItemRemove(component, shopItem.itemData, num2);
                     string text = "\"" + shopItem.Name + "\"";
                     if (num3 > 1)
                     {
                         text = num3.ToString() + " " + text;
                     }
                     ulong amount = (ulong)((long)(num3 * num));
                     Economy.BalanceAdd(Sender.userID, amount);
                     string text2 = Config.GetMessage("Economy.Shop.Sell.ItemSold", Sender, null);
                     text2 = text2.Replace("%TOTALPRICE%", amount.ToString("N0") + Economy.CurrencySign);
                     text2 = text2.Replace("%ITEMNAME%", text);
                     Broadcast.Notice(Sender, Economy.CurrencySign, text2, 5f);
                     Economy.Balance(Sender, userData, "balance", null);
                     return;
                 }
             }
             string newValue = (shopItem != null) ? shopItem.Name : Args[0];
             Broadcast.Notice(Sender, Economy.CurrencySign, Config.GetMessage("Economy.Shop.Sell.ItemNotAvailable", Sender, null).Replace("%ITEMNAME%", newValue), 5f);
         }
         else
         {
             ulong num4 = 0uL;
             List <IInventoryItem>      list             = new List <IInventoryItem>();
             Inventory.OccupiedIterator occupiedIterator = component.occupiedIterator;
             while (occupiedIterator.Next())
             {
                 ShopItem shopItem = Shop.FindItem(occupiedIterator.item.datablock.name);
                 if (shopItem != null && shopItem.BuyPrice != -1)
                 {
                     int   num5 = occupiedIterator.item.datablock._splittable ? occupiedIterator.item.uses : 1;
                     ulong num6 = (ulong)((long)(shopItem.BuyPrice / shopItem.Quantity) * (long)num5);
                     num4 += num6;
                     list.Add(occupiedIterator.item);
                 }
             }
             if (list.Count > 0)
             {
                 foreach (IInventoryItem current in list)
                 {
                     component.RemoveItem(current);
                 }
                 if (num4 > 0uL)
                 {
                     Economy.BalanceAdd(Sender.userID, num4);
                 }
                 string text3 = Config.GetMessage("Economy.Shop.Sell.AllSold", Sender, null);
                 text3 = text3.Replace("%TOTALPRICE%", num4.ToString("N0") + Economy.CurrencySign);
                 text3 = text3.Replace("%TOTALAMOUNT%", list.Count.ToString());
                 Broadcast.Notice(Sender, Economy.CurrencySign, text3, 5f);
             }
             else
             {
                 Broadcast.Notice(Sender, Economy.CurrencySign, Config.GetMessage("Economy.Shop.Sell.NoNothing", Sender, null), 5f);
             }
         }
     }
 }
示例#4
0
 public static void ShopBuy(NetUser Sender, UserData userData, string Command, string[] Args)
 {
     if (!Shop.Enabled || !Shop.CanBuy)
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.Buy.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 if (Args != null && Args.Length != 0)
     {
         int      item_index = 0;
         ShopItem shopItem;
         if (int.TryParse(Args[0], out item_index))
         {
             shopItem = Shop.FindItem(item_index);
         }
         else
         {
             shopItem = Shop.FindItem(Args[0]);
         }
         if (shopItem != null)
         {
             if (shopItem.SellPrice != -1)
             {
                 Inventory component = Sender.playerClient.controllable.GetComponent <Inventory>();
                 if (component == null || component.noVacantSlots)
                 {
                     Broadcast.Notice(Sender, "✘", Config.GetMessage("Player.Inventory.IsFull", Sender, null), 5f);
                     return;
                 }
                 int num  = shopItem.SellPrice / shopItem.Quantity;
                 int num2 = shopItem.Quantity;
                 if (Args.Length > 1 && !int.TryParse(Args[1], out num2))
                 {
                     num2 = shopItem.Quantity;
                 }
                 if (num2 < 1)
                 {
                     num2 = shopItem.Quantity;
                 }
                 ulong num3 = (ulong)((long)(num * num2));
                 if (num3 > Economy.GetBalance(Sender.userID))
                 {
                     string text = Config.GetMessage("Economy.Shop.Buy.NotEnoughBalance", Sender, null);
                     text = text.Replace("%TOTALPRICE%", num3.ToString("N0") + Economy.CurrencySign);
                     text = text.Replace("%ITEMNAME%", shopItem.Name);
                     Broadcast.Notice(Sender, Economy.CurrencySign, text, 5f);
                     return;
                 }
                 num2 = Helper.GiveItem(Sender.playerClient, shopItem.itemData, num2, shopItem.Slots);
                 if (num2 == 0)
                 {
                     Broadcast.Notice(Sender, "✘", Config.GetMessage("Player.Inventory.IsFull", Sender, null), 5f);
                     return;
                 }
                 string text2 = "\"" + shopItem.itemData.name + "\"";
                 if (num2 > 1)
                 {
                     text2 = num2.ToString() + " " + text2;
                 }
                 num3 = (ulong)((long)(num2 * num));
                 Economy.BalanceSub(Sender.userID, num3);
                 string text3 = Config.GetMessage("Economy.Shop.Buy.ItemPurchased", Sender, null);
                 text3 = text3.Replace("%TOTALPRICE%", num3.ToString("N0") + Economy.CurrencySign);
                 text3 = text3.Replace("%ITEMNAME%", text2);
                 Broadcast.Notice(Sender, Economy.CurrencySign, text3, 5f);
                 Economy.Balance(Sender, userData, "balance", null);
                 return;
             }
         }
         string newValue = (shopItem != null) ? shopItem.Name : Args[0];
         Broadcast.Notice(Sender, "✘", Config.GetMessage("Economy.Shop.Buy.ItemNotAvailable", Sender, null).Replace("%ITEMNAME%", newValue), 5f);
     }
     else
     {
         Broadcast.Notice(Sender, "✘", Config.GetMessageCommand("Command.InvalidSyntax", Command, null), 5f);
     }
 }
示例#5
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);
                 }
             }
         }
     }
 }
示例#6
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);
                 }
             }
         }
     }
 }
示例#7
0
        public static bool RunCommand(NetUser netUser, UserData userData, string Command, string[] Args)
        {
            bool result;

            if (Command != null)
            {
                if (Economy.asad == null)
                {
                    Economy.asad = new Dictionary <string, int>(6)
                    {
                        {
                            "balance",
                            0
                        },
                        {
                            "money",
                            1
                        },
                        {
                            "send",
                            2
                        },
                        {
                            "shop",
                            3
                        },
                        {
                            "buy",
                            4
                        },
                        {
                            "sell",
                            5
                        }
                    };
                }
                int num;
                if (Economy.asad.TryGetValue(Command, out num))
                {
                    switch (num)
                    {
                    case 0:
                        Economy.Balance(netUser, userData, Command, Args);
                        break;

                    case 1:
                        Economy.Balance(netUser, userData, Command, Args);
                        break;

                    case 2:
                        Economy.Send(netUser, userData, Command, Args);
                        break;

                    case 3:
                        Economy.ShopList(netUser, userData, Command, Args);
                        break;

                    case 4:
                        Economy.ShopBuy(netUser, userData, Command, Args);
                        break;

                    case 5:
                        Economy.ShopSell(netUser, userData, Command, Args);
                        break;

                    default:
                        result = false;
                        return(result);
                    }
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }
示例#8
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);
                }
            }
        }
示例#9
0
        public static bool Initialize()
        {
            Initialized = AssemblyVerifed;
            if (!Initialized)
            {
                return(false);
            }
            Helper.Log("RustExtended Initialization", true);
            World.Initialize();
            Zones.Initialize();
            Economy.Initialize();
            Helper.Log("RustExtended Economy " + (Economy.Enabled ? "Enabled" : "Disabled") + ".", true);
            Helper.Log("RustExtended Shopping " + (Shop.Enabled ? "Enabled" : "Disabled") + ".", true);
            Users.Initialize();
            Banned.Initialize();
            Clans.Initialize();
            Blocklist.Initialize();
            LoadoutInitialized = InitializeLoadout();
            if (Config.Initialized)
            {
                Helper.Log("  - " + PremiumConnections + " Allocated Premium Connection(s)", true);
                Helper.Log("  - " + Commands.Count + " Total Command(s)", true);
                Helper.Log("  - " + Ranks.Count + " Total Rank(s)", true);
                Helper.Log("  - " + Kits.Count + " Total Kit(s)", true);
                Helper.Log("  - " + ForbiddenUsername.Count + " Total Forbidden Name(s)", true);
                Helper.Log("  - " + ForbiddenObscene.Count + " Total Obscene(s)", true);
                Helper.Log("  - " + Events.Motd.Count + " Total Message Event(s)", true);
                Helper.Log("  - " + Clans.Levels.Count + " Total Clan Level(s)", true);
            }
            if (LoadoutInitialized)
            {
                Helper.Log("  - " + Loadout.Count + " Loadout", true);
            }
            if (Zones.Initialized)
            {
                Helper.Log("  - " + Zones.Count + " Total Zone(s)", true);
            }
            if (Users.Initialized)
            {
                Helper.Log("  - " + Users.Count + " Total User(s)", true);
            }
            if (Banned.Initialized)
            {
                Helper.Log("  - " + Banned.Count + " Banned User(s)", true);
            }
            if (Clans.Initialized)
            {
                Helper.Log("  - " + Clans.Count + " Total Clan(s)", true);
            }
            if (Economy.Enabled && Shop.Initialized)
            {
                Helper.Log("  - " + Shop.GroupCount + " Total Shop Group(s)", true);
                Helper.Log("  - " + Shop.ItemCount + " Total Shop Item(s)", true);
            }
            if (Blocklist.Initialized)
            {
                Helper.Log("  - " + Blocklist.Count + " Total Blocked IP", true);
            }
            if (Override.LootsFileCreated)
            {
                Helper.Log(" Loots file has been created.", true);
            }
            else if (OverrideLoots && Override.LootsInitialized)
            {
                Helper.Log("  - " + Override.LootsCount + " Overridden Loot(s)", true);
            }
            if (Override.ItemsFileCreated)
            {
                Helper.Log(" Items file has been created.", true);
            }
            else if (OverrideItems && Override.ItemsInitialized)
            {
                Helper.Log("  - " + Override.ItemsCount + " Overridden Item(s)", true);
            }
            Events.Initialize();
            GenericSpawners = UnityEngine.Object.FindObjectsOfType <GenericSpawner>();
            for (int i = 0; i < GenericSpawners.Length; i++)
            {
                int num2 = 0;
                switch (i)
                {
                case 0x2b:
                    GenericSpawners[i].transform.position = new Vector3(6019f, 428.8f, -2296.3f);
                    break;

                case 0x2c:
                    GenericSpawners[i].transform.position = new Vector3(5819f, 428.8f, -1896.3f);
                    break;
                }
                foreach (GenericSpawnerSpawnList.GenericSpawnInstance instance in GenericSpawners[i]._spawnList)
                {
                    GenericSpawnsTotal += instance.targetPopulation;
                    num2 += instance.targetPopulation;
                }
                Helper.Log(string.Format("[GenericSpawner #{0}] Position={1}, Radius={2}, Spawns={3}({4}), Think Delay={5}", new object[] { i, GenericSpawners[i].transform.position.AsString(), GenericSpawners[i].radius, GenericSpawners[i]._spawnList.Count, num2, GenericSpawners[i].thinkDelay }), false);
            }
            return(Initialized);
        }
示例#10
0
        public static bool Initialize()
        {
            Core.Initialized = Core.AssemblyVerifed;
            bool result;

            if (!Core.Initialized)
            {
                result = false;
            }
            else
            {
                Helper.Log("RustExtended Initialization", true);
                World.Initialize();
                Zones.Initialize();
                Economy.Initialize();
                Users.Initialize();
                Banned.Initialize();
                Clans.Initialize();
                Blocklist.Initialize();
                Core.LoadoutInitialized = Core.InitializeLoadout();
                if (Spawns.Singleton != null)
                {
                    Spawns.Singleton.Initialize();
                }
                if (Config.Initialized)
                {
                    Helper.Log("  - " + Core.PremiumConnections + " Allocated Premium Connection(s)", true);
                    Helper.Log("  - " + Core.Commands.Count + " Total Command(s)", true);
                    Helper.Log("  - " + Core.Ranks.Count + " Total Rank(s)", true);
                    Helper.Log("  - " + Core.Kits.Count + " Total Kit(s)", true);
                    Helper.Log("  - " + Core.ForbiddenUsername.Count + " Total Forbidden Name(s)", true);
                    Helper.Log("  - " + Core.ForbiddenObscene.Count + " Total Obscene(s)", true);
                    Helper.Log("  - " + Events.Motd.Count + " Total Message Event(s)", true);
                    Helper.Log("  - " + Clans.Levels.Count + " Total Clan Level(s)", true);
                }
                if (Core.LoadoutInitialized)
                {
                }
                if (Zones.Initialized)
                {
                }
                if (Users.Initialized)
                {
                }
                if (Banned.Initialized)
                {
                }
                if (Clans.Initialized)
                {
                }
                if (Economy.Enabled && Shop.Initialized)
                {
                    Helper.Log("  - " + Shop.GroupCount + " Total Shop Group(s)", true);
                    Helper.Log("  - " + Shop.ItemCount + " Total Shop Item(s)", true);
                }
                if (Blocklist.Initialized)
                {
                    Helper.Log("  - " + Blocklist.Count + " Total Blocked IP", true);
                }
                if (!Override.LootsFileCreated)
                {
                    if (Core.OverrideLoots && Override.LootsInitialized)
                    {
                    }
                }
                if (!Override.ItemsFileCreated)
                {
                    if (Core.OverrideItems && Override.ItemsInitialized)
                    {
                    }
                }
                if (Spawns.Initialized)
                {
                    Helper.Log("  - " + Spawns.TotalGeneric + " Generic Spawner(s)", true);
                    Helper.Log("  - " + Spawns.TotalLootable + " Lootable Spawner(s)", true);
                }
                Events.Initialize();
                result = Core.Initialized;
            }
            return(result);
        }