Exemplo n.º 1
0
        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0 && Session != null)
            {
                RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (User == null)
                {
                    return;
                }

                if (!Gamemap.TilesTouching(User.X, User.Y, Item.GetX, Item.GetY))
                {
                    User.MoveTo(Item.SquareInFront);
                    return;
                }

                Item.InteractingUser = Session.GetHabbo().Id;

                User.CanWalk = false;
                User.ClearMovement(true);
                User.SetRot(Rotation.Calculate(User.X, User.Y, Item.GetX, Item.GetY), false);

                Item.ReqUpdate(2, true);

                Item.ExtraData = "1";
                Item.UpdateState(false, true);
            }
        }
Exemplo n.º 2
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter a dance ID. (1-4)");
                return;
            }

            int DanceId = Convert.ToInt32(Params[1]);
            if (DanceId < 0 || DanceId > 4)
            {
                Session.SendWhisper("Please enter a dance ID. (1-4)");
                return;
            }

            List<RoomUser> Users = Room.GetRoomUserManager().GetRoomUsers();
            if (Users.Count > 0)
            {
                foreach (RoomUser U in Users.ToList())
                {
                    if (U == null)
                        continue;

                    if (U.CarryItemID > 0)
                        U.CarryItemID = 0;

                    U.DanceId = DanceId;
                    Room.SendMessage(new DanceComposer(U, DanceId));
                }
            }
        }
Exemplo n.º 3
0
        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            if (Item.wiredHandler != null)
            {
                EntersRoom handler = (EntersRoom)Item.wiredHandler;

                if (!string.IsNullOrEmpty(handler.userName))
                    message.AddString(handler.userName);
                else
                    message.AddString(string.Empty);
            }
            else
            {
                message.AddString(string.Empty);
            }

            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(7);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
Exemplo n.º 4
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to summon.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo() == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Get a life.");
                return;
            }

            TargetClient.SendNotification("You have been summoned to " + Session.GetHabbo().Username + "!");
            if (!TargetClient.GetHabbo().InRoom)
                TargetClient.SendMessage(new RoomForwardComposer(Session.GetHabbo().CurrentRoomId));
            else
                TargetClient.GetHabbo().PrepareRoom(Session.GetHabbo().CurrentRoomId, "");
        }
Exemplo n.º 5
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you wish to alert.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo() == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Get a life.");
                return;
            }

            string Message = CommandManager.MergeParams(Params, 2);

            TargetClient.SendNotification(Session.GetHabbo().Username + " alerted you with the following message:\n\n" + Message);
            Session.SendWhisper("Alert successfully sent to " + TargetClient.GetHabbo().Username);
        }
Exemplo n.º 6
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username you wish to flag.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (TargetClient.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                Session.SendWhisper("You are not allowed to flag that user.");
                return;
            }
            else
            {
                TargetClient.GetHabbo().LastNameChange = 0;
                TargetClient.GetHabbo().ChangingName = true;
                TargetClient.SendNotification("Please be aware that if your username is deemed as inappropriate, you will be banned without question.\r\rAlso note that Staff will NOT allow you to change your username again should you have an issue with what you have chosen.\r\rClose this window and click yourself to begin choosing a new username!");
                TargetClient.SendMessage(new UserObjectComposer(TargetClient.GetHabbo()));
            }
        }
        public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
        {
            if (!bool_0)
            {
                return;
            }
            int num = 0;
            int.TryParse(RoomItem_0.ExtraData, out num);

            {
                switch (int_0)
                {
                    case 1:
                        num++;
                        break;

                    case 2:
                        num--;
                        break;

                    case 3:
                        num = 0;
                        break;
                }
                RoomItem_0.ExtraData = num < 0 ? "0" : num.ToString();
                RoomItem_0.UpdateState(false, true);
            }
        }
Exemplo n.º 8
0
        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            message.AddString(string.Empty);
            message.AddInt32(2);

            if (Item.wiredHandler != null)
            {
                GiveScore handler = (GiveScore)Item.wiredHandler;
                message.AddInt32(handler.scoreToGive);
                message.AddInt32(handler.maxCountPerGame);
            }
            else
            {
                message.AddInt32(0); //Points 
                message.AddInt32(0); //Rounds
            }

            message.AddInt32(0);
            message.AddInt32(6);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
