/// <summary> /// Gets the bots outfit /// </summary> /// <returns></returns> public string[] GetOutFit() { string[] Outfit = new string[2]; Outfit[0] = this.Figure; Outfit[1] = this.Motto; RoomUser User = RoleplayBotManager.GetDeployedBotById(this.Id); if (this.Dead) { if (this.Gender.ToLower() == "m") { Outfit[0] = RoleplayManager.SplitFigure(this.Figure, "lg-280-83.ch-215-83"); } if (this.Gender.ToLower() == "f") { Outfit[0] = RoleplayManager.SplitFigure(this.Figure, "lg-710-83.ch-635-83"); } Outfit[1] = "[MORTO] Paciente do Hospital"; } else if (this.Jailed) { Random Random = new Random(); int PrisonNumber = Random.Next(10000, 100000); if (Gender.ToLower() == "m") { Outfit[0] = RoleplayManager.SplitFigure(this.Figure, "lg-280-1323.sh-3016-92.ch-220-1323"); } if (Gender.ToLower() == "f") { Outfit[0] = RoleplayManager.SplitFigure(this.Figure, "lg-710-1323.sh-3016-92.ch-3067-1323"); } Outfit[1] = "[PRESO] ID do Criminoso [#" + PrisonNumber + "]"; } else if (User != null && User.GetBotRoleplayAI() != null && User.GetBotRoleplayAI().OnDuty) { if (this.WorkUniform != "Nenhum") { Outfit[0] = RoleplayManager.SplitFigure(this.Figure, this.WorkUniform); } Outfit[1] = "[TRABALHANDO] [" + GroupManager.GetJob(this.Corporation).Name + "]"; } return(Outfit); }
public static bool EjectDeployedBot(RoomUser RoleplayBot, Room Room, bool SaveDataToCache = false) { #region Conditions & null checks if (RoleplayBot == null) { return(false); } if (RoleplayBot.GetBotRoleplay() == null) { return(false); } if (RoleplayBot.GetBotRoleplayAI() == null) { return(false); } if (Room == null) { return(false); } if (Room.GetGameMap() == null) { return(false); } if (!RoleplayBotManager.DeployedRoleplayBots.ContainsKey(RoleplayBot.GetBotRoleplay().Id)) { return(false); } #endregion #region Additional null checks if (RoleplayBotManager.DeployedRoleplayBots[RoleplayBot.GetBotRoleplay().Id] == null) { return(false); } if (RoleplayBotManager.DeployedRoleplayBots[RoleplayBot.GetBotRoleplay().Id].GetBotRoleplay() == null) { return(false); } #endregion #region End any ongoing actions / timers #endregion #region Save to cache if (SaveDataToCache) { RoleplayBotManager.SaveDeployedBotsData(RoleplayBot); } #endregion RoleplayBotManager.DeployedRoleplayBots.TryRemove(RoleplayBot.GetBotRoleplay().Id, out RoleplayBot); Room.GetRoomUserManager().RemoveBot(RoleplayBot.VirtualId, false); RoleplayBot.GetBotRoleplay().Invisible = true; return(true); }
/// <summary> /// Sends a message to a bot /// </summary> /// <param name="BotId"></param> /// <param name="Message"></param> internal void MessageBot(int BotId, string Message) { var serverMessage = new NewConsoleMessageComposer(Client.GetHabbo().Id, Message); serverMessage.WriteInteger(BotId); //userid serverMessage.WriteString(Client.GetHabbo().Username); serverMessage.WriteInteger(0); RoomUser Bot = RoleplayBotManager.GetDeployedBotById(BotId - RoleplayBotManager.BotFriendMultiplyer); Bot.GetBotRoleplayAI().OnMessaged(Client, Message); }
/// <summary> /// Handles teleporting /// </summary> /// <param name="Self">Bot's roomuser instance</param> /// <param name="Room">Bot's room</param> public void HandleTeleporting(RoomUser Self, Room Room) { if (Self == null || Room == null) { return; } RoleplayBot Bot = Self.GetBotRoleplay(); if (!Bot.Teleported) { if (Bot.TeleporterEntering == null) { Bot.Teleporting = false; return; } if (Self.Coordinate == Bot.TeleporterEntering.Coordinate) { // Lets teleport the bot! Self.GetBotRoleplayAI().GetRoom().SendMessage(new UserRemoveComposer(Self.VirtualId)); Bot.Teleported = true; Bot.X = Bot.TeleporterExiting.GetX; Bot.Y = Bot.TeleporterExiting.GetY; Bot.SpawnId = Bot.TeleporterExiting.RoomId; Bot.LastTeleport = Bot.TeleporterExiting; Room TeleRoom = RoleplayManager.GenerateRoom(Bot.TeleporterExiting.RoomId); RoleplayBotManager.TransportDeployedBot(Self, TeleRoom.Id, true); if (Bot != null && Bot.TimerManager != null && Bot.TimerManager.ActiveTimers != null && Bot.TimerManager.ActiveTimers.ContainsKey("teleport")) { Bot.TimerManager.ActiveTimers["teleport"].EndTimer(); if (Bot.UserAttacking != null && Bot.UserAttacking.GetHabbo() != null) { Bot.TimerManager.CreateTimer("attack", this, 10, true, Bot.UserAttacking.GetHabbo().Id); } else { Bot.MoveRandomly(); } } } else { // Lets make the bot walk to the teleport! Self.MoveTo(Bot.TeleporterEntering.GetX, Bot.TeleporterEntering.GetY); } } return; }
/// <summary> /// Executes this type of combat on a Bot /// </summary> public void ExecuteBot(GameClient Client, RoleplayBot Bot = null) { if (!this.CanCombat(Client, null, Bot)) { return; } int Damage = this.GetDamage(Client, null, Bot); RoomUser BotUser = Client.GetHabbo().CurrentRoom.GetRoomUserManager().GetBotByName(Bot.Name); if (BotUser.GetRoom() == null) { Client.SendWhisper("Este usuário não foi encontrado nesta sala!", 1); return; } if (BotUser == null) { Client.SendWhisper("Este usuário não foi encontrado nesta sala!", 1); return; } if (BotUser.GetRoom() != Client.GetRoomUser().GetRoom()) { Client.SendWhisper("Este usuário não foi encontrado nesta sala!", 1); return; } // If about to die bool Died = false; if (Bot.CurHealth - Damage <= 0) { Died = true; } else { RoleplayManager.Shout(Client, "*Dá um soco em " + Bot.Name + ", causando " + Damage + " damage*", 6); } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Client, "ACH_Punching", 1); PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Client, QuestType.PUNCH_USER, 1); if ((Client.GetRoleplay().CurEnergy - 2) <= 0) { Client.GetRoleplay().CurEnergy = 0; } else { Client.GetRoleplay().CurEnergy -= 2; } Client.GetRoleplay().Punches++; if (Bot.CurHealth - Damage <= 0) { Bot.CurHealth = 0; } else { Bot.CurHealth -= Damage; } if (!Died) { BotUser.Chat("*[" + Bot.CurHealth + "/" + Bot.MaxHealth + "]*", true, 3); BotUser.GetBotRoleplayAI().OnAttacked(Client); } else { BotUser.GetBotRoleplayAI().OnDeath(Client); } Client.GetRoleplay().CooldownManager.CreateCooldown("fist", 1000, (Client.GetRoleplay().Game == null ? (Client.GetRoleplay().Class.ToLower() == "fighter" ? RoleplayManager.HitCooldown : RoleplayManager.DefaultHitCooldown) : RoleplayManager.HitCooldownInEvent)); }