Пример #1
0
        private void rpe_OnUpdateStat(UnturnedPlayer player, EPlayerStat stat)
        {
            if (player == null)
            {
                return;
            }
            Uconomy u = Uconomy.Instance;

            if (Uconomy_Essentials.Instance.Configuration.Instance.PayZombie && stat == EPlayerStat.KILLS_ZOMBIES_NORMAL)
            {
                decimal balzk = u.Database.IncreaseBalance(player.CSteamID.ToString(), (decimal)Uconomy_Essentials.Instance.Configuration.Instance.PayZombieAmt);
                Uconomy_Essentials.HandleEvent(player, (decimal)Uconomy_Essentials.Instance.Configuration.Instance.PayZombieAmt, "paid");
                if (!Uconomy_Essentials.Instance.Configuration.Instance.SendPayZombieMsg)
                {
                    return;                                                                       // No message is to be sent, so job is done.
                }
                UnturnedChat.Say(player.CSteamID, Uconomy_Essentials.Instance.Translate("zombie_kill_paid_msg", new object[] { Uconomy_Essentials.Instance.Configuration.Instance.PayZombieAmt.ToString(), u.Configuration.Instance.MoneyName, balzk.ToString(), u.Configuration.Instance.MoneyName }));
            }
            else if (Uconomy_Essentials.Instance.Configuration.Instance.PayMegaZombie && stat == EPlayerStat.KILLS_ZOMBIES_MEGA)
            {
                decimal balzk = u.Database.IncreaseBalance(player.CSteamID.ToString(), (decimal)Uconomy_Essentials.Instance.Configuration.Instance.PayMegaZombieAmt);
                Uconomy_Essentials.HandleEvent(player, (decimal)Uconomy_Essentials.Instance.Configuration.Instance.PayMegaZombieAmt, "paid");
                if (!Uconomy_Essentials.Instance.Configuration.Instance.SendPayMegaZombieMsg)
                {
                    return;                                                                           // No message is to be sent, so job is done.
                }
                UnturnedChat.Say(player.CSteamID, Uconomy_Essentials.Instance.Translate("mega_zombie_kill_paid_msg", new object[] { Uconomy_Essentials.Instance.Configuration.Instance.PayMegaZombieAmt.ToString(), u.Configuration.Instance.MoneyName, balzk.ToString(), u.Configuration.Instance.MoneyName }));
            }
        }
Пример #2
0
        private void IR_ItemAdded(UnturnedPlayer player, InventoryGroup inventoryGroup, byte inventoryIndex, ItemJar P)
        {
            if ((!player.IsAdmin ? true : !Configuration.Instance.IRIgnoreAdmin))
            {
                foreach (UItem item in Configuration.Instance.Items)
                {
                    if (item.ID == P.item.id)
                    {
                        ExecuteDependencyCode("Uconomy", (IRocketPlugin plugin) =>
                        {
                            Uconomy Uconomy = (Uconomy)plugin;
                            Uconomy.Database.IncreaseBalance(player.CSteamID.ToString(), item.Money.Value);
                        });

                        while (true)
                        {
                            if (!RemoveItem(player, P.item.id))
                            {
                                break;
                            }
                        }
                        UnturnedChat.Say(player, Translate("item_notPermitted", UnturnedItems.GetItemAssetById(item.ID).itemName, item.Money.Value), UnturnedChat.GetColorFromName(Configuration.Instance.ItemRemoveColor, UnityEngine.Color.red));
                    }
                }
            }
        }
