Ejemplo n.º 1
0
        public ObjectAddComposer(Item Item, Room Room)
            : base(ServerPacketHeader.ObjectAddMessageComposer)
        {
            base.WriteInteger(Item.Id);
            base.WriteInteger(Item.GetBaseItem().SpriteId);
            base.WriteInteger(Item.GetX);
            base.WriteInteger(Item.GetY);
            base.WriteInteger(Item.Rotation);
           base.WriteString(String.Format("{0:0.00}", TextHandling.GetString(Item.GetZ)));
           base.WriteString(String.Empty);

            if (Item.LimitedNo > 0)
            {
                base.WriteInteger(1);
                base.WriteInteger(256);
               base.WriteString(Item.ExtraData);
                base.WriteInteger(Item.LimitedNo);
                base.WriteInteger(Item.LimitedTot);
            }
            else
            {
                ItemBehaviourUtility.GenerateExtradata(Item, this);
            }

            base.WriteInteger(-1); // to-do: check
            base.WriteInteger((Item.GetBaseItem().Modes > 1) ? 1 : 0);
            base.WriteInteger(Item.UserID);
           base.WriteString(Item.Username);
        }
Ejemplo n.º 2
0
        public Gamemap(Room room)
        {
            this._room = room;
            this.DiagonalEnabled = true;

            mStaticModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName);
            if (mStaticModel == null)
            {
                PlusEnvironment.GetGame().GetRoomManager().LoadModel(room.ModelName);
                mStaticModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(room.ModelName);
            }

            if (mStaticModel == null)
                return;

            mDynamicModel = new DynamicRoomModel(mStaticModel);

            mCoordinatedItems = new ConcurrentDictionary<Point, List<int>>();

            gotPublicPool = room.RoomData.Model.gotPublicPool;
            mGameMap = new byte[Model.MapSizeX, Model.MapSizeY];
            mItemHeightMap = new double[Model.MapSizeX, Model.MapSizeY];

            userMap = new ConcurrentDictionary<Point, List<RoomUser>>();
        }
Ejemplo n.º 3
0
 public RegenerateMapsBox(Room Instance, Item Item)
 {
     this.Instance = Instance;
     this.Item = Item;
     this.StringData = "";
     this.SetItems = new ConcurrentDictionary<int, Item>();
 }
Ejemplo n.º 4
0
 public UserSaysCommandBox(Room Instance, Item Item)
 {
     this.Instance = Instance;
     this.Item = Item;
     this.StringData = "";
     this.SetItems = new ConcurrentDictionary<int, Item>();
 }
Ejemplo n.º 5
0
        public ActorIsInTeamBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;

            this.SetItems = new ConcurrentDictionary<int, Item>();
        }
Ejemplo n.º 6
0
 public UserFurniCollision(Room Instance, Item Item)
 {
     this.Instance = Instance;
     this.Item = Item;
     this.StringData = "";
     this.SetItems = new ConcurrentDictionary<int, Item>();
 }
Ejemplo n.º 7
0
        public FilterComponent(Room Instance)
        {
            if (Instance == null)
                return;

            this._instance = Instance;
        }
Ejemplo n.º 8
0
        public static List<Item> GetItemsForRoom(int RoomId, Room Room)
        {
            DataTable Items = null;
            List<Item> I = new List<Item>();

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `items`.*, COALESCE(`items_groups`.`group_id`, 0) AS `group_id` FROM `items` LEFT OUTER JOIN `items_groups` ON `items`.`id` = `items_groups`.`id` WHERE `items`.`room_id` = @rid;");
                dbClient.AddParameter("rid", RoomId);
                Items = dbClient.getTable();

                if (Items != null)
                {
                    foreach (DataRow Row in Items.Rows)
                    {
                        ItemData Data = null;

                        if (PlusEnvironment.GetGame().GetItemManager().GetItem(Convert.ToInt32(Row["base_item"]), out Data))
                        {
                            I.Add(new Item(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["room_id"]), Convert.ToInt32(Row["base_item"]), Convert.ToString(Row["extra_data"]),
                                Convert.ToInt32(Row["x"]), Convert.ToInt32(Row["y"]), Convert.ToDouble(Row["z"]), Convert.ToInt32(Row["rot"]), Convert.ToInt32(Row["user_id"]),
                                Convert.ToInt32(Row["group_id"]), Convert.ToInt32(Row["limited_number"]), Convert.ToInt32(Row["limited_stack"]), Convert.ToString(Row["wall_pos"]), Room));
                        }
                        else
                        {
                            // Item data does not exist anymore.
                        }
                    }
                }
            }
            return I;
        }
