示例#1
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);
        }
示例#2
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);
        }
示例#3
0
        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = Yupi.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);

            if (room == null)
            {
                return(true);
            }

            RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(pms[0]);

            if (user == null)
            {
                return(true);
            }

            string msg = string.Join(" ", pms.Skip(1));

            if (msg.StartsWith(":"))
            {
                msg = ' ' + msg;
            }

            if (string.IsNullOrEmpty(msg))
            {
                return(true);
            }

            user.Chat(user.GetClient(), msg, false, 0);
            return(true);
        }
示例#4
0
        internal void Shout(string Message, int Bubble = 0, bool RemoveAfter = false)
        {
            try
            {
                if (GetHabbo().CurrentRoom == null)
                {
                    return;
                }
                RoomUser User = GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(GetHabbo().UserName);
                if (User == null)
                {
                    return;
                }

                if (Bubble != 0)
                {
                    User.LastBubble = Bubble;
                }

                User.Chat(this, Message, true, 0, User.LastBubble);

                if (RemoveAfter)
                {
                    User.LastBubble = 0;
                }
            }
            catch { }
        }
示例#5
0
        public static void WalkToOwner(RoomUser Pet)
        {
            GameClient FollowingOwner = null;

            FollowingOwner = Plus.GetGame().GetClientManager().GetClientByUserId(Pet.BotData.OwnerId);

            if (FollowingOwner == null)
            {
                Console.WriteLine("Owner was null");
                return;
            }

            if (FollowingOwner.GetHabbo().GetRoomUser() == null)
            {
                Console.WriteLine("Owner roomuser was null");
                return;
            }

            if (FollowingOwner.GetHabbo().GetRoomUser().RoomId != Pet.RoomId)
            {
                Console.WriteLine("Owner is not in the room");
                return;
            }

            Pet.Chat(null, "Just a second master, I'm coming!", true, 0, 0);
            Pet.Move(FollowingOwner.GetHabbo().GetRoomUser().GoalX, FollowingOwner.GetHabbo().GetRoomUser().GoalY, FollowingOwner.GetHabbo().GetRoomUser().FollowingOwner.RotBody);
        }
示例#6
0
        /// <summary>
        ///     Called when [user enter room].
        /// </summary>
        /// <param name="user">The user.</param>
        internal override void OnUserEnterRoom(RoomUser user)
        {
            if (user.GetClient() == null || user.GetClient().GetHabbo() == null)
            {
                return;
            }

            RoomUser roomUser = GetRoomUser();

            if (roomUser == null || user.GetClient().GetHabbo().UserName != roomUser.PetData.OwnerName)
            {
                return;
            }

            Random random = new Random();

            string[] value   = PetLocale.GetValue("welcome.speech.pet");
            string   message = value[random.Next(0, value.Length - 1)];

            message += user.GetUserName();

            roomUser.Statusses.Clear();
            roomUser.UpdateNeeded = true;
            roomUser.Chat(null, message, false, 0);
        }
示例#7
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];
            RoomUser bot      = Room.GetRoomUserManager().GetBotByName(OtherString);

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

            if (OtherBool)
            {
                ServerMessage whisp = new ServerMessage(LibraryParser.OutgoingRequest("WhisperMessageComposer"));
                whisp.AppendInteger(bot.VirtualId);
                whisp.AppendString(OtherExtraString);
                whisp.AppendInteger(0);
                whisp.AppendInteger(2);
                whisp.AppendInteger(0);
                whisp.AppendInteger(-1);
                roomUser.GetClient().SendMessage(whisp);
            }
            else
            {
                bot.Chat(null, roomUser.GetUserName() + " : " + OtherExtraString, false, 0);
            }

            return(true);
        }
示例#8
0
文件: Kill.cs 项目: xXSicilyXx/Yupi
        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = Yupi.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);

            if (room == null)
            {
                return(true);
            }

            RoomUser user2 = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().LastSelectedUser);

            if (user2 == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return(true);
            }

            RoomUser user =
                room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().UserName);

            if (PathFinder.GetDistance(user.X, user.Y, user2.X, user2.Y) > 1)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("kil_command_error_1"));

                return(true);
            }
            if (user2.IsLyingDown || user2.IsSitting)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("kil_command_error_2"));
                return(true);
            }
            if (
                !string.Equals(user2.GetUserName(), session.GetHabbo().UserName,
                               StringComparison.CurrentCultureIgnoreCase))
            {
                user2.Statusses.Add("lay", "0.55");
                user2.IsLyingDown  = true;
                user2.UpdateNeeded = true;
                user.Chat(user.GetClient(), Yupi.GetLanguage().GetVar("command.kill.user"), true, 0, 3);
                user2.Chat(user2.GetClient(), Yupi.GetLanguage().GetVar("command.kill.userdeath"), true, 0,
                           3);
                return(true);
            }
            user.Chat(session, "I am sad", false, 0);
            return(true);
        }
        internal void RequestChat()
        {
            string   Message = Request.PopString();
            RoomUser user    = Session.User.CurrentRoom.GetRoomUserByUserId(Session.User.Id);

            user.Chat(Message);

            Logging.WriteLine(Session.User.Username + ": " + Message, ConsoleColor.Yellow);
        }
示例#10
0
        public void Handle(GameClient session, ClientMessage request)
        {
            string chat = request.PopString();

            RoomUser user = session.User.CurrentRoomUser;

            if (user != null)
            {
                user.Chat(chat);
            }
        }
示例#11
0
        public override void OnUserEnterRoom(RoomUser User)
        {
            if (GetBotData() == null)
            {
                return;
            }

            RoomUser Bot = GetRoomUser();

            if (User.GetClient().GetHabbo().CurrentRoom.OwnerId == User.GetClient().GetHabbo().Id)
            {
                DataTable getUsername;
                using (IQueryAdapter query = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    query.SetQuery("SELECT username FROM room_visits WHERE roomid = @id");
                    query.AddParameter("id", User.RoomId);
                    getUsername = query.getTable();
                }

                foreach (DataRow Row in getUsername.Rows)
                {
                    Bot.Chat("¡Me alegro de verlo Señor! Diga 'Si', si desea saber quien ha visitado la sala en su ausencia.", false);
                    return;
                }
                Bot.Chat("He estado muy atento y te afirmo que nadie visitó esta sala mientras tú no estabas.", false);
            }
            else
            {
                Bot.Chat("Hola " + User.GetClient().GetHabbo().Username + ", le hablaré de ti al dueño.", false);

                using (IQueryAdapter query = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    query.SetQuery("INSERT INTO room_visits (roomid, username, gone) VALUE (@roomid, @username, @gone)");
                    query.AddParameter("roomid", User.RoomId);
                    query.AddParameter("username", User.GetClient().GetHabbo().Username);
                    query.AddParameter("gone", "todavía está en la sala.");
                    query.RunQuery();
                }
                return;
            }
        }
