Exemplo n.º 1
0
        public static void EndEvent(Player donna)
        {
            PvPWorldStatProcedures.Boss_EndDonna();
            var damages = AIProcedures.GetTopAttackers(-4, 20);
            IPlayerRepository playerRepo = new EFPlayerRepository();

            // top player gets 800 XP, each player down the line receives 35 fewer
            var i         = 0;
            var maxReward = 800;

            for (var r = 0; r < damages.Count; r++)
            {
                var damage = damages.ElementAt(r);
                var victor = playerRepo.Players.FirstOrDefault(p => p.Id == damage.PlayerId);
                if (victor == null)
                {
                    continue;
                }
                var reward = maxReward - (i * 40);
                victor.XP += reward;
                i++;

                PlayerLogProcedures.AddPlayerLog(victor.Id, "<b>For your contribution in defeating " + donna.GetFullName() + ", you earn " + reward + " XP from your spells cast against the mythical sorceress.</b>", true);

                playerRepo.SavePlayer(victor);

                // top three get runes
                if (r <= 2 && victor.Mobility == PvPStatics.MobilityFull)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.DONNA_RUNE, PlayerId = victor.Id
                    });
                }
            }
        }
Exemplo n.º 2
0
        public static List <ItemTransferLogViewModel> GetItemTransferLog(int iItem)
        {
            IItemTransferLogRepository ItemTransferLogRepo = new EFItemTransferLogRepository();
            IPlayerRepository          PlayerRepo          = new EFPlayerRepository();
            var query = from p in ItemTransferLogRepo.ItemTransferLogs
                        where p.ItemId == iItem
                        from o in ItemTransferLogRepo.Players
                        .Where(q => q.Id == p.OwnerId)
                        .DefaultIfEmpty()
                        select new ItemTransferLogViewModel
            {
                OwnerIP   = o.IpAddress ?? "-1",
                OwnerName = (o.FirstName == null || o.LastName == null ? "-1" : o.FirstName + " " + o.LastName),
                ItemLog   = new ItemTransferLog_VM
                {
                    Id        = p.Id,
                    ItemId    = p.ItemId,
                    OwnerId   = p.OwnerId,
                    Timestamp = p.Timestamp
                }
            };
            var output = query.OrderBy(p => p.ItemLog.Timestamp).ToList();

            return(output);
        }
        public static void SpawnPetMerchant()
        {
            var petMerchant = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.WuffieBotId
            });

            if (petMerchant == null)
            {
                var cmd = new CreatePlayer
                {
                    BotId        = AIStatics.WuffieBotId,
                    Level        = 5,
                    FirstName    = "Wüffie",
                    LastName     = "the Soul Pet Vendor",
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    Mobility     = PvPStatics.MobilityFull,
                    Money        = 1000,
                    FormSourceId = WuffieFormId,
                    Location     = "270_west_9th_ave", // Lindella starts her rounds here
                    Gender       = PvPStatics.GenderFemale,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo    = new EFPlayerRepository();
                var petMerchantEF = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                petMerchantEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(petMerchantEF));
                playerRepo.SavePlayer(petMerchantEF);
            }
        }
Exemplo n.º 4
0
        public static void CounterAttack(Player victim, Player boss)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();

            // boss counterattacks once
            AttackProcedures.Attack(boss, victim, ChooseSpell(victim));

            // have some of the followers also attack the agressor
            var allFollowers  = GetFollowers();
            var followersHere = allFollowers.Where(f => f.dbLocationName == boss.dbLocationName &&
                                                   f.Id != victim.Id &&
                                                   f.TimesAttackingThisUpdate < 3 &&
                                                   f.ActionPoints >= PvPStatics.AttackCost
                                                   ).ToList();


            for (var i = 0; i < allFollowers.Count / 2; i++)
            {
                var follower = GetRandomFollower(followersHere);
                if (follower != null)
                {
                    AttackProcedures.Attack(follower, victim, ChooseSpell(victim));
                    PlayerLogProcedures.AddPlayerLog(follower.Id, $"<b>{BossFirstName} {BossLastName} orders you to attack {victim.GetFullName()}!</b>", true);

                    // reset the last attack and online timestamp to before the attack, otherwise she bumps her followers online indefinitely...
                    var player = playerRepo.Players.First(p => p.Id == follower.Id);
                    player.LastActionTimestamp = follower.LastActionTimestamp;
                    player.LastCombatTimestamp = follower.LastCombatTimestamp;
                    playerRepo.SavePlayer(player);

                    // remove this person from the list of eligible attackers so they don't do it more than once
                    followersHere = followersHere.Where(f => f.Id != follower.Id).ToList();
                }
            }
        }