Ejemplo n.º 9
0
Archivo: BotAI.cs Proyecto: BjkGkh/Boon
 public void Init(int pBaseId, int pRoomUserId, int pRoomId, RoomUser user, Room room)
 {
     this.BaseId = pBaseId;
     this.RoomUserId = pRoomUserId;
     this.RoomId = pRoomId;
     this.roomUser = user;
     this.room = room;
 }
Ejemplo n.º 10
0
        public GameItemHandler(Room room)
        {
            this.room = room;
            this.rnd = new Random();

            this._banzaiPyramids = new ConcurrentDictionary<int, Item>();
            this._banzaiTeleports = new ConcurrentDictionary<int, Item>();
        }
Ejemplo n.º 11
0
 public MoveFurniFromUserBox(Room Instance, Item Item)
 {
     this.Instance = Instance;
     this.Item = Item;
     this.SetItems = new ConcurrentDictionary<int, Item>();
     this.TickCount = Delay;
     this.Requested = false;
 }
Ejemplo n.º 12
0
        public AddonRandomEffectBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();

            if (this.SetItems.Count > 0)
                this.SetItems.Clear();
        }
Ejemplo n.º 13
0
 public GetRoomFilterListComposer(Room Instance)
     : base(ServerPacketHeader.GetRoomFilterListMessageComposer)
 {
     base.WriteInteger(Instance.WordFilterList.Count);
     foreach (string Word in Instance.WordFilterList)
     {
        base.WriteString(Word);
     }
 }
Ejemplo n.º 14
0
        public GiveRewardBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();

            if (this.SetItems.Count > 0)
                this.SetItems.Clear();
        }
Ejemplo n.º 15
0
        public TeleportUserBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();

            this._queue = new Queue();
            this.TickCount = Delay;
        }
Ejemplo n.º 16
0
 public void Dispose()
 {
     if (this._banzaiTeleports != null)
         this._banzaiTeleports.Clear();
     if (this._banzaiPyramids != null)
         this._banzaiPyramids.Clear();
     this._banzaiPyramids = null;
     this._banzaiTeleports = null;
     this.room = null;
     this.rnd = null;
 }
Ejemplo n.º 17
0
        public KickUserBox(Room Instance, Item Item)
        {
            this.Instance = Instance;
            this.Item = Item;
            this.SetItems = new ConcurrentDictionary<int, Item>();
            this.TickCount = Delay;
            this._toKick = new Queue();

            if (this.SetItems.Count > 0)
                this.SetItems.Clear();
        }
Ejemplo n.º 18
0
        public RoomUserManager(Room room)
        {
            this._room = room;
            this._users = new ConcurrentDictionary<int, RoomUser>();
            this._pets = new ConcurrentDictionary<int, RoomUser>();
            this._bots = new ConcurrentDictionary<int, RoomUser>();

            this.primaryPrivateUserID = 0;
            this.secondaryPrivateUserID = 0;

            this.petCount = 0;
            this.userCount = 0;
        }
Ejemplo n.º 19
0
        public ObjectsComposer(Item[] Objects, Room Room)
            : base(ServerPacketHeader.ObjectsMessageComposer)
        {
            base.WriteInteger(1);

            base.WriteInteger(Room.OwnerId);
           base.WriteString(Room.OwnerName);

            base.WriteInteger(Objects.Length);
            foreach (Item Item in Objects)
            {
                WriteFloorItem(Item, Convert.ToInt32(Item.UserID));
            }
        }
Ejemplo n.º 20
0
        public ItemsComposer(Item[] Objects, Room Room)
            : base(ServerPacketHeader.ItemsMessageComposer)
        {

            base.WriteInteger(1);
            base.WriteInteger(Room.OwnerId);
           base.WriteString(Room.OwnerName);

            base.WriteInteger(Objects.Length);

            foreach (Item Item in Objects)
            {
                WriteWallItem(Item, Room.OwnerId);
            }
        }