示例#12
0
        public bool Execute(params object[] stuff)
        {
            RoomUser bot = Room.GetRoomUserManager().GetBotByName(OtherString);

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

            bot.Chat(null, OtherExtraString, OtherBool, 0);
            return(true);
        }
示例#13
0
        public bool Execute(params object[] stuff)
        {
            //RoomUser roomUser = (RoomUser)stuff[0];
            //InteractionType item = (InteractionType)stuff[1];
            RoomUser bot = Room.GetRoomUserManager().GetBotByName(OtherString);

            if (bot == null)
            {
                return(false);
            }
            bot.Chat(null, OtherExtraString, OtherBool, 0);
            return(true);
        }
示例#14
0
        public void parse(GameClient Session, ClientMessage Event)
        {
            Room room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (room != null)
            {
                RoomUser roomUserByHabbo = room.GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (roomUserByHabbo != null)
                {
                    roomUserByHabbo.Chat(Session, PhoenixEnvironment.FilterInjectionChars(Event.PopFixedString()), false);
                }
            }
        }
示例#15
0
 internal override void OnUserEnterRoom(RoomUser User)
 {
     if (User.GetClient() != null && User.GetClient().GetHabbo() != null)
     {
         RoomUser roomUser = base.GetRoomUser();
         if (roomUser != null && User.GetClient().GetHabbo().Username == roomUser.PetData.OwnerName)
         {
             Random   random  = new Random();
             string[] value   = PetLocale.GetValue("welcome.speech.pet");
             string   message = value[random.Next(0, checked (value.Length - 1))];
             message += User.GetUsername();
             roomUser.Chat(null, message, false, 0, 0);
         }
     }
 }
示例#16
0
        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(this.StringData))
            {
                return(false);
            }

            this.StringData.Split(' ');

            string BotName = this.StringData.Split('	')[0];
            string Chat    = this.StringData.Split('	')[1];

            RoomUser User = this.Instance.GetRoomUserManager().GetBotByName(BotName);

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

            if (this.BoolData == true)
            {
                User.Chat(Chat, true, 31);
            }
            else
            {
                User.Chat(Chat, false, 31);
            }


            return(true);
        }
示例#17
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];
            int      handitem = Delay / 500;

            if (handitem < 0)
            {
                return(false);
            }

            roomUser.CarryItem(handitem);
            RoomUser bot = Room.GetRoomUserManager().GetBotByName(OtherString);

            bot?.Chat(null, Yupi.GetLanguage().GetVar("bot_give_handitem"), false, 0);
            return(true);
        }
示例#18
0
 public override void OnUserEnterRoom(RoomUser User)
 {
     if (User.GetClient() != null && User.GetClient().GetHabbo() != null)
     {
         RoomUser Pet = GetRoomUser();
         if (Pet != null)
         {
             if (User.GetClient().GetHabbo().Username == Pet.PetData.OwnerName)
             {
                 string[] Speech  = QuasarEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("welcome.speech.pet" + Pet.PetData.Type);
                 string   rSpeech = Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)];
                 Pet.Chat(rSpeech, false);
             }
         }
     }
 }
示例#19
0
        public bool Execute(params object[] stuff)
        {
            RoomUser roomUser = (RoomUser)stuff[0];
            //InteractionType item = (InteractionType)stuff[1];
            int handitem = Delay / 500;

            if (handitem < 0)
            {
                return(false);
            }
            roomUser.CarryItem(handitem);
            RoomUser bot = Room.GetRoomUserManager().GetBotByName(OtherString);

            if (bot == null)
            {
                return(true);
            }
            bot.Chat(null, Plus.GetLanguage().GetVar("bot_give_handitem"), false, 0);
            return(true);
        }
示例#20
0
        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(this.StringData))
            {
                return(false);
            }

            this.StringData.Split(' ');
            string BotName = this.StringData.Split('	')[0];
            string Chat    = this.StringData.Split('	')[1];

            string Message         = StringData.Split('	')[1];
            string MessageFiltered = StringData.Split('	')[1];

            RoomUser User = this.Instance.GetRoomUserManager().GetBotByName(BotName);

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

            Habbo Player = (Habbo)Params[0];

            if (this.BoolData)
            {
                Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Chat, 0, 31));
            }
            else
            {
                User.Chat(Player.GetClient().GetHabbo().Username + ": " + Chat, false, User.LastBubble);
            }

            return(true);
        }
示例#21
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);
        }
