コード例 #1
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            if (GroupId >= 1000)
            {
                return;
            }

            Group Group = GroupManager.GetJob(GroupId);

            if (Group == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager") && (Session.GetHabbo().Id != Group.CreatorId || !Group.IsMember(UserId)))
            {
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Opa, ocorreu um erro ao encontrar este usuário.");
                return;
            }

            Group.TakeAdmin(UserId);
            GroupRank Rank = GroupManager.GetJobRank(Group.Id, 1);

            Session.Shout("*Rebaixa " + Habbo.Username + " todos os cargos da Empresa " + Group.Name + " até o cargo " + Rank.Name + "*", 23);

            #region (Disabled) Take Room Rights

            /*
             * Room Room = null;
             * if (PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room))
             * {
             *  RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(UserId);
             *  if (User != null)
             *  {
             *      if (User.Statusses.ContainsKey("flatctrl 3"))
             *          User.RemoveStatus("flatctrl 3");
             *      User.UpdateNeeded = true;
             *      if (User.GetClient() != null)
             *          User.GetClient().SendMessage(new YouAreControllerComposer(0));
             *  }
             * }*/
            #endregion

            Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 2));
        }
コード例 #2
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int    roomID     = Packet.PopInt();
            bool   IsVip      = Session.GetHabbo().VIPRank < 1 ? false : true;
            int    Cost       = IsVip ? 0 : 3;
            int    Time       = IsVip ? (5 + DayNightManager.GetTaxiTime()) : (10 + DayNightManager.GetTaxiTime());
            string TaxiText   = IsVip ? " VIP" : "";
            bool   RoomLoaded = false;
            bool   OnDuty     = false;

            if (Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Session.GetRoleplay().StaffOnDuty)
            {
                OnDuty = true;
            }
            if (Session.GetHabbo().VIPRank > 1)
            {
                OnDuty = true;
            }

            #region Conditions
            if (Session.GetRoleplay().IsJailed || Session.GetRoleplay().IsDead)
            {
                return;
            }

            if (Session.GetRoleplay().Cuffed)
            {
                Session.SendWhisper("Os taxistas não querem levar você, pois estão com medo de você algemado!", 1);
                return;
            }

            if (Session.GetRoomUser() != null)
            {
                if (Session.GetRoomUser().Frozen)
                {
                    Session.SendWhisper("Você não pode pegar um taxi enquanto está atordoado!", 1);
                    return;
                }
            }
            #endregion

            RoomData roomData = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);

            if (roomData == null)
            {
                return;
            }

            if (RoomLoaded)
            {
                return;
            }

            if (roomData.TutorialEnabled && !OnDuty)
            {
                Session.SendWhisper("[RPG Taxi] Você não pode ir para uma sala de Tutorial!", 1);
                return;
            }

            if (Session.GetRoomUser() != null && Session.GetRoomUser().GetRoom() != null)
            {
                if (Session.GetRoomUser().GetRoom().TutorialEnabled&& !OnDuty)
                {
                    Session.SendWhisper("[RPG Taxi] Você não pode usar taxi em uma sala de tutorial, termine ele primeiro!", 1);
                    return;
                }

                if (!Session.GetRoomUser().GetRoom().TaxiFromEnabled&& !OnDuty)
                {
                    Session.SendWhisper("[RPG Taxi] Desculpe, não podemos pegar você neste quarto!", 1);
                    return;
                }
            }

            if (roomID != Session.GetHabbo().CurrentRoomId)
            {
                if (Session.GetRoleplay().Game != null)
                {
                    Session.SendWhisper("Você não pode pegar um texi no evento!", 1);
                    return;
                }

                bool PoliceCost = false;
                if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking)
                {
                    PoliceCost = true;
                }

                if (Session.GetHabbo().Credits < Cost && Cost > 0 && !OnDuty && !PoliceCost)
                {
                    Session.SendWhisper("[RPG Taxi] Você não tem dinheiro suficiente para dar uma volta!", 1);
                    return;
                }

                if (Session.GetRoleplay().InsideTaxi)
                {
                    Session.SendWhisper("[RPG Taxi] Já estou indo pegar você! Digite ':ptaxi' se mudar de ideia!", 1);
                    return;
                }

                bool PoliceTool = false;
                if (Session.GetRoleplay().GuideOtherUser != null)
                {
                    if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide"))
                    {
                        if (Session.GetRoleplay().GuideOtherUser.GetHabbo() != null && Session.GetRoleplay().GuideOtherUser.GetRoomUser() != null)
                        {
                            if (roomID == Session.GetRoleplay().GuideOtherUser.GetRoomUser().RoomId)
                            {
                                PoliceTool = true;
                            }
                        }
                    }
                }

                if (!roomData.TaxiToEnabled && !OnDuty && !PoliceTool)
                {
                    Session.SendWhisper("[RPG Taxi] Desculpe, não podemos buscar você neste quarto!", 1);
                    return;
                }

                bool Event = false;
                if (roomData.RoleplayEvent != null)
                {
                    if (!roomData.RoleplayEvent.HasGameStarted())
                    {
                        Event = true;
                    }
                }

                Session.GetRoleplay().InsideTaxi = true;
                bool PoliceTaxi = false;

                if (!OnDuty && !PoliceTool && Session.GetHabbo().CurrentRoomId > 0 && !Event)
                {
                    if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking)
                    {
                        Cost = 0;
                        Time = 5;

                        if (Session.GetRoomUser() != null)
                        {
                            Session.GetRoomUser().ApplyEffect(EffectsList.PoliceTaxi);
                        }

                        Session.Shout("*Puxa o rádio da Polícia e vai rapidamente para " + roomData.Name + " [ID: " + roomID + "]*", 37);
                        PoliceTaxi = true;
                    }
                    else
                    {
                        if (Session.GetRoomUser() != null)
                        {
                            Session.GetRoomUser().ApplyEffect(EffectsList.Taxi);
                        }

                        Session.Shout("*Chama um Taxi" + TaxiText + " por " + roomData.Name + " [ID: " + roomID + "]*", 4);
                    }

                    new Thread(() =>
                    {
                        for (int i = 0; i < (Time + 1) * 10; i++)
                        {
                            if (Session.GetRoleplay() == null)
                            {
                                break;
                            }

                            if (Session.GetRoleplay().InsideTaxi)
                            {
                                Thread.Sleep(100);
                            }
                            else
                            {
                                break;
                            }
                        }

                        if (Session.GetRoleplay() != null)
                        {
                            if (Session.GetRoleplay().InsideTaxi)
                            {
                                if (Cost > 0)
                                {
                                    Session.GetHabbo().Credits -= Cost;
                                    Session.GetHabbo().UpdateCreditsBalance();
                                }

                                if (PoliceTaxi)
                                {
                                    if (Session.GetRoomUser() != null)
                                    {
                                        Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice);
                                    }
                                    Session.Shout("*Entra no meu carro de polícia e vai para o local*", 37);
                                }
                                else
                                {
                                    Session.Shout("*Pula dentro do meu Taxi" + TaxiText + " e vai rapidamente para o local*", 4);
                                }
                                RoleplayManager.SendUser(Session, roomData.Id);
                            }
                        }
                    }).Start();
                }
                else
                {
                    if (PoliceTool)
                    {
                        if (Session.GetRoomUser() != null)
                        {
                            Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice);
                        }
                        Session.Shout("*Entra no meu carro de polícia e dirige para ajudar um cidadão em necessidade*", 4);
                    }
                    else if (OnDuty)
                    {
                        Session.Shout("*Pula dentro do meu Carro Staff*", 23);
                    }
                    RoleplayManager.SendUser(Session, roomData.Id);
                }
            }
            else
            {
                Session.SendMessage(new GetGuestRoomResultComposer(Session, roomData, true, false));
            }
        }