Пример #3
0
        private void AutoQuestion()
        {
            Automation = this;
            if (Configuration.Instance.MathQuestionsEnabled)
            {
                try
                {
                    if (State == PluginState.Loaded && Configuration.Instance.Interval != 0 && (timer == null || ((DateTime.Now - timer.Value).TotalMinutes > Configuration.Instance.Interval)))
                    {
                        number1 = autonumber.Next(8, 85);
                        number2 = autonumber.Next(10, 97);

                        if (Configuration.Instance.Addition && !Configuration.Instance.Subtraction)
                        {
                            operation = "+"; result = number1 + number2;
                        }
                        if (!Configuration.Instance.Addition && Configuration.Instance.Subtraction)
                        {
                            operation = "-"; result = number1 - number2;
                        }

                        if (Configuration.Instance.Addition == Configuration.Instance.Subtraction)
                        {
                            autoperation = autonumber.Next(1, 3);
                            switch (autoperation)
                            {
                            case 1: operation = "+"; result = number1 + number2; break;

                            case 2: operation = "-"; result = number1 - number2; break;
                            }
                        }

                        MathQuestions.ExecuteDependencyCode("Uconomy", (IRocketPlugin plugin) =>
                        {
                            Uconomy Uconomy  = (Uconomy)plugin;
                            string broadcast = Translate("mathquestions_broadcast_question", number1.ToString(), number2.ToString(), operation, Configuration.Instance.Reward.ToString(), Uconomy.Configuration.Instance.MoneyName);
                            UnturnedChat.Say(broadcast, UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, UnityEngine.Color.yellow));
                        });
                        timer      = DateTime.Now;
                        NoQuestion = false;
                    }
                }
                catch (Exception old)
                {
                    Rocket.Core.Logging.Logger.LogException(old);
                }
            }
            else
            {
                Automation = null;
            }
        }