示例#22
0
        public override void OnTimerTick()
        {
            if (SpeechTimer <= 0)
            {
                RoomUser Pet        = base.GetRoomUser();
                string[] PetDog     = new string[] { TextManager.GetText("pet_chatter_dog1"), TextManager.GetText("pet_chatter_dog2"), TextManager.GetText("pet_chatter_dog3"), TextManager.GetText("pet_chatter_dog4"), TextManager.GetText("pet_chatter_dog5") };
                string[] PetCat     = new string[] { TextManager.GetText("pet_chatter_cat1"), TextManager.GetText("pet_chatter_cat2"), TextManager.GetText("pet_chatter_cat3"), TextManager.GetText("pet_chatter_cat4"), TextManager.GetText("pet_chatter_cat5") };
                string[] PetCroc    = new string[] { TextManager.GetText("pet_chatter_croc1"), TextManager.GetText("pet_chatter_croc2"), TextManager.GetText("pet_chatter_croc3"), TextManager.GetText("pet_chatter_croc4"), TextManager.GetText("pet_chatter_croc5") };
                string[] PetDogg    = new string[] { TextManager.GetText("pet_chatter_dog1"), TextManager.GetText("pet_chatter_dog2"), TextManager.GetText("pet_chatter_dog3"), TextManager.GetText("pet_chatter_dog4"), TextManager.GetText("pet_chatter_dog5") };
                string[] PetBear    = new string[] { TextManager.GetText("pet_chatter_bear1"), TextManager.GetText("pet_chatter_bear2"), TextManager.GetText("pet_chatter_bear3"), TextManager.GetText("pet_chatter_bear4"), TextManager.GetText("pet_chatter_bear5") };
                string[] PetPig     = new string[] { TextManager.GetText("pet_chatter_pig1"), TextManager.GetText("pet_chatter_pig2"), TextManager.GetText("pet_chatter_pig3"), TextManager.GetText("pet_chatter_pig4"), TextManager.GetText("pet_chatter_pig5") };
                string[] PetLion    = new string[] { TextManager.GetText("pet_chatter_lion1"), TextManager.GetText("pet_chatter_lion2"), TextManager.GetText("pet_chatter_lion3"), TextManager.GetText("pet_chatter_lion4"), TextManager.GetText("pet_chatter_lion5") };
                string[] PetRhino   = new string[] { TextManager.GetText("pet_chatter_rhino1"), TextManager.GetText("pet_chatter_rhino2"), TextManager.GetText("pet_chatter_rhino3"), TextManager.GetText("pet_chatter_rhino4"), TextManager.GetText("pet_chatter_rhino5") };
                string[] PetSpider  = new string[] { TextManager.GetText("pet_chatter_spider1"), TextManager.GetText("pet_chatter_spider2"), TextManager.GetText("pet_chatter_spider3"), TextManager.GetText("pet_chatter_spider4"), TextManager.GetText("pet_chatter_spider5") };
                string[] PetTurtle  = new string[] { TextManager.GetText("pet_chatter_turtle1"), TextManager.GetText("pet_chatter_turtle2"), TextManager.GetText("pet_chatter_turtle3"), TextManager.GetText("pet_chatter_turtle4"), TextManager.GetText("pet_chatter_turtle5") };
                string[] PetChic    = new string[] { TextManager.GetText("pet_chatter_chic1"), TextManager.GetText("pet_chatter_chic2"), TextManager.GetText("pet_chatter_chic3"), TextManager.GetText("pet_chatter_chic4"), TextManager.GetText("pet_chatter_chic5") };
                string[] PetFrog    = new string[] { TextManager.GetText("pet_chatter_frog1"), TextManager.GetText("pet_chatter_frog2"), TextManager.GetText("pet_chatter_frog3"), TextManager.GetText("pet_chatter_frog4"), TextManager.GetText("pet_chatter_frog5") };
                string[] PetDragon  = new string[] { TextManager.GetText("pet_chatter_dragon1"), TextManager.GetText("pet_chatter_dragon2"), TextManager.GetText("pet_chatter_dragon3"), TextManager.GetText("pet_chatter_dragon4"), TextManager.GetText("pet_chatter_dragon5") };
                string[] PetHorse   = new string[] { TextManager.GetText("pet_chatter_horse1"), TextManager.GetText("pet_chatter_horse2"), TextManager.GetText("pet_chatter_horse3"), TextManager.GetText("pet_chatter_horse4"), TextManager.GetText("pet_chatter_horse5") };
                string[] PetMonkey  = new string[] { TextManager.GetText("pet_chatter_monkey1"), TextManager.GetText("pet_chatter_monkey2"), TextManager.GetText("pet_chatter_monkey3"), TextManager.GetText("pet_chatter_monkey4"), TextManager.GetText("pet_chatter_monkey5") };
                string[] PetGeneric = new string[] { TextManager.GetText("pet_chatter_generic1"), TextManager.GetText("pet_chatter_generic2"), TextManager.GetText("pet_chatter_generic3"), TextManager.GetText("pet_chatter_generic4"), TextManager.GetText("pet_chatter_generic5") };
                string[] array17    = new string[] { "sit", "lay", "snf", "ded", "jmp", "snf", "sit", "snf" };
                string[] array18    = new string[] { "sit", "lay" };
                string[] array19    = new string[] { "wng", "grn", "flm", "std", "swg", "sit", "lay", "snf", "plf", "jmp", "flm", "crk", "rlx", "flm" };
                if (Pet != null)
                {
                    Random RandomSpeech = new Random();
                    int    num          = PhoenixEnvironment.GetRandomNumber(1, 4);
                    if (num == 2)
                    {
                        Pet.Statusses.Clear();
                        if (base.GetRoomUser().BotData.Rider == null)
                        {
                            if (Pet.PetData.Type == 13)
                            {
                                Pet.Statusses.Add(array18[RandomSpeech.Next(0, array18.Length - 1)], Pet.Z.ToString());
                            }
                            else if (Pet.PetData.Type != 12)
                            {
                                Pet.Statusses.Add(array17[RandomSpeech.Next(0, array17.Length - 1)], Pet.Z.ToString());
                            }
                            else
                            {
                                Pet.Statusses.Add(array19[RandomSpeech.Next(0, array19.Length - 1)], Pet.Z.ToString());
                            }
                        }
                    }
                    switch (Pet.PetData.Type)
                    {
                    case 0:
                        Pet.Chat(null, PetDog[RandomSpeech.Next(0, PetDog.Length - 1)], false);
                        break;

                    case 1:
                        Pet.Chat(null, PetCat[RandomSpeech.Next(0, PetCat.Length - 1)], false);
                        break;

                    case 2:
                        Pet.Chat(null, PetCroc[RandomSpeech.Next(0, PetCroc.Length - 1)], false);
                        break;

                    case 3:
                        Pet.Chat(null, PetDogg[RandomSpeech.Next(0, PetDogg.Length - 1)], false);
                        break;

                    case 4:
                        Pet.Chat(null, PetBear[RandomSpeech.Next(0, PetBear.Length - 1)], false);
                        break;

                    case 5:
                        Pet.Chat(null, PetPig[RandomSpeech.Next(0, PetPig.Length - 1)], false);
                        break;

                    case 6:
                        Pet.Chat(null, PetLion[RandomSpeech.Next(0, PetLion.Length - 1)], false);
                        break;

                    case 7:
                        Pet.Chat(null, PetRhino[RandomSpeech.Next(0, PetRhino.Length - 1)], false);
                        break;

                    case 8:
                        Pet.Chat(null, PetSpider[RandomSpeech.Next(0, PetSpider.Length - 1)], false);
                        break;

                    case 9:
                        Pet.Chat(null, PetTurtle[RandomSpeech.Next(0, PetTurtle.Length - 1)], false);
                        break;

                    case 10:
                        Pet.Chat(null, PetChic[RandomSpeech.Next(0, PetChic.Length - 1)], false);
                        break;

                    case 11:
                        Pet.Chat(null, PetFrog[RandomSpeech.Next(0, PetFrog.Length - 1)], false);
                        break;

                    case 12:
                        Pet.Chat(null, PetDragon[RandomSpeech.Next(0, PetDragon.Length - 1)], false);
                        break;

                    case 13:
                        Pet.Chat(null, PetHorse[RandomSpeech.Next(0, PetHorse.Length - 1)], false);
                        break;

                    case 14:
                        Pet.Chat(null, PetMonkey[RandomSpeech.Next(0, PetMonkey.Length - 1)], false);
                        break;

                    default:
                        Pet.Chat(null, PetGeneric[RandomSpeech.Next(0, PetGeneric.Length - 1)], false);
                        break;
                    }
                }
                SpeechTimer = PhoenixEnvironment.GetRandomNumber(30, 120);
            }
            else
            {
                SpeechTimer--;
            }
            if (EnergyTimer <= 0)
            {
                base.GetRoomUser().PetData.PetEnergy(-10);
                if (base.GetRoomUser().BotData.Rider == null)
                {
                    PetMove(0, 0, true);
                }
                EnergyTimer = 30;
            }
            else
            {
                EnergyTimer--;
            }
        }
