public void should_create_item_when_attacker_null() { var cmd = new PlayerBecomesItem { AttackerId = null, VictimId = victim.Id, NewFormId = formSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog").EqualTo("<br><b>You fully transformed Victim MgGee into a A new Item!</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a A new Item!!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Victim MgGee was completely transformed into a A new Item!</b> here.")); var victimPostTF = DataContext.AsQueryable <Player>().FirstOrDefault(p => p.Id == victim.Id); Assert.That(victimPostTF, Is.Not.Null); Assert.That(victimPostTF.Mobility, Is.EqualTo(PvPStatics.MobilityInanimate)); Assert.That(victimPostTF.FormSource.Id, Is.EqualTo(formSource.Id)); Assert.That(victimPostTF.Item.ItemSource.Id, Is.EqualTo(itemSource.Id)); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == victim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner, Is.Null); Assert.That(newItem.dbLocationName, Is.EqualTo(victim.Location)); Assert.That(newItem.PvPEnabled, Is.EqualTo((int)GameModeStatics.GameModes.Any)); // chaos poof turns into any game mode }
public void pets_automatically_equipped_to_new_owner_when_owner_has_no_existing_pet() { var petItemSource = new ItemSourceBuilder() .With(i => i.Id, 1000) .With(i => i.FriendlyName, "Squeaky Pet") .With(i => i.ItemType, PvPStatics.ItemType_Pet) .BuildAndSave(); var petFormSource = new FormSourceBuilder() .With(i => i.Id, 870) .With(i => i.MobilityType, PvPStatics.MobilityPet) .With(i => i.ItemSource, petItemSource) .BuildAndSave(); var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = victim.Id, NewFormId = petFormSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog").EqualTo("<br><b>You fully transformed Victim MgGee into a Squeaky Pet</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a Squeaky Pet!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Victim MgGee was completely transformed into a Squeaky Pet</b> here.")); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == victim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner, Is.EqualTo(attacker)); Assert.That(newItem.IsEquipped, Is.True); }
public void fall_on_ground_if_no_inventory_space_for_attacker() { attacker = new PlayerBuilder() .With(p => p.Id, 296) .With(p => p.FirstName, "Attacker") .With(p => p.LastName, "Smacker") .With(p => p.Items, emptyItemList) .With(p => p.ExtraInventory, -9999) .BuildAndSave(); var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = victim.Id, NewFormId = formSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog").EqualTo("<br><b>You fully transformed Victim MgGee into a A new Item!</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a A new Item!!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Victim MgGee was completely transformed into a A new Item!</b> here.")); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == victim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner, Is.Null); Assert.That(newItem.dbLocationName, Is.EqualTo(victim.Location)); }
public void Should_throw_exception_if_new_form_not_found() { var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = victim.Id, NewFormId = -1 }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("Form with ID '-1' could not be found")); }
public void Should_throw_exception_if_attacker_specified_but_not_found() { var cmd = new PlayerBecomesItem { AttackerId = 123, VictimId = victim.Id, NewFormId = formSource.Id }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message .EqualTo("Player (attacker) with ID '123' could not be found")); }
public void psychotic_players_should_not_lock_permanently() { var botVictim = new PlayerBuilder() .With(p => p.Id, 55) .With(p => p.FirstName, "Victim") .With(p => p.LastName, "McGee") .With(p => p.GameMode, (int)GameModeStatics.GameModes.PvP) .With(p => p.BotId, AIStatics.PsychopathBotId) .With(p => p.Level, 7) .BuildAndSave(); var effectSourcePsychotic = new EffectSourceBuilder() .With(e => e.Id, JokeShopProcedures.PSYCHOTIC_EFFECT) .BuildAndSave(); var effectPsychotic = new EffectBuilder() .With(e => e.EffectSource, effectSourcePsychotic) .With(e => e.Duration, 1) .With(e => e.Owner, botVictim) .BuildAndSave(); botVictim.Effects.Add(effectPsychotic); var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = botVictim.Id, NewFormId = formSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog") .EqualTo("<br><b>You fully transformed Victim McGee into a A new Item!</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a A new Item!!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Victim McGee was completely transformed into a A new Item!</b> here.")); var victimPostTF = DataContext.AsQueryable <Player>().FirstOrDefault(p => p.Id == botVictim.Id); Assert.That(victimPostTF, Is.Not.Null); Assert.That(victimPostTF.Mobility, Is.EqualTo(PvPStatics.MobilityInanimate)); Assert.That(victimPostTF.FormSource.Id, Is.EqualTo(formSource.Id)); Assert.That(victimPostTF.Item.ItemSource.Id, Is.EqualTo(itemSource.Id)); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == botVictim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner.Id, Is.EqualTo(attacker.Id)); Assert.That(newItem.PvPEnabled, Is.EqualTo((int)GameModeStatics.GameModes.Protection)); Assert.That(newItem.IsPermanent, Is.False); Assert.That(newItem.Level, Is.EqualTo(botVictim.Level)); Assert.That(newItem.dbLocationName, Is.Empty); Assert.That(newItem.ItemSource.FriendlyName, Is.EqualTo(itemSource.FriendlyName)); Assert.That(newItem.ConsentsToSoulbinding, Is.False); }
public void Should_throw_exception_if_item_source_not_found() { var formSource2 = new FormSourceBuilder() .With(i => i.Id, 99) .With(i => i.ItemSource, null) .BuildAndSave(); var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = victim.Id, NewFormId = formSource2.Id }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("Form is not inanimate or pet")); }
public void player_should_become_item_and_go_to_attacker_and_drop_inventory_by_default() { var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = victim.Id, NewFormId = formSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog").EqualTo("<br><b>You fully transformed Victim MgGee into a A new Item!</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a A new Item!!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Victim MgGee was completely transformed into a A new Item!</b> here.")); var victimPostTF = DataContext.AsQueryable <Player>().FirstOrDefault(p => p.Id == victim.Id); Assert.That(victimPostTF, Is.Not.Null); Assert.That(victimPostTF.Mobility, Is.EqualTo(PvPStatics.MobilityInanimate)); Assert.That(victimPostTF.FormSource.Id, Is.EqualTo(formSource.Id)); Assert.That(victimPostTF.Item.ItemSource.Id, Is.EqualTo(itemSource.Id)); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == victim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner.Id, Is.EqualTo(attacker.Id)); Assert.That(newItem.IsPermanent, Is.False); Assert.That(newItem.PvPEnabled, Is.EqualTo((int)GameModeStatics.GameModes.Protection)); // Superprotection players always get protection items Assert.That(newItem.Level, Is.EqualTo(victim.Level)); Assert.That(newItem.dbLocationName, Is.Empty); Assert.That(newItem.ItemSource.FriendlyName, Is.EqualTo(itemSource.FriendlyName)); Assert.That(newItem.ConsentsToSoulbinding, Is.False); var attackerPostTF = DataContext.AsQueryable <Player>().FirstOrDefault(p => p.Id == attacker.Id); Assert.That(attackerPostTF, Is.Not.Null); Assert.That(attackerPostTF.Items, Has.Exactly(1).Items); Assert.That(attackerPostTF.Items.ElementAt(0).FormerPlayer.Id, Is.EqualTo(victimPostTF.Id)); var droppedItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.Id == 82624); Assert.That(droppedItem, Is.Not.Null); Assert.That(droppedItem.Owner, Is.Null); Assert.That(droppedItem.dbLocationName, Is.EqualTo("someplace")); }
public void bots_should_lock_permanently_immediately_and_be_any_game_mode() { var botVictim = new PlayerBuilder() .With(p => p.Id, 5) .With(p => p.FirstName, "Psychopath") .With(p => p.LastName, "Panties") .With(p => p.GameMode, (int)GameModeStatics.GameModes.Protection) .With(p => p.BotId, AIStatics.PsychopathBotId) .With(p => p.Level, 7) .BuildAndSave(); var cmd = new PlayerBecomesItem { AttackerId = attacker.Id, VictimId = botVictim.Id, NewFormId = formSource.Id }; Assert.That(DomainRegistry.Repository.Execute(cmd), Has.Property("AttackerLog") .EqualTo("<br><b>You fully transformed Psychopath Panties into a A new Item!</b>!") .And.Property("VictimLog") .EqualTo("<br><b>You have been fully transformed into a A new Item!!</b>!") .And.Property("LocationLog") .EqualTo("<br><b>Psychopath Panties was completely transformed into a A new Item!</b> here.")); var victimPostTF = DataContext.AsQueryable <Player>().FirstOrDefault(p => p.Id == botVictim.Id); Assert.That(victimPostTF, Is.Not.Null); Assert.That(victimPostTF.Mobility, Is.EqualTo(PvPStatics.MobilityInanimate)); Assert.That(victimPostTF.FormSource.Id, Is.EqualTo(formSource.Id)); Assert.That(victimPostTF.Item.ItemSource.Id, Is.EqualTo(itemSource.Id)); var newItem = DataContext.AsQueryable <Item>().FirstOrDefault(i => i.FormerPlayer != null && i.FormerPlayer.Id == botVictim.Id); Assert.That(newItem, Is.Not.Null); Assert.That(newItem.Owner.Id, Is.EqualTo(attacker.Id)); Assert.That(newItem.PvPEnabled, Is.EqualTo((int)GameModeStatics.GameModes.Any)); Assert.That(newItem.IsPermanent, Is.True); Assert.That(newItem.Level, Is.EqualTo(botVictim.Level)); Assert.That(newItem.dbLocationName, Is.Empty); Assert.That(newItem.ItemSource.FriendlyName, Is.EqualTo(itemSource.FriendlyName)); Assert.That(newItem.ConsentsToSoulbinding, Is.True); }