Пример #4
0
        public void ExecuteCommandCevap(IRocketPlayer caller, string[] answer)
        {
            try {
                UnturnedPlayer player = (UnturnedPlayer)caller;
                if (NoQuestion)
                {
                    string noquestion = Translate("mathquestions_no_question");
                    UnturnedChat.Say(caller, noquestion, UnturnedChat.GetColorFromName(Configuration.Instance.UnfavorableMessageColor, UnityEngine.Color.red));
                }
                else
                {
                    if (answer.Length >= 1)
                    {
                        if (answer[0] == result.ToString() && !NoQuestion)
                        {
                            NoQuestion = true;
                            MathQuestions.ExecuteDependencyCode("Uconomy", (IRocketPlugin plugin) =>
                            {
                                Uconomy Uconomy = (Uconomy)plugin;
                                Uconomy.Database.IncreaseBalance(player.CSteamID.ToString(), Configuration.Instance.Reward);
                                {
                                    string rightanswer = Translate("mathquestions_true_answer", Configuration.Instance.Reward.ToString(), Uconomy.Configuration.Instance.MoneyName, Uconomy.Database.GetBalance(player.CSteamID.ToString()));
                                    UnturnedChat.Say(player, rightanswer, UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, UnityEngine.Color.yellow));

                                    string winner = Translate("mathquestions_broadcast_winner", caller.DisplayName, result.ToString(), Configuration.Instance.Reward.ToString(), Uconomy.Configuration.Instance.MoneyName);
                                    UnturnedChat.Say(winner, UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, UnityEngine.Color.yellow));
                                }
                            });
                        }
                        if (answer[0] != result.ToString() && !NoQuestion)
                        {
                            UnturnedChat.Say(caller, Translate("mathquestions_wrong_answer"), UnturnedChat.GetColorFromName(Configuration.Instance.UnfavorableMessageColor, UnityEngine.Color.red));
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(caller, Translate("mathquestions_invalid_parameter"), UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, UnityEngine.Color.yellow));
                    }
                }
            }
        }
        private void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer)


        {
            murderer3 = UnturnedPlayer.FromCSteamID(murderer);
            string Part = "???";
            int    num  = Provider.clients.Count;

            if (Instance.Configuration.Instance.Groups != null && Instance.Configuration.Instance.Groups.Count > 0)
            {
                foreach (SteamPlayer current in Provider.clients)
                {
                    if (CheckDeathMessage(current.playerID.steamID))
                    {
                        num--;
                    }
                }
            }


            {
                if (cause.ToString() == "ZOMBIE")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.zombie + " ", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                }
                else if (cause.ToString() == "GUN")
                {
                    if (limb == ELimb.SKULL)
                    {
                        UnturnedChat.Say(player.CharacterName + ", " + Configuration.Instance.headshotgun + ", " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString() + " " + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Head + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a Headshot!", Color.green);
                        }
                    }
                    else if (limb == ELimb.SPINE)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.gun + ", " + player.CharacterName + ", " + Configuration.Instance.usinga + " " + UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString() + " " + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Body + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a body shot!", Color.green);
                        }
                    }
                    else if (limb == ELimb.RIGHT_ARM || limb == ELimb.LEFT_ARM || limb == ELimb.LEFT_HAND || limb == ELimb.RIGHT_HAND)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.gun + ", " + player.CharacterName + ", " + Configuration.Instance.usinga + " " + UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString() + " " + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Arm + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting an arm shot!", Color.green);
                        }
                    }
                    else if (limb == ELimb.RIGHT_LEG || limb == ELimb.LEFT_LEG || limb == ELimb.LEFT_FOOT || limb == ELimb.RIGHT_FOOT)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.gun + ", " + player.CharacterName + ", " + Configuration.Instance.usinga + " " + UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString() + " " + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Leg + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a leg shot!", Color.green);
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.gun + ", " + player.CharacterName + ", " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString() + " " + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    }
                }
                else if (cause.ToString() == "MELEE")
                {
                    if (limb == ELimb.SKULL)
                    {
                        UnturnedChat.Say(player.CharacterName + ", " + Configuration.Instance.headchop + ", " + UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString() + " " + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Head + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a head chop!", Color.yellow);
                        }
                    }
                    else if (limb == ELimb.SPINE)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.melee + ", " + player.CharacterName + ", " + Configuration.Instance.melee2 + " " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString(), UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Body + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a body kill!", Color.green);
                        }
                    }
                    else if (limb == ELimb.RIGHT_ARM || limb == ELimb.LEFT_ARM || limb == ELimb.LEFT_HAND || limb == ELimb.RIGHT_HAND)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.melee + ", " + player.CharacterName + ", " + Configuration.Instance.melee2 + " " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString(), UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Arm + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting an arm kill!", Color.green);
                        }
                    }
                    else if (limb == ELimb.RIGHT_LEG || limb == ELimb.LEFT_LEG || limb == ELimb.LEFT_FOOT || limb == ELimb.RIGHT_FOOT)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.melee + ", " + player.CharacterName + ", " + Configuration.Instance.melee2 + " " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString(), UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Leg + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a leg kill!", Color.green);
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.melee + ", " + player.CharacterName + ", " + Configuration.Instance.melee2 + " " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).Player.equipment.asset.itemName.ToString(), UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    }
                }
                else if (cause.ToString() == "PUNCH")
                {
                    if (limb == ELimb.SKULL)
                    {
                        UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.headpunch + ", " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Head + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a head punch kill!", Color.green);
                        }
                    }
                    else if (limb == ELimb.SPINE)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.punch + " " + player.CharacterName + ", " + Configuration.Instance.punch2, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Body + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a body punch kill!", Color.green);
                        }
                    }
                    else if (limb == ELimb.RIGHT_ARM || limb == ELimb.LEFT_ARM || limb == ELimb.LEFT_HAND || limb == ELimb.RIGHT_HAND)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.punch + " " + player.CharacterName + ", " + Configuration.Instance.punch2, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Arm + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting an arm punch kill!", Color.green);
                        }
                    }
                    else if (limb == ELimb.RIGHT_LEG || limb == ELimb.LEFT_LEG || limb == ELimb.LEFT_FOOT || limb == ELimb.RIGHT_FOOT)
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.punch + " " + player.CharacterName + ", " + Configuration.Instance.punch2, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                        if (Configuration.Instance.UconomyEnabled)
                        {
                            UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Leg + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for getting a leg punch kill!", Color.green);
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.punch + " " + player.CharacterName + ", " + Configuration.Instance.punch2, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    }
                }
                else if (cause.ToString() == "SHRED")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.shred, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "ROADKILL")
                {
                    UnturnedChat.Say(UnturnedPlayer.FromCSteamID(murderer).CharacterName + ", " + "HP:" + " " + UnturnedPlayer.FromCSteamID(murderer).Health.ToString() + "%" + ", " + Configuration.Instance.roadkill + " " + player.CharacterName + ", " + Configuration.Instance.usinga + " " + Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer).CurrentVehicle.asset.vehicleName.ToString() + "!", UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        UnturnedChat.Say(murderer, "You recieved" + " " + Configuration.Instance.Roadkill + " " + Uconomy.Instance.Configuration.Instance.MoneyName + " " + "for Roadkill!", Color.yellow);
                    }
                }
                else if (cause.ToString() == "SPARK")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.spark, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "VEHICLE")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.vehicle, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "FOOD")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.food, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "WATER")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.water, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "INFECTION")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.infection, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "BLEEDING")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.bleeding, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "LANDMINE")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.landmine, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "BREATH")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.breath, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "GRENADE")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.grenade, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "FREEZING")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.freezing, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "SENTRY")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.sentry, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "CHARGE")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.charge, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "MISSILE")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.missile, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "BONES")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.bones, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "SPLASH")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.splash, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "ACID")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.acid, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "SPIT")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.spit, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "BURNING")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.fire, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "BURNER")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.fire, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                else if (cause.ToString() == "BOULDER")
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.boulder, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }

                else if (cause.ToString() == "SUICIDE" && Configuration.Instance.suicidemsg)
                {
                    UnturnedChat.Say(player.CharacterName + " " + Configuration.Instance.suicide, UnturnedChat.GetColorFromName(Configuration.Instance.messagecolour, Color.red));
                    if (Configuration.Instance.UconomyEnabled)
                    {
                        // Do nothing
                    }
                }
                if (limb == ELimb.SKULL)
                {
                    Part = ("head");
                }
                else if (limb == ELimb.SPINE)
                {
                    Part = ("body");
                }
                else if (limb == ELimb.LEFT_ARM || limb == ELimb.RIGHT_ARM || limb == ELimb.LEFT_HAND || limb == ELimb.RIGHT_HAND)
                {
                    Part = ("arm");
                }
                else if (limb == ELimb.LEFT_LEG || limb == ELimb.RIGHT_LEG || limb == ELimb.LEFT_FOOT || limb == ELimb.RIGHT_FOOT)
                {
                    Part = ("leg");
                }
                if (Configuration.Instance.UconomyEnabled)
                {
                    try
                    {
                        if (IsDependencyLoaded("Uconomy"))
                        {
                            ExecuteDependencyCode("Uconomy", delegate(IRocketPlugin plugin)
                            {
                                Uconomy uconomy = (Uconomy)plugin;
                                int value       = 0;
                                if (Part == "head")
                                {
                                    value = Configuration.Instance.Head;
                                }
                                else if (Part == "body")
                                {
                                    value = Configuration.Instance.Body;
                                }
                                else if (Part == "arm")
                                {
                                    value = Configuration.Instance.Arm;
                                }
                                else if (Part == "leg")
                                {
                                    value = Configuration.Instance.Leg;
                                }
                                else if (cause.ToString() == "ROADKILL")
                                {
                                    value = Configuration.Instance.Roadkill;
                                }
                                else
                                {
                                    Rocket.Core.Logging.Logger.LogWarning("");
                                }
                                uconomy.Database.IncreaseBalance(murderer3.CSteamID.ToString(), value);
                            });
                        }
                        else
                        {
                            Rocket.Core.Logging.Logger.LogError("Uconomy not found, loading without it!");
                        }
                    }
                    catch (Exception)
                    {
                    }
                }

                if (Configuration.Instance.ExperienceEnabled)
                {
                    try
                    {
                        uint num1 = 0u;
                        if (Part == "head")
                        {
                            num1 = Configuration.Instance.ExpHead;
                        }
                        else if (Part == "body")
                        {
                            num1 = Configuration.Instance.ExpBody;
                        }
                        else if (Part == "arm")
                        {
                            num1 = Configuration.Instance.ExpArm;
                        }
                        else if (Part == "leg")
                        {
                            num1 = Configuration.Instance.ExpLeg;
                        }
                        else
                        {
                            num1 = 0;
                        }
                        UnturnedPlayer exp = murderer3;
                        exp.Experience = +num1;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Пример #6
0
        private void onEnterVehicleRequeseted(Player pl, InteractableVehicle vehicle, ref bool shouldAllow)
        {
            if (vehicle.asset.id == Configuration.Instance.BusID)
            {
                UnturnedPlayer player = UnturnedPlayer.FromPlayer(pl);


                if ((GetDriver(vehicle, player) == player) && (!Colectivero.Contains(player.CSteamID)))
                {
                    ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("ARENT_DRIVER").Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true);
                    shouldAllow = false;
                    return;
                }
                else if (Colectivero.Contains(player.CSteamID))
                {
                    Earnings.Add(player.CSteamID, 0);
                    return;
                }


                UnturnedPlayer driver = GetDriver(vehicle, player);

                var cob = (UInt32)pluginInstance.Configuration.Instance.Payment;


                if (pluginInstance.Configuration.Instance.UseXP)
                {
                    if (player.Experience > cob)
                    {
                        player.Experience = player.Experience - (cob * 2);
                        driver.Experience = driver.Experience + cob;
                    }
                    else
                    {
                        ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("NOT_ENOUGH_MONEY", cob).Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true);
                        shouldAllow = false;
                    }
                }
                else
                {
                    try
                    {
                        ExecuteDependencyCode("Uconomy", (IRocketPlugin plugin) =>
                        {
                            Uconomy Uconomy = (Uconomy)plugin;

                            if ((uint)Uconomy.Database.GetBalance(player.CSteamID.m_SteamID.ToString()) < cob)
                            {
                                AutoBusPlugin.Balance.Add(player.CSteamID, Uconomy.Database.GetBalance(player.CSteamID.m_SteamID.ToString()));
                            }
                            else
                            {
                                Uconomy.Database.IncreaseBalance(player.CSteamID.m_SteamID.ToString(), (cob * -1));
                                Uconomy.Database.IncreaseBalance(driver.CSteamID.m_SteamID.ToString(), (cob));
                            }
                        });
                        if (AutoBusPlugin.Balance[player.CSteamID] < cob)
                        {
                            ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("NOT_ENOUGH_MONEY", cob).Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true);
                            AutoBusPlugin.Balance.Remove(player.CSteamID);
                            shouldAllow = false;
                            return;
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.Log($"error at try execute a trasaction{e.Message}");
                    }
                    Earnings[player.CSteamID] += Configuration.Instance.Payment;
                    EffectManager.sendUIEffect(5463, 5464, true, pluginInstance.Translate("UI_WON"), Earnings[player.CSteamID].ToString(), Configuration.Instance.Payment.ToString());
                    ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("PAY_TO_DRIVER", driver.CharacterName, cob).Replace('(', '<').Replace(')', '>')), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true);
                    ChatManager.serverSendMessage(String.Format(pluginInstance.Translate("WON_DRIVER", cob).Replace('(', '<').Replace(')', '>')), Color.white, null, driver.SteamPlayer(), EChatMode.WELCOME, AutoBusPlugin.pluginInstance.Configuration.Instance.ImageUrl, true);
                    shouldAllow = true;
                    return;
                }
                shouldAllow = true;
                return;
            }
        }
