示例#1
0
        void AddPoints(IPlayer player, int amount)
        {
            object multiplier = GetRewardMultiplier(player);

            if (multiplier == null)
            {
                multiplier = 1f;
            }
            amount = Convert.ToInt32(Math.Floor(amount * (float)multiplier));
            if (amount == 0)
            {
                amount = 1;
            }

            string currency = Msg("currencyNameEco", player.Id);

            #if RUST
            if (ServerRewards && configData.RewardSystem.RewardPlugins.Rust.ServerRewards)
            {
                ServerRewards?.Call("AddPoints", ulong.Parse(player.Id), amount);
                currency = Msg("currencyNameRP", player.Id);
            }

            if (Economics && configData.RewardSystem.RewardPlugins.Rust.Economics)
            {
                Economics?.Call("Deposit", player.Id, (double)amount);
            }
            #endif

            #if HURTWORLD
            if (Economy && configData.RewardSystem.RewardPlugins.Hurtworld.Economy)
            {
                Economy?.Call("AddMoney", player.Object as PlayerSession, (double)amount);
            }
            #endif
            if (UEconomics && configData.RewardSystem.RewardPlugins.Universal.UEconomics)
            {
                UEconomics?.Call("Deposit", player.Id, amount);
            }

            if (configData.RewardSystem.SendDepositMessage)
            {
                player.Reply(string.Format(Msg("depositMsg", player.Id), amount, currency));
            }
        }
示例#2
0
        private void StealMoney(BasePlayer victim, BasePlayer attacker)
        {
            var chance = random.NextDouble() * (config.MaxChanceMoney / 100f);

            // Economics plugin support - http://oxidemod.org/plugins/economics.717/
            if (Economics != null)
            {
                var balance = (double)Economics.Call("GetPlayerMoney", victim.userID);
                var money   = Math.Floor(balance * chance);

                if (money > 0)
                {
                    Economics.Call("Transfer", victim.userID, attacker.userID, money);
                    Player.Reply(attacker, Lang("StoleMoney", attacker.UserIDString, money, victim.displayName));
                }
                else
                {
                    Player.Reply(attacker, Lang("StoleNothing", attacker.UserIDString, victim.displayName));
                }
            }

            // UEconomics plugin support - http://oxidemod.org/plugins/ueconomics.2129/
            if (UEconomics != null)
            {
                var balance = (int)UEconomics.Call("GetPlayerMoney", victim.UserIDString);
                var money   = Math.Floor(balance * chance);

                if (money > 0)
                {
                    UEconomics.Call("Withdraw", victim.UserIDString, money);
                    UEconomics.Call("Deposit", attacker.UserIDString, money);
                    Player.Reply(attacker, Lang("StoleMoney", attacker.UserIDString, money, victim.displayName));
                }
                else
                {
                    Player.Reply(attacker, Lang("StoleNothing", attacker.UserIDString, victim.displayName));
                }
            }
        }