コード例 #3
0
        public void HandleATMQuestion(HabboHotel.GameClients.GameClient Session, int questionId, string amount)
        {
            if (Session.GetRoleplay().BankAccount <= 0)
            {
                if (Session.GetRoomUser() != null)
                {
                    if (!Session.GetRoomUser().CanWalk)
                    {
                        Session.GetRoomUser().CanWalk = true;
                    }
                }
            }

            if (questionId == 1)
            {
                if (!Session.GetRoleplay().ATMFailed)
                {
                    if (amount == "1")
                    {
                        Session.GetRoleplay().ATMAccount = "Cheques";
                    }
                    else if (amount == "2")
                    {
                        Session.GetRoleplay().ATMAccount = "Poupanca";
                    }
                    else
                    {
                        Session.GetRoleplay().ATMFailed = true;
                    }
                }
            }
            else if (questionId == 2)
            {
                if (!Session.GetRoleplay().ATMFailed)
                {
                    if (amount == "1")
                    {
                        Session.GetRoleplay().ATMAction = "Retirar";
                    }
                    else if (amount == "2")
                    {
                        Session.GetRoleplay().ATMAction = "Depositar";
                    }
                    else
                    {
                        Session.GetRoleplay().ATMFailed = true;
                    }
                }
            }
            else
            {
                int Amount;
                if (int.TryParse(amount, out Amount))
                {
                    if (Amount <= 0)
                    {
                        Session.GetRoleplay().ATMFailed = true;
                    }

                    if (!Session.GetRoleplay().ATMFailed)
                    {
                        if (Session.GetRoleplay().ATMAccount.ToLower() == "cheques")
                        {
                            if (Session.GetRoleplay().ATMAction.ToLower() == "retirar")
                            {
                                if (Session.GetRoleplay().BankChequings < Amount)
                                {
                                    Session.GetRoleplay().ATMFailed = true;
                                }
                                else
                                {
                                    Session.GetRoleplay().BankChequings -= Amount;
                                    Session.GetHabbo().Credits          += Amount;
                                    Session.GetHabbo().UpdateCreditsBalance();

                                    Session.Shout("*Usa o ATM para retirar R$" + Amount + " na minha conta de Cheques*", 5);
                                }
                            }
                            else if (Session.GetRoleplay().ATMAction.ToLower() == "depositar")
                            {
                                if (Amount > Session.GetHabbo().Credits)
                                {
                                    Session.GetRoleplay().ATMFailed = true;
                                }
                                else
                                {
                                    Session.GetRoleplay().BankChequings += Amount;
                                    Session.GetHabbo().Credits          -= Amount;
                                    Session.GetHabbo().UpdateCreditsBalance();

                                    Session.Shout("*Usa o ATM para depositar R$" + Amount + " na mina conta de Cheques*", 5);
                                }
                            }
                            else
                            {
                                Session.GetRoleplay().ATMFailed = true;
                            }
                        }
                        else
                        {
                            if (Session.GetRoleplay().ATMAction.ToLower() == "retirar")
                            {
                                if (Amount > 20)
                                {
                                    if (Session.GetRoleplay().BankSavings < Amount)
                                    {
                                        Session.GetRoleplay().ATMFailed = true;
                                    }
                                    else
                                    {
                                        int TaxAmount = Convert.ToInt32((double)Amount * 0.05);

                                        Session.GetHabbo().Credits += (Amount - TaxAmount);
                                        Session.GetHabbo().UpdateCreditsBalance();

                                        Session.GetRoleplay().BankSavings -= Amount;
                                        Session.Shout("*Retira R$" + Amount + " da minha conta de Cheques e coloca no bolso*", 5);
                                        Session.SendWhisper("Você pagou uma taxa de R$" + TaxAmount + " por retirar " + Amount, 1);
                                    }
                                }
                                else
                                {
                                    Session.GetRoleplay().ATMFailed = true;
                                }
                            }
                            else if (Session.GetRoleplay().ATMAction.ToLower() == "depositar")
                            {
                                if (Amount > Session.GetHabbo().Credits)
                                {
                                    Session.GetRoleplay().ATMFailed = true;
                                }
                                else
                                {
                                    Session.GetRoleplay().BankSavings += Amount;
                                    Session.GetHabbo().Credits        -= Amount;
                                    Session.GetHabbo().UpdateCreditsBalance();

                                    Session.Shout("*Usa o ATM para depositar R$" + Amount + " na minha conta Poupança*", 5);
                                }
                            }
                            else
                            {
                                Session.GetRoleplay().ATMFailed = true;
                            }
                        }
                    }
                    else
                    {
                        Session.GetRoleplay().ATMFailed = true;
                    }

                    if (Session.GetRoleplay().ATMFailed == true)
                    {
                        Session.SendWhisper("Error... ATM Falhou!", 1);
                    }
                }
                else
                {
                    Session.SendWhisper("Error... ATM Falhou!", 1);
                }

                Session.GetRoleplay().ATMAccount = "";
                Session.GetRoleplay().ATMAction  = "";
                Session.GetRoleplay().ATMFailed  = false;
            }
        }