示例#23
0
        public override void OnUserSay(RoomUser User, string Message)
        {
            RoomUser Pet = base.GetRoomUser();

            if (Pet.BotData.Rider == null)
            {
                if (Message.ToLower().Equals(Pet.PetData.Name.ToLower()))
                {
                    Pet.SetRot(Rotation.Calculate(Pet.X, Pet.Y, User.X, User.Y));
                }
                else
                {
                    if (Message.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && User.GetClient().GetHabbo().Username.ToLower() == base.GetRoomUser().PetData.OwnerName.ToLower())
                    {
                        string key = Message.Substring(Pet.PetData.Name.ToLower().Length + 1);
                        if ((Pet.PetData.Energy >= 10 && this.LevelStake() < 6) || Pet.PetData.Level >= 15)
                        {
                            Pet.Statusses.Clear();
                            if (!PhoenixEnvironment.GetGame().GetRoleManager().PetCommandsList.ContainsKey(key))
                            {
                                string[] array = new string[]
                                {
                                    TextManager.GetText("pet_response_confused1"),
                                    TextManager.GetText("pet_response_confused2"),
                                    TextManager.GetText("pet_response_confused3"),
                                    TextManager.GetText("pet_response_confused4"),
                                    TextManager.GetText("pet_response_confused5"),
                                    TextManager.GetText("pet_response_confused6"),
                                    TextManager.GetText("pet_response_confused7")
                                };
                                Random random = new Random();
                                Pet.Chat(null, array[random.Next(0, array.Length - 1)], false);
                            }
                            else
                            {
                                switch (PhoenixEnvironment.GetGame().GetRoleManager().PetCommandsList[key])
                                {
                                case 1:
                                    Pet.PetData.AddExpirience(10, -25);
                                    Pet.Chat(null, TextManager.GetText("pet_response_sleep"), false);
                                    Pet.Statusses.Add("lay", Pet.Z.ToString());
                                    break;

                                case 2:
                                    this.PetMove(0, 0, true);
                                    Pet.PetData.AddExpirience(5, 5);
                                    break;

                                case 3:
                                    Pet.PetData.AddExpirience(5, 5);
                                    Pet.Statusses.Add("sit", Pet.Z.ToString());
                                    break;

                                case 4:
                                    Pet.PetData.AddExpirience(5, 5);
                                    Pet.Statusses.Add("lay", Pet.Z.ToString());
                                    break;

                                case 5:
                                    Pet.PetData.AddExpirience(10, 10);
                                    this.EnergyTimer = 60;
                                    break;

                                case 6:
                                {
                                    int NewX = User.X;
                                    int NewY = User.Y;
                                    if (User.RotBody == 4)
                                    {
                                        NewY = User.Y + 1;
                                    }
                                    else if (User.RotBody == 0)
                                    {
                                        NewY = User.Y - 1;
                                    }
                                    else if (User.RotBody == 6)
                                    {
                                        NewX = User.X - 1;
                                    }
                                    else if (User.RotBody == 2)
                                    {
                                        NewX = User.X + 1;
                                    }
                                    else if (User.RotBody == 3)
                                    {
                                        NewX = User.X + 1;
                                        NewY = User.Y + 1;
                                    }
                                    else if (User.RotBody == 1)
                                    {
                                        NewX = User.X + 1;
                                        NewY = User.Y - 1;
                                    }
                                    else if (User.RotBody == 7)
                                    {
                                        NewX = User.X - 1;
                                        NewY = User.Y - 1;
                                    }
                                    else if (User.RotBody == 5)
                                    {
                                        NewX = User.X - 1;
                                        NewY = User.Y + 1;
                                    }
                                    Pet.PetData.AddExpirience(15, 15);
                                    this.PetMove(NewX, NewY, false);
                                    break;
                                }

                                case 7:
                                    Pet.PetData.AddExpirience(20, 20);
                                    Pet.Statusses.Add("ded", Pet.Z.ToString());
                                    break;

                                case 8:
                                    Pet.PetData.AddExpirience(10, 10);
                                    Pet.Statusses.Add("beg", Pet.Z.ToString());
                                    break;

                                case 9:
                                    Pet.PetData.AddExpirience(15, 15);
                                    Pet.Statusses.Add("jmp", Pet.Z.ToString());
                                    break;

                                case 10:
                                    Pet.PetData.AddExpirience(25, 25);
                                    Pet.Chat(null, TextManager.GetText("pet_response_silent"), false);
                                    this.SpeechTimer = 120;
                                    break;

                                case 11:
                                    Pet.PetData.AddExpirience(15, 15);
                                    this.SpeechTimer = 2;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            string[] array2 = new string[]
                            {
                                TextManager.GetText("pet_response_sleeping1"),
                                TextManager.GetText("pet_response_sleeping2"),
                                TextManager.GetText("pet_response_sleeping3"),
                                TextManager.GetText("pet_response_sleeping4"),
                                TextManager.GetText("pet_response_sleeping5")
                            };
                            string[] array3 = new string[]
                            {
                                TextManager.GetText("pet_response_refusal1"),
                                TextManager.GetText("pet_response_refusal2"),
                                TextManager.GetText("pet_response_refusal3"),
                                TextManager.GetText("pet_response_refusal4"),
                                TextManager.GetText("pet_response_refusal5")
                            };
                            Pet.GoalX = Pet.SetX;
                            Pet.GoalY = Pet.SetY;
                            Pet.Statusses.Clear();
                            if (Pet.PetData.Energy < 10)
                            {
                                Random random2 = new Random();
                                Pet.Chat(null, array2[random2.Next(0, array2.Length - 1)], false);
                                if (Pet.PetData.Type != 13)
                                {
                                    Pet.Statusses.Add("lay", Pet.Z.ToString());
                                }
                                else
                                {
                                    Pet.Statusses.Add("lay", (Pet.Z - 1.0).ToString());
                                }
                                this.SpeechTimer = 25;
                                this.EnergyTimer = 20;
                                base.GetRoomUser().PetData.PetEnergy(-25);
                            }
                            else
                            {
                                Random random2 = new Random();
                                Pet.Chat(null, array3[random2.Next(0, array3.Length - 1)], false);
                            }
                        }
                        Pet.UpdateNeeded = true;
                    }
                }
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

            if (!BiosEmuThiago.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                return;
            }

            int BotId = Packet.PopInt();
            int X     = Packet.PopInt();
            int Y     = Packet.PopInt();

            if (!Room.GetGameMap().CanWalk(X, Y, false) || !Room.GetGameMap().ValidTile(X, Y))
            {
                Session.SendNotification("Não pode colocar um bot aqui!");
                return;
            }

            Bot Bot = null;

            if (!Session.GetHabbo().GetInventoryComponent().TryGetBot(BotId, out Bot))
            {
                return;
            }

            int BotCount = 0;

            foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (User == null || User.IsPet || !User.IsBot)
                {
                    continue;
                }

                BotCount += 1;
            }

            if (BotCount >= 25 && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override"))
            {
                Session.SendNotification("Sentimos muito, mas só pode colocar 25 bots no quarto!");
                return;
            }

            //TODO: Hmm, maybe not????
            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `bots` SET `room_id` = @roomId, `x` = @CoordX, `y` = @CoordY WHERE `id` = @BotId LIMIT 1");
                dbClient.AddParameter("roomId", Room.RoomId);
                dbClient.AddParameter("BotId", Bot.Id);
                dbClient.AddParameter("CoordX", X);
                dbClient.AddParameter("CoordY", Y);
                dbClient.RunQuery();
            }

            List <RandomSpeech> BotSpeechList = new List <RandomSpeech>();

            //TODO: Grab data?
            DataRow GetData = null;

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `ai_type`,`rotation`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `id` = @BotId LIMIT 1");
                dbClient.AddParameter("BotId", Bot.Id);
                GetData = dbClient.getRow();

                dbClient.SetQuery("SELECT * FROM `bots_speech` WHERE `bot_id` = @BotId ORDER BY id ASC");
                dbClient.AddParameter("BotId", Bot.Id);
                DataTable BotSpeech = dbClient.getTable();

                foreach (DataRow Speech in BotSpeech.Rows)
                {
                    BotSpeechList.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Bot.Id));
                }
            }

            RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(Bot.Id, Session.GetHabbo().CurrentRoomId, Convert.ToString(GetData["ai_type"]), Convert.ToString(GetData["walk_mode"]), Bot.Name, "", Bot.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, Bot.OwnerId, BiosEmuThiago.EnumToBool(GetData["automatic_chat"].ToString()), Convert.ToInt32(GetData["speaking_interval"]), BiosEmuThiago.EnumToBool(GetData["mix_sentences"].ToString()), Convert.ToInt32(GetData["chat_bubble"])), null);

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `bots` WHERE `id` = @BotId ");
                dbClient.AddParameter("BotId", Bot.Id);
                DataTable BotSpeechData = dbClient.getTable();
                foreach (DataRow SpeechData in BotSpeechData.Rows)
                {
                    BotUser.Chat("Olá!", false, (Convert.ToInt32(SpeechData["chat_bubble"])));
                }
            }

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


            Bot ToRemove = null;

            if (!Session.GetHabbo().GetInventoryComponent().TryRemoveBot(BotId, out ToRemove))
            {
                Console.WriteLine("Erro em eliminar no bot: " + ToRemove.Id);
                return;
            }
            Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
        }
