private int GetKarmaForType(KarmaTypePositive karmaType)
        {
            switch (karmaType)
            {
            case KarmaTypePositive.BeAHero:
                return(7);

            case KarmaTypePositive.BeASuperHero:
                return(8);

            case KarmaTypePositive.BeATeamPlayer:
                return(5);

            case KarmaTypePositive.BeingDetermined:
                return(5);

            case KarmaTypePositive.BeingFast:
                return(5);

            case KarmaTypePositive.ContributingTowardsAGoodCauseAdministrator:
                return(3);

            case KarmaTypePositive.ContributingTowardsAGoodCauseSpeaker:
                return(8);

            case KarmaTypePositive.ContributingTowardsAGoodCauseContributor:
                return(5);

            case KarmaTypePositive.ContributingTowardsAGoodCauseCreatorOrganiser:
                return(10);

            case KarmaTypePositive.ContributingTowardsAGoodCauseFunder:
                return(8);

            case KarmaTypePositive.ContributingTowardsAGoodCausePeacefulProtesterActivist:
                return(5);

            case KarmaTypePositive.ContributingTowardsAGoodCauseSharer:
                return(3);

            case KarmaTypePositive.HelpingAnimals:
                return(5);

            case KarmaTypePositive.HelpingTheEnvironment:
                return(5);

            case KarmaTypePositive.Other:
                return(2);

            case KarmaTypePositive.OurWorld:
                return(5);

            case KarmaTypePositive.SelfHelpImprovement:
                return(2);

            default:
                return(0);
            }
        }
        public async Task <KarmaAkashicRecord> KarmaEarnt(KarmaTypePositive karmaType, KarmaSourceType karmaSourceType, string karamSourceTitle, string karmaSourceDesc, bool autoSave = true)
        {
            KarmaAkashicRecord record = new KarmaAkashicRecord {
                KarmaEarntOrLost = KarmaEarntOrLost.Earnt, Date = DateTime.Now, Karma = GetKarmaForType(karmaType), KarmaSource = karmaSourceType, KarmaSourceTitle = karamSourceTitle, KarmaSourceDesc = karmaSourceDesc, KarmaTypePositive = karmaType, UserId = UserId, Provider = ProviderManager.CurrentStorageProviderType
            };

            this.Karma += GetKarmaForType(karmaType);

            if (this.KarmaAkashicRecords == null)
            {
                this.KarmaAkashicRecords = new List <KarmaAkashicRecord>();
            }

            this.KarmaAkashicRecords.Add(record);

            if (autoSave)
            {
                await Save();
            }

            return(record);
        }
        public async Task <KarmaAkashicRecord> AddKarmaToProfileAsync(IProfile profile, KarmaTypePositive karmaType, KarmaSourceType karmaSourceType, string karamSourceTitle, string karmaSourceDesc, ProviderType provider = ProviderType.Default)
        {
            if (provider != ProviderType.Default)
            {
                return(await((IOASISStorage)ProviderManager.GetAndActivateProvider(provider)).AddKarmaToProfileAsync(profile, karmaType, karmaSourceType, karamSourceTitle, karmaSourceDesc));
            }

            return(await ProviderManager.CurrentStorageProvider.AddKarmaToProfileAsync(profile, karmaType, karmaSourceType, karamSourceTitle, karmaSourceDesc));
        }
コード例 #4
0
 public Task <KarmaAkashicRecord> AddKarmaToProfileAsync(API.Core.IProfile profile, KarmaTypePositive karmaType, KarmaSourceType karmaSourceType, string karamSourceTitle, string karmaSourceDesc)
 {
     return(profile.KarmaEarnt(karmaType, karmaSourceType, karamSourceTitle, karmaSourceDesc));
 }