Exemplo n.º 9
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null || User.GetClient() == null)
                return;

            string[] headParts;
            string[] figureParts = Session.GetHabbo().Look.Split('.');
            foreach (string Part in figureParts)
            {
                if (Part.StartsWith("hd"))
                {
                    headParts = Part.Split('-');
                    if (!headParts[1].Equals("99999"))
                        headParts[1] = "99999";
                    else
                        return;

                    Session.GetHabbo().Look = Session.GetHabbo().Look.Replace(Part, "hd-" + headParts[1] + "-" + headParts[2]);
                    break;
                }
            }
            Session.GetHabbo().Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Session.GetHabbo().Look);
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `look` = '" + Session.GetHabbo().Look + "' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            Session.SendMessage(new UserChangeComposer(User, true));
            Session.GetHabbo().CurrentRoom.SendMessage(new UserChangeComposer(User, false));
            return;
        }
Exemplo n.º 10
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, only the room owner can run this command!");
                return;
            }

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

                RoomUser BotUser = null;
                if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out BotUser))
                    return;

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", User.BotData.Id);
                    dbClient.RunQuery();
                }

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
            }

            Session.SendWhisper("Success, removed all bots.");
        }
Exemplo n.º 11
0
 public override void OnUserLeaveRoom(GameClients.GameClient Client)
 {
     if (GetRoom().Owner.ToLower() == Client.GetHabbo().Username.ToLower())
     {
         GetRoom().RemoveBot(GetRoomUser().VirtualId, false);
     }
 }
Exemplo n.º 12
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Room = Session.GetHabbo().CurrentRoom;
            if (Room == null)
                return;

            if (Room.Group == null)
            {
                Session.SendWhisper("Oops, there is no group here?");
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("DELETE FROM `groups` WHERE `id` = '" + Room.Group.Id + "'");
                dbClient.RunQuery("DELETE FROM `group_memberships` WHERE `group_id` = '" + Room.Group.Id + "'");
                dbClient.RunQuery("DELETE FROM `group_requests` WHERE `group_id` = '" + Room.Group.Id + "'");
                dbClient.RunQuery("UPDATE `rooms` SET `group_id` = '0' WHERE `group_id` = '" + Room.Group.Id + "' LIMIT 1");
                dbClient.RunQuery("UPDATE `user_stats` SET `groupid` = '0' WHERE `groupid` = '" + Room.Group.Id + "' LIMIT 1");
                dbClient.RunQuery("DELETE FROM `items_groups` WHERE `group_id` = '" + Room.Group.Id + "'");
            }

            PlusEnvironment.GetGame().GetGroupManager().DeleteGroup(Room.RoomData.Group.Id);

            Room.Group = null;
            Room.RoomData.Group = null;

            PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(Room, true);

            Session.SendNotification("Success, group deleted.");
            return;
        }
Exemplo n.º 13
0
        public void OnPlace(GameClients.GameClient Session, RoomItem Item)
        {
            Item.ExtraData = "0";

            if (Item.InteractingUser != 0)
            {
                RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);

                if (User != null)
                {
                    User.ClearMovement(true);
                    User.AllowOverride = false;
                    User.CanWalk = true;
                }

                Item.InteractingUser = 0;
            }

            if (Item.InteractingUser2 != 0)
            {
                RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser2);

                if (User != null)
                {
                    User.ClearMovement(true);
                    User.AllowOverride = false;
                    User.CanWalk = true;
                }

                Item.InteractingUser2 = 0;
            }
        }
Exemplo n.º 14
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length != 3)
            {
                Session.SendWhisper("Please enter a username and the code of the badge you'd like to give!");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient != null)
            {
                if (!TargetClient.GetHabbo().GetBadgeComponent().HasBadge(Params[2]))
                {
                    TargetClient.GetHabbo().GetBadgeComponent().GiveBadge(Params[2], true, TargetClient);
                    if (TargetClient.GetHabbo().Id != Session.GetHabbo().Id)
                        TargetClient.SendNotification("You have just been given a badge!");
                    else
                        Session.SendWhisper("You have successfully given yourself the badge " + Params[2] + "!");
                }
                else
                    Session.SendWhisper("Oops, that user already has this badge (" + Params[2] + ") !");
                return;
            }
            else
            {
                Session.SendWhisper("Oops, we couldn't find that target user!");
                return;
            }
        }