コード例 #4
0
ファイル: JoinGroupEvent.cs プロジェクト: xjoao97/HabboRP
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            int       GroupId   = Packet.PopInt();
            Group     Group     = null;
            GroupRank GroupRank = null;

            if (GroupId < 1000)
            {
                Group     = GroupManager.GetJob(GroupId);
                GroupRank = GroupManager.GetJobRank(GroupId, 1);
            }
            else
            {
                Group     = GroupManager.GetGang(GroupId);
                GroupRank = GroupManager.GetGangRank(GroupId, 1);
            }

            if (GroupId >= 1000)
            {
                Group CurrentGang = GroupManager.GetGang(Session.GetRoleplay().GangId);

                if (CurrentGang != null && CurrentGang.CreatorId == Session.GetHabbo().Id)
                {
                    Session.SendNotification("Você deve excluir sua primeira gangue se quiser se juntar a outra gangue!");
                    return;
                }
            }

            if (Group == null)
            {
                return;
            }

            if (Group.IsMember(Session.GetHabbo().Id) || Group.IsAdmin(Session.GetHabbo().Id))
            {
                return;
            }

            if (Group.GroupType == GroupType.LOCKED && Group.HasRequest(Session.GetHabbo().Id))
            {
                return;
            }

            if (Group.GroupType == GroupType.PRIVATE)
            {
                return;
            }

            List <Group> Groups = PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(Session.GetHabbo().Id);

            if (Groups.Count >= 3)
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Opa, parece que você atingiu o limite do grupo! Você só pode juntar até 1.500 grupos."));
                return;
            }

            if (Group.Id < 1000 && GroupRank.HasCommand("guide"))
            {
                if (BlackListManager.BlackList.Contains(Session.GetHabbo().Id))
                {
                    Session.SendWhisper("Você está na lista negra e não pode se juntar à corporação da polícia!", 1);
                    return;
                }
            }

            if (GroupId < 1000)
            {
                if (Group.GroupType == GroupType.LOCKED && !Session.GetHabbo().GetPermissions().HasRight("corporation_rights"))
                {
                    Session.GetRoleplay().JobRequest = GroupId;
                    Group.Requests.Add(Session.GetHabbo().Id);

                    Session.SendWhisper("Sucesso, você solicitou com sucesso para se juntar à empresa '" + Group.Name + "'!", 1);
                    List <GameClient> GroupAdmins = (from Client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList() where Client != null && Client.GetHabbo() != null && (Group.IsAdmin(Client.GetHabbo().Id) || Client.GetHabbo().GetPermissions().HasRight("corporation_rights")) select Client).ToList();
                    foreach (GameClient Client in GroupAdmins)
                    {
                        Client.SendMessage(new GroupMembershipRequestedComposer(Group.Id, Session.GetHabbo(), 3));
                    }
                    Session.SendMessage(new GroupInfoComposer(Group, Session));
                    return;
                }
                else
                {
                    int Bubble = 4;
                    if (Session.GetHabbo().GetPermissions().HasRight("corporation_rights"))
                    {
                        Bubble = 23;
                    }

                    Session.Shout("*Se contrata como um " + Group.Name + " no cargo " + GroupRank.Name + "*", Bubble);

                    //Session.SendMessage(new GroupFurniConfigComposer(PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(Session.GetHabbo().Id)));

                    Session.GetRoleplay().TimeWorked = 0;
                    Session.GetRoleplay().JobId      = Group.Id;
                    Session.GetRoleplay().JobRank    = 1;
                    Session.GetRoleplay().JobRequest = 0;

                    Group.AddNewMember(Session.GetHabbo().Id);
                    Group.SendPackets(Session);
                }
            }
            else
            {
                if (Group.GroupType == GroupType.LOCKED)
                {
                    Session.GetRoleplay().GangRequest = GroupId;
                    Group.Requests.Add(Session.GetHabbo().Id);

                    Session.SendWhisper("Sucesso, você solicitou com sucesso para se juntar à gangue '" + Group.Name + "'!", 1);

                    List <GameClient> GroupAdmins = (from Client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList() where Client != null && Client.GetHabbo() != null && (Group.IsAdmin(Client.GetHabbo().Id)) select Client).ToList();
                    foreach (GameClient Client in GroupAdmins)
                    {
                        Client.SendMessage(new GroupMembershipRequestedComposer(Group.Id, Session.GetHabbo(), 3));
                    }

                    Session.SendMessage(new GroupInfoComposer(Group, Session));

                    UserCache Junk = null;
                    PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(Session.GetHabbo().Id, out Junk);
                    PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Session.GetHabbo().Id);
                }
                else
                {
                    Session.Shout("*Entra na gangue '" + Group.Name + "' no cargo " + GroupRank.Name + "*", 4);

                    Session.SendMessage(new GroupFurniConfigComposer(PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(Session.GetHabbo().Id)));

                    Session.GetRoleplay().GangId      = Group.Id;
                    Session.GetRoleplay().GangRank    = 1;
                    Session.GetRoleplay().GangRequest = 0;

                    Group.AddNewMember(Session.GetHabbo().Id);
                    Group.SendPackets(Session);
                }
            }
        }
