public static string TeleportToFriendlyNPC(Player player, Random rand = null) { rand = rand ?? new Random(); var roll = rand.Next(6); int npc = 0; // View view = null; switch (roll) { case 0: npc = AIStatics.BartenderBotId; // view = MVC.NPC.TalkToBartender("none"); break; case 1: npc = AIStatics.LoremasterBotId; // view = MVC.NPC.TalkToLorekeeper(); break; case 2: npc = AIStatics.SoulbinderBotId; // view = MVC.NPC.TalkToSoulbinder(); break; case 3: npc = AIStatics.JewdewfaeBotId; // view = MVC.NPC.TalkWithJewdewfae(); break; case 4: npc = AIStatics.LindellaBotId; // view = MVC.NPC.TradeWithMerchant("shirt"); break; case 5: npc = AIStatics.WuffieBotId; // view = MVC.NPC.TradeWithPetMerchant(); break; } var npcPlayer = TeleportToNPC(player, npc, rand); if (npcPlayer == null) { return(null); } if (npcPlayer.BotId == AIStatics.JewdewfaeBotId) { var encounter = BossProcedures_Jewdewfae.GetFairyChallengeInfoAtLocation(npcPlayer.dbLocationName); // interface currently restricts to one encounter per location CharacterPrankProcedures.TryAnimateTransform(player, encounter.RequiredFormSourceId); } // It would be a nice touch if we could redirect to the NPC's talk/trade page return($"The bejeweled eyes of a strage ornament begin to glow as a raspy sucking voice echoes throughout the room: \"Maybe you should talk to <b>{npcPlayer.GetFullName()}</b>?\" The room then fades away."); }
public static string TeleportToHostileNPC(Player player, bool attack, Random rand = null) { var targetFormSourceId = -1; var minLevel = 4; IPlayerRepository playerRepo = new EFPlayerRepository(); // Bosses var hostiles = playerRepo.Players.Where(p => p.Mobility == PvPStatics.MobilityFull && ( p.BotId == AIStatics.BimboBossBotId || p.BotId == AIStatics.DonnaBotId || p.BotId == AIStatics.FaebossBotId || p.BotId == AIStatics.MotorcycleGangLeaderBotId || p.BotId == AIStatics.MouseBimboBotId || p.BotId == AIStatics.MouseNerdBotId || p.BotId == AIStatics.FemaleRatBotId || p.BotId == AIStatics.MaleRatBotId || p.BotId == AIStatics.ValentineBotId)).ToList(); // Minibosses if (hostiles == null || hostiles.IsEmpty()) { hostiles = playerRepo.Players.Where(p => p.Mobility == PvPStatics.MobilityFull && ( p.BotId == AIStatics.MinibossPlushAngelId || p.BotId == AIStatics.MinibossArchangelId || p.BotId == AIStatics.MinibossArchdemonId || p.BotId == AIStatics.MinibossExchangeProfessorId || p.BotId == AIStatics.MinibossFiendishFarmhandId || p.BotId == AIStatics.MinibossGroundskeeperId || p.BotId == AIStatics.MinibossLazyLifeguardId || p.BotId == AIStatics.MinibossPopGoddessId || p.BotId == AIStatics.MinibossPossessedMaidId || p.BotId == AIStatics.MinibossSeamstressId || p.BotId == AIStatics.MinibossSororityMotherId)).ToList(); } rand = rand ?? new Random(); Player npcPlayer = null; if (hostiles != null && hostiles.Any()) { npcPlayer = hostiles[rand.Next(hostiles.Count())]; } // Psychopaths if (npcPlayer == null) { npcPlayer = playerRepo.Players.Where(p => p.Mobility == PvPStatics.MobilityFull && p.BotId == AIStatics.PsychopathBotId && p.Level <= player.Level) .OrderByDescending(p => p.Level).FirstOrDefault(); minLevel = 1; } if (npcPlayer == null) { return(null); } // Turn into form needed to attack if (npcPlayer.BotId == AIStatics.MouseBimboBotId) { targetFormSourceId = BossProcedures_Sisters.NerdSpellFormSourceId; } else if (npcPlayer.BotId == AIStatics.MouseNerdBotId) { targetFormSourceId = BossProcedures_Sisters.BimboSpellFormSourceId; } if (targetFormSourceId != -1) { CharacterPrankProcedures.TryAnimateTransform(player, targetFormSourceId); } // Move to same tile as NPC if (!Teleport(player, npcPlayer.dbLocationName, rand.Next(2) == 0)) { return(null); } var message = "The shop suddenly seems to connect with some evil force. A vortex opens and you are pulled in towards the source of the magic!"; if (attack && player.Level >= minLevel) { var spells = SkillProcedures.AvailableSkills(player, npcPlayer, true); if (spells != null && spells.Any()) { var spellList = spells.ToArray(); var spell = spellList[rand.Next(spellList.Count())]; // Note we do not apply the full gamut of preconditions of a manual attack present in the controller var attackMessage = AttackProcedures.AttackSequence(player, npcPlayer, spell); message = $"{message}<br />{attackMessage}"; } } return(message); }