Exemple #1
0
 private void UconomyReward(classLevel configLevel, UnturnedPlayer player)
 {
     fr34kyn01535.Uconomy.Uconomy.Instance.Database.IncreaseBalance(player.Id, configLevel.UconomyAmount);
     if (configLevel.UconomyNotify)
     {
         UnturnedChat.Say(player, Translate("level_up_uconomy", configLevel.UconomyAmount + fr34kyn01535.Uconomy.Uconomy.Instance.Configuration.Instance.MoneyName), configNotificationColor);
     }
 }
Exemple #2
0
        public void UpdatePoints(UnturnedPlayer player, int points)
        {
            int  oldPoints;
            bool playerExists = dicPoints.TryGetValue(player.CSteamID, out oldPoints);

            if (playerExists)
            {
                FeexRanks.Instance.FeexRanksDatabase.AddPoints(player.CSteamID.ToString(), points);
                dicPoints[player.CSteamID] += points;

                int        newPoints      = oldPoints + points;
                classLevel configLevelOld = GetLevel(oldPoints);
                classLevel configLevelNew = GetLevel(newPoints);

                if (configLevelOld.Name != configLevelNew.Name)
                {
                    if (FeexRanks.Instance.Configuration.Instance.EnableLevelUpNotification)
                    {
                        UnturnedChat.Say(player, Translate("level_up", newPoints, configLevelNew.Name), configNotificationColor);
                    }
                    if (FeexRanks.Instance.Configuration.Instance.EnableLevelUpNotificationGlobal)
                    {
                        UnturnedChat.Say(Translate("level_up_global", newPoints, configLevelNew.Name, player.DisplayName), configNotificationColorGlobal);
                    }

                    if (configLevelNew.KitReward)
                    {
                        try
                        {
                            KitReward(configLevelNew, player);
                        }
                        catch { }
                    }
                    if (configLevelNew.PermissionGroupReward)
                    {
                        try
                        {
                            PermissionGroupReward(configLevelNew, player);
                        }
                        catch { }
                    }
                    if (configLevelNew.UconomyReward)
                    {
                        try
                        {
                            UconomyReward(configLevelNew, player);
                        }
                        catch { }
                    }
                }
            }
        }
Exemple #3
0
        private void PermissionGroupReward(classLevel configLevel, UnturnedPlayer player)
        {
            var a = R.Permissions.GetGroup(configLevel.PermissionGroupName);

            if (a == null)
            {
                Logger.LogWarning("Group " + configLevel.PermissionGroupName + " does not exist. Group was not given to player.");
                return;
            }

            R.Permissions.AddPlayerToGroup(configLevel.PermissionGroupName, player);

            if (configLevel.PermissionGroupNotify)
            {
                UnturnedChat.Say(player, Translate("level_up_rank", configLevel.PermissionGroupName), configNotificationColor);
            }
        }
Exemple #4
0
        private void KitReward(classLevel configLevel, UnturnedPlayer player)
        {
            fr34kyn01535.Kits.Kit rewardKit = fr34kyn01535.Kits.Kits.Instance.Configuration.Instance.Kits.Where(k => k.Name.ToLower() == configLevel.KitName.ToLower()).FirstOrDefault();
            if (rewardKit == null)
            {
                Rocket.Core.Logging.Logger.LogWarning("Kit " + configLevel.KitName + " not found.");
                return;
            }
            foreach (fr34kyn01535.Kits.KitItem item in rewardKit.Items)
            {
                if (!player.GiveItem(item.ItemId, item.Amount))
                {
                    Rocket.Core.Logging.Logger.Log(string.Format("Failed giving a item to {0} ({1}, {2})", player.CharacterName, item.ItemId, item.Amount));
                }
            }
            player.Experience += rewardKit.XP.Value;

            if (configLevel.KitNotify)
            {
                UnturnedChat.Say(player, Translate("level_up_kit", configLevel.KitName), configNotificationColor);
            }
        }