Beispiel #1
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);
            }
        }
        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");
            }
        }
Beispiel #3
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 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!");
            }
        }
        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);
            }
        }
        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)}");
        }
        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 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 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
                    });
                }
            }
        }
Beispiel #10
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();
                }
            }
        }
        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);
            }
        }
Beispiel #12
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);
            }
        }
        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)}!");
        }
        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)}!");
        }
        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);
        }
        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.");
        }
        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 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);
        }
        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!");
        }
Beispiel #22
0
        public static void SendDuelChallenge(Player challenger, Player target)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            IDuelRepository   duelRepo   = new EFDuelRepository();

            var dbChallenger = playerRepo.Players.FirstOrDefault(p => p.Id == challenger.Id);
            var dbTarget     = playerRepo.Players.FirstOrDefault(p => p.Id == target.Id);


            var newDuel = new Duel
            {
                StartTurn          = -1,
                ProposalTurn       = PvPWorldStatProcedures.GetWorldTurnNumber(),
                CompletionTurn     = -1,
                Status             = PENDING,
                LastResetTimestamp = DateTime.UtcNow,
                Combatants         = new List <DuelCombatant> {
                    new DuelCombatant {
                        PlayerId = challenger.Id,
                        Team     = 1,
                    }, new DuelCombatant {
                        PlayerId = target.Id,
                        Team     = 2,
                    }
                },
            };

            duelRepo.SaveDuel(newDuel);

            // TODO:  make it so target has to accept first
            // dbChallenger.InDuel = newDuel.Id;
            // dbTarget.InDuel = newDuel.Id;

            var messageToTarget = "You have been challenge to a duel by <b>" + challenger.GetFullName() + "</b>!  Will you accept the challenge or show your cowardice?  " +
                                  "<b><u><a href='/Duel/AcceptChallenge/" + newDuel.Id + "'>Click here to Accept</a></b></u>."
            ;

            PlayerLogProcedures.AddPlayerLog(dbTarget.Id, messageToTarget, true);

            playerRepo.SavePlayer(dbChallenger);
            playerRepo.SavePlayer(dbTarget);
        }
        public static void EndEvent(int newOwnerId)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            IItemRepository   itemRepo   = new EFItemRepository();

            var valentine = playerRepo.Players.FirstOrDefault(f => f.BotId == AIStatics.ValentineBotId);


            var panties = itemRepo.Items.FirstOrDefault(i => i.ItemSourceId == QueensPantiesItemSourceId);

            panties.OwnerId = newOwnerId;
            itemRepo.SaveItem(panties);

            DomainRegistry.Repository.Execute(new DropAllItems {
                PlayerId = valentine.Id, IgnoreRunes = true
            });
            DomainRegistry.Repository.Execute(new DeletePlayer {
                PlayerId = valentine.Id
            });

            PvPWorldStatProcedures.Boss_EndValentine();

            // find the players who dealt the most damage and award them with XP
            var damages = AIProcedures.GetTopAttackers(valentine.BotId, 15);

            // top player gets 500 XP, each player down the line receives 25 fewer
            var l         = 0;
            var maxReward = 500;

            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 - (l * 30);
                victor.XP += reward;
                l++;

                PlayerLogProcedures.AddPlayerLog(victor.Id, "<b>For your valiant (maybe foolish?) efforts in challenging " + valentine.GetFullName() + " you receieve " + reward + " XP from your risky struggle!</b>", true);

                playerRepo.SavePlayer(victor);

                // top three get runes
                if (r <= 2 && victor.Mobility == PvPStatics.MobilityFull)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.VAMPIRE_RUNE, PlayerId = victor.Id
                    });
                }
            }
        }