コード例 #5
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            Group Group       = null;
            Group RemoveGroup = null;

            if (GroupId < 1000)
            {
                Group = GroupManager.GetJob(GroupId);
            }
            else
            {
                Group = GroupManager.GetGang(GroupId);
            }

            if (Group == null)
            {
                return;
            }

            if (GroupId == 1)
            {
                return;
            }

            if (GroupId == 1000)
            {
                return;
            }

            if (!Group.IsMember(UserId))
            {
                return;
            }

            UserCache Junk = null;

            PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(UserId, out Junk);
            PlusEnvironment.GetGame().GetCacheManager().GenerateUser(UserId);

            bool CanRemove = false;

            if (UserId == Session.GetHabbo().Id || Group.CreatorId == Session.GetHabbo().Id || Group.IsAdmin(Session.GetHabbo().Id) || Session.GetHabbo().GetPermissions().HasRight("corporation_rights"))
            {
                CanRemove = true;
            }

            if (!CanRemove)
            {
                if (Group.Id < 1000)
                {
                    if (Group.IsAdmin(UserId) && Group.CreatorId != Session.GetHabbo().Id)
                    {
                        if (!Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager"))
                        {
                            Session.SendWhisper("Desculpe, apenas um gerente pode adicionar outro!", 1);
                            return;
                        }
                    }
                }
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            Group NewGroup;

            if (GroupId < 1000)
            {
                NewGroup = GroupManager.GetJob(1);
            }
            else
            {
                NewGroup = GroupManager.GetGang(1000);
            }

            #region (Disabled) Remove Room Rights

            /*
             * if ((Group.AdminOnlyDeco == 0 || Group.IsAdmin(UserId)) && Client != null && Client.GetRoomUser() != null)
             * {
             *  Room Room;
             *  if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room))
             *      return;
             *
             *  RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
             *  if (User != null)
             *  {
             *      User.RemoveStatus("flatctrl 1");
             *      User.UpdateNeeded = true;
             *      Client.SendMessage(new YouAreControllerComposer(0));
             *  }
             * }*/
            #endregion

            if (Session.GetHabbo().Id == UserId)
            {
                UpdateGroupData(Group, Session);
                NewGroup.AddNewMember(UserId);
                NewGroup.SendPackets(Session);

                if (Group.Id < 1000)
                {
                    Session.Shout("*Se demite da empresa " + Group.Name + "*", 4);
                }
                else
                {
                    Session.Shout("*Sai da gangue " + Group.Name + "*", 4);
                }
            }
            else
            {
                GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client != null && Client.GetHabbo() != null && Client.GetRoleplay() != null)
                {
                    UpdateGroupData(Group, Client);
                    NewGroup.AddNewMember(UserId);
                    NewGroup.SendPackets(Client);
                    Group.SendMembersPackets(Client);
                }
                else
                {
                    NewGroup.AddNewMember(UserId);
                    Group.SendMembersPackets(Session);
                }

                int Bubble = Session.GetHabbo().GetPermissions().HasRight("mod_tool") ? 23 : 4;
                if (Group.CreatorId == Session.GetHabbo().Id)
                {
                    Bubble = 4;
                }

                string Username = Habbo == null ? "alguém" : Habbo.Username;
                if (Group.Id < 1000)
                {
                    Session.Shout("*Demite " + Username + " da empresa " + Group.Name + "*", Bubble);
                }
                else
                {
                    Session.Shout("*Expulsa " + Username + " da gangue " + Group.Name + "*", Bubble);
                }
            }


            if (Group.Id >= 1000)
            {
                foreach (int Member in Group.Members.Keys)
                {
                    GameClient GangMember = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Member);

                    if (GangMember == null)
                    {
                        continue;
                    }

                    GangMember.SendWhisper("[GANGUE] " + Habbo == null ? "alguém" : Habbo.Username + " acabou de sair do grupo!", 34);
                }
            }
        }