示例#25
0
        public override void OnTimerTick()
        {
            RoomUser Pet = GetRoomUser();

            if (Pet == null)
            {
                return;
            }


            #region Speech

            if (SpeechTimer <= 0)
            {
                if (Pet.PetData.DBState != DatabaseUpdateState.NeedsInsert)
                {
                    Pet.PetData.DBState = DatabaseUpdateState.NeedsUpdate;
                }

                if (Pet != null)
                {
                    var RandomSpeech = new Random();
                    RemovePetStatus();

                    string[] Speech  = QuasarEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("speech.pet" + Pet.PetData.Type);
                    string   rSpeech = Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)];

                    if (rSpeech.Length != 3)
                    {
                        Pet.Chat(rSpeech, false);
                    }
                    else
                    {
                        Pet.Statusses.Add(rSpeech, TextHandling.GetString(Pet.Z));
                    }
                }
                SpeechTimer = QuasarEnvironment.GetRandomNumber(20, 120);
            }
            else
            {
                SpeechTimer--;
            }

            #endregion

            #region Actions

            if (ActionTimer <= 0)
            {
                try
                {
                    RemovePetStatus();
                    ActionTimer = RandomNumber.GenerateRandom(15, 40 + GetRoomUser().PetData.VirtualId);
                    if (!GetRoomUser().RidingHorse)
                    {
                        // Remove Status
                        RemovePetStatus();

                        Point nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                        if (GetRoomUser().CanWalk)
                        {
                            GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);
                        }
                    }
                }
                catch (Exception e)
                {
                    Logging.HandleException(e, "PetBot.OnTimerTick");
                }
            }
            else
            {
                ActionTimer--;
            }

            #endregion

            #region Energy

            if (EnergyTimer <= 0)
            {
                RemovePetStatus();                                  // Remove Status

                Pet.PetData.PetEnergy(true);                        // Add Energy

                EnergyTimer = RandomNumber.GenerateRandom(30, 120); // 2 Min Max
            }
            else
            {
                EnergyTimer--;
            }

            #endregion
        }
示例#26
0
        public override void OnUserSay(RoomUser User, string Message)
        {
            if (User == null)
            {
                return;
            }

            RoomUser Pet = GetRoomUser();

            if (Pet == null)
            {
                return;
            }

            if (Pet.PetData.DBState != DatabaseUpdateState.NeedsInsert)
            {
                Pet.PetData.DBState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Message.ToLower().Equals(Pet.PetData.Name.ToLower()))
            {
                Pet.SetRot(Rotation.Calculate(Pet.X, Pet.Y, User.X, User.Y), false);
                return;
            }

            //if (!Pet.Statusses.ContainsKey("gst thr"))
            //    Pet.Statusses.Add("gst thr", TextHandling.GetString(Pet.Z));

            if ((Message.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && User.GetClient().GetHabbo().Username.ToLower() == Pet.PetData.OwnerName.ToLower()) || (Message.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && QuasarEnvironment.GetGame().GetChatManager().GetPetCommands().TryInvoke(Message.Substring(Pet.PetData.Name.ToLower().Length + 1)) == 8))
            {
                string Command = Message.Substring(Pet.PetData.Name.ToLower().Length + 1);

                int r = RandomNumber.GenerateRandom(1, 8); // Made Random
                if (Pet.PetData.Energy > 10 && r < 6 || Pet.PetData.Level > 15 || QuasarEnvironment.GetGame().GetChatManager().GetPetCommands().TryInvoke(Command) == 8)
                {
                    RemovePetStatus(); // Remove Status

                    switch (QuasarEnvironment.GetGame().GetChatManager().GetPetCommands().TryInvoke(Command))
                    {
                        // TODO - Level you can use the commands at...



                        #region [1] Rennen

                    case 1:
                        RemovePetStatus();

                        //int randomX = QuasarEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeX);
                        //int randomY = QuasarEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeY);
                        Point nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                        Pet.MoveTo(nextCoord.X, nextCoord.Y);

                        Pet.PetData.Addexperience(10);     // Give XP

                        break;

                        #endregion

                        #region [2] Kom Hier

                    case 2:

                        RemovePetStatus();

                        int NewX = User.X;
                        int NewY = User.Y;

                        ActionTimer = 30;     // Reset ActionTimer

                        #region Draaien

                        if (User.RotBody == 4)
                        {
                            NewY = User.Y + 1;
                        }
                        else if (User.RotBody == 0)
                        {
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 6)
                        {
                            NewX = User.X - 1;
                        }
                        else if (User.RotBody == 2)
                        {
                            NewX = User.X + 1;
                        }
                        else if (User.RotBody == 3)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y + 1;
                        }
                        else if (User.RotBody == 1)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 7)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 5)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y + 1;
                        }

                        #endregion

                        Pet.PetData.Addexperience(10);     // Give XP

                        Pet.MoveTo(NewX, NewY);
                        break;

                        #endregion

                        #region [3] Zitten

                    case 3:
                        // Remove Status
                        RemovePetStatus();

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Add Status
                        Pet.Statusses.Add("sit", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        ActionTimer = 25;
                        EnergyTimer = 10;
                        break;

                        #endregion

                        #region [4] Liggen

                    case 4:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Statusses.Add("lay", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        ActionTimer = 30;
                        EnergyTimer = 5;
                        break;

                        #endregion

                        #region [5] Lig Dood

                    case 5:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Statusses.Add("ded", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        SpeechTimer = 45;
                        ActionTimer = 30;

                        break;

                        #endregion

                        #region [6] Slapen

                    case 6:
                        // Remove Status
                        RemovePetStatus();

                        Pet.Chat("ZzzZZZzzzzZzz", false);
                        Pet.Statusses.Add("lay", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        EnergyTimer = 5;
                        SpeechTimer = 30;
                        ActionTimer = 45;
                        break;

                        #endregion

                        #region [7] Springen

                    case 7:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Statusses.Add("jmp", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        EnergyTimer = 5;
                        SpeechTimer = 10;
                        ActionTimer = 5;
                        break;

                        #endregion

                        #region [8] Tellen
                    case 8:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Chat("1..3...39 : 3 = 13 tot de macht 38,5.. huh?", false);
                        Pet.Statusses.Add("count", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        SpeechTimer = 45;
                        ActionTimer = 30;
                        break;
                        #endregion

                    default:
                        string[] Speech = QuasarEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("pet.unknowncommand");

                        Pet.Chat(Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)], false);
                        break;
                    }
                    Pet.PetData.PetEnergy(false); // Remove Energy
                }
                else
                {
                    RemovePetStatus(); // Remove Status

                    if (Pet.PetData.Energy < 10)
                    {
                        string[] Speech = QuasarEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("pet.tired");

                        var RandomSpeech = new Random();
                        Pet.Chat(Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)], false);

                        Pet.Statusses.Add("lay", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        SpeechTimer = 50;
                        ActionTimer = 45;
                        EnergyTimer = 5;
                    }
                    else
                    {
                        string[] Speech = QuasarEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("pet.lazy");

                        var RandomSpeech = new Random();
                        Pet.Chat(Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)], false);

                        Pet.PetData.PetEnergy(false); // Remove Energy
                    }
                }
            }
            //Pet = null;
        }