Beispiel #24
0
        public static void SpawnBimboBoss()
        {
            var bimboBoss = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.BimboBossBotId
            });

            if (bimboBoss == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = BossFirstName,
                    LastName     = BossLastName,
                    Location     = "stripclub_bar_seats",
                    Gender       = PvPStatics.GenderFemale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = BimboBossFormSourceId,
                    Money        = 2500,
                    Level        = 15,
                    BotId        = AIStatics.BimboBossBotId,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo = new EFPlayerRepository();
                var bimboEF    = playerRepo.Players.FirstOrDefault(p => p.Id == id);

                bimboEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(bimboEF));

                playerRepo.SavePlayer(bimboEF);


                // set up her AI directive so it is not deleted
                IAIDirectiveRepository aiRepo = new EFAIDirectiveRepository();
                var directive = new AIDirective
                {
                    OwnerId        = id,
                    Timestamp      = DateTime.UtcNow,
                    SpawnTurn      = PvPWorldStatProcedures.GetWorldTurnNumber(),
                    DoNotRecycleMe = true,
                };

                aiRepo.SaveAIDirective(directive);

                for (var i = 0; i < 2; i++)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.BIMBO_RUNE, PlayerId = bimboEF.Id
                    });
                }
            }
        }
Beispiel #25
0
        public virtual ActionResult RevertToBase(int Id)
        {
            // Get Moderator info.
            var myMembershipId = User.Identity.GetUserId();
            var me             = PlayerProcedures.GetPlayerFromMembership(myMembershipId);

            var checkModerator = User.IsInRole(PvPStatics.Permissions_Moderator);

            if (!checkModerator)
            {
                TempData["Result"] = "You do not have permission to do that.";
                return(RedirectToAction(MVC.PvP.LookAtPlayer(Id)));
            }

            // Get the player info needed
            var playerMembershipId = PlayerProcedures.GetPlayer(Id);

            IPlayerRepository playerRepo = new EFPlayerRepository();

            var player = playerRepo.Players.FirstOrDefault(p => p.MembershipId == playerMembershipId.MembershipId);

            if (player.Mobility != PvPStatics.MobilityFull)
            {
                TempData["Result"] = "Only animate players can be force reverted to base form.";
                return(RedirectToAction(MVC.PvP.LookAtPlayer(Id)));
            }

            // Check for empty field
            if (player.OriginalFirstName == null || player.OriginalLastName == null)
            {
                TempData["Result"] = "The player is missing their original first or last name. Please contact an admin to get this fixed.";
                return(RedirectToAction(MVC.PvP.LookAtPlayer(Id)));
            }

            // Revert the player to their original self.
            player.FirstName = player.OriginalFirstName;
            player.LastName  = player.OriginalLastName;

            playerRepo.SavePlayer(player);

            DomainRegistry.Repository.Execute(new ChangeForm
            {
                PlayerId     = Id,
                FormSourceId = player.OriginalFormSourceId
            });

            PlayerLogProcedures.AddPlayerLog(me.Id,
                                             $"<b>You have reverted {player.OriginalFirstName} {player.OriginalLastName} back to their starting identity.</b>", true);
            return(RedirectToAction(MVC.PvP.Play()));
        }