Exemplo n.º 5
0
        public static void SpawnLoremaster()
        {
            var loremaster = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.LoremasterBotId
            });

            if (loremaster == null)
            {
                var cmd = new CreatePlayer
                {
                    BotId        = AIStatics.LoremasterBotId,
                    Level        = 5,
                    FirstName    = FirstName,
                    LastName     = LastName,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    Mobility     = PvPStatics.MobilityFull,
                    Money        = 1000,
                    FormSourceId = LoremasterFormId,
                    Location     = "bookstore_back",
                    Gender       = PvPStatics.GenderMale,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo   = new EFPlayerRepository();
                var lorekeeperEF = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                lorekeeperEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(lorekeeperEF));
                playerRepo.SavePlayer(lorekeeperEF);
            }
        }
Exemplo n.º 6
0
        public static void CounterAttack(Player human, Player bimboss)
        {
            // record that human attacked the boss
            AIProcedures.DealBossDamage(bimboss, human, true, 1);

            // if the bimboboss is inanimate, end this boss event
            if (bimboss.Mobility != PvPStatics.MobilityFull)
            {
                return;
            }

            // if the player doesn't currently have it, give them the infection kiss
            if (!EffectProcedures.PlayerHasEffect(human, KissEffectSourceId) && !EffectProcedures.PlayerHasEffect(human, CureEffectSourceId))
            {
                AttackProcedures.Attack(bimboss, human, KissSkillSourceId);
                AIProcedures.DealBossDamage(bimboss, human, false, 1);
            }

            // otherwise run the regular trasformation
            else if (human.FormSourceId != RegularBimboFormSourceId)
            {
                var rand        = new Random(Guid.NewGuid().GetHashCode());
                var attackCount = (int)Math.Floor(rand.NextDouble() * 2 + 1);
                for (var i = 0; i < attackCount; i++)
                {
                    AttackProcedures.Attack(bimboss, human, RegularTFSpellSourceId);
                }
                AIProcedures.DealBossDamage(bimboss, human, false, attackCount);
            }

            // otherwise make the human wander away to find more targets
            else
            {
                var targetLocation = GetLocationWithMostEligibleTargets();
                var newlocation    = AIProcedures.MoveTo(human, targetLocation, 9);

                IPlayerRepository playerRepo = new EFPlayerRepository();
                var dbHuman = playerRepo.Players.FirstOrDefault(p => p.Id == human.Id);
                dbHuman.TimesAttackingThisUpdate = PvPStatics.MaxAttacksPerUpdate;
                dbHuman.Health         = 0;
                dbHuman.Mana           = 0;
                dbHuman.XP            -= 25;
                dbHuman.dbLocationName = newlocation;
                dbHuman.ActionPoints  -= 10;

                if (dbHuman.XP < 0)
                {
                    dbHuman.XP = 0;
                }

                if (dbHuman.ActionPoints < 0)
                {
                    dbHuman.ActionPoints = 0;
                }

                playerRepo.SavePlayer(dbHuman);
                var message = "Lady Lovebringer is not pleased with you attacking her after she has so graciously given you that sexy body and carefree mind.  She whispers something into your ear that causes your body to grow limp in her arms, then injects you with a serum that makes your mind just a bit foggier and loyal to your bimbonic mother.  She orders you away to find new targets to spread the virus to.  The combination of lust and her command leaves you with no choice but to mindlessly obey...";
                PlayerLogProcedures.AddPlayerLog(human.Id, message, true);
            }
        }
