Ejemplo n.º 1
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.GetRoleplay().LastCommand = ":soco";
                CombatManager.GetCombatType("fist").Execute(Session, null, true);
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                RoomUser Bot = Room.GetRoomUserManager().GetBotByName(Params[1]);

                if (Bot != null && Bot.GetBotRoleplay() != null)
                {
                    Session.GetRoleplay().LastCommand = ":soco " + Params[1];
                    CombatManager.GetCombatType("fist").ExecuteBot(Session, Bot.GetBotRoleplay());
                    return;
                }

                Session.GetRoleplay().LastCommand = ":soco " + Params[1];
                Session.SendWhisper("Ocorreu um erro ao tentar encontrar esse usuário, talvez ele esteja offline.", 1);
                return;
            }

            if (Room == null)
            {
                Session.GetRoleplay().LastCommand = ":soco " + Params[1];
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            if (TargetClient == null)
            {
                Session.GetRoleplay().LastCommand = ":soco " + Params[1];
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            if (TargetClient.GetHabbo() == null)
            {
                Session.GetRoleplay().LastCommand = ":soco " + Params[1];
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);

            if (TargetUser == null)
            {
                Session.GetRoleplay().LastCommand = ":soco " + Params[1];
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            Session.GetRoleplay().LastCommand = ":soco " + Params[1];
            CombatManager.GetCombatType("fist").Execute(Session, TargetClient);
        }
Ejemplo n.º 2
0
 private static void SaveDeployedBotsData(RoomUser RoleplayBot)
 {
     if (RoleplayBotManager.CachedRoleplayBots.ContainsKey(RoleplayBot.GetBotRoleplay().Id))
     {
         RoleplayBotManager.CachedRoleplayBots[RoleplayBot.GetBotRoleplay().Id] = RoleplayBot.GetBotRoleplay();
     }
     else
     {
         RoleplayBotManager.CachedRoleplayBots.TryAdd(RoleplayBot.GetBotRoleplay().Id, RoleplayBot.GetBotRoleplay());
     }
 }
Ejemplo n.º 3
0
        private bool HandleCombat(GameClient Client, RoomUser RoleplayBot)
        {
            int Damage = GetDamage(RoleplayBot);

            bool Died = false;

            if ((Client.GetRoleplay().CurHealth - Damage) <= 0)
            {
                Client.GetRoleplay().CurHealth = 0;
                RoleplayBot.Chat("*Swings at " + Client.GetHabbo().Username + ", knocking them out*", true, 6);
                Died = true;

                if (!this.FindNewTarget())
                {
                    return(this.AbortHandler());
                }
            }
            else
            {
                Client.GetRoleplay().CurHealth -= Damage;
                RoleplayBot.Chat("*Swings at " + Client.GetHabbo().Username + ", causing " + Damage + " damage*", true, 6);
            }

            RoleplayBot.GetBotRoleplay().CooldownManager.CreateCooldown("fist", 1000, 3);
            return(Died);
        }
Ejemplo n.º 4
0
        public bool HandleCombat(GameClient Client, RoomUser RoleplayBot)
        {
            int Damage = GetDamage(RoleplayBot);

            bool Died = false;

            if ((Client.GetRoleplay().CurHealth - Damage) <= 0)
            {
                Client.GetRoleplay().CurHealth = 0;
                RoleplayBot.Chat("*Dá um soco em " + Client.GetHabbo().Username + ", e mata-o*", true, 6);
                Died = true;

                lock (PlusEnvironment.GetGame().GetClientManager().GetClients)
                {
                    foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                    {
                        if (client == null || client.GetHabbo() == null)
                        {
                            continue;
                        }

                        client.SendMessage(new RoomNotificationComposer("staff_notice", "message", "[Notícia Urgente] " + Client.GetHabbo().Username + " matou com socos o cidadão " + Client.GetHabbo().Username + ", tome cuidado!"));
                    }
                }
            }
            else
            {
                Client.GetRoleplay().CurHealth -= Damage;
                RoleplayBot.Chat("*Dá um soco em " + Client.GetHabbo().Username + ", e causa " + Damage + " damage*", true, 6);
            }

            RoleplayBot.GetBotRoleplay().CooldownManager.CreateCooldown("fist", 1000, RoleplayBot.GetBotRoleplay().AttackInterval);
            return(Died);
        }
Ejemplo n.º 5
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            int BotId = Packet.PopInt();

            if (BotId == 0)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser BotUser = null;

            if (!Room.GetRoomUserManager().TryGetBot(BotId, out BotUser))
            {
                return;
            }

            if (Session.GetHabbo().Id != BotUser.BotData.ownerID && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override"))
            {
                Session.SendWhisper("Você só pode pegar seus próprios bots!");
                return;
            }

            if (BotUser.GetBotRoleplay() == null)
            {
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", BotId);
                    dbClient.RunQuery();
                }

                Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y));

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
            }
            else
            {
                Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y));

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                RoleplayBotManager.EjectDeployedBot(BotUser, Room, true);
            }
        }