Exemplo n.º 15
0
        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (!HasRights)
            {
                return;
            }

            int OldValue = 0;

            if (!int.TryParse(Item.ExtraData, out OldValue))
            {

            }

            if (Request == 1)
            {
                OldValue++;
            }
            else if (Request == 2)
            {
                OldValue--;
            }
            else if (Request == 3)
            {
                OldValue = 0;
            }

            Item.ExtraData = OldValue.ToString();
            Item.UpdateState(false, true);
        }
Exemplo n.º 16
0
        public void OnRemove(GameClients.GameClient Session, RoomItem Item)
        {
            Item.ExtraData = "0";

            if (Item.InteractingUser != 0)
            {
                RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);

                if (User != null)
                {
                    User.UnlockWalking();
                }

                Item.InteractingUser = 0;
            }

            if (Item.InteractingUser2 != 0)
            {
                RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser2);

                if (User != null)
                {
                    User.UnlockWalking();
                }

                Item.InteractingUser2 = 0;
            }
        }
Exemplo n.º 17
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, you forgot to enter a bubble ID!");
                return;
            }

            int Bubble = 0;
            if (!int.TryParse(Params[1].ToString(), out Bubble))
            {
                Session.SendWhisper("Please enter a valid number.");
                return;
            }

            ChatStyle Style = null;
            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Bubble, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Session.SendWhisper("Oops, you cannot use this bubble due to a rank requirement, sorry!");
                return;
            }

            User.LastBubble = Bubble;
            Session.GetHabbo().CustomBubbleId = Bubble;
            Session.SendWhisper("Bubble set to: " + Bubble);
        }
Exemplo n.º 18
0
 public void OnRemove(GameClients.GameClient Session, RoomItem Item)
 {
     if (Item.ExtraData == "-1")
     {
         Item.ExtraData = "0";
     }
 }
Exemplo n.º 19
0
        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            RoomUser User = null;
            if (Session != null)
                User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))
            {
                if (Item.ExtraData != "-1")
                {
                    if (Request == -1)
                    {
                        Item.ExtraData = "0";
                        Item.UpdateState();
                    }
                    else
                    {
                        Item.ExtraData = "-1";
                        Item.UpdateState(false, true);
                        Item.ReqUpdate(4, true);
                    }
                }
            }
            else
            {
                User.MoveTo(Item.SquareInFront);
            }
        }
Exemplo n.º 20
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please provide a reason for muting the room to show to the users.");
                return;
            }

            if (!Room.RoomMuted)
                Room.RoomMuted = true;

            string Msg = CommandManager.MergeParams(Params, 1);

            List<RoomUser> RoomUsers = Room.GetRoomUserManager().GetRoomUsers();
            if (RoomUsers.Count > 0)
            {
                foreach (RoomUser User in RoomUsers)
                {
                    if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null || User.GetClient().GetHabbo().Username == Session.GetHabbo().Username)
                        continue;

                    User.GetClient().SendWhisper("This room has been muted because: " + Msg);
                }
            }
        }
Exemplo n.º 21
0
        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(5);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            message.AddString(string.Empty);
            message.AddInt32(1);

            if (Item.wiredHandler != null)
            {
                ScoreAchieved handler = (ScoreAchieved)Item.wiredHandler;
                message.AddInt32(handler.scoreLevel);
            }
            else
            {
                message.AddInt32(0);
            }

            message.AddInt32(0);
            message.AddInt32(10);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