Exemplo n.º 7
0
        public static IEnumerable <BlacklistEntryViewModel> GetMyBlacklistEntries(Player player)
        {
            IBlacklistEntryRepository repo       = new EFBlacklistEntryRepository();
            IPlayerRepository         playerRepo = new EFPlayerRepository();

            var rawEntries = repo.BlacklistEntries.Where(e => e.CreatorMembershipId == player.MembershipId).ToList();
            var output     = new List <BlacklistEntryViewModel>();

            foreach (var e in rawEntries)
            {
                var addme = new BlacklistEntryViewModel
                {
                    dbBlacklistEntry = e,
                };

                var target = playerRepo.Players.FirstOrDefault(p => p.MembershipId == e.TargetMembershipId);

                if (target != null)
                {
                    addme.PlayerName = target.GetFullName();
                    addme.PlayerId   = target.Id;
                }
                else
                {
                    addme.PlayerName = "(You do not currently have any players on your blacklist.)";
                    addme.PlayerId   = -1;
                }

                output.Add(addme);
            }

            return(output);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Attack an attacking player back.  There is a random chance to draw Narcissa's aggro from doing this if she has a target.  If she has no active target,
        /// the attacker instantly becomes her new target.
        /// </summary>
        /// <param name="attacker"></param>
        public static void CounterAttack(Player attacker)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var faeboss = playerRepo.Players.FirstOrDefault(f => f.BotId == AIStatics.FaebossBotId);

            AIProcedures.DealBossDamage(faeboss, attacker, true, 1); // log attack for human on boss

            var spell = ChooseSpell(PvPWorldStatProcedures.GetWorldTurnNumber(), PvPStatics.MobilityInanimate);

            for (var i = 0; i < 3; i++)
            {
                AttackProcedures.Attack(faeboss, attacker, spell);
                AIProcedures.DealBossDamage(faeboss, attacker, false, 1); // log attack for boss on human
            }

            var directive = AIDirectiveProcedures.GetAIDirective(faeboss.Id);

            // random chance to aggro faeboss
            var rand = new Random(Guid.NewGuid().GetHashCode());
            var num  = rand.NextDouble();

            if (num < AggroChance || directive.Var1 == 0)
            {
                IAIDirectiveRepository aiRepo = new EFAIDirectiveRepository();
                var dbDirective = aiRepo.AIDirectives.FirstOrDefault(a => a.Id == directive.Id);

                dbDirective.Var1 = attacker.Id;
                aiRepo.SaveAIDirective(dbDirective);
            }
        }
Exemplo n.º 9
0
        public static (bool, decimal) RunFormChangeLogic(Player victim, int attackerId, SkillViewModel skill, decimal energyAccumulated, LogBox output)
        {
            // redundant check to make sure the victim is still in a transformable state
            if (victim.Mobility != PvPStatics.MobilityFull)
            {
                return(false, victim.Health);
            }

            var targetForm = FormStatics.GetForm(skill.StaticSkill.FormSourceId.Value);

            // check and see if the target has enough points accumulated to try the form's energy requirement
            if (energyAccumulated < targetForm.TFEnergyRequired)
            {
                // Less than 100% TFE - don't complete form change
                return(false, victim.Health);
            }

            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbAttacker = playerRepo.Players.FirstOrDefault(p => p.Id == attackerId);

            // Collect the attacker & victim TFE related buffs
            decimal modifiedTFEnergyPercent = CalculateTFEBonusBuff(victim, dbAttacker);

            // check and see if the target's health is low enough to be eligible for the TF
            var updatedHealth = AddExtraHealthDamage(victim, dbAttacker, targetForm.TFEnergyRequired, energyAccumulated, modifiedTFEnergyPercent, output);
            var completed     = PotentiallyCompleteTransformation(victim, dbAttacker, targetForm, skill.StaticSkill.Id, updatedHealth, output);

            // if there is a duel going on, end it if all but 1 player is defeated (not in the form they started in)
            if (victim.InDuel > 0)
            {
                EndDuel(victim);
            }

            return(completed, updatedHealth);
        }