Ejemplo n.º 6
0
        public static bool TransportDeployedBot(RoomUser RoleplayBot, int NewRoomID, bool SaveDataToCache = true)
        {
            if (RoleplayBot == null)
            {
                return(false);
            }
            if (RoleplayBot.GetBotRoleplay() == null)
            {
                return(false);
            }

            int BotsID = RoleplayBot.GetBotRoleplay().Id;

            try
            {
                Room NewRoom;
                if (RoleplayManager.GenerateRoom(NewRoomID, false) == null)
                {
                    return(false);
                }
                else
                {
                    NewRoom = RoleplayManager.GenerateRoom(NewRoomID, false);
                }


                RoleplayBotManager.EjectDeployedBot(RoleplayBot, RoleplayBot.GetRoom(), SaveDataToCache);
                RoleplayBotManager.DeployBotByID(BotsID, "default", NewRoom.Id);


                //Console.WriteLine("Transfered bot " + RoleplayBotManager.GetDeployedBotById(BotsID).GetBotRoleplay().Name + " to [" + NewRoom.Id + "] " + NewRoom.Name);
                return(true);
            }
            catch (Exception ex)
            {
                RoleplayBotManager.OnError(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 7
0
        public void ExecuteBot(GameClient Session, RoomUser Bot, Room Room)
        {
            if (!Bot.GetBotRoleplay().Jailed)
            {
                Session.SendWhisper("Desculpe, mas " + Bot.GetBotRoleplay().Name + " não está preso!", 1);
                return;
            }

            double Distance   = RoleplayManager.GetDistanceBetweenPoints2D(Session.GetRoomUser().Coordinate, Bot.Coordinate);
            Wanted Wanted     = RoleplayManager.WantedList.ContainsKey(Bot.GetBotRoleplay().Id) ? RoleplayManager.WantedList[Bot.GetBotRoleplay().Id] : null;
            int    WantedTime = Wanted == null ? 5 : Wanted.WantedLevel * 5;

            if (Distance <= 1)
            {
                // cba rn
            }
            else
            {
                Session.SendWhisper("Você deve se aproximar de " + Bot.GetBotRoleplay().Name + "para prendê-lo!", 1);
                return;
            }
        }
Ejemplo n.º 8
0
        /// <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;
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length < 3)
            {
                Session.SendWhisper("Comando inválido! Use :botacao <bot> <ação>");
                return;
            }

            string BotName   = Convert.ToString(Params[1]);
            string BotAction = Convert.ToString(Params[2]);

            RoomUser Bot = Room.GetRoomUserManager().GetBotByName(BotName);

            if (Bot == null)
            {
                Session.SendWhisper("Este bot é nulo", 1);
                return;
            }

            IBotHandler Handler = null;

            switch (BotAction.ToLower())
            {
            case "teleport":
            case "teleportar":
                object[] Parameters = { Bot.GetBotRoleplay().GetRandomTeleport() };
                Bot.GetBotRoleplay().StartHandler(Handlers.TELEPORT, out Handler, Parameters);
                break;

            default:
                Session.SendWhisper("Ação inválida!", 1);
                break;
            }

            return;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles the court trial case
        /// </summary>
        /// <param name="Self">Bot's roomuser instance</param>
        /// <param name="Room">Bot's room</param>
        public void HandleJuryCase(RoomUser Self, Room Room)
        {
            if (Self == null || Room == null)
            {
                return;
            }

            RoleplayBot Bot = Self.GetBotRoleplay();

            if (Bot != null && Bot.TimerManager != null && Bot.TimerManager.ActiveTimers != null && !Bot.TimerManager.ActiveTimers.ContainsKey("jury"))
            {
                Bot.TimerManager.CreateTimer("jury", this, 1000, true);
            }
            return;
        }
Ejemplo n.º 12
0
        private int GetDamage(RoomUser RoleplayBot)
        {
            CryptoRandom Random = new CryptoRandom();

            int Strength  = RoleplayBot.GetBotRoleplay().Strength;
            int MinDamage = (Strength - 4) <= 0 ? 1 : (Strength - 4);
            int MaxDamage = Strength + 4;

            // Lucky shot?
            if (Random.Next(0, 100) < 10)
            {
                MinDamage = Strength + 10;
                MaxDamage = MinDamage + 1;
            }

            return(Random.Next(MinDamage, MaxDamage));
        }
Ejemplo n.º 13
0
        private bool CanCombat(GameClient Client, RoomUser RoleplayBot)
        {
            Point Point;

            if (!this.GetAttackingPosition(out Point))
            {
                return(false);
            }

            double Distance = RoleplayManager.GetDistanceBetweenPoints2D(RoleplayBot.Coordinate, Point);

            if (Distance <= 1.5)
            {
                if (this.InteractingUser.GetRoomUser().IsWalking)
                {
                    int Odds  = new Random().Next(this.InteractingBot.MinOdds, this.InteractingBot.MaxOdds);
                    int Odds2 = new Random().Next(this.InteractingBot.MinOdds, this.InteractingBot.MaxOdds);

                    if (Odds == Odds2)
                    {
                        RoleplayBot.Chat("*Swings at " + Client.GetHabbo().Username + ", but misses*", true, 6);
                        RoleplayBot.GetBotRoleplay().CooldownManager.CreateCooldown("fist", 1000, 3);
                    }
                }

                int Rot = Rotation.Calculate(GetRoomUser().X, GetRoomUser().Y, Client.GetRoomUser().X, Client.GetRoomUser().Y);

                GetRoomUser().SetRot(Rot, false);
                GetRoomUser().UpdateNeeded = true;

                return(true);
            }


            return(false);
        }
Ejemplo n.º 14
0
        public bool RequestBuddy(string UserQuery)
        {
            int  userID;
            bool hasFQDisabled;

            #region Bot Friendship
            if (RoleplayBotManager.GetDeployedBotByName(UserQuery) != null)
            {
                RoomUser BotUser = RoleplayBotManager.GetDeployedBotByName(UserQuery);

                if (BotUser.GetBotRoleplay() == null)
                {
                    return(false);
                }

                if (GetClient().GetRoleplay().BotFriendShips.ContainsKey(BotUser.GetBotRoleplay().Id))
                {
                    GetClient().SendWhisper("Você já é amigo deste NPC!", 1);
                    return(false);
                }

                if (!BotUser.GetBotRoleplay().AddableBot)
                {
                    GetClient().SendWhisper("Você não pode adicionar este bot!", 1);
                    return(false);
                }

                BotUser.Chat("OK " + GetClient().GetHabbo().Username + ", eu adicionei você à lista de contatos do meu telefone!", true);
                GetClient().GetRoleplay().AddBotAsFriend(BotUser.GetBotRoleplay().Id);

                return(true);
            }
            #endregion

            if (GetClient().GetRoleplay().PhoneType <= 0)
            {
                GetClient().SendWhisper("Você não tem um telefone para fazer isso! Compre um na Loja de Celulares [Quarto ID: 25]", 1);
                return(false);
            }

            GameClient client = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(UserQuery);
            if (client == null)
            {
                DataRow Row = null;
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `id`,`block_newfriends` FROM `users` WHERE `username` = @query LIMIT 1");
                    dbClient.AddParameter("query", UserQuery.ToLower());
                    Row = dbClient.getRow();
                }

                if (Row == null)
                {
                    return(false);
                }

                userID        = Convert.ToInt32(Row["id"]);
                hasFQDisabled = PlusEnvironment.EnumToBool(Row["block_newfriends"].ToString());
            }
            else
            {
                userID        = client.GetHabbo().Id;
                hasFQDisabled = client.GetHabbo().AllowFriendRequests;
            }

            if (hasFQDisabled)
            {
                GetClient().SendMessage(new MessengerErrorComposer(39, 3));
                return(false);
            }

            int ToId = userID;
            if (RequestExists(ToId))
            {
                return(true);
            }

            int PhoneType = 0;
            if (client == null || client.GetHabbo() == null || client.GetRoleplay() == null)
            {
                using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `phone` FROM `rp_stats` WHERE `id` = @userid LIMIT 1");
                    dbClient.AddParameter("userid", userID);
                    PhoneType = dbClient.getInteger();
                }
            }
            else
            {
                PhoneType = client.GetRoleplay().PhoneType;
            }

            if (PhoneType <= 0)
            {
                GetClient().SendWhisper("Desculpe, " + UserQuery + " não tem um telefone!", 1);
                return(false);
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("REPLACE INTO `messenger_requests` (`from_id`,`to_id`) VALUES ('" + _userId + "','" + ToId + "')");
            }

            GameClient ToUser = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(ToId);
            if (ToUser == null || ToUser.GetHabbo() == null)
            {
                return(true);
            }

            MessengerRequest Request = new MessengerRequest(ToId, _userId, PlusEnvironment.GetGame().GetClientManager().GetNameById(_userId));

            ToUser.GetHabbo().GetMessenger().OnNewRequest(_userId);

            using (UserCache ThisUser = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(_userId))
            {
                if (ThisUser != null)
                {
                    ToUser.SendMessage(new NewBuddyRequestComposer(ThisUser));
                }
            }

            _requests.Add(ToId, Request);
            return(true);
        }
