/// <summary> /// Gets the linked teleport for a target teleport /// </summary> /// <param name="EnteringTeleport"></param> /// <returns></returns> public Item GetLinkedTeleport(Item EnteringTeleport) { int LinkedTele = ItemTeleporterFinder.GetLinkedTele(EnteringTeleport.Id, this.DRoom); int TeleRoomId = ItemTeleporterFinder.GetTeleRoomId(LinkedTele, this.DRoom); if (TeleRoomId <= 0) { return(null); } Room NewRoom = RoleplayManager.GenerateRoom(TeleRoomId); if (NewRoom == null) { return(null); } if (NewRoom.GetRoomItemHandler() == null) { return(null); } Item Teleport = NewRoom.GetRoomItemHandler().GetItem(LinkedTele); return(Teleport); }
/// <summary> /// Enters a teleport/arrow /// </summary> /// <param name="Self">Bot's roomuser instance</param> /// <param name="Room">Bot's room</param> /// <param name="Params">Teleport data</param> public void StartTeleporting(RoomUser Self, Room Room, object[] Params) { object[] Bits = Params; int ItemX = Convert.ToInt32(Bits[0]); int ItemY = Convert.ToInt32(Bits[1]); int LastRoomId = Convert.ToInt32(Bits[2]); int NextRoomId = Convert.ToInt32(Bits[3]); int LastTeleId = Convert.ToInt32(Bits[4]); int NextTeleId = Convert.ToInt32(Bits[5]); TeleporterEntering = Room.GetRoomItemHandler().GetItem(LastTeleId); if (TeleporterEntering == null) { return; } int LinkedTele = ItemTeleporterFinder.GetLinkedTele(TeleporterEntering.Id, Room); int TeleRoomId = ItemTeleporterFinder.GetTeleRoomId(LinkedTele, Room); Room NewRoom = HabboRoleplay.Misc.RoleplayManager.GenerateRoom(TeleRoomId); if (NewRoom == null) { TeleporterExiting = null; return; } if (NewRoom.GetRoomItemHandler() == null) { TeleporterExiting = null; return; } if (NewRoom.GetRoomItemHandler().GetItem(LinkedTele) == null) { TeleporterExiting = null; return; } TeleporterExiting = NewRoom.GetRoomItemHandler().GetItem(LinkedTele); Teleporting = true; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Opa, você esqueceu de entrar em um comando!", 1); return; } string Command = Convert.ToString(Params[1]); switch (Command) { #region follow case "follow": case "followme": case "mesiga": { RoomUser Target = null; foreach (RoomUser Bot in Room.GetRoomUserManager()._bots.Values) { if (!Bot.IsRoleplayBot) { continue; } Target = Bot; } if (Target == null) { Session.SendWhisper("Nenhum BOT para interagir foi encontrado, desculpe!"); return; } Target.GetBotRoleplay().UserFollowing = Session; Target.GetBotRoleplay().Following = true; Session.Shout("*Avisa " + Target.GetBotRoleplay().Name + " para me seguir"); return; } break; #endregion #region attack case "attack": case "attackme": case "fight": case "fightme": case "atacar": { RoomUser Target = null; foreach (RoomUser Bot in Room.GetRoomUserManager()._bots.Values) { if (!Bot.IsRoleplayBot) { continue; } Target = Bot; } if (Target == null) { Session.SendWhisper("Nenhum BOT para interagir foi encontrado, desculpe!"); return; } Target.GetBotRoleplay().UserAttacking = Session; Target.GetBotRoleplay().Roaming = false; Target.GetBotRoleplay().Attacking = true; Session.Shout("*Avisa " + Target.GetBotRoleplay().Name + " para me atacar"); return; } break; #endregion #region tele case "randomtele": case "tele": { RoomUser Target = null; Item Randtele = null; foreach (RoomUser Bot in Room.GetRoomUserManager()._bots.Values) { if (!Bot.IsRoleplayBot) { continue; } Target = Bot; } if (Target == null) { Session.SendWhisper("Nenhum BOT para interagir foi encontrado, desculpe!"); return; } foreach (Item Item in Room.GetRoomItemHandler().GetFloor.ToList()) { if (Item == null || Item.GetBaseItem() == null) { continue; } if (Item.GetBaseItem().InteractionType != InteractionType.ARROW) { continue; } Randtele = Item; } if (Randtele == null) { Session.SendWhisper("Não foi encontrado TELEPORTE para interagir, desculpe!"); return; } Target.GetBotRoleplay().TeleporterEntering = Randtele; int LinkedTele = ItemTeleporterFinder.GetLinkedTele(Target.GetBotRoleplay().TeleporterEntering.Id, Room); int TeleRoomId = ItemTeleporterFinder.GetTeleRoomId(LinkedTele, Room); Room NewRoom = RoleplayManager.GenerateRoom(TeleRoomId); Target.GetBotRoleplay().TeleporterExiting = NewRoom.GetRoomItemHandler().GetItem(LinkedTele); Target.GetBotRoleplay().Teleporting = true; Session.Shout("*Avisa " + Target.GetBotRoleplay().Name + " para pisar na seta*"); return; } break; #endregion } }
/// <summary> /// Begins chasing the client /// </summary> public override void Execute() { try { if (base.CachedBot == null || base.CachedBot.DRoomUser.GetBotRoleplay() == null || base.CachedBot.DRoom == null) { this.StopAttacking(); return; } if (GetAttacking() == null || GetAttacking().GetHabbo() == null) { this.StopAttacking(); return; } if (GetAttacking().GetRoomUser() == null && GetAttacking().GetHabbo().CurrentRoomId != 0) { return; } if (GetAttacking() != null && GetAttacking().GetHabbo() != null && GetAttacking().GetRoleplay() != null) { if (GetAttacking().GetRoleplay().IsDead) { base.CachedBot.DRoomUser.GetBotRoleplay().UserAttacking = null; this.StopAttacking(); return; } } TimeCount++; // Waits 1.5 seconds before chasing the user down if (TimeCount < 150) { return; } #region Chase user through rooms if (GetAttacking().GetHabbo().CurrentRoom != base.CachedBot.DRoom) { if (base.CachedBot.DRoomUser.GetBotRoleplay().AIType == RoleplayBotAIType.MAFIAWARS) { this.StopAttacking(); return; } List <Item> AllArrows = base.CachedBot.DRoom.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == InteractionType.ARROW).ToList(); List <Item> PossibleArrows = AllArrows.Where(x => ItemTeleporterFinder.GetTeleRoomId(ItemTeleporterFinder.GetLinkedTele(x.Id, base.CachedBot.DRoom), base.CachedBot.DRoom) == GetAttacking().GetRoomUser().RoomId).ToList(); if (PossibleArrows.Count <= 0) { if (GetAttacking() != null) { base.CachedBot.DRoomUser.Chat("Merda! Você conseguiu, eu vou te pegar na próxima vez " + GetAttacking().GetHabbo().Username + "!", true, 4); } base.CachedBot.DRoomUser.GetBotRoleplay().UserAttacking = null; this.StopAttacking(); return; } Item RandTele = PossibleArrows.FirstOrDefault(); int LinkedTeleId = ItemTeleporterFinder.GetLinkedTele(RandTele.Id, base.CachedBot.DRoom); int LinkedTeleRoomId = ItemTeleporterFinder.GetTeleRoomId(LinkedTeleId, base.CachedBot.DRoom); Room LinkedRoom = RoleplayManager.GenerateRoom(LinkedTeleRoomId); //object[] Params = { RandTele, LinkedTeleId, LinkedTeleRoomId, LinkedRoom }; object[] Params = { CachedBot, RandTele }; if (LinkedRoom.HitEnabled) { base.CachedBot.DRoomUser.GetBotRoleplay().TimerManager.CreateTimer("teleport", CachedBot, 100, true, Params); } else { if (GetAttacking() != null) { base.CachedBot.DRoomUser.Chat("Merda! Você conseguiu, eu vou te pegar na próxima vez" + GetAttacking().GetHabbo().Username + "!", true, 4); } base.CachedBot.DRoomUser.GetBotRoleplay().UserAttacking = null; } this.StopAttacking(); return; } else #endregion { if (CanCombat(GetAttacking(), base.CachedBot.DRoomUser) && !base.CachedBot.DRoomUser.GetBotRoleplay().TryGetCooldown("fist")) { if (HandleCombat(GetAttacking(), base.CachedBot.DRoomUser)) { this.StopAttacking(); return; } } if (!base.CachedBot.DRoomUser.GetBotRoleplay().TryGetCooldown("fist")) { base.CachedBot.DRoomUser.MoveTo(GetAttacking().GetRoomUser().Coordinate); } else { base.CachedBot.DRoomUser.MoveTo(base.CachedBot.DRoom.GetGameMap().getRandomWalkableSquare()); } return; } } catch { this.StopAttacking(); } }