Exemplo n.º 10
0
        public static string OpenPsychoNip(Player player)
        {
            IAIDirectiveRepository directiveRepo = new EFAIDirectiveRepository();
            var idleBots = directiveRepo.AIDirectives.Where(d => d.State == "idle")
                           .Select(d => d.OwnerId)
                           .ToArray();

            // Set three lowest level psychos without targets on the player
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var botsToAttract            = playerRepo.Players.Where(p => idleBots.Contains(p.Id) &&
                                                                    p.BotId == AIStatics.PsychopathBotId &&
                                                                    p.Mobility == PvPStatics.MobilityFull)
                                           .OrderBy(p => p.Level)
                                           .Select(p => p.Id)
                                           .Take(3)
                                           .ToArray();

            foreach (var botId in botsToAttract)
            {
                AIDirectiveProcedures.SetAIDirective_Attack(botId, player.Id);
            }

            PlayerLogProcedures.AddPlayerLog(player.Id, $"You open a tin pf PsychoNip", false);
            LocationLogProcedures.AddLocationLog(player.dbLocationName, $"{player.GetFullName()} opened a tin of PsychoNip!");

            return("You spot a tin with a colorful insignia on a shelf.  You move over to take a closer look, but accidentally knock the tin to the floor and spill its contents!  You gather up the fallen leaves and place them back in the tin.  \"PsychoNip,\" it reads.  Perhaps you should stay alert for the next few turns in case the scent has caught anyone's attention...");
        }
        public static void SpawnLindella()
        {
            var merchant = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.LindellaBotId
            });

            if (merchant == null)
            {
                var cmd = new CreatePlayer
                {
                    BotId        = AIStatics.LindellaBotId,
                    Level        = 5,
                    FirstName    = "Lindella",
                    LastName     = "the Soul Vendor",
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    Mobility     = PvPStatics.MobilityFull,
                    Money        = 1000,
                    FormSourceId = LindellaFormId,
                    Location     = "270_west_9th_ave", // Lindella starts her rounds here
                    Gender       = PvPStatics.GenderFemale,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                IPlayerRepository playerRepo = new EFPlayerRepository();
                var newMerchant = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                newMerchant.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(newMerchant));
                playerRepo.SavePlayer(newMerchant);

                AIDirectiveProcedures.GetAIDirective(id);
                AIDirectiveProcedures.SetAIDirective_MoveTo(id, "street_15th_south");
            }
        }
Exemplo n.º 12
0
        public static void AddMindControl(Player attacker, Player victim, int formSourceId)
        {
            IMindControlRepository mcRepo     = new EFMindControlRepository();
            IPlayerRepository      playerRepo = new EFPlayerRepository();
            var dbVictim = playerRepo.Players.FirstOrDefault(p => p.Id == victim.Id);

            var mc = mcRepo.MindControls.FirstOrDefault(m => m.VictimId == victim.Id && m.MasterId == attacker.Id && m.FormSourceId == formSourceId);

            if (mc == null)
            {
                mc = new MindControl
                {
                    TurnsRemaining = 6,
                    MasterId       = attacker.Id,
                    VictimId       = victim.Id,
                    FormSourceId   = formSourceId
                };
            }
            else
            {
                mc.TurnsRemaining = 6;
            }



            mcRepo.SaveMindControl(mc);

            dbVictim.MindControlIsActive = true;
            playerRepo.SavePlayer(dbVictim);
        }
        public static void SpawnBartender()
        {
            var bartender = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.DonnaBotId
            });

            if (bartender == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = "Rusty",
                    LastName     = "Steamstein the Automaton Bartender",
                    Location     = "tavern_counter",
                    Gender       = PvPStatics.GenderMale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = BartenderFormId,
                    Money        = 0,
                    Mobility     = PvPStatics.MobilityFull,
                    Level        = 15,
                    BotId        = AIStatics.BartenderBotId,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                IPlayerRepository playerRepo = new EFPlayerRepository();
                var newBartender             = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                newBartender.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(newBartender));
                playerRepo.SavePlayer(newBartender);
            }
        }
        public static string ChangeActionPoints(Player player, int amount)
        {
            if (amount >= 0)
            {
                amount++;
            }

            var playerRepo = new EFPlayerRepository();
            var target     = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);
            var before     = target.ActionPoints;

            target.ActionPoints = Math.Min(Math.Max(0, target.ActionPoints + amount), TurnTimesStatics.GetActionPointLimit());
            var after = target.ActionPoints;

            playerRepo.SavePlayer(target);

            var delta = after - before;

            if (delta == 0)
            {
                return(null);
            }

            if (delta > 0)
            {
                return($"The shop energizes you to the tune of {delta} action points!");
            }
            else
            {
                return($"A mana quagmire slows you down, taking {-delta} of your action points!");
            }
        }
        private static string ChangeDungeonPoints(Player player, int amount)
        {
            if (player.GameMode != (int)GameModeStatics.GameModes.PvP)
            {
                return(null);
            }

            if (amount >= 0)
            {
                amount++;
            }

            var playerRepo = new EFPlayerRepository();
            var target     = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);
            var before     = target.PvPScore;

            target.PvPScore = Math.Max(0, target.PvPScore + amount);
            var after = target.PvPScore;

            playerRepo.SavePlayer(target);

            var delta = after - before;

            if (delta == 0)
            {
                return(null);
            }

            var increaseOrDecrease = (delta < 0) ? "decrease" : "increase";

            return($"The transdimensional store momentarily touches down deep below the streets.  You feel your dungeon points {increaseOrDecrease} by {Math.Abs(delta)}");
        }