Ejemplo n.º 15
0
        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
            }
        }
Ejemplo n.º 16
0
        private void WriteUser(RoomUser User)
        {
            if (!User.IsPet && !User.IsBot)
            {
                Habbo Habbo = User.GetClient().GetHabbo();
                Group Group = GroupManager.GetJob(User.GetClient().GetRoleplay().JobId);

                if (Habbo.PetId == 0)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(Habbo.Look);
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);

                    base.WriteInteger(0); //2 for user, 4 for bot.
                    base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot.
                    base.WriteString(Habbo.Gender.ToLower());

                    if (Group != null)
                    {
                        base.WriteInteger(Group.Id);
                        base.WriteInteger(0);
                        base.WriteString(Group.Name);
                    }
                    else
                    {
                        base.WriteInteger(0);
                        base.WriteInteger(0);
                        base.WriteString("");
                    }

                    base.WriteString("");                                  //Whats this?
                    base.WriteInteger(Habbo.GetStats().AchievementPoints); //Achievement score
                    base.WriteBoolean(false);                              //Builders club?
                }
                else if (Habbo.PetId > 0 && Habbo.PetId != 100)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString((Habbo.PetFigure == null) ? PetFigureForType(Habbo) : Habbo.PetFigure);

                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger(2);             //Pet.

                    base.WriteInteger(Habbo.PetId);   //pet type.
                    base.WriteInteger(Habbo.Id);      //UserId of the owner.
                    base.WriteString(Habbo.Username); //Username of the owner.
                    base.WriteInteger(1);
                    base.WriteBoolean(false);         //Has saddle.
                    base.WriteBoolean(false);         //Is someone riding this horse?
                    base.WriteInteger(0);
                    base.WriteInteger(0);
                    base.WriteString("");
                }
                else if (Habbo.PetId > 0 && Habbo.PetId == 100)
                {
                    base.WriteInteger(Habbo.Id);
                    base.WriteString(Habbo.Username);
                    base.WriteString(Habbo.Motto);
                    base.WriteString(Habbo.Look.ToLower());
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger(4);

                    base.WriteString(Habbo.Gender.ToLower()); // ?
                    base.WriteInteger(Habbo.Id);              //Owner Id
                    base.WriteString(Habbo.Username);         // Owner name
                    base.WriteInteger(0);                     //Action Count
                }
            }
            else if (User.IsPet)
            {
                base.WriteInteger(User.BotAI.BaseId);
                base.WriteString(User.BotData.Name);
                base.WriteString(User.BotData.Motto);

                //base.WriteString("26 30 ffffff 5 3 302 4 2 201 11 1 102 12 0 -1 28 4 401 24");
                base.WriteString(User.BotData.Look.ToLower() + ((User.PetData.Saddle > 0) ? " 3 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 4 " + User.PetData.Saddle + " 0" : " 2 2 " + User.PetData.PetHair + " " + User.PetData.HairDye + " 3 " + User.PetData.PetHair + " " + User.PetData.HairDye + ""));

                base.WriteInteger(User.VirtualId);
                base.WriteInteger(User.X);
                base.WriteInteger(User.Y);
                base.WriteDouble(User.Z);
                base.WriteInteger(0);
                base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4);
                base.WriteInteger(User.PetData.Type);
                base.WriteInteger(User.PetData.OwnerId);  // userid
                base.WriteString(User.PetData.OwnerName); // username
                base.WriteInteger(1);
                base.WriteBoolean(User.PetData.Saddle > 0);
                base.WriteBoolean(User.RidingHorse);
                base.WriteInteger(0);
                base.WriteInteger(0);
                base.WriteString("");
            }
            else if (User.IsBot)
            {
                if (User.IsRoleplayBot)
                {
                    string[] Outfit = User.GetBotRoleplay().GetOutFit();

                    #region BOT Profile Type 1
                    base.WriteInteger(User.BotAI.BaseId + 1000000);
                    base.WriteString(User.GetBotRoleplay().Name);
                    base.WriteString(Outfit[1]);
                    base.WriteString(Outfit[0]);
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);

                    base.WriteInteger(0); //2 for user, 4 for bot.
                    base.WriteInteger(1); //1 for user, 2 for pet, 3 for bot.
                    base.WriteString(User.GetBotRoleplay().Gender.ToLower());

                    Group BotGroup = GroupManager.GetJob(User.GetBotRoleplay().Corporation);
                    if (BotGroup != null)
                    {
                        base.WriteInteger(BotGroup.Id);
                        base.WriteInteger(0);
                        base.WriteString(BotGroup.Name);
                    }
                    else
                    {
                        base.WriteInteger(0);
                        base.WriteInteger(0);
                        base.WriteString("");
                    }

                    base.WriteString("");     //Whats this?
                    base.WriteInteger(0);     //Achievement score
                    base.WriteBoolean(false); //Builders club?
                    #endregion
                }
                else
                {
                    #region BOT Profile Type 2
                    base.WriteInteger(User.BotAI.BaseId);
                    base.WriteString(User.BotData.Name);
                    base.WriteString(User.BotData.Motto);
                    base.WriteString(User.BotData.Look.ToLower());
                    base.WriteInteger(User.VirtualId);
                    base.WriteInteger(User.X);
                    base.WriteInteger(User.Y);
                    base.WriteDouble(User.Z);
                    base.WriteInteger(0);
                    base.WriteInteger((User.BotData.AiType == BotAIType.PET) ? 2 : 4);

                    base.WriteString(User.BotData.Gender.ToLower());                         // ?
                    base.WriteInteger(User.BotData.ownerID);                                 //Owner Id
                    base.WriteString(PlusEnvironment.GetUsernameById(User.BotData.ownerID)); // Owner name
                    base.WriteInteger(5);                                                    //Action Count
                    base.WriteShort(1);                                                      //Copy looks
                    base.WriteShort(2);                                                      //Setup speech
                    base.WriteShort(3);                                                      //Relax
                    base.WriteShort(4);                                                      //Dance
                    base.WriteShort(5);                                                      //Change name
                    #endregion
                }
            }
        }