コード例 #6
0
ファイル: FollowFriendEvent.cs プロジェクト: xjoao97/HabboRP
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            if (!RoleplayManager.FollowFriends)
            {
                Session.SendWhisper("Opa, o gerenciamento do servidor desativou a capacidade de seguir seus amigos.", 1);
                return;
            }

            int    BuddyId  = Packet.PopInt();
            bool   IsVip    = Session.GetHabbo().VIPRank < 1 ? false : true;
            int    Cost     = IsVip ? 0 : 3;
            int    Time     = IsVip ? (5 + DayNightManager.GetTaxiTime()) : (10 + DayNightManager.GetTaxiTime());
            string TaxiText = IsVip ? " VIP" : "";
            bool   OnDuty   = false;

            if (BuddyId == 0 || BuddyId == Session.GetHabbo().Id)
            {
                return;
            }

            GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(BuddyId);

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

            if (!Client.GetHabbo().InRoom)
            {
                Session.SendMessage(new FollowFriendFailedComposer(2));
                Session.GetHabbo().GetMessenger().UpdateFriend(Client.GetHabbo().Id, Client, true);
                return;
            }
            else if (Session.GetHabbo().CurrentRoom != null && Client.GetHabbo().CurrentRoom != null)
            {
                if (Session.GetHabbo().CurrentRoom.RoomId == Client.GetHabbo().CurrentRoom.RoomId)
                {
                    return;
                }
            }

            if (!Client.GetHabbo().AllowConsoleMessages)
            {
                if (Session.GetHabbo().InRoom)
                {
                    Session.SendWhisper("Desculpe, mas esse cidadão desligou o telefone, então você não pode segui-lo.", 1);
                }
                else
                {
                    Session.SendNotification("Desculpe, mas esse cidadão desligou o telefone, então você não pode segui-lo.");
                }
                return;
            }

            if (Session.GetRoleplay().IsDead)
            {
                Session.SendWhisper("Você não pode seguir seu amigo enquanto está morto!", 1);
                return;
            }

            if (Session.GetRoleplay().IsJailed)
            {
                Session.SendWhisper("Você não pode seguir seu amigo enquanto está preso!", 1);
                return;
            }

            if (Session.GetRoomUser() != null)
            {
                if (Session.GetRoomUser().Frozen)
                {
                    Session.SendWhisper("Você não pode seguir seu amigo enquanto está congelado ou atordoado!", 1);
                    return;
                }
            }

            if (Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Session.GetRoleplay().StaffOnDuty)
            {
                OnDuty = true;
            }
            if (Session.GetHabbo().VIPRank > 1)
            {
                OnDuty = true;
            }

            if (Session.GetHabbo().CurrentRoom != null)
            {
                if (!Session.GetHabbo().CurrentRoom.TaxiFromEnabled&& !OnDuty)
                {
                    Session.SendWhisper("[RPG Taxi] Desculpe, não podemos levá-lo para fora deste quarto!", 1);
                    return;
                }
            }

            if (Session.GetRoleplay().Cuffed)
            {
                Session.SendWhisper("Os motoristas de taxi estão muito assustados para levá-lo com as algemas presas em você!", 1);
                return;
            }

            bool PoliceCost = false;

            if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking)
            {
                PoliceCost = true;
            }

            if (Session.GetHabbo().Credits < Cost && Cost > 0 && !OnDuty && !PoliceCost)
            {
                Session.SendWhisper("[RPG Taxi] Você não tem dinheiro suficiente para dar uma volta!", 1);
                return;
            }

            if (Session.GetRoleplay().InsideTaxi)
            {
                Session.SendWhisper("[RPG Taxi] Já estou indo te buscar! Digite ':ptaxi' se mudar de ideia!", 1);
                return;
            }

            RoomData roomData = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(Client.GetHabbo().CurrentRoomId);

            if (roomData == null)
            {
                Session.SendWhisper("[RPG Taxi] Desculpe, não conseguimos encontrar esse quarto!", 1);
                return;
            }

            if (!roomData.TaxiToEnabled && !OnDuty)
            {
                Session.SendWhisper("[RPG Taxi] Desculpe, não podemos táxi você para este quarto!", 1);
                return;
            }

            if (roomData.TutorialEnabled && !OnDuty)
            {
                Session.SendWhisper("Você não pode ir para uma sala de tutorial, desculpe!", 1);
                return;
            }

            if (Session.GetHabbo().CurrentRoom != null)
            {
                if (Session.GetHabbo().CurrentRoom.TutorialEnabled&& !OnDuty)
                {
                    Session.SendWhisper("Você não pode sair de uma sala de tutorial! Somente após concluir!", 1);
                    return;
                }
            }

            if (Session.GetRoleplay().Game != null)
            {
                Session.SendWhisper("Você não pode pegar um taxi enquanto está dentro de um evento!", 1);
                return;
            }

            if (Session.GetRoleplay().TexasHoldEmPlayer > 0)
            {
                Session.SendWhisper("Você não pode pegar um taxi no meio de um jogo de Texas Hold!", 1);
                return;
            }

            Session.GetRoleplay().InsideTaxi = true;
            bool PoliceTaxi = false;

            if (!OnDuty)
            {
                if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking)
                {
                    Cost = 0;
                    Time = 5;

                    if (Session.GetRoomUser() != null)
                    {
                        Session.GetRoomUser().ApplyEffect(597);
                    }

                    Session.Shout("*Puxa o rádio da Polícia e vai rapidamente para " + roomData.Name + " [ID: " + roomData.Id + "]*", 37);
                    PoliceTaxi = true;
                }
                else
                {
                    if (Session.GetRoomUser() != null)
                    {
                        Session.GetRoomUser().ApplyEffect(596);
                    }

                    Session.Shout("*Chama um Taxi" + TaxiText + " para " + roomData.Name + " [ID: " + roomData.Id + "]*", 4);
                }

                new Thread(() =>
                {
                    for (int i = 0; i < (Time + 1) * 10; i++)
                    {
                        if (Session.GetRoleplay() == null)
                        {
                            break;
                        }

                        if (Session.GetRoleplay().InsideTaxi)
                        {
                            Thread.Sleep(100);
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (Session.GetRoleplay() != null)
                    {
                        if (Session.GetRoleplay().InsideTaxi)
                        {
                            if (Cost > 0)
                            {
                                Session.GetHabbo().Credits -= Cost;
                                Session.GetHabbo().UpdateCreditsBalance();
                            }

                            if (PoliceTaxi)
                            {
                                if (Session.GetRoomUser() != null)
                                {
                                    Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice);
                                }
                                Session.Shout("*Pula dentro do carro da polícia do meu parceiro e vai para o local*", 37);
                            }
                            else
                            {
                                Session.Shout("*Pula no meu Taxi" + TaxiText + " e vai para o local*", 4);
                            }
                            RoleplayManager.SendUser(Session, roomData.Id);
                        }
                    }
                }).Start();
            }
            else
            {
                Session.Shout("*Segue imediatamente " + Client.GetHabbo().Username + "*", 23);
                RoleplayManager.SendUser(Session, Client.GetHabbo().CurrentRoomId);
                PlusEnvironment.GetGame().GetChatManager().GetCommands().LogCommand(Session.GetHabbo().Id, "follow " + Client.GetHabbo().Username, Session.GetHabbo().MachineId, "staff");
            }
        }