Exemplo n.º 22
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            int TotalValue = 0;

            try
            {
                DataTable Table = null;
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `id` FROM `items` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND (`room_id`=  '0' OR `room_id` = '')");
                    Table = dbClient.getTable();
                }

                if (Table == null)
                {
                    Session.SendWhisper("You currently have no items in your inventory!");
                    return;
                }

                foreach (DataRow Row in Table.Rows)
                {
                    Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Convert.ToInt32(Row[0]));
                    if (Item == null)
                        continue;

                    if (!Item.GetBaseItem().ItemName.StartsWith("CF_") && !Item.GetBaseItem().ItemName.StartsWith("CFC_"))
                        continue;

                    if (Item.RoomId > 0)
                        continue;

                    string[] Split = Item.GetBaseItem().ItemName.Split('_');
                    int Value = int.Parse(Split[1]);

                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                    }

                    Session.GetHabbo().GetInventoryComponent().RemoveItem(Item.Id);

                    TotalValue += Value;

                    if (Value > 0)
                    {
                        Session.GetHabbo().Credits += Value;
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                }

                if (TotalValue > 0)
                    Session.SendNotification("All credits have successfully been converted!\r\r(Total value: " + TotalValue + " credits!");
                else
                    Session.SendNotification("It appears you don't have any exchangeable items!");
            }
            catch
            {
                Session.SendNotification("Oops, an error occoured whilst converting your credits!");
            }
        }
Exemplo n.º 23
0
    void Start()
    {
        GameMain    = FindObjectOfType <GameMain>();
        GameClients = FindObjectOfType <GameClients>();
        ItemsBase   = FindObjectOfType <ItemsBase>();
        //Смотрим страну
        int          Country    = GameClients.CurrentClient.GetComponent <Client>().ClientType;
        List <Place> CasePlaces = new List <Place>();

        CasePlaces.AddRange(FindObjectsOfType <Place>());
        List <GameObject> CountryItems = new List <GameObject>();

        CountryItems.AddRange(ItemsBase.Elements[GameClients.CurrentCountry].Items);
        foreach (Place a in CasePlaces) //в каждой ячейке создаём каждый предмет
        {
            for (int i = 0; i < ItemsBase.Elements[GameClients.CurrentCountry].Items.Count; i++)
            {
                GameObject NewItem = Instantiate(CountryItems[i], a.transform);
                NewItem.transform.position    = a.transform.position;
                NewItem.transform.eulerAngles = Vector3.zero;
                AllItems.Add(NewItem);
            }
        }
        //перемешиваем предметы
        AllItems = My.Shuffle(AllItems);
        //Сортируем по возрастанию необходимых ячеек
        AllItems = AllItems.ToArray().OrderBy(x => x.GetComponent <Item>().PlacesCountNeeded).ToList();
        //переворачиваем, ибо нам нужно по убыванию ячеек
        AllItems.Reverse();
        StartCoroutine(Prestart());
    }
Exemplo n.º 24
0
        public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
        {
            if (Item == null || Item.GetRoom() == null || Session == null || Session.GetHabbo() == null)
                return;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            // Alright. But is this user in the right position?
            if (User.Coordinate == Item.Coordinate || User.Coordinate == Item.SquareInFront)
            {
                // Fine. But is this tele even free?
                if (Item.InteractingUser != 0)
                {
                    return;
                }

                User.TeleDelay = 2;
                Item.InteractingUser = User.GetClient().GetHabbo().Id;

            }
            else if (User.CanWalk)
            {
                User.MoveTo(Item.SquareInFront);
            }
        }
Exemplo n.º 25
0
 public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
 {
     if(RoomItem_0.GetRoom().CheckRights(Session,true))
     {
         string imageUrl = "";
         int offsetX = 0;
         int offsetY = 0;
         int offsetZ = 0;
         int count = 0;
         string[] splitted = RoomItem_0.ExtraData.Split(Convert.ToChar(9));
         foreach(string s in RoomItem_0.ExtraData.Split(Convert.ToChar(9)))
         {
             try {
                 if (s == "imageUrl")
                     imageUrl = splitted[count +1];
                 if (s == "offsetX")
                     offsetX = int.Parse(splitted[count + 1]);
                 if (s == "offsetY")
                     offsetY = int.Parse(splitted[count + 1]);
                 if (s == "offsetZ")
                     offsetZ = int.Parse(splitted[count + 1]);
                 }catch{}
             count++;
         }
         string tosend = "17|" + RoomItem_0.uint_0 + "|" + imageUrl.Replace("https://","http://") + "|" + offsetX + "|" + offsetY + "|" + offsetZ;
         Essential.getWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send(tosend);
     }
 }