Ejemplo n.º 17
0
        public void ExecuteBot(GameClient Session, RoomUser Bot, Room Room)
        {
            if (!Bot.GetBotRoleplay().Dead)
            {
                Session.SendWhisper("Desculpe, mas " + Bot.GetBotRoleplay().Name + " não está morto!", 1);
                return;
            }

            double Distance = RoleplayManager.GetDistanceBetweenPoints2D(Session.GetRoomUser().Coordinate, Bot.Coordinate);

            if (Distance <= 5)
            {
                if (Bot.GetBotRoleplay().TimerManager.ActiveTimers.ContainsKey("botdeath"))
                {
                    Bot.GetBotRoleplay().TimerManager.ActiveTimers["botdeath"].EndTimer();
                }

                if (Bot.Frozen)
                {
                    Bot.Frozen = false;
                }

                Session.Shout("*Revive " + Bot.GetBotRoleplay().Name + " da cama de hospital*", 4);
                RoleplayManager.SpawnChairs(null, "val14_wchair", Bot);

                Bot.GetBotRoleplay().Dead = false;
                Room.SendMessage(new UsersComposer(Bot));

                if (Bot.GetBotRoleplay().RoamBot)
                {
                    Bot.GetBotRoleplay().MoveRandomly();
                }

                if (Session.GetRoleplay().LastKilled != (RoleplayBotManager.BotFriendMultiplyer + Bot.GetBotRoleplay().Id))
                {
                    int Amount = 0;

                    if (Session.GetRoleplay().Level <= 5)
                    {
                        Amount = 1;
                    }
                    else if (Session.GetRoleplay().Level > 5 && Session.GetRoleplay().Level <= 10)
                    {
                        Amount = 2;
                    }
                    else if (Session.GetRoleplay().Level > 10 && Session.GetRoleplay().Level <= 15)
                    {
                        Amount = 3;
                    }
                    else
                    {
                        Amount = 4;
                    }

                    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Discharging", 1);

                    Session.GetRoleplay().LastKilled = (RoleplayBotManager.BotFriendMultiplyer + Bot.GetBotRoleplay().Id);

                    if (!Room.HitEnabled && !Room.ShootEnabled)
                    {
                        Session.GetHabbo().Credits += Amount;
                        Session.GetHabbo().UpdateCreditsBalance();
                        Session.SendWhisper("Você ganhou R$" + Amount + " extra por reviver " + Bot.GetBotRoleplay().Name + "!", 1);
                    }
                }
                return;
            }
            else
            {
                Session.SendWhisper("Você deve se aproximar de " + Bot.GetBotRoleplay().Name + " para revive-lo!", 1);
                return;
            }
        }