Ejemplo n.º 21
0
        public static int GetLinkedTele(int TeleId, Room pRoom)
        {
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `tele_two_id` FROM `room_items_tele_links` WHERE `tele_one_id` = '" + TeleId + "' LIMIT 1");
                DataRow Row = dbClient.getRow();

                if (Row == null)
                {
                    return 0;
                }

                return Convert.ToInt32(Row[0]);
            }
        }
Ejemplo n.º 22
0
        public ModeratorRoomChatlogComposer(Room Room)
            : base(ServerPacketHeader.ModeratorRoomChatlogMessageComposer)
        {
            base.WriteByte(1);
            base.WriteShort(2);//Count
           base.WriteString("roomName");
            base.WriteByte(2);
           base.WriteString(Room.Name);
           base.WriteString("roomId");
            base.WriteByte(1);
            base.WriteInteger(Room.Id);

            DataTable Table = null;
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `chatlogs` WHERE `room_id` = @rid ORDER BY `id` DESC LIMIT 250");
                dbClient.AddParameter("rid", Room.Id);
                Table = dbClient.getTable();
            }

            base.WriteShort(Table.Rows.Count);
            if (Table != null)
            {
                foreach (DataRow Row in Table.Rows)
                {
                    UserCache Habbo = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Convert.ToInt32(Row["user_id"]));

                    if (Habbo == null)
                    {
                        base.WriteInteger(((int)PlusEnvironment.GetUnixTimestamp() - Convert.ToInt32(Row["timestamp"])) * 1000);
                        base.WriteInteger(-1);
                       base.WriteString("Unknown User");
                       base.WriteString(string.IsNullOrWhiteSpace(Convert.ToString(Row["message"])) ? "*user sent a blank message*" : Convert.ToString(Row["message"]));
                        base.WriteBoolean(false);
                    }
                    else
                    {
                        base.WriteInteger(((int)PlusEnvironment.GetUnixTimestamp() - Convert.ToInt32(Row["timestamp"])) * 1000);
                        base.WriteInteger(Habbo.Id);
                       base.WriteString(Habbo.Username);
                       base.WriteString(string.IsNullOrWhiteSpace(Convert.ToString(Row["message"]) )? "*user sent a blank message*" : Convert.ToString(Row["message"]));
                        base.WriteBoolean(false);
                    }
                }
            }
        }
Ejemplo n.º 23
0
        public static int GetTeleRoomId(int TeleId, Room pRoom)
        {
            if (pRoom.GetRoomItemHandler().GetItem(TeleId) != null)
                return pRoom.RoomId;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `room_id` FROM `items` WHERE `id` = " + TeleId + " LIMIT 1");
                DataRow Row = dbClient.getRow();

                if (Row == null)
                {
                    return 0;
                }

                return Convert.ToInt32(Row[0]);
            }
        }
Ejemplo n.º 24
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            TimeSpan Uptime = DateTime.Now - PlusEnvironment.ServerStarted;
            int OnlineUsers = PlusEnvironment.GetGame().GetClientManager().Count;
            int RoomCount = PlusEnvironment.GetGame().GetRoomManager().Count;

            Session.SendMessage(new RoomNotificationComposer("Powered by PlusEmulator",
                 "<b>Credits</b>:\n" +
                 "Sledmore (Developer)\n" +
                 "123 (Developer)\n" +
                 "Joopie (Encryption)\n" +
                 "Tweeney (PlusEMU)\n" +
                 "Butterfly Emulator developers\n\n" +
                 "<b>Current run time information</b>:\n" +
                 "Online Users: " + OnlineUsers + "\n" +
                 "Rooms Loaded: " + RoomCount + "\n" +
                 "Uptime: " + Uptime.Days + " day(s), " + Uptime.Hours + " hours and " + Uptime.Minutes + " minutes.\n\n" +
                 "<b>SWF Revision</b>:\n" + PlusEnvironment.SWFRevision, "plus", ""));
        }
Ejemplo n.º 25
0
        public RoomItemHandling(Room Room)
        {
            this._room = Room;

            this.HopperCount = 0;
            this.mGotRollers = false;
            this.mRollerSpeed = 4;
            this.mRollerCycle = 0;

            this._movedItems = new ConcurrentDictionary<int, Item>();

            this._rollers = new ConcurrentDictionary<int, Item>();
            this._wallItems = new ConcurrentDictionary<int, Item>();
            this._floorItems = new ConcurrentDictionary<int, Item>();

            this.rollerItemsMoved = new List<int>();
            this.rollerUsersMoved = new List<int>();
            this.rollerMessages = new List<ServerPacket>();

            this._roomItemUpdateQueue = new ConcurrentQueue<Item>();
        }