Exemplo n.º 16
0
        public static string GivePerkToPlayer(int effectSourceId, int playerId, int?Duration = null, int?Cooldown = null)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == playerId);

            return(GivePerkToPlayer(effectSourceId, dbPlayer, Duration, Cooldown));
        }
        private static string ChangeMoney(Player player, int amount)
        {
            if (amount >= 0)
            {
                amount++;
            }

            var playerRepo = new EFPlayerRepository();
            var target     = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);
            var before     = target.Money;

            target.Money = Math.Max(0, target.Money + amount);
            var after = target.Money;

            playerRepo.SavePlayer(target);

            var delta = after - before;

            if (delta == 0)
            {
                return(null);
            }

            if (delta < 0)
            {
                return($"The antique cash register on the counter rattles and jangles.  The next thing you know it's pinched {-delta} of your Arpeyjis!");
            }
            else
            {
                return($"The antique cash register on the counter rattles and jangles.  The next thing you know it's refunded you {delta} Arpeyjis!  Lindella's never done that!");
            }
        }
        public static string ChangeHealth(Player player, int amount)
        {
            if (amount >= 0)
            {
                amount++;
            }

            var playerRepo = new EFPlayerRepository();
            var target     = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);
            var before     = target.Health;

            target.Health += amount;
            target.NormalizeHealthMana();
            var after = target.Health;

            playerRepo.SavePlayer(target);

            var delta = after - before;

            if (delta == 0)
            {
                return(null);
            }

            var reducesOrIncreases = (delta < 0) ? "reduces" : "increases";

            return($"The foreboding atmostphere in the shop {reducesOrIncreases} your willpower by {Math.Abs(delta)}!");
        }
Exemplo n.º 19
0
        internal static void ActOnInstinct(List <int> playersToControl, Random rand = null)
        {
            if (playersToControl == null || playersToControl.IsEmpty())
            {
                return;
            }

            rand = rand ?? new Random();
            var cutoff = DateTime.UtcNow.AddMinutes(-TurnTimesStatics.GetOfflineAfterXMinutes());

            IPlayerRepository playerRepo = new EFPlayerRepository();
            var activePlayers            = playerRepo.Players
                                           .Where(p => p.LastActionTimestamp >= cutoff &&
                                                  p.Mobility == PvPStatics.MobilityFull &&
                                                  p.InDuel <= 0 &&
                                                  p.InQuest <= 0 &&
                                                  p.BotId == AIStatics.ActivePlayerBotId &&
                                                  !p.dbLocationName.StartsWith("dungeon_"))
                                           .Select(p => new InstinctData {
                Id = p.Id, FormSourceId = p.FormSourceId, dbLocationName = p.dbLocationName
            })
                                           .ToList();

            var mcPlayers   = activePlayers.Where(p => playersToControl.Any(victim => p.Id == victim));
            var freePlayers = activePlayers.Where(p => !playersToControl.Any(victim => p.Id == victim));

            (mcPlayers, freePlayers) = SheepActions(playerRepo, mcPlayers, freePlayers, rand);
            (mcPlayers, freePlayers) = DogActions(playerRepo, mcPlayers, freePlayers, rand);
            (mcPlayers, freePlayers) = CatActions(playerRepo, mcPlayers, freePlayers, rand);
            mcPlayers = MaidActions(playerRepo, mcPlayers, rand);
            mcPlayers = StripperActions(playerRepo, mcPlayers, rand);
            mcPlayers = GhostActions(playerRepo, mcPlayers, rand);
        }