示例#27
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

            if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            int  PetId = Packet.PopInt();
            bool Type  = Packet.PopBoolean();

            RoomUser Pet = null;

            if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet))
            {
                return;
            }

            if (Pet.PetData == null)
            {
                return;
            }

            if (Pet.PetData.AnyoneCanRide == 0 && Pet.PetData.OwnerId != User.UserId)
            {
                Session.SendNotification(
                    "Você não consegue montar este cavalo.\nO dono do animal de estimação selecionou para ninguém montá-lo.");
                return;
            }

            if (Type)
            {
                if (Pet.RidingHorse)
                {
                    string[] Speech2       = PlusEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("pet.alreadymounted");
                    var      RandomSpeech2 = new Random();
                    Pet.Chat(Speech2[RandomSpeech2.Next(0, Speech2.Length - 1)], false);
                }
                else if (User.RidingHorse)
                {
                    Session.SendNotification("Você já está montado em um cavalo!");
                }
                else
                {
                    if (Pet.Statusses.Count > 0)
                    {
                        Pet.Statusses.Clear();
                    }

                    int NewX2 = User.X;
                    int NewY2 = User.Y;
                    Room.SendMessage(Room.GetRoomItemHandler().UpdateUserOnRoller(Pet, new Point(NewX2, NewY2), 0, Room.GetGameMap().SqAbsoluteHeight(NewX2, NewY2)));
                    Room.SendMessage(Room.GetRoomItemHandler().UpdateUserOnRoller(User, new Point(NewX2, NewY2), 0, Room.GetGameMap().SqAbsoluteHeight(NewX2, NewY2) + 1));

                    User.MoveTo(NewX2, NewY2);

                    Pet.ClearMovement(true);

                    User.RidingHorse = true;
                    Pet.RidingHorse  = true;
                    Pet.HorseID      = User.VirtualId;
                    User.HorseID     = Pet.VirtualId;

                    User.ApplyEffect(77);

                    User.RotBody = Pet.RotBody;
                    User.RotHead = Pet.RotHead;

                    User.UpdateNeeded = true;
                    Pet.UpdateNeeded  = true;
                }
            }
            else
            {
                if (User.VirtualId == Pet.HorseID)
                {
                    Pet.Statusses.Remove("sit");
                    Pet.Statusses.Remove("lay");
                    Pet.Statusses.Remove("snf");
                    Pet.Statusses.Remove("eat");
                    Pet.Statusses.Remove("ded");
                    Pet.Statusses.Remove("jmp");
                    User.RidingHorse = false;
                    User.HorseID     = 0;
                    Pet.RidingHorse  = false;
                    Pet.HorseID      = 0;
                    User.MoveTo(new Point(User.X + 2, User.Y + 2));
                    User.ApplyEffect(-1);
                    User.UpdateNeeded = true;
                    Pet.UpdateNeeded  = true;
                }
                else
                {
                    Session.SendNotification("Não foi possível descer deste cavalo - Você não está montando!");
                }
            }

            Room.SendMessage(new PetHorseFigureInformationComposer(Pet));
        }