Beispiel #26
0
        public static string UseFurniture(int furnitureId, Player user)
        {
            IFurnitureRepository furnRepo = new EFFurnitureRepository();
            var dbFurniture = furnRepo.Furnitures.FirstOrDefault(f => f.Id == furnitureId);

            dbFurniture.LastUseTimestamp = DateTime.UtcNow;
            dbFurniture.LastUsersIds     = user.Id.ToString();
            furnRepo.SaveFurniture(dbFurniture);

            var furnitureStatic = furnRepo.DbStaticFurniture.FirstOrDefault(f => f.dbType == dbFurniture.dbType);

            var logMessage = "<b>" + user.GetFullName() + "</b> used <b>" + dbFurniture.HumanName + "</b>.";

            CovenantProcedures.WriteCovenantLog(logMessage, (int)user.Covenant, false);

            // furniture gives AP reserve bonus
            if (furnitureStatic.APReserveRefillAmount > 0)
            {
                IPlayerRepository playerRepo = new EFPlayerRepository();
                var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == user.Id);
                dbPlayer.ActionPoints_Refill += furnitureStatic.APReserveRefillAmount;
                if (dbPlayer.ActionPoints_Refill > TurnTimesStatics.GetActionPointReserveLimit())
                {
                    dbPlayer.ActionPoints_Refill = TurnTimesStatics.GetActionPointReserveLimit();
                }
                dbPlayer.LastActionTimestamp = DateTime.UtcNow;
                playerRepo.SavePlayer(dbPlayer);

                return("You used " + dbFurniture.HumanName + ", a human voluntarily transformed into furniture and leased by your covenant, and gained " + furnitureStatic.APReserveRefillAmount + " reserve action points.");
            }

            // furniture gives effect
            else if (furnitureStatic.GivesEffectSourceId != null)
            {
                EffectProcedures.GivePerkToPlayer(furnitureStatic.GivesEffectSourceId.Value, user);
                PlayerProcedures.SetTimestampToNow(user);
                return("You used " + dbFurniture.HumanName + ", a human voluntarily transformed into furniture and leased by your covenant, and gained the " + EffectStatics.GetDbStaticEffect(furnitureStatic.GivesEffectSourceId.Value).FriendlyName + " effect.");
            }

            //furniture gives item
            else if (furnitureStatic.GivesItemSourceId != null)
            {
                ItemProcedures.GiveNewItemToPlayer(user, furnitureStatic.GivesItemSourceId.Value);
                PlayerProcedures.SetTimestampToNow(user);
                var itemGained = ItemStatics.GetStaticItem(furnitureStatic.GivesItemSourceId.Value);
                return("You used " + dbFurniture.HumanName + ", a human voluntarily transformed into furniture and leased by your covenant, gaining a " + itemGained.FriendlyName + ".");
            }

            return("ERROR");
        }
        public static string AddPlayerToCovenant(int playerId, int covId)
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();

            var dbPlayer = playerRepo.Players.FirstOrDefault(p => p.Id == playerId);

            dbPlayer.Covenant = covId;
            playerRepo.SavePlayer(dbPlayer);

            var covMessage = dbPlayer.GetFullName() + " is now a member of the covenant.";

            WriteCovenantLog(covMessage, covId, true);

            return("");
        }
        public static void MoveToNewLocation()
        {
            IPlayerRepository playerRepo = new EFPlayerRepository();
            var fae = playerRepo.Players.FirstOrDefault(f => f.BotId == AIStatics.JewdewfaeBotId);

            IJewdewfaeEncounterRepository faeRepo = new EFJewdewfaeEncounterRepository();

            IAIDirectiveRepository aiRepo = new EFAIDirectiveRepository();
            var directive = aiRepo.AIDirectives.FirstOrDefault(i => i.OwnerId == fae.Id);

            // add fae's current location to the list of places visited
            directive.sVar2 += fae.dbLocationName + ";";

            var fairyLocations = faeRepo.JewdewfaeEncounters.Where(f => f.IsLive).Select(f => f.dbLocationName).ToList();

            var visitedFairyLocations = directive.sVar2.Split(';').Where(f => f.Length > 1).ToList();

            var possibleLocations = fairyLocations.Except(visitedFairyLocations).ToList();

            // if there are no locations left to visit, reset
            if (!possibleLocations.Any())
            {
                possibleLocations = fairyLocations;
                directive.sVar2   = "";
            }

            double max  = possibleLocations.Count();
            var    rand = new Random();
            var    num  = rand.NextDouble();

            var index       = Convert.ToInt32(Math.Floor(num * max));
            var newLocation = possibleLocations.ElementAt(index);


            directive.Var1  = 0;
            directive.Var2  = PvPWorldStatProcedures.GetWorldTurnNumber();
            directive.sVar1 = ";";

            aiRepo.SaveAIDirective(directive);

            LocationLogProcedures.AddLocationLog(fae.dbLocationName, "<b>Jewdewfae got bored and flew away from here.</b>");

            fae.dbLocationName = newLocation;
            playerRepo.SavePlayer(fae);

            LocationLogProcedures.AddLocationLog(fae.dbLocationName, "<b>Jewdewfae flew here.  She looks bored and wants to play with someone.</b>");
        }
        public static void SpawnFae()
        {
            var fae = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.JewdewfaeBotId
            });

            if (fae == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = FirstName,
                    LastName     = LastName,
                    Location     = "apartment_dog_park",
                    Gender       = PvPStatics.GenderFemale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = FaeFormId,
                    Money        = 1000,
                    Level        = 7,
                    BotId        = AIStatics.JewdewfaeBotId
                };
                var id = DomainRegistry.Repository.Execute(cmd);

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

                // set up her AI directive so it is not deleted
                IAIDirectiveRepository aiRepo = new EFAIDirectiveRepository();
                var directive = new AIDirective
                {
                    OwnerId        = id,
                    Timestamp      = DateTime.UtcNow,
                    SpawnTurn      = 0,
                    DoNotRecycleMe = true,
                    sVar1          = ";", // this is used to keep track of which players have interacted with her by appending their id to this string
                    sVar2          = "",  // this is used to keep track of which locations Jewdewfae has been in during the past cycle
                    Var1           = 0,   // this keeps track of how many people she has played with in the current location
                    Var2           = 0    // this stores the turn number of Jewdewfae's last move
                };

                aiRepo.SaveAIDirective(directive);
            }
        }