Ejemplo n.º 26
0
        public RoomRightsListComposer(Room Instance)
            : base(ServerPacketHeader.RoomRightsListMessageComposer)
        {
            base.WriteInteger(Instance.Id);

            base.WriteInteger(Instance.UsersWithRights.Count);
            foreach (int Id in Instance.UsersWithRights.ToList())
            {
                UserCache Data = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Id);
                if (Data == null)
                {
                    base.WriteInteger(0);
                    base.WriteString("Unknown Error");
                }
                else
                {
                    base.WriteInteger(Data.Id);
                    base.WriteString(Data.Username);
                }
            }
        }
Ejemplo n.º 27
0
        public GetRoomBannedUsersComposer(Room Instance)
            : base(ServerPacketHeader.GetRoomBannedUsersMessageComposer)
        {
            base.WriteInteger(Instance.Id);

            base.WriteInteger(Instance.BannedUsers().Count);//Count
            foreach (int Id in Instance.BannedUsers().ToList())
            {
                UserCache Data = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(Id);

                if (Data == null)
                {
                    base.WriteInteger(0);
                    base.WriteString("Unknown Error");
                }
                else
                {
                    base.WriteInteger(Data.Id);
                    base.WriteString(Data.Username);
                }
            }
        }
Ejemplo n.º 28
0
        public static bool IsTeleLinked(int TeleId, Room pRoom)
        {
            int LinkId = GetLinkedTele(TeleId, pRoom);

            if (LinkId == 0)
            {
                return false;
            }

            Item item = pRoom.GetRoomItemHandler().GetItem(LinkId);
            if (item != null && item.GetBaseItem().InteractionType == InteractionType.TELEPORT)
                return true;

            int RoomId = GetTeleRoomId(LinkId, pRoom);

            if (RoomId == 0)
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 29
0
        public RoomSettingsDataComposer(Room Room)
            : base(ServerPacketHeader.RoomSettingsDataMessageComposer)
        {
            base.WriteInteger(Room.RoomId);
           base.WriteString(Room.Name);
           base.WriteString(Room.Description);
            base.WriteInteger(RoomAccessUtility.GetRoomAccessPacketNum(Room.Access));
            base.WriteInteger(Room.Category);
            base.WriteInteger(Room.UsersMax);
            base.WriteInteger(((Room.RoomData.Model.MapSizeX * Room.RoomData.Model.MapSizeY) > 100) ? 50 : 25);

            base.WriteInteger(Room.Tags.Count);
            foreach (string Tag in Room.Tags.ToArray())
            {
               base.WriteString(Tag);
            }

            base.WriteInteger(Room.TradeSettings); //Trade
            base.WriteInteger(Room.AllowPets); // allows pets in room - pet system lacking, so always off
            base.WriteInteger(Room.AllowPetsEating);// allows pets to eat your food - pet system lacking, so always off
            base.WriteInteger(Room.RoomBlockingEnabled);
            base.WriteInteger(Room.Hidewall);
            base.WriteInteger(Room.WallThickness);
            base.WriteInteger(Room.FloorThickness);

            base.WriteInteger(Room.chatMode);//Chat mode
            base.WriteInteger(Room.chatSize);//Chat size
            base.WriteInteger(Room.chatSpeed);//Chat speed
            base.WriteInteger(Room.chatDistance);//Hearing Distance
            base.WriteInteger(Room.extraFlood);//Additional Flood

            base.WriteBoolean(true);

            base.WriteInteger(Room.WhoCanMute); // who can mute
            base.WriteInteger(Room.WhoCanKick); // who can kick
            base.WriteInteger(Room.WhoCanBan); // who can ban

        }
Ejemplo n.º 30
0
        public void Dispose()
        {
            foreach (Item Item in this.GetWallAndFloor.ToList())
            {
                if (Item == null)
                    continue;

                Item.Destroy();
            }

            _floorItems.Clear();
            _wallItems.Clear();
            _movedItems.Clear();
            this._roomItemUpdateQueue = null;

            _room = null;
            _floorItems = null;
            _wallItems = null;
            _movedItems = null;
            _wallItems = null;
            _roomItemUpdateQueue = null;
        }