示例#28
0
        public override void OnUserSay(RoomUser User, string Message)
        {
            if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null)
                return;

            if (GetBotData() == null)
                return;

            if (Gamemap.TileDistance(GetRoomUser().X, GetRoomUser().Y, User.X, User.Y) > 8)
                return;

            string Command = Message.Substring(GetBotData().Name.ToLower().Length + 1);

            if ((Message.ToLower().StartsWith(GetBotData().Name.ToLower() + " ")))
            {
                switch (Command)
                {
                    case "ven":
                    case "comehere":
                    case "come here":
                    case "ven aqui":
                    case "come":
                        GetRoomUser().Chat("¡Voy!", false, 0);
                        GetRoomUser().MoveTo(User.SquareInFront);
                        break;

                    case "sirve":
                    case "serve":
                        if (GetRoom().CheckRights(User.GetClient()))
                        {
                            foreach (var current in GetRoom().GetRoomUserManager().GetRoomUsers()) current.CarryItem(Random.Next(1, 38));
                            GetRoomUser().Chat("Vale. Ya teneis todos algo para zampar.", false, 0);
                            return;
                        }
                        break;
                    case "agua":
                    case "té":
                    case "te":
                    case "tea":
                    case "juice":
                    case "water":
                    case "zumo":
                        GetRoomUser().Chat("Aquí tienes.", false, 0);
                        User.CarryItem(Random.Next(1, 3));
                        break;

                    case "helado":
                    case "icecream":
                    case "ice cream":
                        GetRoomUser().Chat("Aquí tienes. ¡Que no se te quede pegada la lengua, je je!", false, 0);
                        User.CarryItem(4);
                        break;

                    case "rose":
                    case "rosa":
                        GetRoomUser().Chat("Aquí tienes... que te vaya bien en tu cita.", false, 0);
                        User.CarryItem(Random.Next(1000, 1002));
                        break;

                    case "girasol":
                    case "sunflower":
                        GetRoomUser().Chat("Aquí tienes algo muy bonito de la naturaleza.", false, 0);
                        User.CarryItem(1002);
                        break;

                    case "flor":
                    case "flower":
                        GetRoomUser().Chat("Aquí tienes algo muy bonito de la naturaleza.", false, 0);
                        if (Random.Next(1, 3) == 2)
                        {
                            User.CarryItem(Random.Next(1019, 1024));
                            return;
                        }
                        User.CarryItem(Random.Next(1006, 1010));
                        break;

                    case "zanahoria":
                    case "zana":
                    case "carrot":
                        GetRoomUser().Chat("Aquí tienes una buena verdura. ¡Provecho!", false, 0);
                        User.CarryItem(3);
                        break;

                    case "café":
                    case "cafe":
                    case "capuccino":
                    case "coffee":
                    case "latte":
                    case "mocha":
                    case "espresso":
                    case "expreso":
                        GetRoomUser().Chat("Aquí tienes tu café. ¡Está espumoso!", false, 0);
                        User.CarryItem(Random.Next(11, 18));
                        break;

                    case "fruta":
                    case "fruit":
                        GetRoomUser().Chat("Aquí tienes algo sano, fresco y natural. ¡Que lo disfrutes!", false, 0);
                        User.CarryItem(Random.Next(36, 40));
                        break;

                    case "naranja":
                    case "orange":
                        GetRoomUser().Chat("Aquí tienes algo sano, fresco y natural. ¡Que lo disfrutes!", false, 0);
                        User.CarryItem(38);
                        break;

                    case "manzana":
                    case "apple":
                        GetRoomUser().Chat("Aquí tienes algo sano, fresco y natural. ¡Que lo disfrutes!", false, 0);
                        User.CarryItem(37);
                        break;

                    case "cola":
                    case "habbocola":
                    case "cocacola":
                    case "coca cola":
                    case "coca-cola":
                    case "habbo cola":
                    case "habbo-cola":
                        GetRoomUser().Chat("Aquí tienes un refresco bastante famoso.", false, 0);
                        User.CarryItem(19);
                        break;

                    case "pear":
                    case "pera":
                        GetRoomUser().Chat("Aquí tienes algo sano, fresco y natural. ¡Que lo disfrutes!", false, 0);
                        User.CarryItem(36);
                        break;

                    case "ananá":
                    case "pineapple":
                    case "piña":
                    case "rodaja de piña":
                        GetRoomUser().Chat("Aquí tienes algo sano, fresco y natural. ¡Que lo disfrutes!", false, 0);
                        User.CarryItem(39);
                        break;

                    case "puta":
                    case "puto":
                    case "gilipollas":
                    case "metemela":
                    case "polla":
                    case "pene":
                    case "penis":
                    case "idiot":
                    case "f**k":
                    case "bastardo":
                    case "idiota":
                    case "chupamela":
                    case "tonta":
                    case "tonto":
                    case "mierda":
                        GetRoomUser().Chat("¡No me trates así, eh!", true, 0);
                        break;

                    case "casate conmigo":
                        GetRoomUser().Chat("Ire ahora!", true, 0);
                        break;

                    case "protocolo destruir":
                        GetRoomUser().Chat("Iniciando Auto Destrucción del Mundo", true, 0);
                        break;

                    case "lindo":
                    case "hermoso":
                    case "linda":
                    case "guapa":
                    case "beautiful":
                    case "handsome":
                    case "love":
                    case "guapo":
                    case "i love you":
                    case "hermosa":
                    case "preciosa":
                    case "teamo":
                    case "amor":
                    case "miamor":
                    case "mi amor":
                        GetRoomUser().Chat("Soy un bot, err... esto se está poniendo incómodo, ¿sabes?", false, 0);
                        break;
                    case "chupala":
                        if (User.GetClient().GetHabbo().Credits < 500)
                        {
                            GetRoomUser().Chat("Opps no tienes creditos suficientes para recibir lo tuyo... necesitas 500$", false, 0);
                            return;
                        }
                        GetRoomUser().Chat("* Chupar a " + User.GetClient().GetHabbo().Username + " *", false, 0);
                        User.Chat("* Oh seh BUENA CHUPADA! ohh seh!! *", false, 0);
                        User.GetClient().GetHabbo().Credits = User.GetClient().GetHabbo().Credits - 500;
                        User.GetClient().SendMessage(new CreditBalanceComposer(User.GetClient().GetHabbo().Credits));
                        break;
                    case "pajilla":
                        if (User.GetClient().GetHabbo().Credits < 300)
                        {
                            GetRoomUser().Chat("Opps no tienes creditos suficientes para recibir lo tuyo... necesitas 300$", false, 0);
                            return;
                        }
                        GetRoomUser().Chat("* Haciendo una pajilla a " + User.GetClient().GetHabbo().Username + " *", false, 0);
                        User.Chat("* Oh seh baby! ohh seh!! *", false, 0);
                        User.GetClient().GetHabbo().Credits = User.GetClient().GetHabbo().Credits - 300;
                        User.GetClient().SendMessage(new CreditBalanceComposer(User.GetClient().GetHabbo().Credits));
                        break;
                    case "juangomez":
                    case "JuanGomez":
                        GetRoomUser().Chat("Alabado sea el Sr. JuanGomez!", true, 34);
                        break;
                }
            }
        }