Exemplo n.º 26
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser ThisUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (ThisUser == null)
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter an ID of a dance.");
                return;
            }

            int DanceId;
            if (int.TryParse(Params[1], out DanceId))
            {
                if (DanceId > 4 || DanceId < 0)
                {
                    Session.SendWhisper("The dance ID must be between 0 and 4!");
                    return;
                }

                Session.GetHabbo().CurrentRoom.SendMessage(new DanceComposer(ThisUser, DanceId));
            }
            else
                Session.SendWhisper("Please enter a valid dance ID.");
        }
Exemplo n.º 27
0
        public void OnPlace(GameClients.GameClient Session, RoomItem Item)
        {
            Item.GetRoom().GetRoomItemHandler().HopperCount++;
            using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("INSERT INTO items_hopper (hopper_id, room_id) VALUES (@hopperid, @roomid);");
                dbClient.addParameter("hopperid", Item.Id);
                dbClient.addParameter("roomid", Item.RoomId);
                dbClient.runQuery();
            }

            if (Item.InteractingUser != 0)
            {
                RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Item.InteractingUser);

                if (User != null)
                {
                    User.ClearMovement(true);
                    User.AllowOverride = false;
                    User.CanWalk = true;
                }

                Item.InteractingUser = 0;
            }
        }
Exemplo n.º 28
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (ThisUser == null)
                return;

            Session.SendNotification("X: " + ThisUser.X + "\n - Y: " + ThisUser.Y + "\n - Z: " + ThisUser.Z + "\n - Rot: " + ThisUser.RotBody + ", sqState: " + Room.GetGameMap().GameMap[ThisUser.X, ThisUser.Y].ToString() + "\n\n - RoomID: " + Session.GetHabbo().CurrentRoomId);
        }
Exemplo n.º 29
0
        public void OnPlace(GameClients.GameClient Session, RoomItem Item)
        {
            if (Item.team == Team.none)
                return;

            Item.ExtraData = Item.GetRoom().GetGameManager().Points[(int)Item.team].ToString();
            Item.UpdateState(false, true);
        }
 public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
 {
     if(bool_0)
     {
         try { Essential.getWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("31|" + RoomItem_0.uint_0 + "|" + "https://youtube.com/watch?v=" + RoomItem_0.string_2); }
         catch { }
     }
 }
Exemplo n.º 31
0
 public void OnPlace(GameClients.GameClient Session, RoomItem Item)
 {
     if (Item.ExtraData == "-1")
     {
         Item.ExtraData = "0";
         Item.UpdateNeeded = true;
     }
 }
