Example #1
0
        /// <summary>
        /// Gets the coins from the users dead body
        /// </summary>
        public int GetCoins(GameClient TargetClient, RoleplayBot Bot = null)
        {
            if (TargetClient != null && TargetClient.GetHabbo() != null)
            {
                if (TargetClient.GetHabbo().VIPRank > 1)
                {
                    return(0);
                }

                if (TargetClient.GetHabbo().Credits < 3)
                {
                    return(0);
                }
            }

            if (Bot != null)
            {
                int MinMoney = Convert.ToInt32(RoleplayData.GetData("bots", "minmoney"));
                int MaxMoney = Convert.ToInt32(RoleplayData.GetData("bots", "maxmoney"));

                if (MaxMoney == 0)
                {
                    return(0);
                }

                CryptoRandom Random = new CryptoRandom();
                return(Random.Next(MinMoney, (MaxMoney + 1)));
            }

            return(TargetClient.GetHabbo().Credits / 3);
        }
        public HabboUserBadgesComposer(Habbo Habbo, RoleplayBot Bot = null)
            : base(ServerPacketHeader.HabboUserBadgesMessageComposer)
        {
            if (Bot != null)
            {
                base.WriteInteger(Bot.Id + 1000000);
                base.WriteInteger(1);
                base.WriteInteger(1);
                base.WriteString("BOT");
            }
            else
            {
                base.WriteInteger(Habbo.Id);
                base.WriteInteger(Habbo.GetBadgeComponent().EquippedCount);

                foreach (Badge Badge in Habbo.GetBadgeComponent().GetBadges().ToList())
                {
                    if (Badge.Slot <= 0)
                    {
                        continue;
                    }

                    base.WriteInteger(Badge.Slot);
                    base.WriteString(Badge.Code);
                }
            }
        }
Example #3
0
 public PickupDeliveryTimer(string Type, RoleplayBot CachedBot, int Time, bool Forever, object[] Params)
     : base(Type, CachedBot, Time, Forever, Params)
 {
     TimeCount        = 0;
     TimeCount2       = 0;
     this.PickedCrate = false;
 }
Example #4
0
 public DeliveryWaitTimer(string Type, RoleplayBot CachedBot, int Time, bool Forever, object[] Params)
     : base(Type, CachedBot, Time, Forever, Params)
 {
     TimeCount            = 0;
     TimeCount2           = 0;
     this.DeliveryArrived = false;
 }
Example #5
0
        public void WriteBotData(RoleplayBot Bot)
        {
            int FakeBotId = Bot.Id + 1000000;

            base.WriteInteger(FakeBotId);
            base.WriteInteger(3);

            base.WriteInteger(1);
            base.WriteInteger(1);
            base.WriteInteger(FakeBotId);
            base.WriteString("Casado(a) com: Ninguém");
            base.WriteString(Bot.Figure);

            base.WriteInteger(2);
            base.WriteInteger(1);
            base.WriteInteger(FakeBotId);
            base.WriteString("Level: " + Bot.Level + "/" + RoleplayManager.LevelCap);
            base.WriteString(Bot.Figure);

            base.WriteInteger(3);
            base.WriteInteger(1);
            base.WriteInteger(FakeBotId);
            base.WriteString("Força: " + Bot.Strength + "/" + (Bot.Strength > 20 ? Bot.Strength : 20));
            base.WriteString(Bot.Figure);
        }