Exemplo n.º 20
0
        public static void SendCovenantMoneyToPlayer(int covId, Player giftee, decimal amount)
        {
            ICovenantRepository covRepo    = new EFCovenantRepository();
            IPlayerRepository   playerRepo = new EFPlayerRepository();
            var dbCov    = covRepo.Covenants.FirstOrDefault(c => c.Id == covId);
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == giftee.Id);

            dbCov.Money -= amount;

            // taxes...
            amount *= .95M;
            amount  = Math.Floor(amount);

            if (dbPlayer.Money + amount > PvPStatics.MaxMoney)
            {
                dbPlayer.Money = PvPStatics.MaxMoney;
            }
            else
            {
                dbPlayer.Money += amount;
            }

            playerRepo.SavePlayer(dbPlayer);
            covRepo.SaveCovenant(dbCov);

            var covMessage = (int)amount + " Arpeyjis were gifted out to " + giftee.GetFullName() + " from the covenant treasury.";

            WriteCovenantLog(covMessage, covId, false);
        }
        public static string ChangeMana(Player player, int amount)
        {
            if (amount >= 0)
            {
                amount++;
            }

            var playerRepo = new EFPlayerRepository();
            var target     = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);
            var before     = target.Mana;

            target.Mana += amount;
            target.NormalizeHealthMana();
            var after = target.Mana;

            playerRepo.SavePlayer(target);

            var delta = after - before;

            if (delta == 0)
            {
                return(null);
            }

            var reducingOrIncreasing = (delta < 0) ? "reducing" : "increasing";

            return($"The room is charged with magic - you can feel it arcing between all the enchanted items.  You find yourself caught in one of these discharges, {reducingOrIncreasing} your mana by {Math.Abs(delta)}!");
        }
Exemplo n.º 22
0
        public static int GetPlayerCountInCovenant_Animate_Lvl3(Covenant covenant)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();

            return
                (playerRepo.Players.Count(
                     p => p.Covenant == covenant.Id && p.Mobility == PvPStatics.MobilityFull && p.Level >= 3));
        }
Exemplo n.º 23
0
        public static int GetPlayerCountInCovenant(Covenant covenant, bool animateOnly)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();

            return(animateOnly
                ? playerRepo.Players.Count(p => p.Covenant == covenant.Id && p.Mobility == PvPStatics.MobilityFull)
                : playerRepo.Players.Count(p => p.Covenant == covenant.Id));
        }
        public static void ResetActivityTimer(Player player, double proportionOutOfOnline = 0.0)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var target = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            target.LastActionTimestamp = DateTime.UtcNow.AddMinutes(-proportionOutOfOnline * TurnTimesStatics.GetOfflineAfterXMinutes());
            playerRepo.SavePlayer(player);
        }
Exemplo n.º 25
0
        public static void PlayerSetQuestState(Player player, QuestState questState)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            dbPlayer.LastActionTimestamp     = DateTime.UtcNow;
            dbPlayer.OnlineActivityTimestamp = DateTime.UtcNow;
            dbPlayer.InQuestState            = questState.Id;
            playerRepo.SavePlayer(dbPlayer);
        }
        public static string ResetCombatTimer(Player player, double proportionOutOfCombat = 0.0)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var target = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            target.LastCombatTimestamp = DateTime.UtcNow.AddMinutes(-proportionOutOfCombat * TurnTimesStatics.GetMinutesSinceLastCombatBeforeQuestingOrDuelling());
            playerRepo.SavePlayer(player);

            return("A whiff of magic passes under your nose, the acrid smell reminding you of your last battle.  It seems so recent...");
        }
        public static string BlockItemUses(Player player)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            dbPlayer.ItemsUsedThisTurn = PvPStatics.MaxActionsPerUpdate;
            playerRepo.SavePlayer(player);

            return("The zipper on your satchel has broken!  You may not be able to use your consumables for a while!");
        }
        public static string BlockCleanseMeditates(Player player)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            dbPlayer.CleansesMeditatesThisRound = PvPStatics.MaxCleansesMeditatesPerUpdate;
            playerRepo.SavePlayer(player);

            return("An artifact inside the shop is jamming your ability to cleanse and meditate!");
        }
        public static string BlockAttacks(Player player)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            dbPlayer.TimesAttackingThisUpdate = PvPStatics.MaxAttacksPerUpdate;
            playerRepo.SavePlayer(player);

            return("A calm descends and you begin to wonder if the world would be a better place without conflict.");
        }
Exemplo n.º 30
0
        public static void PlayerBeginQuest(Player player, QuestStart questStart)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == player.Id);

            dbPlayer.InQuest             = questStart.Id;
            dbPlayer.InQuestState        = questStart.StartState;
            dbPlayer.LastActionTimestamp = DateTime.UtcNow;
            playerRepo.SavePlayer(dbPlayer);
        }