Exemplo n.º 32
0
 internal void ClientDisconnect(Edict.Native *pEntity)
 {
     try
     {
         GameClients.Disconnect(EntityDictionary.EdictFromNative(pEntity));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 33
0
 internal void ClientCommand(Edict.Native *pEntity)
 {
     try
     {
         GameClients.Command(EntityDictionary.EdictFromNative(pEntity), new Command(ServerAPIUtils.ArgsAsList(EngineFuncs)));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 34
0
 internal void ClientPutInServer(Edict.Native *pEntity)
 {
     try
     {
         GameClients.PutInServer(EntityDictionary.EdictFromNative(pEntity));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 35
0
 internal void PlayerPostThink(Edict.Native *pEntity)
 {
     try
     {
         GameClients.PostThink(EntityDictionary.EdictFromNative(pEntity));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 36
0
 internal void PlayerCustomization(Edict.Native *pEntity, Customization.Native *pCustom)
 {
     try
     {
         GameClients.Customization(EntityDictionary.EdictFromNative(pEntity), new Customization(pCustom));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 37
0
 internal void ClientUserInfoChanged(Edict.Native *pEntity, IntPtr infoBuffer)
 {
     try
     {
         var edict = EntityDictionary.EdictFromNative(pEntity);
         GameClients.UserInfoChanged(edict, new ClientInfoBuffer(EngineFuncs, infoBuffer, EntityDictionary.EntityIndex(edict)));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 38
0
        internal QBoolean ClientConnect(Edict.Native *pEntity, string name, string address, byte *szRejectReason)
        {
            try
            {
                var result = GameClients.Connect(EntityDictionary.EdictFromNative(pEntity), name, address, out var rejectReason);

                InterfaceUtils.CopyStringToUnmanagedBuffer(rejectReason ?? string.Empty, szRejectReason, Interfaces.DLLFunctions.ClientConnectRejectReasonLength);

                return(result ? QBoolean.True : QBoolean.False);
            }
            catch (Exception e)
            {
                Log.Exception(e);
                throw;
            }
        }
        private void RefreshGameClients()
        {
            // remove game processes that have exited
            var exited = GameClients.Where(x => x.Process.HasExited).ToList();

            GameClients.RemoveAll(exited);

            // add new game processes
            Process.GetProcessesByName("elementclient")
            .Where(p => !GameClients.Any(g => p.Id == g.Process.Id))
            .Select(x => new GameModel(x))
            .ForEach(GameClients.Add);

            if (GameClients.Count == 1)
            {
                Attach.ExecuteAsync(GameClients.First());
            }
        }
Exemplo n.º 40
0
 private void Start()
 {
     GameClients = FindObjectOfType <GameClients>();
     ScreenCoeff = 450 / (float)(Screen.width);
 }
Exemplo n.º 41
0
        private static void Main(string[] args)
        {
            if (args.Length > 0 && args[0].ToLower() == "setup")
            {
                InitiateGameServerSetup();
            }

            if (args.Length > 0 && args[0].ToLower() != "setup")
            {
                Log.Warn("Arguments found yet none were recognized! Arguments: " + args);

                HaltOnFatalError();
            }

            if (!File.Exists(Application.ExecutablePath + "WvsGame.ini"))
            {
                Log.Warn("Could not find file WvsGame.ini at path: {0}", Application.ExecutablePath);

                if (Log.YesNo("Would you like to initiate setup process for Destiny game server? ", true))
                {
                    InitiateGameServerSetup();
                }
                else
                {
                    Log.Warn("\n Argument setup was not found!" +
                             "\n Neither was found WvsGame.ini!" +
                             "\n And finally you chose not to setup game server!" +
                             "\n What shall i do then? Make a prophecy about your intent?");

                    HaltOnFatalError();
                }
            }

start:
            Clients = new GameClients();

            Log.Entitle("WvsGame v.{0}.{1}", Application.MapleVersion, Application.PatchVersion);

            try
            {
                // Read game-server settings from ini
                Settings.Initialize(Application.ExecutablePath + "WvsGame.ini");
                // Test connection to database
                Database.Test();
                // Parse thru MaplestoryDB
                Database.Analyze(true);
                // Create key shortcuts
                Shortcuts.Apply();
                // Set auto-reset
                AutoRestartTime = Settings.GetInt("Server/AutoRestartTime");
                Log.Inform("Automatic restart time set to {0} seconds.", AutoRestartTime);
                // Initiate data handler
                DataProvider.Initialize();
                // Success game-server is alive!
                IsAlive = true;
            }
            catch (Exception ex)
            {
                Log.SkipLine();
                Tracer.TraceErrorMessage(ex, "Exception occurred during game-server initialization!");
            }

            if (IsAlive)
            {
                CenterConnectionDone.Reset();

                new Thread(new ThreadStart(GameToCenterServer.Main)).Start();

                CenterConnectionDone.WaitOne();
#if DEBUG
                string linkPath = Path.Combine(Application.ExecutablePath, "LaunchClient.lnk");

                if (File.Exists(linkPath) && WorldID == 0 && ChannelID == 0) //Only for the first WvsGame instance, and only if shortcut exists
                {
                    System.Diagnostics.Process proc = new System.Diagnostics.Process {
                        StartInfo = { FileName = linkPath }
                    };
                    proc.Start();
                }
#endif
            }
            else
            {
                HaltOnFatalError();
            }

            while (IsAlive)
            {
                AcceptDone.Reset();

                try
                {
                    Listener.BeginAcceptSocket(new AsyncCallback(OnAcceptSocket), null);
                }

                catch (Exception ex)
                {
                    Log.SkipLine();
                    Tracer.TraceErrorMessage(ex, "Ex occured in game server!");
                    throw;
                }

                AcceptDone.WaitOne();
            }

            CloseGameServer();

            if (AutoRestartTime > 0) // TODO: fugly rework
            {
                Log.Inform("Attempting auto-restart in {0} seconds.", AutoRestartTime);
                Thread.Sleep(AutoRestartTime * 1000);
                goto start;
            }

            Console.Read();
        }