Example #6
0
        /// <summary>
        /// Ontick for Roleplay Bots
        /// </summary>
        public override void Execute()
        {
            try
            {
                #region Available Bot Timer Manager
                foreach (RoomUser RoleplayBot in RoleplayBotManager.DeployedRoleplayBots.Values)
                {
                    if (RoleplayBot == null)
                    {
                        continue;
                    }

                    if (RoleplayBot.GetBotRoleplay() == null)
                    {
                        continue;
                    }

                    if (!RoleplayBot.GetBotRoleplay().Deployed)
                    {
                        continue;
                    }

                    RoleplayBot.GetBotRoleplayAI().RandomSpeechTick();
                    RoleplayBot.GetBotRoleplayAI().OnTimerTick();
                }
                #endregion
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Example #7
0
        public static bool EjectRoomsDeployedBots(Room Room)
        {
            try
            {
                foreach (RoomUser RoleplayBot in RoleplayBotManager.DeployedRoleplayBots.Values)
                {
                    if (RoleplayBot == null)
                    {
                        continue;
                    }
                    if (RoleplayBot.GetRoom() == null)
                    {
                        continue;
                    }

                    if (RoleplayBot.GetRoom() == Room)
                    {
                        RoleplayBotManager.EjectDeployedBot(RoleplayBot, RoleplayBot.GetRoom());
                    }

                    return(true);
                }
            }
            catch (Exception ex)
            {
                RoleplayBotManager.OnError(ex.Message);
            }

            return(false);
        }
Example #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 public BotCooldown(string Type, RoleplayBot CachedBot, int Time, int Amount)
 {
     this.Type          = Type;
     this.Bot           = CachedBot;
     this.Time          = Time;
     this.Amount        = Amount;
     this.CooldownTimer = new Timer(Finished, null, Time, Time);
 }
Example #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 public BotRoleplayTimer(string Type, RoleplayBot CachedBot, int Time, bool Forever, object[] Params)
 {
     this.Type      = Type;
     this.Time      = Time;
     this.Forever   = Forever;
     this.CachedBot = CachedBot;
     this.Params    = Params;
     this.Timer     = new Timer(Finished, null, Time, Time);
 }
Example #10
0
        /// <summary>
        /// Returns a new timer based on the type
        /// </summary>
        /// <param name="TypeOfTimer"></param>
        private BotRoleplayTimer GetTimerFromType(string TypeOfTimer, RoleplayBot CachedBot, int Time, bool Forever, object[] Params)
        {
            switch (TypeOfTimer)
            {
            // Default Bots
            case "startwork":
            case "trabalhar":
                return(new StartWorkTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            case "stopwork":
            case "ptrabalhar":
                return(new StopWorkTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            // Hospital Bots
            case "discharge":
            case "reviver":
                return(new DischargeTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            // Serving Bots
            case "serving":
            case "serve":
            case "servir":
                return(new ServingTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            // Gun Store Bots
            case "deliverywait":
                return(new DeliveryWaitTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            case "pickupdelivery":
                return(new PickupDeliveryTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            // Delivery Bots
            case "startdelivery":
                return(new StartDeliveryTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            case "stopdelivery":
                return(new StopDeliveryTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            // Thug Bots
            case "attack":
            case "atacar":
                return(new AttackTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            case "botdeath":
                return(new BotDeathTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            // Jury Bots
            case "jury":
            case "juiz":
                return(new JuryTimer(TypeOfTimer, CachedBot, Time, Forever, Params));

            default:
                return(null);
            }
        }
Example #11
0
        public override void OnDeath(GameClient Client)
        {
            bool IsBoss = (GetBotRoleplay().Motto.ToLower().Contains("boss")) ? true : false;

            if (IsBoss)
            {
                RoleplayManager.Shout(Client, "*Dá um soco em " + GetBotRoleplay().Name + ", matando-o e ganhando a Guerra de Máfias " + Client.GetRoleplay().Team.Name + "! [+5 Pontos de Eventos]*", 1);

                Client.GetHabbo().EventPoints += 5;
                Client.GetHabbo().UpdateEventPointsBalance();

                RoleplayTeam DefeatedTeam = Client.GetRoleplay().Game.GetTeams().Values.FirstOrDefault(x => x.CaptureRoom == Client.GetRoomUser().RoomId);
                Client.GetRoleplay().Game.NotifyPlayers("O mestre do time" + DefeatedTeam.Name + " foi derrotado por " + Client.GetHabbo().Username + "! A vitória pertence ao Time " + Client.GetRoleplay().Team.Name + "!");


                foreach (RoomUser RoleplayBot in GetRoom().GetRoomUserManager().GetBotList())
                {
                    if (RoleplayBot == null)
                    {
                        continue;
                    }
                    if (!RoleplayBot.IsRoleplayBot)
                    {
                        continue;
                    }
                    if (RoleplayBot.GetBotRoleplay() == null)
                    {
                        continue;
                    }
                    if (RoleplayBot.GetBotRoleplay().Invisible || (RoleplayBot.GetBotRoleplay().Dead))
                    {
                        continue;
                    }

                    RoleplayBot.GetBotRoleplay().StopAllHandlers();
                }

                new Thread(() => {
                    Thread.Sleep(5000);
                    Client.GetRoleplay().Game.RemoveTeamMembers(DefeatedTeam);
                }).Start();
            }
            else
            {
                RoleplayManager.Shout(Client, "*Dá um soco em " + GetBotRoleplay().Name + ", matando-o*");

                Client.GetHabbo().EventPoints += 10;
                Client.GetHabbo().UpdateEventPointsBalance();
            }

            GetRoom().SendMessage(new UserRemoveComposer(GetRoomUser().VirtualId));
            GetBotRoleplay().Invisible = true;
            GetBotRoleplay().Dead      = true;
        }
Example #12
0
        /// <summary>
        /// Gets the damage
        /// </summary>
        private int GetDamage(GameClient Client, GameClient TargetClient, RoleplayBot Bot = null)
        {
            CryptoRandom Randomizer = new CryptoRandom();

            if (Client.GetRoleplay().Game != null && Client.GetRoleplay().Game.GetGameMode() == GameMode.ColourWars)
            {
                return(Randomizer.Next(5, 13));
            }

            int Strength  = Client.GetRoleplay().Strength;
            int MinDamage = (Strength - 6) <= 0 ? 5 : (Strength - 6);
            int MaxDamage = Strength + 6;

            // Lucky shot?
            if (Randomizer.Next(0, 100) < 12)
            {
                MinDamage = Strength + 12;
                MaxDamage = MinDamage + 3;
            }

            int Damage = Randomizer.Next(MinDamage, MaxDamage);

            if (Client.GetRoleplay().Class.ToLower() == "fighter")
            {
                Damage += Randomizer.Next(2, 4);
            }

            if (Client.GetRoleplay().GangId > 1000 && Bot == null)
            {
                if (GroupManager.HasGangCommand(Client, "fighter"))
                {
                    if (RoleplayManager.GenerateRoom(Client.GetHabbo().CurrentRoomId, false).TurfEnabled || GroupManager.HasJobCommand(TargetClient, "guide"))
                    {
                        Damage += Randomizer.Next(1, 3);
                    }
                }
            }

            if (Client.GetRoleplay().HighOffWeed)
            {
                Damage += Randomizer.Next(1, 3);
            }

            return(Damage);
        }
Example #13
0
        /// <summary>
        /// Creates a timer
        /// </summary>
        public BotRoleplayTimer CreateTimer(string Type, RoleplayBot CachedBot, int Time, bool Forever, params object[] Params)
        {
            if (ActiveTimers.ContainsKey(Type))
            {
                return(null);
            }

            BotRoleplayTimer Timer = GetTimerFromType(Type, CachedBot, Time, Forever, Params);

            if (Timer == null)
            {
                return(null);
            }

            ActiveTimers.TryAdd(Type, Timer);

            return(Timer);
        }
Example #14
0
        public GetRelationshipsComposer(Habbo Habbo, RoleplayBot Bot = null)
            : base(ServerPacketHeader.GetRelationshipsMessageComposer)
        {
            if (Bot != null)
            {
                WriteBotData(Bot);
                return;
            }

            if (Habbo == null)
            {
                WriteNullData();
                return;
            }
            else
            {
                WriteHabboData(Habbo);
                return;
            }
        }
Example #15
0
        public static RoleplayBot GetCachedBotByAI(RoleplayBotAIType BotAI)
        {
            RoleplayBot CachedBot = null;

            foreach (RoleplayBot CachedBots in RoleplayBotManager.CachedRoleplayBots.Values)
            {
                if (CachedBots == null)
                {
                    continue;
                }
                if (CachedBots.AIType != BotAI)
                {
                    continue;
                }

                CachedBot = CachedBots;
            }

            return(CachedBot);
        }
Example #16
0
        public static RoleplayBot GetCachedBotById(int BotsID)
        {
            RoleplayBot CachedBot = null;

            foreach (RoleplayBot CachedBots in RoleplayBotManager.CachedRoleplayBots.Values)
            {
                if (CachedBots == null)
                {
                    continue;
                }
                if (CachedBots.Id != BotsID)
                {
                    continue;
                }

                CachedBot = CachedBots;
            }

            return(CachedBot);
        }
Example #17
0
        /// <summary>
        /// Constructs our manager
        /// </summary>
        public BotTimerManager(RoleplayBot CachedBot)
        {
            this.CachedBot = CachedBot;
            ActiveTimers   = new ConcurrentDictionary <string, BotRoleplayTimer>();

            if (this.CachedBot == null)
            {
                return;
            }

            if (this.CachedBot.DRoomUser == null)
            {
                return;
            }

            if (this.CachedBot.RoamBot)
            {
                this.CachedBot.MoveRandomly();
            }
        }
Example #18
0
        /// <summary>
        /// calculates the amount of exp to give to the client
        /// </summary>
        public int GetEXP(GameClient Client, GameClient TargetClient, RoleplayBot Bot = null)
        {
            int TargetLevel = TargetClient == null ? Bot.Level : TargetClient.GetRoleplay().Level;

            CryptoRandom Random          = new CryptoRandom();
            int          LevelDifference = Math.Abs(Client.GetRoleplay().Level - TargetLevel);
            int          Amount;
            int          Bonus;

            if (LevelDifference > 8)
            {
                Amount = 0;
                Bonus  = 0;
            }
            else
            {
                if (TargetLevel > Client.GetRoleplay().Level)
                {
                    Bonus = (10 * (LevelDifference + 1)) + LevelDifference * 2 + 5;
                }
                else if (TargetLevel == Client.GetRoleplay().Level)
                {
                    Bonus = (10 * 2) + 3 + 5;
                }
                else if (TargetLevel < Client.GetRoleplay().Level)
                {
                    Bonus = 10 + 5;
                }
                else
                {
                    Bonus = 2 * LevelDifference + 5;
                }

                Amount = Random.Next(20, 20 + (LevelDifference + 9));
            }

            return(Amount + Bonus + 18);
        }
Example #19
0
        public static RoomUser DeployBotByAI(RoleplayBotAIType BotAI, string SpawnType = "default", int RoomID = 0)
        {
            lock (SyncLock)
            {
                try
                {
                    RoleplayBot Bot = RoleplayBotManager.GetCachedBotByAI(BotAI);

                    if (Bot == null)
                    {
                        return(null);
                    }

                    return(RoleplayBotManager.DeployBotByID(Bot.Id));
                }
                catch (Exception ex)
                {
                    RoleplayBotManager.OnError(ex.Message);
                }
            }

            return(null);
        }
Example #20
0
        /// <summary>
        /// Checks if a client can complete this action
        /// </summary>
        public bool CanCombat(GameClient Client, GameClient TargetClient, RoleplayBot Bot = null)
        {
            #region Variables
            RoomUser RoomUser       = Client.GetRoomUser();
            RoomUser TargetRoomUser = TargetClient.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);
            #endregion

            #region Cooldown Conditions
            if (Client.GetRoleplay().TryGetCooldown("reload", false))
            {
                return(false);
            }

            if (Client.GetRoleplay().TryGetCooldown("gun", false))
            {
                return(false);
            }
            #endregion

            #region Main Conditions
            Weapon Weapon = Client.GetRoleplay().EquippedWeapon;
            Room   Room   = null;

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

            if (Client.GetHabbo().CurrentRoomId > 0)
            {
                Room = Client.GetHabbo().CurrentRoom;
            }

            if (Room != null)
            {
                if (Room.SafeZoneEnabled)
                {
                    Client.SendWhisper("Você não pode atirar nessa sala!", 1);
                    return(false);
                }

                if (!RoleplayManager.PurgeStarted)
                {
                    if (!Room.ShootEnabled && Client.GetRoleplay().Game == null)
                    {
                        Client.SendWhisper("Você não pode atirar nessa sala!", 1);
                        return(false);
                    }
                }
            }

            if (TargetRoomUser == null)
            {
                Client.SendWhisper("Esta pessoa não está na mesma sala que você!", 1);
                return(false);
            }

            if (Client.GetRoleplay().Game == null)
            {
                if (RoleplayManager.LevelDifference)
                {
                    if (!Room.TurfEnabled)
                    {
                        int LevelDifference = Math.Abs(Client.GetRoleplay().Level - TargetClient.GetRoleplay().Level);

                        if (LevelDifference > 8)
                        {
                            Client.SendWhisper("Você não pode gravar esse usuário, pois sua diferença de nível é maior do que 8!", 1);
                            return(false);
                        }
                    }
                }
            }
            else
            {
                if (Client.GetRoleplay().Game.GetGameMode() != Games.GameMode.SoloQueueGuns)
                {
                    Client.SendWhisper("Você não pode atirar dentro de Eventos " + Client.GetRoleplay().Game.GetName() + "!", 1);
                    return(false);
                }

                if (!Client.GetRoleplay().Game.HasGameStarted())
                {
                    Client.SendWhisper("O evento ainda não começou!!", 1);
                    return(false);
                }

                if (TargetClient.GetRoleplay().Game != Client.GetRoleplay().Game)
                {
                    Client.SendWhisper("Seu alvo não faz parte desse evento!", 1);
                    return(false);
                }
            }

            if (Weapon == null)
            {
                Client.SendWhisper("Você atualmente não tem nenhuma arma equipada!", 1);
                return(false);
            }
            #endregion

            #region User Conditions

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

            if (RoomUser.Frozen)
            {
                Client.SendWhisper("Você não pode fazer isso enquanto você está atordoado!", 1);
                return(false);
            }

            if (RoomUser.IsAsleep)
            {
                Client.SendWhisper("Você não pode fazer em uma pessoa AUS", 1);
                return(false);
            }

            if (Client.GetRoleplay().IsDead)
            {
                Client.SendWhisper("Você não pode completar esta ação enquanto está morto!", 1);
                return(false);
            }

            if (Client.GetRoleplay().IsWorking)
            {
                Client.SendWhisper("Você não pode completar esta ação enquanto trabalha!", 1);
                return(false);
            }

            if (Client.GetRoleplay().StaffOnDuty || Client.GetRoleplay().AmbassadorOnDuty)
            {
                Client.SendWhisper("Você não pode atirar em alguém enquanto está de plantão!", 1);
                return(false);
            }

            if (Client.GetRoleplay().Cuffed)
            {
                Client.SendWhisper("Você não pode atirar em um cidadão enquanto você está algemado!", 1);
                return(false);
            }

            if (Client.GetRoleplay().DrivingCar)
            {
                Client.SendWhisper("Por favor, pare de dirigir o seu veículo para disparar sua arma!", 1);
                return(false);
            }

            if (Client.GetRoleplay().IsJailed)
            {
                Client.SendWhisper("Você não pode completar esta ação enquanto você está na prisão!", 1);
                return(false);
            }

            if (Client.GetRoleplay().IsNoob)
            {
                if (Client.GetRoleplay().IsNoob)
                {
                    if (!Client.GetRoleplay().NoobWarned)
                    {
                        Client.SendWhisper("[OBSERVE] Se fizer isso mais vezes você perderá sua proteção de Deus e poderá ser atacado. (Avisos: 1/2)", 1);
                        Client.GetRoleplay().NoobWarned = true;
                        return(false);
                    }
                    else if (!Client.GetRoleplay().NoobWarned2)
                    {
                        Client.SendWhisper("[OBSERVE] Se fizer isso mais vezes você perderá sua proteção de Deus e poderá ser atacado. (Avisos: 2/2)", 1);
                        Client.GetRoleplay().NoobWarned2 = true;
                        return(false);
                    }
                    else
                    {
                        Client.SendWhisper("Você perdeu sua proteção de deus, você está sozinho agora.", 1);

                        if (Client.GetRoleplay().TimerManager != null && Client.GetRoleplay().TimerManager.ActiveTimers != null)
                        {
                            if (Client.GetRoleplay().TimerManager.ActiveTimers.ContainsKey("noob"))
                            {
                                Client.GetRoleplay().TimerManager.ActiveTimers["noob"].EndTimer();
                            }
                        }

                        Client.GetRoleplay().IsNoob       = false;
                        Client.GetRoleplay().NoobTimeLeft = 0;
                        return(true);
                    }
                }
            }

            if (Client.GetRoleplay().Bullets <= 0 && Client.GetRoleplay().Game == null)
            {
                Client.SendWhisper("Você não pode completar esta ação, você está sem balas!", 1);
                return(false);
            }

            if (Client.GetRoleplay().CurEnergy <= 0 && Client.GetRoleplay().Game == null)
            {
                Client.SendWhisper("Você não pode completar esta ação, você está sem energia!", 1);
                return(false);
            }
            #endregion

            #region Target Conditions
            if (TargetClient == Client)
            {
                Client.SendWhisper("Você não pode se atirar!", 1);
                return(false);
            }

            if (TargetClient.GetRoleplay().IsDead)
            {
                Client.SendWhisper("Você não pode atirar em alguém que está morto!", 1);
                return(false);
            }

            if (TargetClient.GetRoleplay().IsJailed)
            {
                Client.SendWhisper("Você não pode atirar em alguém que está na prisão!", 1);
                return(false);
            }

            if (TargetClient.GetRoleplay().StaffOnDuty)
            {
                Client.SendWhisper("Você não pode atirar em um funcionário que esteja de plantão!", 1);
                return(false);
            }

            if (TargetClient.GetRoleplay().AmbassadorOnDuty)
            {
                Client.SendWhisper("Você não pode atirar em um embaixador que está de plantão!", 1);
                return(false);
            }

            if (TargetClient.GetRoomUser().IsAsleep)
            {
                Client.SendWhisper("Você não pode atirar em alguém que está ausente!", 1);
                return(false);
            }

            if (TargetClient.GetRoleplay().Level < 2)
            {
                Client.SendWhisper("Você não pode completar esta ação porque o usuário é Nível 1!", 1);
                return(false);
            }

            if (Client.GetRoleplay().Level < 2)
            {
                Client.SendWhisper("Você não pode completar esta ação, pois você ainda é Nível 1!!", 1);
                return(false);
            }
            #endregion

            return(true);
        }
Example #21
0
 /// <summary>
 /// Executes this type of combat on a Bot
 /// </summary>
 public void ExecuteBot(GameClient Client, RoleplayBot Bot = null)
 {
 }
        public ProfileInformationComposer(Habbo Data, GameClient Session, List <Group> Groups, int friendCount, RoleplayBot Bot = null)
            : base(ServerPacketHeader.ProfileInformationMessageComposer)
        {
            if (Bot != null)
            {
                BotProfile(Session, Groups, friendCount, Bot);
            }
            else
            {
                DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Data.AccountCreated).ToLocalTime();

                base.WriteInteger(Data.Id);
                base.WriteString(Data.Username);
                base.WriteString(Data.Look);
                base.WriteString(Data.Motto);
                base.WriteString(origin.ToString("dd/MM/yyyy"));
                base.WriteInteger((Data.GetStats() == null) ? 0 : Data.GetStats().AchievementPoints);
                base.WriteInteger(friendCount);                                                                                                                                                 // Friend Count
                base.WriteBoolean(Data.Id != Session.GetHabbo().Id&& Session.GetHabbo().GetMessenger().FriendshipExists(Data.Id));                                                              //  Is friend
                base.WriteBoolean(Data.Id != Session.GetHabbo().Id&& !Session.GetHabbo().GetMessenger().FriendshipExists(Data.Id) && Session.GetHabbo().GetMessenger().RequestExists(Data.Id)); // Sent friend request
                base.WriteBoolean((PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Data.Id)) != null);

                base.WriteInteger(Groups.Where(x => x != null).ToList().Count);
                foreach (Group Group in Groups)
                {
                    if (Group == null)
                    {
                        continue;
                    }

                    base.WriteInteger(Group.Id);
                    base.WriteString(Group.Name);
                    base.WriteString(Group.Badge);
                    base.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true));
                    base.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false));
                    base.WriteBoolean((Data.Id == 0 && Group.Id == 1) ? true : ((Group.Id < 1000 && Data.Id > 0) ? true : false)); // todo favs
                    base.WriteInteger(0);                                                                                          //what the f**k
                    base.WriteBoolean(Group != null ? Group.ForumEnabled : true);                                                  //HabboTalk
                }

                base.WriteInteger(Convert.ToInt32(PlusEnvironment.GetUnixTimestamp() - Data.LastOnline)); // Last online
                base.WriteBoolean(true);                                                                  // Show the profile
            }
        }
Example #23
0
 public ServingTimer(string Type, RoleplayBot CachedBot, int Time, bool Forever, object[] Params)
     : base(Type, CachedBot, Time, Forever, Params)
 {
     TimeCount = 0;
 }
        public void BotProfile(GameClient Session, List <Group> Groups, int friendCount, RoleplayBot Bot)
        {
            int FakeBotId = Bot.Id + 1000000;
            var Habbo     = PlusEnvironment.GetHabboById(1);

            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Habbo.AccountCreated).ToLocalTime();

            base.WriteInteger(FakeBotId);
            base.WriteString(Bot.Name);
            base.WriteString(Bot.Figure);
            base.WriteString("Civil - [+R$]");
            base.WriteString(origin.ToString("dd/MM/yyyy"));
            base.WriteInteger(0);                                            // Achievement
            base.WriteInteger(friendCount);                                  // Friend Count
            base.WriteBoolean(Session.GetRoleplay().FriendsWithBot(Bot.Id)); //  Is friend
            base.WriteBoolean(false);                                        // Sent friend request
            base.WriteBoolean(true);

            base.WriteInteger(Groups.Count);
            foreach (Group Group in Groups)
            {
                base.WriteInteger(Group.Id);
                base.WriteString(Group.Name);
                base.WriteString(Group.Badge);
                base.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true));
                base.WriteString(PlusEnvironment.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false));

                if (Group.Id == Bot.Corporation)
                {
                    base.WriteBoolean(true);
                }
                else
                {
                    base.WriteBoolean(false);
                }
                base.WriteInteger(0);
                base.WriteBoolean(Group != null ? Group.ForumEnabled : true);
            }

            base.WriteInteger(0);
            base.WriteBoolean(true);
        }
Example #25
0
        /// <summary>
        /// Waits for delivery bot to arrive with package
        /// </summary>
        public override void Execute()
        {
            try
            {
                if (base.CachedBot == null || base.CachedBot.DRoomUser == null || base.CachedBot.DRoom == null || !RoleplayManager.CalledDelivery || RoleplayManager.DeliveryWeapon == null)
                {
                    base.EndTimer();
                    return;
                }

                TimeCount++;

                if (TimeCount < 1000)
                {
                    return;
                }

                if (!this.DeliveryArrived)
                {
                    RoleplayBot Bot = RoleplayBotManager.GetCachedBotByAI(RoleplayBotAIType.DELIVERY);

                    if (Bot == null)
                    {
                        base.CachedBot.DRoomUser.Chat("O bot de entrega está ocupado agora, desculpe por isso!", true);
                        base.EndTimer();
                        return;
                    }
                    else
                    {
                        if (!this.DeliveryArrived)
                        {
                            Item Item = null;

                            Bot.GetStopWorkItem(base.CachedBot.DRoom, out Item);

                            if (Item == null)
                            {
                                base.CachedBot.DRoomUser.Chat("O bot de entrega está ocupado agora, desculpe por isso! ", true);
                                base.EndTimer();
                                return;
                            }

                            RoleplayBotManager.DeployBotByAI(RoleplayBotAIType.DELIVERY, "workitem", base.CachedBot.DRoom.Id);

                            this.DeliveryArrived = true;
                        }
                    }
                }


                if (base.CachedBot.DRoom.GetRoomItemHandler().GetFloor.Where(x => x.GetBaseItem().InteractionType == InteractionType.DELIVERY_BOX).ToList().Count <= 0)
                {
                    return;
                }

                TimeCount2++;

                if (TimeCount2 < 200)
                {
                    return;
                }

                RoleplayManager.CalledDelivery = false;
                HandleDelivery();
                base.EndTimer();
            }
            catch
            {
                base.EndTimer();
            }
        }
Example #26
0
 /// <summary>
 /// Gets the coins from the users dead body
 /// </summary>
 public int GetCoins(GameClient TargetClient, RoleplayBot Bot = null)
 {
     return(0);
 }
Example #27
0
 public DefaultBotCooldown(string Type, RoleplayBot CachedBot, int Time, int Amount)
     : base(Type, CachedBot, Time, Amount)
 {
     TimeLeft = Amount * 1000;
 }
Example #28
0
 public BotJailTimer(string Type, RoleplayBot CachedBot, int Time, bool Forever, object[] Params)
     : base(Type, CachedBot, Time, Forever, Params)
 {
     TimeLeft  = 1000 * 60;
     TimeCount = 0;
 }
Example #29
0
 /// <summary>
 /// Gets the rewards from the dead body
 /// </summary>
 /// <param name="Client"></param>
 /// <param name="TargetClient"></param>
 /// <param name="Bot"></param>
 public void GetRewards(GameClient Client, GameClient TargetClient, RoleplayBot Bot = null)
 {
 }
Example #30
0
        /// <summary>
        /// Loads bot friendships
        /// </summary>
        internal void LoadBotFriendships()
        {
            BotFriendShips = new ConcurrentDictionary <int, RoleplayBot>();

            DataTable BotFriends = null;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `bot_id` FROM `rp_bots_friendships` WHERE `user_id` = '" + Client.GetHabbo().Id + "'");
                BotFriends = dbClient.getTable();

                if (BotFriends == null)
                {
                    return;
                }

                foreach (DataRow BotUser in BotFriends.Rows)
                {
                    int BotId = Convert.ToInt32(BotUser["bot_id"]);

                    RoleplayBot Botfriend = RoleplayBotManager.GetCachedBotById(BotId);

                    if (Botfriend == null)
                    {
                        return;
                    }

                    MessengerBuddy newfriend = new MessengerBuddy(Botfriend.Id + RoleplayBotManager.BotFriendMultiplyer,
                                                                  Botfriend.Name,
                                                                  Botfriend.Figure,
                                                                  Botfriend.Motto, 0, false, true, true);

                    int addid = Botfriend.Id + RoleplayBotManager.BotFriendMultiplyer;

                    if (Client.GetHabbo() == null)
                    {
                        return;
                    }

                    if (Client.GetHabbo().GetMessenger() == null)
                    {
                        return;
                    }

                    if (Client.GetHabbo().GetMessenger()._friends == null)
                    {
                        return;
                    }

                    if (!Client.GetHabbo().GetMessenger()._friends.ContainsKey(addid))
                    {
                        Client.GetHabbo().GetMessenger()._friends.Add(addid, newfriend);
                    }

                    if (!BotFriendShips.ContainsKey(Botfriend.Id))
                    {
                        BotFriendShips.TryAdd(Botfriend.Id, Botfriend);
                    }

                    Client.SendMessage(Client.GetHabbo().GetMessenger().SerializeUpdate(newfriend));
                }
            }
        }