示例#29
0
        private void PullUser(RoomUser roomuserTarget, RoomUser roomuserSource)
        {
            if (roomuserTarget == null)
                return;

            Point userSquare = roomuserTarget.Coordinate;
            Point closestSquare = roomuserTarget.Coordinate;

            Point a = new Point(userSquare.X, userSquare.Y++);
            if (CoordinationUtil.GetDistance(closestSquare, a) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                closestSquare = a;

            Point b = new Point(userSquare.X, userSquare.Y--);
            if (CoordinationUtil.GetDistance(closestSquare, b) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                closestSquare = b;

            Point c = new Point(userSquare.X++, userSquare.Y);
            if (CoordinationUtil.GetDistance(closestSquare, c) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                closestSquare = c;

            Point d = new Point(userSquare.X--, userSquare.Y++);
            if (CoordinationUtil.GetDistance(closestSquare, d) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                closestSquare = d;

            Point e = new Point(userSquare.X++, userSquare.Y--);
            if (CoordinationUtil.GetDistance(closestSquare, e) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                closestSquare = e;

            Point f = new Point(userSquare.X--, userSquare.Y);
            if (CoordinationUtil.GetDistance(closestSquare, f) < CoordinationUtil.GetDistance(closestSquare, roomuserTarget.Coordinate))
                closestSquare = f;

            roomuserTarget.MoveTo(closestSquare);
            roomuserSource.Chat(Session, string.Format(LanguageLocale.GetValue("commands.pulluser"), roomuserTarget.GetUsername()), true);
        }
        public override void OnUserSay(RoomUser User, string Message)
        {
            if (User == null)
            {
                return;
            }

            RoomUser Pet = GetRoomUser();

            if (Pet == null)
            {
                return;
            }

            if (Pet.PetData.DBState != DatabaseUpdateState.NeedsInsert)
            {
                Pet.PetData.DBState = DatabaseUpdateState.NeedsUpdate;
            }

            if (Message.ToLower().Equals(Pet.PetData.Name.ToLower()))
            {
                Pet.SetRot(Rotation.Calculate(Pet.X, Pet.Y, User.X, User.Y), false);
                return;
            }

            //if (!Pet.Statusses.ContainsKey("gst thr"))
            //    Pet.Statusses.Add("gst, TextHandling.GetString(Pet.Z));

            if ((Message.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && User.GetClient().GetHabbo().Username.ToLower() == Pet.PetData.OwnerName.ToLower()) || (Message.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && BiosEmuThiago.GetGame().GetChatManager().GetPetCommands().TryInvoke(Message.Substring(Pet.PetData.Name.ToLower().Length + 1)) == 8))
            {
                string Command = Message.Substring(Pet.PetData.Name.ToLower().Length + 1);

                int r = RandomNumber.GenerateRandom(1, 8); // Made Random
                if (Pet.PetData.Energy > 10 && r < 6 || Pet.PetData.Level > 15 || BiosEmuThiago.GetGame().GetChatManager().GetPetCommands().TryInvoke(Command) == 8)
                {
                    RemovePetStatus(); // Remove Status

                    switch (BiosEmuThiago.GetGame().GetChatManager().GetPetCommands().TryInvoke(Command))
                    {
                        // TODO - Level you can use the commands at...



                        #region free

                    case 1:
                        RemovePetStatus();

                        //int randomX = BiosEmuThiago.GetRandomNumber(0, GetRoom().Model.MapSizeX);
                        //int randomY = BiosEmuThiago.GetRandomNumber(0, GetRoom().Model.MapSizeY);
                        Point nextCoord = GetRoom().GetGameMap().GetRandomWalkableSquare();
                        Pet.MoveTo(nextCoord.X, nextCoord.Y);

                        Pet.PetData.Addexperience(10);     // Give XP

                        break;

                        #endregion

                        #region here

                    case 2:

                        RemovePetStatus();

                        int NewX = User.X;
                        int NewY = User.Y;

                        ActionTimer = 30;     // Reset ActionTimer

                        #region Rotation

                        if (User.RotBody == 4)
                        {
                            NewY = User.Y + 1;
                        }
                        else if (User.RotBody == 0)
                        {
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 6)
                        {
                            NewX = User.X - 1;
                        }
                        else if (User.RotBody == 2)
                        {
                            NewX = User.X + 1;
                        }
                        else if (User.RotBody == 3)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y + 1;
                        }
                        else if (User.RotBody == 1)
                        {
                            NewX = User.X + 1;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 7)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y - 1;
                        }
                        else if (User.RotBody == 5)
                        {
                            NewX = User.X - 1;
                            NewY = User.Y + 1;
                        }

                        #endregion

                        Pet.PetData.Addexperience(10);     // Give XP

                        Pet.MoveTo(NewX, NewY);
                        break;

                        #endregion

                        #region sit

                    case 3:
                        // Remove Status
                        RemovePetStatus();

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Add Status
                        Pet.Statusses.Add("sit", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        ActionTimer = 25;
                        EnergyTimer = 10;
                        break;

                        #endregion

                        #region lay

                    case 4:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Statusses.Add("lay", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        ActionTimer = 30;
                        EnergyTimer = 5;
                        break;

                        #endregion

                        #region dead

                    case 5:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Statusses.Add("ded", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        SpeechTimer = 45;
                        ActionTimer = 30;

                        break;

                        #endregion

                        #region sleep

                    case 6:
                        // Remove Status
                        RemovePetStatus();

                        Pet.Chat("ZzzZZZzzzzZzz", false);
                        Pet.Statusses.Add("lay", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        EnergyTimer = 5;
                        SpeechTimer = 30;
                        ActionTimer = 45;
                        break;

                        #endregion

                        #region jump

                    case 7:
                        // Remove Status
                        RemovePetStatus();

                        // Add Status
                        Pet.Statusses.Add("jmp", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        Pet.PetData.Addexperience(10);     // Give XP

                        // Don't move to speak for a set amount of time.
                        EnergyTimer = 5;
                        SpeechTimer = 10;
                        ActionTimer = 5;
                        break;

                        #endregion

                        #region breed
                    case 46:

                        break;
                        #endregion

                    default:
                        string[] Speech = BiosEmuThiago.GetGame().GetChatManager().GetPetLocale().GetValue("pet.unknowncommand");

                        Pet.Chat(Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)], false);
                        break;
                    }
                    Pet.PetData.PetEnergy(false); // Remove Energy
                }
                else
                {
                    RemovePetStatus(); // Remove Status

                    if (Pet.PetData.Energy < 10)
                    {
                        //GetRoomUser refers to the pet
                        //User refers to Owner

                        RoomUser UserRiding = GetRoom().GetRoomUserManager().GetRoomUserByVirtualId(Pet.HorseID);;

                        if (UserRiding.RidingHorse)
                        {
                            Pet.Chat("Getof my sit", false);
                            UserRiding.RidingHorse = false;
                            Pet.RidingHorse        = false;
                            UserRiding.ApplyEffect(-1);
                            UserRiding.MoveTo(new Point(GetRoomUser().X + 1, GetRoomUser().Y + 1));
                        }

                        string[] Speech = BiosEmuThiago.GetGame().GetChatManager().GetPetLocale().GetValue("pet.tired");

                        var RandomSpeech = new Random();
                        Pet.Chat(Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)], false);

                        Pet.Statusses.Add("lay", TextHandling.GetString(Pet.Z));
                        Pet.UpdateNeeded = true;

                        SpeechTimer = 50;
                        ActionTimer = 45;
                        EnergyTimer = 5;
                    }
                    else
                    {
                        string[] Speech = BiosEmuThiago.GetGame().GetChatManager().GetPetLocale().GetValue("pet.lazy");

                        var RandomSpeech = new Random();
                        Pet.Chat(Speech[RandomNumber.GenerateRandom(0, Speech.Length - 1)], false);

                        Pet.PetData.PetEnergy(false); // Remove Energy
                    }
                }
            }
            //Pet = null;
        }
示例#31
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);
        }