Пример #1
0
        internal override void OnTimerTick()
        {
            if (base.GetBotData() != null)
            {
                #region Ammunation
                if (base.GetRoom().RoomData.Description.Contains("AMMUNATION"))
                {
                    if (base.GetRoomUser().RotBody != 2)
                    {
                        base.GetRoomUser().RotBody = 2;
                        base.GetRoomUser().RotHead = 2;
                    }
                }
                #endregion

                #region Hobo

                if (base.GetBotData().InteractingWith != null && base.GetBotData().Name.Contains("HOBO"))
                {
                    HabboHotel.PathFinding.Vector2D Pos1 = new HabboHotel.PathFinding.Vector2D(base.GetRoomUser().X, base.GetRoomUser().Y);

                    HabboHotel.PathFinding.Vector2D Pos2 = new HabboHotel.PathFinding.Vector2D(base.GetBotData().InteractingWith.X, base.GetBotData().InteractingWith.Y);

                    if (LActionTimer <= 5)
                    {
                        List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                        if (list.Count == 0)
                        {
                            return;
                        }
                        int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);
                        base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y, true);

                        LActionTimer++;
                    }
                    else
                    {
                        if (!Robbed)
                        {
                            if (RoleplayManager.Distance(Pos1, Pos2) > 1)
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                            }
                            else
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                                Robbed = true;
                            }
                        }

                        if (!Robbed && !base.GetRoomUser().IsWalking)
                        {
                            base.GetBotData().TimesTried++;
                        }

                        if (base.GetBotData().TimesTried >= 20)
                        {
                            base.GetRoomUser().Chat(null, "Filho da puta!", true, 1);
                            System.Threading.Thread.Sleep(2000);
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }

                        if (Robbed && !Done)
                        {
                            Random _s   = new Random();
                            int    Amnt = _s.Next(5, 100);

                            if (base.GetBotData().InteractingWith.GetClient() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetHabbo() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetHabbo().Credits - Amnt <= 0)
                            {
                                base.GetRoomUser().Chat(null, "Droga, você está sem dinheiro, vou deixar você ir desta vez!", true, 1);
                                Done = true;
                                return;
                            }

                            base.GetRoomUser().Chat(null, "*Rouba $" + Amnt + " de " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " e foge*", true, 1);
                            RoleplayManager.GiveMoney(base.GetBotData().InteractingWith.GetClient(), -Amnt);
                            Done = true;
                        }

                        if (Done)
                        {
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }
                    }
                }
                else
                {
                    if (base.GetBotData() != null)
                    {
                        if (base.GetBotData().Name.Contains("HOBO"))
                        {
                            if (base.GetBotData().InteractingWith == null && base.GetBotData().Name.Contains("HOBO") || base.GetBotData().InteractingWith.GetClient().GetHabbo().CurrentRoomId != base.GetBotData().RoomId)
                            {
                                RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                            }
                        }
                    }
                }

                #endregion

                #region Hobo 2

                if (base.GetBotData().InteractingWith != null && base.GetBotData().Name.Contains("HOBO 2"))
                {
                    HabboHotel.PathFinding.Vector2D Pos1 = new HabboHotel.PathFinding.Vector2D(base.GetRoomUser().X, base.GetRoomUser().Y);

                    HabboHotel.PathFinding.Vector2D Pos2 = new HabboHotel.PathFinding.Vector2D(base.GetBotData().InteractingWith.X, base.GetBotData().InteractingWith.Y);

                    if (LActionTimer <= 5)
                    {
                        List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                        if (list.Count == 0)
                        {
                            return;
                        }
                        int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);
                        base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y, true);

                        LActionTimer++;
                    }
                    else
                    {
                        if (!Robbed)
                        {
                            if (RoleplayManager.Distance(Pos1, Pos2) > 1)
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                            }
                            else
                            {
                                base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);
                                Robbed = true;
                            }
                        }

                        if (!Robbed && !base.GetRoomUser().IsWalking)
                        {
                            base.GetBotData().TimesTried++;
                        }

                        if (base.GetBotData().TimesTried >= 20)
                        {
                            base.GetRoomUser().Chat(null, "Filho da puta!", true, 1);
                            System.Threading.Thread.Sleep(2000);
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }

                        if (Robbed && !Done)
                        {
                            Random _s       = new Random();
                            int    AmntBank = _s.Next(5, 500);

                            if (base.GetBotData().InteractingWith.GetClient() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetHabbo() == null)
                            {
                                Done = true;
                            }

                            if (base.GetBotData().InteractingWith.GetClient().GetRoleplay().Bank - AmntBank <= 0)
                            {
                                base.GetRoomUser().Chat(null, "Droga, você está sem dinheiro, vou deixar você ir desta vez!", true, 1);
                                Done = true;
                                return;
                            }

                            base.GetRoomUser().Chat(null, "*Rouba $" + AmntBank + " de " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " e foge*", true, 1);
                            base.GetBotData().InteractingWith.GetClient().GetRoleplay().SaveQuickStat("bank", "" + (base.GetBotData().InteractingWith.GetClient().GetRoleplay().Bank - AmntBank));
                            base.GetBotData().InteractingWith.GetClient().GetRoleplay().Bank -= AmntBank;
                            Done = true;
                        }

                        if (Done)
                        {
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }
                    }
                }
                else
                {
                    if (base.GetBotData() != null)
                    {
                        if (base.GetBotData().Name.Contains("HOBO 2"))
                        {
                            if (base.GetBotData().InteractingWith == null && base.GetBotData().Name.Contains("HOBO 2") || base.GetBotData().InteractingWith.GetClient().GetHabbo().CurrentRoomId != base.GetBotData().RoomId)
                            {
                                RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                            }
                        }
                    }
                }

                #endregion

                #region Free Roam Bot



                #endregion

                #region Store Bot

                if (robber != null)
                {
                    if (robber.GetHabbo() == null)
                    {
                        beingRobbed = false;
                        gatherNum   = 0;
                        gatherMsg   = 0;
                        amount      = 0;
                        return;
                    }

                    if (robber.GetHabbo().GetRoomUser() == null)
                    {
                        beingRobbed = false;
                        gatherNum   = 0;
                        gatherMsg   = 0;
                        amount      = 0;
                        return;
                    }


                    if (robber.GetRoleplay() == null)
                    {
                        beingRobbed = false;
                        gatherNum   = 0;
                        gatherMsg   = 0;
                        amount      = 0;
                        return;
                    }

                    if (robber.GetHabbo().GetRoomUser().Frozen || robber.GetRoleplay().Jailed || robber.GetRoleplay().Dead)
                    {
                        amount    = 0;
                        gatherMsg = 0;
                        gatherNum = 0;
                        robber.GetRoleplay().robbingStore = 0;
                        robber = null;
                        base.GetRoomUser().ApplyEffect(13);
                        disableRob  = true;
                        beingRobbed = false;
                        return;
                    }

                    if (gatherMsg <= 0)
                    {
                        base.GetRoomUser().Chat(null, "*Begins taking money from cash register*", true, 1);

                        if (gatherSpeed == 1)
                        {
                            gatherMsg = 10;
                        }

                        if (gatherSpeed == 2)
                        {
                            gatherMsg = 5;
                        }

                        if (gatherSpeed == 0)
                        {
                            gatherMsg = 20;
                        }


                        gatherNum++;
                    }
                    else
                    {
                        gatherMsg--;
                    }


                    if (gatherNum == 5)
                    {
                        int amount = new Random().Next(0, 100);

                        if (attack <= 6)
                        {
                            if (robber == null)
                            {
                                amount    = 0;
                                gatherMsg = 0;
                                gatherNum = 0;
                                robber.GetRoleplay().robbingStore = 0;
                                robber = null;
                                base.GetRoomUser().ApplyEffect(13);
                                disableRob  = true;
                                beingRobbed = false;
                                return;
                            }
                            else
                            {
                                attackCount++;

                                base.GetRoomUser().Chat(null, "*Takes out their pump shotgun*", true, 1);
                                base.GetRoomUser().ApplyEffect(164);

                                base.GetRoomUser().Chat(null, "*Shoots " + robber.GetHabbo().UserName + ", killing them!*", true, 1);

                                robber.GetRoleplay().DeadFigSet  = false;
                                robber.GetRoleplay().DeadSeconds = 60;
                                robber.GetRoleplay().DeadTimer   = 2;
                                robber.GetRoleplay().Dead        = true;
                                robber.GetRoleplay().SaveStatusComponents("dead");
                                RoleplayManager.HandleDeath(robber);
                                robber.SendNotif("You have been killed by a store clerk.");
                                return;
                            }
                        }

                        base.GetRoomUser().Chat(null, "*Drops money* Theres your money, now leave me alone!! [-$" + amount + "]", true, 1);
                        RoleplayManager.GiveMoney(robber, +amount);

                        amount    = 0;
                        gatherMsg = 0;
                        gatherNum = 0;
                        robber.GetRoleplay().robbingStore = 0;
                        robber = null;
                        base.GetRoomUser().ApplyEffect(13);
                        disableRob  = true;
                        beingRobbed = false;
                    }
                }
                else
                {
                    beingRobbed = false;
                    gatherNum   = 0;
                    gatherMsg   = 0;
                    amount      = 0;
                }

                lastRobbed++;
                if (lastRobbed > 5000 && disableRob)
                {
                    disableRob = false;
                    lastRobbed = 0;
                    base.GetRoomUser().ApplyEffect(0);
                }
            }

            #endregion

            #region Eatery Bot
            if (base.GetRoom() == null)
            {
                return;
            }
            if (base.GetRoom().RoomData.Description.Contains("EATERY"))
            {
                if (event_serving && event_serving_orderPlaced && !event_serving_delivered && !GetRoomUser().IsWalking)
                {
                    if (!resetted)
                    {
                        if (order_tick >= 15)
                        {
                            resetted = true;
                            GetRoomUser().Chat(null, "An error occured with pathfinding and I was unable to get to you, sorry about that!", true, 1);
                            serving.SendWhisper("Order has been aborted! Try sitting closer maybe?");
                            ResetVariablesFor("eatery");
                        }
                        else
                        {
                            order_tick++;
                        }
                    }
                }

                if (event_serving)
                {
                    if (event_serving_orderPlaced && !event_serving_delivered)
                    {
                        RoomUser User = serving.GetHabbo().GetRoomUser();


                        #region Delete Serve Session
                        if (serving == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetHabbo() == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetRoleplay() == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetHabbo().CurrentRoom == null)
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        if (serving.GetHabbo().CurrentRoom != GetRoom())
                        {
                            event_serving = false;
                            ResetVariablesFor("eatery");
                            return;
                        }
                        #endregion
                        if (!event_set_items)
                        {
                            event_serving_plate   = retrieveItem("diner_tray_0", true, User);
                            event_serving_oneway  = retrieveItem("one_way_door*1");
                            event_serving_oneway2 = retrieveItem("one_way_door*4");
                            event_set_items       = true;

                            if (event_serving_plate == null)
                            {
                                GetRoomUser().Chat(null, "Can you sit near an empty plate please?", true, 1);
                                ResetVariablesFor("eatery");
                                return;
                            }
                        }
                        else
                        {
                            /*
                             * Vector2D TargetVector = new Vector2D(event_serving_plate.GetX,event_serving_plate.GetY);
                             * Vector2D CurrentPos = new Vector2D(GetRoomUser().X,GetRoomUser().Y);
                             * if(Plus.Misc.Distance(TargetVector,CurrentPos) > 2)
                             * {
                             *
                             * }*/

                            if (Undefined_Timer_Tick_2 != 2)
                            {
                                passing_cur_gate       = false;
                                Undefined_Timer_Tick_2 = 2;
                            }

                            if (!event_serving_passedGate1)
                            {
                                HandleGatePass(event_serving_oneway);
                            }
                            else
                            {
                                GetRoomUser().AllowOverride = false;
                                if (!event_serving_atTable)
                                {
                                    if (GetRoomUser().X == RoleplayManager.GetPosSquare("behind", User).X&& GetRoomUser().Y == RoleplayManager.GetPosSquare("behind", User).Y)
                                    {
                                        GetRoomUser().RotBody = User.RotBody;
                                        GetRoomUser().RotHead = User.RotBody;
                                        event_serving_atTable = true;
                                    }
                                    else
                                    {
                                        GetRoomUser().MoveTo(RoleplayManager.GetPosSquare("behind", User));
                                    }
                                }
                                else
                                {
                                    if (!event_serving_delivered)
                                    {
                                        Food nFood = Substances.GetFoodByUName(event_serving_fooditem);

                                        RoleplayManager.ReplaceItem(serving, event_serving_plate, nFood.Item_Name);
                                        event_serving_delivered = true;
                                        GetRoomUser().Chat(null, "There you go, enjoy!", true, 1);

                                        ServerMessage action = new ServerMessage(LibraryParser.OutgoingRequest("RoomUserActionMessageComposer"));
                                        action.AppendInteger(GetRoomUser().VirtualId);
                                        action.AppendInteger(2);
                                        GetRoom().SendMessage(action);

                                        passing_cur_gate = false;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!event_serving_passedGate2)
                        {
                            HandleGatePass(event_serving_oneway2);
                        }
                        else
                        {
                            ResetVariablesFor("eatery");
                        }
                    }
                }
            }
            #endregion
        }
Пример #2
0
        internal override void OnTimerTick()
        {
            if (base.GetBotData() != null)
            {
                if (base.GetBotData().Name.ToLower().Contains("doctor"))
                {
                    if (base.GetRoomUser().RotBody != 4)
                    {
                        base.GetRoomUser().RotBody = 4;
                        base.GetRoomUser().RotHead = 4;
                    }

                    if (!base.GetRoomUser().Statusses.ContainsKey("sit"))
                    {
                        base.GetRoomUser().Statusses.Add("sit", "1.0");
                        base.GetRoomUser().Z            = 0.00;
                        base.GetRoomUser().IsSitting    = true;
                        base.GetRoomUser().UpdateNeeded = true;
                    }
                }

                switch (base.GetBotData().HospBotType)
                {
                    #region Paramedic Bot
                case "paramedic_bot":
                {
                    bool LeaveRoom = false;

                    if (base.GetBotData().InteractingWith == null)
                    {
                        LeaveRoom = true;
                    }

                    if (!base.GetBotData().InteractingWith.GetClient().GetRoleplay().Dead)
                    {
                        LeaveRoom = true;
                    }

                    if (base.GetBotData() != null)
                    {
                        if (base.GetBotData().InteractingWith != null)
                        {
                            if (base.GetBotData().InteractingWith.GetClient() != null)
                            {
                                if (base.GetBotData().InteractingWith.GetClient().GetHabbo() != null)
                                {
                                    if (base.GetBotData().InteractingWith.GetClient().GetHabbo().CurrentRoomId != base.GetBotData().RoomId)
                                    {
                                        LeaveRoom = true;
                                    }
                                }
                            }
                        }
                    }

                    if (base.GetRoom() == null)
                    {
                        LeaveRoom = true;
                    }

                    #region Leaveroom
                    if (LeaveRoom)
                    {
                        if (LActionTimer < 20)
                        {
                            base.GetRoomUser().ApplyEffect(20);
                            List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                            if (list.Count == 0)
                            {
                                return;
                            }
                            int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);

                            base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
                            LActionTimer++;
                        }
                        else
                        {
                            RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                        }
                    }
                    #endregion


                    if (!LeaveRoom)
                    {
                        base.GetRoomUser().ApplyEffect(20);


                        HabboHotel.PathFinding.Vector2D Pos1 = new HabboHotel.PathFinding.Vector2D(base.GetRoomUser().X, base.GetRoomUser().Y);
                        HabboHotel.PathFinding.Vector2D Pos2 = new HabboHotel.PathFinding.Vector2D(base.GetBotData().InteractingWith.X, base.GetBotData().InteractingWith.Y);

                        if (RoleplayManager.Distance(Pos1, Pos2) > 3)
                        {
                            if (!base.GetRoomUser().IsWalking)
                            {
                                base.GetBotData().TimesTried++;
                            }

                            base.GetRoomUser().MoveTo(Pos2.X, Pos2.Y + 1, true);

                            if (base.GetBotData().TimesTried >= 7)
                            {
                                base.GetRoomUser().SetPos(Pos2.X, Pos2.Y, 0);
                                base.GetRoomUser().UpdateNeeded = true;
                            }
                        }
                        else
                        {
                            if (LActionTimer < 5)
                            {
                                LActionTimer++;
                            }
                            else
                            {
                                if (!LoadedUser)
                                {
                                    base.GetRoomUser().Chat(null, "*Loads " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " into the ambulance strecher*", true, 1);
                                    base.GetBotData().InteractingWith.ApplyEffect(23);
                                    LoadedUser = true;
                                }
                                else
                                {
                                    if (LActionTimer < 10)
                                    {
                                        LActionTimer++;
                                    }
                                    else
                                    {
                                        if (!TransferedUser)
                                        {
                                            base.GetBotData().InteractingWith.GetClient().GetMessageHandler().PrepareRoomForUser(2, null);
                                            base.GetRoomUser().Chat(null, "*Takes " + base.GetBotData().InteractingWith.GetClient().GetHabbo().UserName + " to the hospital in their ambulance*", true, 1);
                                            base.GetRoomUser().ApplyEffect(3);
                                            TransferedUser = true;
                                        }
                                        else
                                        {
                                            if (LActionTimer < 15)
                                            {
                                                if (LActionTimer == 13)
                                                {
                                                    List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                                                    if (list.Count == 0)
                                                    {
                                                        return;
                                                    }
                                                    int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);

                                                    base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y, true);
                                                }
                                                LActionTimer++;
                                            }
                                            else
                                            {
                                                if (LActionTimer < 20)
                                                {
                                                    base.GetRoomUser().ApplyEffect(20);
                                                    List <Point> list = base.GetRoom().GetGameMap().getWalkableList();
                                                    if (list.Count == 0)
                                                    {
                                                        return;
                                                    }
                                                    int randomNumber = new Random(DateTime.Now.Millisecond + this._virtualId ^ 2).Next(0, list.Count - 1);

                                                    base.GetRoomUser().MoveTo(list[randomNumber].X, list[randomNumber].Y);
                                                    LActionTimer++;
                                                }
                                                else
                                                {
                                                    RoleplayManager.KickBotFromRoom(base.GetRoomUser().BotData.Name, base.GetBotData().RoomId);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }


                break;

                    #endregion
                }
            }
        }