Example #1
0
        public void get_all_items_of_itemsource_id()
        {
            new ItemBuilder().With(i => i.Id, 21)
            .With(cr => cr.Owner, null)
            .With(cr => cr.dbLocationName, "swamps")
            .With(cr => cr.ItemSource, new ItemSourceBuilder().With(i => i.Id, 35).BuildAndSave())
            .BuildAndSave();

            new ItemBuilder().With(i => i.Id, 99)
            .With(cr => cr.Owner, null)
            .With(cr => cr.dbLocationName, "bog")
            .With(cr => cr.ItemSource, new ItemSourceBuilder().With(i => i.Id, 86).BuildAndSave())
            .BuildAndSave();

            new ItemBuilder().With(i => i.Id, 100)
            .With(cr => cr.Owner, null)
            .With(cr => cr.dbLocationName, "swamps")
            .With(cr => cr.ItemSource, new ItemSourceBuilder().With(i => i.Id, 35).BuildAndSave())
            .BuildAndSave();

            var cmd = new GetAllItemsOfType {
                ItemSourceId = 35
            };

            var items = DomainRegistry.Repository.Find(cmd);

            Assert.That(items, Has.Exactly(2).Items);
            Assert.That(items.First().Id, Is.EqualTo(21));
            Assert.That(items.Last().Id, Is.EqualTo(100));
        }
Example #2
0
        public static void EndEvent()
        {
            PvPWorldStatProcedures.Boss_EndBimbo();

            // delete all bimbo effects, both the kiss and the cure
            IEffectRepository effectRepo = new EFEffectRepository();
            var effectsToDelete          = effectRepo.Effects.Where(e => e.EffectSourceId == KissEffectSourceId || e.EffectSourceId == CureEffectSourceId).ToList();

            foreach (var e in effectsToDelete)
            {
                effectRepo.DeleteEffect(e.Id);
            }

            // delete all the cure vials
            var cmd = new GetAllItemsOfType {
                ItemSourceId = CureItemSourceId
            };
            var cures = DomainRegistry.Repository.Find(cmd);

            foreach (var cure in cures)
            {
                var deleteCmd = new DeleteItem {
                    ItemId = cure.Id
                };
                DomainRegistry.Repository.Execute(deleteCmd);
            }

            // restore any bimbos back to their base form and notify them

            var message = "Your body suddenly returns to normal as the bimbonic virus in your body suddenly goes into submission, the psychic link between you and your plague mother separated for good.  Due to the bravery of your fellow mages the Bimbocalypse has been thwarted... for now.";

            IPlayerRepository playerRepo = new EFPlayerRepository();
            var infected = playerRepo.Players.Where(p => p.FormSourceId == RegularBimboFormSourceId).ToList();

            foreach (var p in infected)
            {
                PlayerProcedures.InstantRestoreToBase(p);
                if (p.BotId == AIStatics.ActivePlayerBotId)
                {
                    PlayerLogProcedures.AddPlayerLog(p.Id, message, true);
                }
            }

            var damages = AIProcedures.GetTopAttackers(-7, 17);

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

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

                PlayerLogProcedures.AddPlayerLog(victor.Id, "<b>For your contribution in defeating " + BossFirstName + " " + BossLastName + ", you earn " + reward + " XP from your spells cast against the plague mother.</b>", true);

                playerRepo.SavePlayer(victor);

                // top three get runes
                if (i <= 2 && victor.Mobility == PvPStatics.MobilityFull)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.BIMBO_RUNE, PlayerId = victor.Id
                    });
                }
            }
        }
 public GetAllItemsOfTypeWrapper(GetAllItemsOfType gal)
 {
     line = gal;
 }