Пример #7
0
        private void rpe_OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer)
        {
            if (player == null)
            {
                return;
            }
            if (murderer == null)
            {
                return;
            }
            UnturnedPlayer killer = UnturnedPlayer.FromCSteamID(murderer);

            if (killer == null)
            {
                return;
            }
            if (Uconomy_Essentials.Instance.Configuration.Instance.PayHit)
            {
                Uconomy u   = Uconomy.Instance;
                decimal bal = u.Database.GetBalance(player.CSteamID.ToString());
                if (cause == EDeathCause.SUICIDE && Uconomy_Essentials.Instance.Configuration.Instance.LoseSuicide)
                {
                    // We are going to remove currency for the suicide
                    decimal loss = (decimal)Uconomy_Essentials.Instance.Configuration.Instance.LoseSuicideAmt * -1.0m;
                    if (bal + loss < 0.0m)
                    {
                        loss = bal * -1.0m;
                    }
                    decimal bal1 = u.Database.IncreaseBalance(player.CSteamID.ToString(), loss);
                    Uconomy_Essentials.HandleEvent(player, (loss * -1.0m), "loss");
                    UnturnedChat.Say(player.CSteamID, Uconomy_Essentials.Instance.Translate("lose_suicide_msg", new object[] { Uconomy_Essentials.Instance.Configuration.Instance.LoseSuicideAmt, u.Configuration.Instance.MoneyName }));
                    if (bal1 != 0m)
                    {
                        UnturnedChat.Say(player.CSteamID, Uconomy_Essentials.Instance.Translate("new_balance_msg", new object[] { bal1, u.Configuration.Instance.MoneyName }));
                    }
                    return;
                }
                else if (cause == EDeathCause.SUICIDE && !Uconomy_Essentials.Instance.Configuration.Instance.LoseSuicide)
                {
                    // We do nothing if they suicide.
                    return;
                }
                if (Uconomy_Essentials.Instance.Configuration.Instance.LoseMoneyOnDeath)
                {
                    decimal loss = (decimal)Uconomy_Essentials.Instance.Configuration.Instance.LoseMoneyOnDeathAmt * -1.0m;
                    if (bal + loss < 0.0m)
                    {
                        loss = bal * -1.0m;
                    }
                    decimal lostbal = u.Database.IncreaseBalance(player.CSteamID.ToString(), loss);
                    Uconomy_Essentials.HandleEvent(player, (loss * -1.0m), "loss");
                    UnturnedChat.Say(player.CSteamID, Uconomy_Essentials.Instance.Translate("lose_money_on_death_msg", new object[] { Uconomy_Essentials.Instance.Configuration.Instance.LoseMoneyOnDeathAmt.ToString(), u.Configuration.Instance.MoneyName }));
                }
                // Pay the other player for the kill
                decimal balk = u.Database.IncreaseBalance(murderer.ToString(), (decimal)Uconomy_Essentials.Instance.Configuration.Instance.PayHitAmt);
                Uconomy_Essentials.HandleEvent(player, (decimal)Uconomy_Essentials.Instance.Configuration.Instance.PayHitAmt, "paid");
                if (!Uconomy_Essentials.Instance.Configuration.Instance.SendPayHitMsg)
                {
                    return;                                                                    // No message is to be sent, so job is done.
                }
                UnturnedChat.Say(murderer, Uconomy_Essentials.Instance.Translate("to_killer_msg", new object[] { Uconomy_Essentials.Instance.Configuration.Instance.PayHitAmt.ToString(), u.Configuration.Instance.MoneyName, player.CharacterName }));
                if (bal != 0m)
                {
                    UnturnedChat.Say(murderer, Uconomy_Essentials.Instance.Translate("new_balance_msg", new object[] { balk.ToString(), u.Configuration.Instance.MoneyName }));
                }
            }
        }