コード例 #7
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetRoleplay() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Item.Data == null)
            {
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Opa, este item não está configurado como um item de roupa!");
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Item.Data.ClothingId == 0)
            {
                Session.SendNotification("Opa, este item não tem uma configuração de roupa de ligação, por favor, informe à Equipe!");
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            ClothingItem Clothing = null;

            if (!PlusEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Opa, não conseguimos encontrar esta peça de roupa!");
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Session.GetRoleplay().PurchasingClothing)
            {
                return;
            }

            if (Session.GetRoleplay().Clothing != Clothing)
            {
                string Discount = "";
                if (Session.GetRoleplay().OfferManager.ActiveOffers.ContainsKey("clothing"))
                {
                    int Bonus   = Convert.ToInt32((double)Clothing.Cost * 0.01);
                    int NewCost = Clothing.Cost - Bonus;

                    Discount = " (R$" + String.Format("{0:N0}", NewCost) + " devido ao desconto de roupa de 5%)";
                }

                Session.SendWhisper("Essa roupa vai custar R$" + String.Format("{0:N0}", Clothing.Cost) + "" + (Discount == null ? "" : Discount) + "! Clique em 'Comprar Roupa' se você realmente quer comprar!", 1);
                Session.GetRoleplay().Clothing           = Clothing;
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            if (Session.GetHabbo().Credits < Clothing.Cost)
            {
                Session.SendWhisper("Desculpe, você não tem dinheiro suficiente para comprar esta roupa!", 1);
                Session.GetRoleplay().PurchasingClothing = true;
                return;
            }

            Session.GetRoleplay().Clothing = null;
            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingAllParts));
            Session.Shout("*Comprou " + Item.GetBaseItem().PublicName + " por R$" + String.Format("{0:N0}", Clothing.Cost) + "*", 4);
            //Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendMessage(new RoomNotificationComposer("purchased_clothing", "message", "Ual! Você comprou com sucesso o '" + Item.GetBaseItem().PublicName + "' por R$" + String.Format("{0:N0}", Clothing.Cost) + "!"));
            Session.SendWhisper("Se, por algum motivo, não puder ver sua nova roupa, recarregue o RP!", 1);

            #region Clothing Discount Check
            if (Session.GetRoleplay().OfferManager.ActiveOffers.ContainsKey("clothing"))
            {
                if (Clothing.Cost > 0)
                {
                    RoleplayOffer Offer = Session.GetRoleplay().OfferManager.ActiveOffers["clothing"];
                    int           Bonus = Convert.ToInt32((double)Clothing.Cost * 0.05);

                    if (Offer.Params == null)
                    {
                        var Offerer = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Offer.OffererId);

                        if (Offerer != null && Offerer.GetHabbo() != null)
                        {
                            Offerer.GetHabbo().Credits += Bonus;
                            Offerer.GetHabbo().UpdateCreditsBalance();
                            Offerer.SendWhisper("Você recebeu um bônus de R$" + String.Format("{0:N0}", Bonus) + ", " + Session.GetHabbo().Username + " quando comprou " + Item.GetBaseItem().PublicName + "!", 1);
                            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Offerer, "ACH_Discounting", 1);
                        }
                    }

                    RoleplayOffer Junk;
                    Session.GetRoleplay().OfferManager.ActiveOffers.TryRemove("clothing", out Junk);

                    int NewCost = Clothing.Cost - Bonus;

                    if (NewCost > 0)
                    {
                        Session.GetHabbo().Credits -= NewCost;
                        Session.GetHabbo().UpdateCreditsBalance();
                    }
                    return;
                }
                else
                {
                    Session.SendWhisper("Você ainda tem o desconto para a próxima vez que você comprar um item de vestuário!", 1);
                    return;
                }
            }
            else
            {
                if (Clothing.Cost > 0)
                {
                    Session.GetHabbo().Credits -= Clothing.Cost;
                    Session.GetHabbo().UpdateCreditsBalance();
                }
            }
            #endregion

            return;
        }