Beispiel #30
0
        private static void PerformAnimateTransformation(Player victim, Player attacker, DbStaticForm targetForm, LogBox output)
        {
            var playerRepo = new EFPlayerRepository();
            var dbVictim   = playerRepo.Players.FirstOrDefault(p => p.Id == victim.Id);

            SkillProcedures.UpdateFormSpecificSkillsToPlayer(dbVictim, targetForm.Id);
            DomainRegistry.Repository.Execute(new ChangeForm
            {
                PlayerId     = dbVictim.Id,
                FormSourceId = targetForm.Id
            });

            // wipe out half of the target's mana
            dbVictim.Mana -= dbVictim.MaxMana / 2;
            if (dbVictim.Mana < 0)
            {
                dbVictim.Mana = 0;
            }

            // Remove any Self Restore entires.
            RemoveSelfRestore(dbVictim);

            var targetbuffs = ItemProcedures.GetPlayerBuffs(dbVictim);

            dbVictim = PlayerProcedures.ReadjustMaxes(dbVictim, targetbuffs);


            // take away some of the victim's XP based on the their level
            // target.XP += -2.5M * target.Level;

            playerRepo.SavePlayer(dbVictim);

            output.LocationLog += $"<br><b>{dbVictim.GetFullName()} was completely transformed into a {targetForm.FriendlyName} here.</b>";
            output.AttackerLog += $"<br><b>You fully transformed {dbVictim.GetFullName()} into a {targetForm.FriendlyName}</b>!";
            output.VictimLog   += $"<br><b>You have been fully transformed into a {targetForm.FriendlyName}!</b>";

            // Let the target know they are best friends with the angel plush.
            if (attacker.BotId == AIStatics.MinibossPlushAngelId)
            {
                output.VictimLog += $"<br><br><b>{attacker.GetFullName()}</b> was happy to make you into a new friend!<br>";
            }

            TFEnergyProcedures.DeleteAllPlayerTFEnergiesOfFormSourceId(dbVictim.Id, targetForm.Id);

            StatsProcedures.AddStat(dbVictim.MembershipId, StatsProcedures.Stat__TimesAnimateTFed, 1);
            StatsProcedures.AddStat(attacker.MembershipId, StatsProcedures.Stat__TimesAnimateTFing, 1);
        }