Ejemplo n.º 18
0
        public void Execute(GameClient Session, Rooms.Room Room, string[] Params)
        {
            #region Conditions
            if (Params.Length == 1)
            {
                Session.SendWhisper("Opa, você esqueceu de inserir um nome de usuário!", 1);
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                RoomUser Bot = Room.GetRoomUserManager().GetBotByName(Params[1]);

                if (Bot != null && Bot.GetBotRoleplay() != null)
                {
                    ExecuteBot(Session, Bot, Room);
                    return;
                }

                Session.SendWhisper("Ocorreu um erro ao tentar encontrar esse usuário, talvez ele esteja offline.", 1);
                return;
            }

            RoomUser RoomUser   = Session.GetRoomUser();
            RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);
            if (TargetUser == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja online ou nesta sala.", 1);
                return;
            }

            if (!GroupManager.HasJobCommand(Session, "discharge"))
            {
                Session.SendWhisper("Somente um trabalhador do Hospital pode usar esse comando!", 1);
                return;
            }

            if (!Session.GetRoleplay().IsWorking)
            {
                Session.SendWhisper("Você deve estar trabalhando para usar esse comando!", 1);
                return;
            }

            if (!TargetClient.GetRoleplay().IsDead)
            {
                Session.SendWhisper("Você não pode reviver alguém que não está morto!", 1);
                return;
            }
            #endregion

            #region Execute
            double Distance = RoleplayManager.GetDistanceBetweenPoints2D(Session.GetRoomUser().Coordinate, TargetClient.GetRoomUser().Coordinate);

            if (Distance <= 5)
            {
                Session.Shout("*Revive " + TargetClient.GetHabbo().Username + " da cama de hospital*", 4);
                TargetClient.GetRoleplay().IsDead       = false;
                TargetClient.GetRoleplay().DeadTimeLeft = 0;

                if (Session.GetRoleplay().LastKilled != TargetClient.GetHabbo().Id)
                {
                    int Amount = 0;

                    if (Session.GetRoleplay().Level <= 5)
                    {
                        Amount = 1;
                    }
                    else if (Session.GetRoleplay().Level > 5 && Session.GetRoleplay().Level <= 10)
                    {
                        Amount = 2;
                    }
                    else if (Session.GetRoleplay().Level > 10 && Session.GetRoleplay().Level <= 15)
                    {
                        Amount = 3;
                    }
                    else
                    {
                        Amount = 4;
                    }

                    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Discharging", 1);

                    Session.GetRoleplay().LastKilled = TargetClient.GetHabbo().Id;

                    if (!Room.HitEnabled && !Room.ShootEnabled)
                    {
                        Session.GetHabbo().Credits += Amount;
                        Session.GetHabbo().UpdateCreditsBalance();
                        Session.SendWhisper("Você ganhou R$" + Amount + " extra por reviver " + TargetClient.GetHabbo().Username + "!", 1);
                    }
                }
                return;
            }
            else
            {
                Session.SendWhisper("Você deve se aproximar desse cidadão para revive-lo!", 1);
                return;
            }
            #endregion
        }