示例#1
0
    // Parsing
    public static RoomData FromObject(JsonData jsonData)
    {
        RoomData roomData = new RoomData();

        int gameID = SessionData.GetInstance().GameID;
        int room_x = (int)jsonData["room_x"];
        int room_y = (int)jsonData["room_y"];
        int room_z = (int)jsonData["room_z"];

        float world_x= jsonData["world_x"].IsInt ? (float)((int)jsonData["world_x"]) : (float)((double)jsonData["world_x"]);
        float world_y= jsonData["world_y"].IsInt ? (float)((int)jsonData["world_y"]) : (float)((double)jsonData["world_y"]);
        float world_z= jsonData["world_z"].IsInt ? (float)((int)jsonData["world_z"]) : (float)((double)jsonData["world_z"]);

        roomData.RoomKey.Set(gameID, room_x, room_y, room_z);
        roomData.WorldPosition.Set(world_x, world_y, world_z);
        roomData.StaticRoomData = StaticRoomData.FromObject(roomData.RoomKey, jsonData["data"]);

        {
            JsonData portalList = jsonData["portals"];

            for (int portalIndex= 0; portalIndex < portalList.Count; portalIndex++)
            {
                JsonData portalObject = portalList[portalIndex];
                RoomPortal portal = RoomPortal.FromObject(portalObject);

                roomData.RoomPortals.Add(portal);
            }
        }

        {
            JsonData mobObjects = jsonData["mobs"];

            roomData.m_mobs = new Dictionary<int, MobData>();

            for (int mobIndex= 0; mobIndex < mobObjects.Count; mobIndex++)
            {
                JsonData mobObject = mobObjects[mobIndex];
                MobData mobData = MobData.FromObject(mobObject);

                roomData.SetMobById(mobData.mob_id, mobData);
            }
        }

        {
            JsonData energyTankObjects = jsonData["energyTanks"];

            roomData.m_energyTanks = new Dictionary<int, EnergyTankData>();

            for (int energyTankIndex = 0; energyTankIndex < energyTankObjects.Count; energyTankIndex++)
            {
                JsonData energyTankObject = energyTankObjects[energyTankIndex];
                EnergyTankData energyTankData = EnergyTankData.FromObject(energyTankObject);

                roomData.SetEnergyTankById(energyTankData.energy_tank_id, energyTankData);
            }
        }

        return roomData;
    }
 public void onUserLeftRoom(RoomData eventObj, String username)
 {
     if (Global.localUsername != username)
         Deployment.Current.Dispatcher.BeginInvoke(() =>
         {
             System.Diagnostics.Debug.WriteLine("someone left");
         });
 }
示例#3
0
 void Awake()
 {
     Player = new PlayerData();
     Room = new RoomData();
     MessageQueue = new Queue<string>();
     AfkChecker = gameObject.GetOrAddComponent<AFKChecker>();
     AfkChecker.OnStatusChanged += OnAway;
 }
示例#4
0
 public Room(RoomData data)
 {
     RoomRect = data.RoomRect;
     isMonsterHouse = data.IsMonsterHouse;
     isShop = data.IsShop;
     EntranceDoorPositions = new Vector2[] { };
     ID = InstanceID++;
     //Debug.Log(this.ToString());
 }
        public void onUserJoinedRoom(RoomData eventObj, String username)
        {
            _page.UpdateStatus(username + " joined " + eventObj.getId());
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                _page.UnLockGameboard();
                _page.UpdateStatus("Click on any block to start Game");

            });
        }
    /// <summary>
    /// Create and add a new Room into the repository.
    /// </summary>
    public RoomData Post(RoomData data)
    {
        // Note: repository creates a Room, not RoomData.
        var room = Program.Rooms.Store(Room.createInstance(data.RoomType));

        // set room ID back to the data object
        data.Id = room.Id;

        return data;
    }
示例#7
0
	public void UpdateItemCount (RoomData roomData) {
		SQLiteDB sqliteDB = OpenDatabase ();
		StringBuilder sb = new StringBuilder ();
		sb.Append ("update " + ROOM_DATA_LIST_TABLE + " ");
		sb.Append ("set " + RoomDataField.ITEM_COUNT + " = " + roomData.ItemCount + " ");
		sb.Append ("where " + RoomDataField.ID + " = " + roomData.Id + ";");
		Debug.Log("sql = "+sb.ToString());
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sb.ToString ());
		sqliteQuery.Step ();
		CloseDatabase (sqliteDB, sqliteQuery);
	}
 public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary<String, Object> properties)
 {
     _page.showResult("Notification for User Changed Room Propert received");
     _page.showResult(roomData.getId());
     _page.showResult(sender);
     foreach (KeyValuePair<string, object> entry in properties)
     {
         _page.showResult("KEY:" + entry.Key);
         _page.showResult("VALUE:" + entry.Value.ToString());
     }
 }
    IEnumerator LoadRoomRoutine( RoomData data )
    {
        string levelName = m_CurrentWorldName + data.Name;

        AsyncOperation loadLevel = Application.LoadLevelAdditiveAsync( levelName );

        while( loadLevel.isDone == false )
        {
            //Debug.Log( "Loading " + levelName + ": " + Mathf.Round( loadLevel.progress * 100 ) + "%" );
            yield return null;
        }   
    }
	void Init (RoomData roomData) {
		Debug.Log ("roomId = " + roomData.Id);
		mRoomData = roomData;
		mShortMoneyTweenColor = priceLabelObject.GetComponent<TweenColor>();
		string spriteName = "room_item_" + roomData.Id;
		UISpriteData spriteData = roomItemAtlas.GetSprite (spriteName);
		itemSprite.spriteName = "room_item_" + roomData.Id;
		itemSprite.width = spriteData.width;
		itemSprite.height = spriteData.height;
		nameLabel.text = roomData.ItemName;
		priceLabelObject.GetComponent<UILabel>().text  = "price : " + roomData.ItemPrice;
		countLabel.text = "所持数 : " + roomData.ItemCount;
		descriptionLabel.text = roomData.ItemDescription;
	}
    void LoadRoom( string name, int x, int y )
    {
        if( DoesRoomExist( x, y ) == true )
        {
            return;
        }

        RoomData newRoomData = new RoomData();
        newRoomData.Name = name;
        newRoomData.X = x;
        newRoomData.Y = y;

        m_LoadRoomQueue.Enqueue( newRoomData );
    }
 public void onUserJoinedRoom(RoomData roomObj, String username)
 {
     Debug.WriteLine("On User Joined Room "+username);
     if (!GlobalContext.joinedUsers.Contains(username))
     {
         GlobalContext.joinedUsers.Add(username);
     }
     if (!GlobalContext.localUsername.Equals(username))
     {
         GlobalContext.opponentName = username;
     }
     if((GlobalContext.joinedUsers.Count==2)&& GlobalContext.tableProperties["IsPrivateRoom"].Equals("true"))
     {
         Deployment.Current.Dispatcher.BeginInvoke(delegate() { App.g_HomePageListener.StartQuiz(); });
     }
 }
示例#13
0
	void Init (RoomData roomData) {  
		mRoomData = roomData;
		if(mItemSpriteList == null){
			CreateItemSpriteList();
		}
		if (mRoomData.ItemCount == 0) {
			lockObject.SetActive (true);
			return;
		}
		// only first
		UISprite firstItemSprite = mItemSpriteList[0];
		if(!firstItemSprite.enabled){
			SetActiveItem ();
		}
		SetTextData (); 
	}
示例#14
0
    public void ResetCell(RoomData roomData, Pair pos, int ord = 0)
    {
        room = roomData;
        roomID = room.ID;

        int roomLevel = GameManager.Instance.GetRoomLevel(roomID);
        LevelItemData levelItemData = GameManager.Instance.GetLevelItemData(roomData.boardID);

        if (levelItemData == null)
            return;

        int boardID = levelItemData.getItemID(roomLevel);
        ItemData itemData = GameManager.Instance.GetItemData(boardID);

        ResetItem(pos, itemData, ord, false);
    }
示例#15
0
	public List<RoomData> GetRoomDataList () {
		SQLiteDB sqliteDB = OpenDatabase ();
		string sql = "select * from " + ROOM_DATA_LIST_TABLE + ";";
		Debug.Log("sql = "+ sql);
		SQLiteQuery sqliteQuery = new SQLiteQuery (sqliteDB, sql);
		List<RoomData> roomDataList = new List<RoomData> ();
		while (sqliteQuery.Step()) {
			RoomData roomData = new RoomData ();
			roomData.Id = sqliteQuery.GetInteger (RoomDataField.ID);
			roomData.ItemCount = sqliteQuery.GetInteger (RoomDataField.ITEM_COUNT);
			roomData.ItemPrice = sqliteQuery.GetInteger (RoomDataField.PRICE);
			roomData.GenerateSpeed = (float)sqliteQuery.GetDouble (RoomDataField.GENERATE_SPEED);
			roomData.ItemName = sqliteQuery.GetString (RoomDataField.NAME);
			roomData.ItemDescription = sqliteQuery.GetString (RoomDataField.DESCRIPTION);
			roomDataList.Add (roomData);
		}
		CloseDatabase (sqliteDB, sqliteQuery);
		return roomDataList;
	}
    void UpdateRoomQueue()
    {
        if( m_IsLoadingRoom == true )
        {
            return;
        }

        if( m_LoadRoomQueue.Count == 0 )
        {
            return;
        }

        m_CurrentLoadRoomData = m_LoadRoomQueue.Dequeue();
        m_IsLoadingRoom = true;

        //Debug.Log( "Loading new room: " + m_CurrentLoadRoomData.Name + " at " + m_CurrentLoadRoomData.X + ", " + m_CurrentLoadRoomData.Y );

        StartCoroutine( LoadRoomRoutine( m_CurrentLoadRoomData ) );
    }
示例#17
0
    void OnRecieveRoomList(ServerMessage.RoomList message)
    {
        browserItems.ForEach(x => Destroy(x.gameObject));
        browserItems.Clear();

        foreach (var room in message.Rooms)
        {
            // Make instance of view
            var view = UiUtility.AddChild<UiBrowserItem>(Browser.gameObject, BrowserItemPrototype, true);
            view.Text.text = string.Format("{0}'s Game / Players: {1} / Started?: {2}", room.Owner.Name, room.Players.Count, room.GameStarted);
            view.Toggle.group = toggleGroup;
            view.RoomData = room;

            // Add toggle listener
            var temp = room;
            view.Toggle.onValueChanged.AddListener((enabled) =>
            {
                if (enabled)
                {
                    Debug.LogFormat("Select room {0}", view.RoomData.ID);
                    selectedRoom = temp;
                }
            });

            view.gameObject.GetOrAddComponent<DoubleClickHandler>().OnDoubleClick += () =>
            {
                OnJoin();
            };

            browserItems.Add(view);
        }

        // Select first item
        if (browserItems.Count != 0)
            browserItems[0].Toggle.isOn = true;

        NoGames.SetActive(browserItems.Count == 0);
    }
        public void onUserJoinedRoom(RoomData eventObj, String username)
        {
            System.Diagnostics.Debug.WriteLine(username + " joined room");
            /*
            if(!username.Equals(Global.localUsername))
            {
                Global.opponentUsername = username;
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    _page.ready.Text = Global.localUsername + " \nvs\n" + Global.opponentUsername;
                });
                        
            }
            else if(!eventObj.getRoomOwner().Equals(Global.localUsername))
            {
                Global.opponentUsername = eventObj.getRoomOwner();
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    _page.ready.Text = Global.localUsername + " \nvs\n" + Global.opponentUsername;
                });

            }
            */
        }
示例#19
0
 public void onUserLeftRoom(RoomData eventObj, String username)
 {
 }
示例#20
0
 public void onRoomCreated(RoomData eventObj)
 {
 }
示例#21
0
		public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary<string, object> properties, Dictionary<string, string> lockedPropertiesTable){}
 public void onUserJoinedRoom(RoomData eventObj, string username)
 {
     Log ("onUserJoinedRoom : " + username);
 }
示例#23
0
    void CollideWithTerrain(Player player, Vector3i position)
    {
        if (player != this.Controller)
        {
            return;
        }
        if (this.groundHits == null)
        {
            this.groundHits = new HashSet <Vector3i>();
        }

        WorldLayer playerActivity = WorldLayerManager.GetLayer(LayerNames.PlayerActivity);

        // destroy plants and spawn dirt within a radius under the hit position
        int radius = 1;

        for (int x = -radius; x <= radius; x++)
        {
            for (int z = -radius; z <= radius; z++)
            {
                var offsetpos = position + new Vector3i(x, -1, z);
                if (this.groundHits.Contains(offsetpos))
                {
                    continue;
                }
                this.groundHits.Add(offsetpos);
                var abovepos   = offsetpos + Vector3i.Up;
                var aboveblock = World.GetBlock(abovepos);
                var hitblock   = World.GetBlock(offsetpos);
                if (!aboveblock.Is <Solid>())
                {
                    // turn soil into dirt
                    if (hitblock.GetType() == typeof(GrassBlock) || hitblock.GetType() == typeof(ForestSoilBlock))
                    {
                        player.SpawnBlockEffect(offsetpos, typeof(DirtBlock), BlockEffect.Delete);
                        World.SetBlock <DirtBlock>(offsetpos);
                        BiomePusher.AddFrozenColumn(offsetpos.XZ);
                    }

                    // kill any above plants
                    if (aboveblock is PlantBlock)
                    {
                        // make sure there is a plant here, sometimes world/ecosim are out of sync
                        var plant = EcoSim.PlantSim.GetPlant(abovepos);
                        if (plant != null)
                        {
                            player.SpawnBlockEffect(abovepos, aboveblock.GetType(), BlockEffect.Delete);
                            EcoSim.PlantSim.DestroyPlant(plant, DeathType.Deforestation);
                        }
                        else
                        {
                            World.DeleteBlock(abovepos);
                        }
                    }

                    if (hitblock.Is <Solid>() && World.GetBlock(abovepos).Is <Empty>() && RandomUtil.Value < this.Species.ChanceToSpawnDebris)
                    {
                        Block placedBlock = World.SetBlock(typeof(TreeDebrisBlock), abovepos);
                        player.SpawnBlockEffect(abovepos, typeof(TreeDebrisBlock), BlockEffect.Place);
                        RoomData.TestLandscapeChange(abovepos, true);
                    }
                }
            }
        }
    }
示例#24
0
 public ModerationTicket(int id, int type, int category, double timestamp, int priority, Habbo sender, Habbo reported, string issue, RoomData room, List <string> reportedChats)
 {
     this.Id            = id;
     this.Type          = type;
     this.Category      = category;
     this.Timestamp     = timestamp;
     this.Priority      = priority;
     this.Sender        = sender;
     this.Reported      = reported;
     this.Moderator     = null;
     this.Issue         = issue;
     this.Room          = room;
     this.Answered      = false;
     this.ReportedChats = reportedChats;
 }
示例#25
0
        public static void ApplyRoomData(PrototypeDungeonRoom room, RoomData roomData, bool setRoomCategory, bool autoAssignToFloor, bool assignDecorationProperties, float?Weight)
        {
            // Tools.Print("Building Exits...");
            if (roomData.exitPositions != null)
            {
                for (int i = 0; i < roomData.exitPositions.Length; i++)
                {
                    DungeonData.Direction dir = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper());
                    AddExit(room, roomData.exitPositions[i], dir);
                }
            }
            else
            {
                AddExit(room, new Vector2(room.Width / 2, room.Height), DungeonData.Direction.NORTH);
                AddExit(room, new Vector2(room.Width / 2, 0), DungeonData.Direction.SOUTH);
                AddExit(room, new Vector2(room.Width, room.Height / 2), DungeonData.Direction.EAST);
                AddExit(room, new Vector2(0, room.Height / 2), DungeonData.Direction.WEST);
            }

            // Tools.Print("Adding Enemies...");
            if (roomData.enemyPositions != null)
            {
                for (int i = 0; i < roomData.enemyPositions.Length; i++)
                {
                    AddEnemyToRoom(room, roomData.enemyPositions[i], roomData.enemyGUIDs[i], roomData.enemyReinforcementLayers[i], roomData.randomizeEnemyPositions);
                }
            }

            // Tools.Print("Adding Objects...");
            if (roomData.placeablePositions != null)
            {
                for (int i = 0; i < roomData.placeablePositions.Length; i++)
                {
                    AddPlaceableToRoom(room, roomData.placeablePositions[i], roomData.placeableGUIDs[i]);
                }
            }

            if (setRoomCategory | autoAssignToFloor)
            {
                // Set categories
                if (!string.IsNullOrEmpty(roomData.category))
                {
                    room.category = GetRoomCategory(roomData.category);
                }
                if (!string.IsNullOrEmpty(roomData.normalSubCategory))
                {
                    room.subCategoryNormal = GetRoomNormalSubCategory(roomData.normalSubCategory);
                }
                if (!string.IsNullOrEmpty(roomData.bossSubCategory))
                {
                    room.subCategoryBoss = GetRoomBossSubCategory(roomData.bossSubCategory);
                }
                if (!string.IsNullOrEmpty(roomData.specialSubCategory))
                {
                    room.subCategorySpecial = GetRoomSpecialSubCategory(roomData.specialSubCategory);
                }
            }
            if (autoAssignToFloor && roomData.floors != null)
            {
                if (!Weight.HasValue)
                {
                    if (room.category == PrototypeDungeonRoom.RoomCategory.SECRET)
                    {
                        Weight = 15; // Normal secret rooms have weight of 15.
                    }
                    else
                    {
                        Weight = 1;
                    }
                }
                if (room.category == PrototypeDungeonRoom.RoomCategory.SECRET)
                {
                    // Secret rooms are generally shared across all floors via a specific room table.
                    // Room Editor doesn't currently set this for secret rooms
                    room.OverrideMusicState = DungeonFloorMusicController.DungeonMusicState.CALM;
                    CakeMod.ModPrefabs.SecretRoomTable.includedRooms.elements.Add(CakeMod.ModRoomPrefabs.GenerateWeightedRoom(room, Weight.Value));
                }
                else
                {
                    foreach (string floor in roomData.floors)
                    {
                        AssignRoomToFloorRoomTable(room, GetTileSet(floor), Weight);
                    }

                    /*ExpandPrefabs.CustomRoomTableSecretGlitchFloor.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value));
                     * ExpandPrefabs.CustomRoomTable.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value));
                     * ExpandPrefabs.CustomRoomTable2.includedRooms.elements.Add(ExpandRoomPrefabs.GenerateWeightedRoom(room, Weight.Value));*/
                }
            }

            if (assignDecorationProperties)
            {
                room.allowFloorDecoration   = roomData.doFloorDecoration;
                room.allowWallDecoration    = roomData.doWallDecoration;
                room.usesProceduralLighting = roomData.doLighting;
            }
        }
示例#26
0
 public void Reset()
 {
     room             = new RoomData();
     isLogin          = false;
     m_needReconnnect = false;
 }
示例#27
0
 private void ChangeColor(RoomData room, Color color)   // veranderd de kamer kleur
 {
     room.gameObject.GetComponent <MeshRenderer>().material.color = color;
 }
示例#28
0
 public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary <string, object> properties, Dictionary <string, string> lockedPropertiesTable)
 {
     Log("onUserChangeRoomProperty : " + sender);
 }
 public RoomData method_12(uint uint_0)
 {
     RoomData @class = new RoomData();
     RoomData result;
     lock (this.hashtable_0)
     {
         if (this.hashtable_0.ContainsKey(uint_0))
         {
             result = (this.hashtable_0[uint_0] as RoomData);
             return result;
         }
         if (this.method_13(uint_0))
         {
             result = this.GetRoom(uint_0).Class27_0;
             return result;
         }
         DataRow dataRow = null;
         using (DatabaseClient class2 = GoldTree.GetDatabase().GetClient())
         {
             dataRow = class2.ReadDataRow("SELECT * FROM rooms WHERE Id = '" + uint_0 + "' LIMIT 1");
         }
         if (dataRow == null)
         {
             result = null;
             return result;
         }
         @class.method_1(dataRow);
     }
     if (!this.hashtable_0.ContainsKey(uint_0))
     {
         this.hashtable_0.Add(uint_0, @class);
     }
     result = @class;
     return result;
 }
示例#30
0
    //public RoomData RoomData { get{return roomData;} }

    IEnumerator Start()
    {
        //UnityEngine.PlayerPrefs.SetInt("_room", 0);
        if (roomId < 0)
        {
            roomId = 0;
            //roomId = UnityEngine.PlayerPrefs.GetInt("_room"); // check PlayerPrefs._room
        }
        else
        {
            roomId     = UnityEngine.PlayerPrefs.GetInt("_room");
            score      = UnityEngine.PlayerPrefs.GetInt("_score");
            isDemoMode = UnityEngine.PlayerPrefs.GetInt("_demo") > 0 ? true : false;
        }

        var store        = GetComponent <RoomStore>();
        var roomRenderer = GetComponent <RoomRenderer>();

        while (!store.IsReady)
        {
            yield return(null);
        }

        //RoomData data = store.Rooms[roomId];
        roomData = store.Rooms[roomId];

        // miner willy
        minerWilly = new Mob(store.MinerWillySprites, roomData.StartPoint.X, roomData.StartPoint.Y, 4, 0, 0, 7);

        // horizontal guardians
        //roomData.HorizontalGuardians.ForEach(g=>mobs.Add(new MobX(g)));
        roomData.HorizontalGuardians.ForEach(g => mobs.Add(new Mob(roomData.GuardianGraphics, g.StartX, g.StartY, g.Left, g.Right, g.StartFrame, g.Attribute)));

        // conveyor shape
        foreach (var block in roomData.Blocks.Values)
        {
            if (block.Type == BlockType.Conveyor)
            {
                roomData.ConveyorShape = block.Shape;
                break;
            }
        }

        mainCamera.backgroundColor = Com.SloanKelly.ZXSpectrum.ZXColour.Get(roomData.BorderColour);

        SetupRenderer(roomRenderer);

        StartCoroutine(DrawScreen(roomRenderer, roomData));
        StartCoroutine(LoseAir(roomData));
        if (!isDemoMode)
        {
            StartCoroutine(MoveMinerWilly(minerWilly, roomData));
        }
        StartCoroutine(CycleColours(roomData.RoomKeys));
        StartCoroutine(AnimateConveyor(roomData));
        StartCoroutine(CheckPortalCollision(roomData));
        StartCoroutine(EndOfCavernCheck(roomData));

        if (isDemoMode)
        {
            StartCoroutine(DemoNextScreen());
        }

        if ((roomId >= 0 && roomId <= 6) || roomId == 9 || roomId == 15)
        {
            StartCoroutine(BidirectionalSprites());
        }
    }
    void hasPlayerExit(object obj)
    {
        IntPtr connId = (IntPtr)obj;

        PlayerData playerData = GameUtil.getPlayerDataByConnId(connId);

        if (playerData == null)
        {
            LogUtil.getInstance().addDebugLog("踢出玩家失败,找不到IntPtr:" + connId + "对应的玩家");
            return;
        }

        if (PlayLogic_Relax.getInstance().doTaskPlayerCloseConn(playerData.m_uid))
        {
            // 日志
            {
                if (playerData != null)
                {
                    RoomData room = GameUtil.getRoomByUid(playerData.m_uid);
                    if (room != null)
                    {
                        LogUtil.getInstance().writeRoomLog(room, "踢出玩家成功:" + connId);
                    }
                    else
                    {
                        LogUtil.getInstance().addDebugLog("踢出玩家成功:" + connId);
                    }
                }
                else
                {
                    LogUtil.getInstance().addDebugLog("踢出玩家成功:" + connId);
                }
            }
        }
        else if (PlayLogic_PVP.getInstance().doTaskPlayerCloseConn(playerData.m_uid))
        {
            // 日志
            {
                if (playerData != null)
                {
                    RoomData room = GameUtil.getRoomByUid(playerData.m_uid);
                    if (room != null)
                    {
                        LogUtil.getInstance().writeRoomLog(room, "踢出玩家成功:" + connId);
                    }
                    else
                    {
                        LogUtil.getInstance().addDebugLog("踢出玩家成功:" + connId);
                    }
                }
                else
                {
                    LogUtil.getInstance().addDebugLog("踢出玩家成功:" + connId);
                }
            }
        }
        else
        {
            LogUtil.getInstance().addDebugLog("踢出玩家失败,找不到该玩家:" + connId);
        }
    }
示例#32
0
        public static void Search(ServerPacket packet, SearchResultList result, string query, Habbo habbo, int limit)
        {
            if (habbo == null)
            {
                return;
            }

            switch (result.CategoryType)
            {
            default:
            case NavigatorCategoryType.MyFavourites:
            case NavigatorCategoryType.MyHistory:
            case NavigatorCategoryType.Featured:
                packet.WriteInteger(0);
                break;

            case NavigatorCategoryType.Query:
            {
                #region Query
                if (query.ToLower().StartsWith("owner:"))
                {
                    if (query.Length > 0)
                    {
                        int       UserId   = 0;
                        DataTable GetRooms = null;
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            if (query.ToLower().StartsWith("owner:"))
                            {
                                dbClient.SetQuery("SELECT `id` FROM `users` WHERE `username` = @username LIMIT 1");
                                dbClient.AddParameter("username", query.Remove(0, 6));
                                UserId = dbClient.GetInteger();

                                dbClient.SetQuery("SELECT * FROM `rooms` WHERE `owner` = '" + UserId + "' and `state` != 'invisible' ORDER BY `users_now` DESC LIMIT 50");
                                GetRooms = dbClient.GetTable();
                            }
                        }

                        List <RoomData> Results = new List <RoomData>();
                        if (GetRooms != null)
                        {
                            foreach (DataRow Row in GetRooms.Rows)
                            {
                                RoomData Data = null;
                                if (!RoomFactory.TryGetData(Convert.ToInt32(Row["id"]), out Data))
                                {
                                    continue;
                                }

                                if (!Results.Contains(Data))
                                {
                                    Results.Add(Data);
                                }
                            }

                            GetRooms = null;
                        }

                        packet.WriteInteger(Results.Count);
                        foreach (RoomData Data in Results.ToList())
                        {
                            RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                        }

                        Results = null;
                    }
                }
                else if (query.ToLower().StartsWith("tag:"))
                {
                    query = query.Remove(0, 4);
                    ICollection <Room> TagMatches = PlusEnvironment.GetGame().GetRoomManager().SearchTaggedRooms(query);

                    packet.WriteInteger(TagMatches.Count);
                    foreach (RoomData Data in TagMatches.ToList())
                    {
                        RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                    }

                    TagMatches = null;
                }
                else if (query.ToLower().StartsWith("group:"))
                {
                    query = query.Remove(0, 6);
                    ICollection <Room> GroupRooms = PlusEnvironment.GetGame().GetRoomManager().SearchGroupRooms(query);

                    packet.WriteInteger(GroupRooms.Count);
                    foreach (RoomData Data in GroupRooms.ToList())
                    {
                        RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                    }

                    GroupRooms = null;
                }
                else
                {
                    if (query.Length > 0)
                    {
                        DataTable Table = null;
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("SELECT `id`,`caption`,`description`,`roomtype`,`owner`,`state`,`category`,`users_now`,`users_max`,`model_name`,`score`,`allow_pets`,`allow_pets_eat`,`room_blocking_disabled`,`allow_hidewall`,`password`,`wallpaper`,`floor`,`landscape`,`floorthick`,`wallthick`,`mute_settings`,`kick_settings`,`ban_settings`,`chat_mode`,`chat_speed`,`chat_size`,`trade_settings`,`group_id`,`tags`,`push_enabled`,`pull_enabled`,`enables_enabled`,`respect_notifications_enabled`,`pet_morphs_allowed`,`spush_enabled`,`spull_enabled`,`sale_price` FROM rooms WHERE `caption` LIKE @query ORDER BY `users_now` DESC LIMIT 50");
                            dbClient.AddParameter("query", query + "%");
                            Table = dbClient.GetTable();
                        }

                        List <RoomData> Results = new List <RoomData>();
                        if (Table != null)
                        {
                            foreach (DataRow Row in Table.Rows)
                            {
                                if (Convert.ToString(Row["state"]) == "invisible")
                                {
                                    continue;
                                }

                                RoomData Data = null;
                                if (!RoomFactory.TryGetData(Convert.ToInt32(Row["id"]), out Data))
                                {
                                    continue;
                                }

                                if (!Results.Contains(Data))
                                {
                                    Results.Add(Data);
                                }
                            }

                            Table = null;
                        }

                        packet.WriteInteger(Results.Count);
                        foreach (RoomData Data in Results.ToList())
                        {
                            RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                        }

                        Results = null;
                    }
                }
                #endregion

                break;
            }

            case NavigatorCategoryType.Popular:
            {
                List <Room> PopularRooms = PlusEnvironment.GetGame().GetRoomManager().GetPopularRooms(-1, limit);

                packet.WriteInteger(PopularRooms.Count);
                foreach (RoomData Data in PopularRooms.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                PopularRooms = null;
                break;
            }

            case NavigatorCategoryType.Recommended:
            {
                List <Room> RecommendedRooms = PlusEnvironment.GetGame().GetRoomManager().GetRecommendedRooms(limit);

                packet.WriteInteger(RecommendedRooms.Count);
                foreach (RoomData Data in RecommendedRooms.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                RecommendedRooms = null;
                break;
            }

            case NavigatorCategoryType.Category:
            {
                List <Room> GetRoomsByCategory = PlusEnvironment.GetGame().GetRoomManager().GetRoomsByCategory(result.Id, limit);

                packet.WriteInteger(GetRoomsByCategory.Count);
                foreach (RoomData Data in GetRoomsByCategory.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                GetRoomsByCategory = null;
                break;
            }

            case NavigatorCategoryType.MyRooms:
            {
                ICollection <RoomData> rooms = RoomFactory.GetRoomsDataByOwnerSortByName(habbo.Id).OrderByDescending(x => x.UsersNow).ToList();

                packet.WriteInteger(rooms.Count);
                foreach (RoomData Data in rooms.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                break;
            }

            case NavigatorCategoryType.MyGroups:
            {
                List <RoomData> MyGroups = new List <RoomData>();

                foreach (Group Group in PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(habbo.Id).ToList())
                {
                    if (Group == null)
                    {
                        continue;
                    }

                    RoomData Data = null;
                    if (!RoomFactory.TryGetData(Group.RoomId, out Data))
                    {
                        continue;
                    }

                    if (!MyGroups.Contains(Data))
                    {
                        MyGroups.Add(Data);
                    }
                }

                MyGroups = MyGroups.Take(limit).ToList();

                packet.WriteInteger(MyGroups.Count);
                foreach (RoomData Data in MyGroups.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                MyGroups = null;

                break;
            }

            case NavigatorCategoryType.MyFriendsRooms:
            {
                List <int> RoomIds = new List <int>();

                if (habbo == null || habbo.GetMessenger() == null || habbo.GetMessenger().GetFriends() == null)
                {
                    return;
                }

                foreach (MessengerBuddy buddy in habbo.GetMessenger().GetFriends().Where(p => p.InRoom))
                {
                    if (buddy == null || !buddy.InRoom || buddy.UserId == habbo.Id)
                    {
                        continue;
                    }

                    if (!RoomIds.Contains(buddy.CurrentRoom.Id))
                    {
                        RoomIds.Add(buddy.CurrentRoom.Id);
                    }
                }

                List <Room> MyFriendsRooms = PlusEnvironment.GetGame().GetRoomManager().GetRoomsByIds(RoomIds.ToList());

                packet.WriteInteger(MyFriendsRooms.Count);
                foreach (RoomData Data in MyFriendsRooms.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                MyFriendsRooms = null;
                break;
            }

            case NavigatorCategoryType.MyRights:
            {
                List <RoomData> MyRights = new List <RoomData>();

                if (habbo != null)
                {
                    DataTable GetRights = null;
                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("SELECT `room_id` FROM `room_rights` WHERE `user_id` = @UserId LIMIT @FetchLimit");
                        dbClient.AddParameter("UserId", habbo.Id);
                        dbClient.AddParameter("FetchLimit", limit);
                        GetRights = dbClient.GetTable();

                        foreach (DataRow Row in GetRights.Rows)
                        {
                            RoomData Data = null;
                            if (!RoomFactory.TryGetData(Convert.ToInt32(Row["room_id"]), out Data))
                            {
                                continue;
                            }

                            if (!MyRights.Contains(Data))
                            {
                                MyRights.Add(Data);
                            }
                        }
                    }
                }

                packet.WriteInteger(MyRights.Count);
                foreach (RoomData Data in MyRights.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                MyRights = null;
                break;
            }

            case NavigatorCategoryType.TopPromotions:
            {
                List <Room> GetPopularPromotions = PlusEnvironment.GetGame().GetRoomManager().GetOnGoingRoomPromotions(16, limit);

                packet.WriteInteger(GetPopularPromotions.Count);
                foreach (RoomData Data in GetPopularPromotions.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                GetPopularPromotions = null;

                break;
            }


            case NavigatorCategoryType.PromotionCategory:
            {
                List <Room> GetPromotedRooms = PlusEnvironment.GetGame().GetRoomManager().GetPromotedRooms(result.OrderId, limit);

                packet.WriteInteger(GetPromotedRooms.Count);
                foreach (RoomData Data in GetPromotedRooms.ToList())
                {
                    RoomAppender.WriteRoom(packet, Data, Data.Promotion);
                }

                GetPromotedRooms = null;

                break;
            }
            }
        }
示例#33
0
    private void CheckRoom(RoomData.WallDir direction)   // controleert als we wel die richting op kunnen
    {
        switch (direction)
        {
        case RoomData.WallDir.North:
            if (!_generator.Grid[_currentX, _currentY + 1].Visited)
            {
                ChangeColor(_curChecking, Color.magenta);
                Destroy(_curChecking.GetWall(direction));
                _curChecking.RemoveWall(direction);
                _generator.Grid[_currentX, _currentY + 1].RemoveWall(RoomData.WallDir.South);
                _path.Add(_generator.Grid[_currentX, _currentY + 1]);
                _curChecking = _generator.Grid[_currentX, _currentY + 1];
                ChangeColor(_curChecking, Color.yellow);
                _curChecking.Visited = true;
                _distance++;
                _curChecking.Distance = _distance;
            }
            else
            {
                _curChecking.RemoveWall(direction);
            }
            break;

        case RoomData.WallDir.East:
            if (!_generator.Grid[_currentX + 1, _currentY].Visited)
            {
                ChangeColor(_curChecking, Color.magenta);
                Destroy(_curChecking.GetWall(direction));
                _curChecking.RemoveWall(direction);
                _generator.Grid[_currentX + 1, _currentY].RemoveWall(RoomData.WallDir.West);
                _path.Add(_generator.Grid[_currentX + 1, _currentY]);
                _curChecking = _generator.Grid[_currentX + 1, _currentY];
                ChangeColor(_curChecking, Color.yellow);
                _curChecking.Visited = true;
                _distance++;
                _curChecking.Distance = _distance;
            }
            else
            {
                _curChecking.RemoveWall(direction);
            }
            break;

        case RoomData.WallDir.South:
            if (!_generator.Grid[_currentX, _currentY - 1].Visited)
            {
                ChangeColor(_curChecking, Color.magenta);
                Destroy(_curChecking.GetWall(direction));
                _curChecking.RemoveWall(direction);
                _generator.Grid[_currentX, _currentY - 1].RemoveWall(RoomData.WallDir.North);
                _path.Add(_generator.Grid[_currentX, _currentY - 1]);
                _curChecking = _generator.Grid[_currentX, _currentY - 1];
                ChangeColor(_curChecking, Color.yellow);
                _curChecking.Visited = true;
                _distance++;
                _curChecking.Distance = _distance;
            }
            else
            {
                _curChecking.RemoveWall(direction);
            }
            break;

        case RoomData.WallDir.West:
            if (!_generator.Grid[_currentX - 1, _currentY].Visited)
            {
                ChangeColor(_curChecking, Color.magenta);
                Destroy(_curChecking.GetWall(direction));
                _curChecking.RemoveWall(direction);
                _generator.Grid[_currentX - 1, _currentY].RemoveWall(RoomData.WallDir.East);
                _path.Add(_generator.Grid[_currentX - 1, _currentY]);
                _curChecking = _generator.Grid[_currentX - 1, _currentY];
                ChangeColor(_curChecking, Color.yellow);
                _curChecking.Visited = true;
                _distance++;
                _curChecking.Distance = _distance;
            }
            else
            {
                _curChecking.RemoveWall(direction);
            }
            break;
        }
    }
示例#34
0
 public static void RecreateRooms()
 {
     {
         Rooms.Clear();
         var r = new RoomData("RoomTile");
         r.Name = "Entrance";
         Rooms.Add(r);
     }
     {
         var r = new RoomData("GirlsRoom");
         r.Name = "Girls Room";
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
     }
     {
         var r = new RoomData("Bedroom");
         r.Name = "Bedroom";
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
     }
     {
         var r = new RoomData("LivingRoom");
         r.Name = "Living Room";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
     {
         var r = new RoomData("Study");
         r.Name = "Study";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
     {
         var r = new RoomData("MusicRoom");
         r.Name = "Music Room";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
     {
         var r = new RoomData("FurnaceRoom");
         r.Name = "Furnace Room";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
     {
         var r = new RoomData("Bathroom");
         r.Name = "Bathroom";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
     {
         var r = new RoomData("Kitchen");
         r.Name = "Kitchen";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
     {
         var r = new RoomData("Hallway");
         r.Name = "Hallway";
         //r.OnExplored += (p, rm) => { EventList.FindEventForRoom(r).Trigger(p, rm); };
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
         Rooms.Add(r);
     }
 }
示例#35
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().Credits < QuasarStaticGameSettings.GroupPurchaseAmount)
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! De groep kost " + QuasarStaticGameSettings.GroupPurchaseAmount + " credits! Jij hebt helaas maar " + Session.GetHabbo().Credits + " credits!"));
                return;
            }
            else
            {
                Session.GetHabbo().Credits -= QuasarStaticGameSettings.GroupPurchaseAmount;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }
            string word;
            string Name = Packet.PopString();

            Name = QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name;
            string Description = Packet.PopString();

            Description = QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description;
            int RoomId    = Packet.PopInt();
            int Colour1   = Packet.PopInt();
            int Colour2   = Packet.PopInt();
            int groupID3  = Packet.PopInt();
            int groupID4  = Packet.PopInt();
            int groupID5  = Packet.PopInt();
            int groupID6  = Packet.PopInt();
            int groupID7  = Packet.PopInt();
            int groupID8  = Packet.PopInt();
            int groupID9  = Packet.PopInt();
            int groupID10 = Packet.PopInt();
            int groupID11 = Packet.PopInt();
            int groupID12 = Packet.PopInt();
            int groupID13 = Packet.PopInt();
            int groupID14 = Packet.PopInt();
            int groupID15 = Packet.PopInt();
            int groupID16 = Packet.PopInt();
            int groupID17 = Packet.PopInt();
            int groupID18 = Packet.PopInt();

            RoomData Room = QuasarEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Room == null || Room.OwnerId != Session.GetHabbo().Id || Room.Group != null)
            {
                return;
            }

            string Base    = "b" + ((groupID4 < 10) ? "0" + groupID4.ToString() : groupID4.ToString()) + ((groupID5 < 10) ? "0" + groupID5.ToString() : groupID5.ToString()) + groupID6;
            string Symbol1 = "s" + ((groupID7 < 10) ? "0" + groupID7.ToString() : groupID7.ToString()) + ((groupID8 < 10) ? "0" + groupID8.ToString() : groupID8.ToString()) + groupID9;
            string Symbol2 = "s" + ((groupID10 < 10) ? "0" + groupID10.ToString() : groupID10.ToString()) + ((groupID11 < 10) ? "0" + groupID11.ToString() : groupID11.ToString()) + groupID12;
            string Symbol3 = "s" + ((groupID13 < 10) ? "0" + groupID13.ToString() : groupID13.ToString()) + ((groupID14 < 10) ? "0" + groupID14.ToString() : groupID14.ToString()) + groupID15;
            string Symbol4 = "s" + ((groupID16 < 10) ? "0" + groupID16.ToString() : groupID16.ToString()) + ((groupID17 < 10) ? "0" + groupID17.ToString() : groupID17.ToString()) + groupID18;

            Symbol1 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol1);
            Symbol2 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol2);
            Symbol3 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol3);
            Symbol4 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol4);

            string Badge = Base + Symbol1 + Symbol2 + Symbol3 + Symbol4;

            Group Group = null;

            if (!QuasarEnvironment.GetGame().GetGroupManager().TryCreateGroup(Session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group))
            {
                Session.SendNotification("Oeps! Je groep kon niet worden aangemaakt. Meld dit even bij een medewerker.");
                return;
            }

            Session.SendMessage(new PurchaseOKComposer());

            Room.Group = Group;

            if (Session.GetHabbo().CurrentRoomId != Room.Id)
            {
                Session.SendMessage(new RoomForwardComposer(Room.Id));
            }

            Session.SendMessage(new NewGroupInfoComposer(RoomId, Group.Id));
            QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ExploreMakeGroup", 1);
        }
示例#36
0
        public Task SetRoomReservationData(RoomData roomData)
        {
            requestedData = roomData;

            return(Task.CompletedTask);
        }
示例#37
0
 public SosProxy()
 {
     room = new RoomData();
 }
示例#38
0
        public void RoomData_Users_Uses_Empty_List_If_One_Is_Omitted(string roomName)
        {
            var data = new RoomData(roomName, null, false, null, null);

            Assert.NotNull(data.Users);
        }
示例#39
0
        public static void ApplyRoomData(PrototypeDungeonRoom room, RoomData roomData)
        {
            if (roomData.exitPositions != null)
            {
                for (int i = 0; i < roomData.exitPositions.Length; i++)
                {
                    DungeonData.Direction dir = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper());
                    AddExit(room, roomData.exitPositions[i], dir);
                }
            }
            else
            {
                AddExit(room, new Vector2(room.Width / 2, room.Height), DungeonData.Direction.NORTH);
                AddExit(room, new Vector2(room.Width / 2, 0), DungeonData.Direction.SOUTH);
                AddExit(room, new Vector2(room.Width, room.Height / 2), DungeonData.Direction.EAST);
                AddExit(room, new Vector2(0, room.Height / 2), DungeonData.Direction.WEST);
            }

            if (roomData.enemyPositions != null)
            {
                for (int i = 0; i < roomData.enemyPositions.Length; i++)
                {
                    AddEnemyToRoom(room, roomData.enemyPositions[i], roomData.enemyGUIDs[i], roomData.enemyReinforcementLayers[i], roomData.randomizeEnemyPositions);
                }
            }

            if (roomData.placeablePositions != null)
            {
                for (int i = 0; i < roomData.placeablePositions.Length; i++)
                {
                    AddPlaceableToRoom(room, roomData.placeablePositions[i], roomData.placeableGUIDs[i]);
                }
            }

            if (roomData.floors != null)
            {
                foreach (var floor in roomData.floors)
                {
                    room.prerequisites.Add(new DungeonPrerequisite()
                    {
                        prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET,
                        requiredTileset  = ShrineTools.GetEnumValue <GlobalDungeonData.ValidTilesets>(floor)
                    });
                }
            }
            //Set categories
            if (!string.IsNullOrEmpty(roomData.category))
            {
                room.category = ShrineTools.GetEnumValue <PrototypeDungeonRoom.RoomCategory>(roomData.category);
            }
            if (!string.IsNullOrEmpty(roomData.normalSubCategory))
            {
                room.subCategoryNormal = ShrineTools.GetEnumValue <PrototypeDungeonRoom.RoomNormalSubCategory>(roomData.normalSubCategory);
            }
            //========================
            if (!string.IsNullOrEmpty(roomData.bossSubCategory))
            {
                room.subCategoryBoss = ShrineTools.GetEnumValue <PrototypeDungeonRoom.RoomBossSubCategory>(roomData.bossSubCategory);
            }
            //========================
            if (!string.IsNullOrEmpty(roomData.specialSubCategory))
            {
                room.subCategorySpecial = ShrineTools.GetEnumValue <PrototypeDungeonRoom.RoomSpecialSubCategory>(roomData.specialSubCategory);
            }
            room.usesProceduralDecoration = true;
            room.allowFloorDecoration     = roomData.doFloorDecoration;
            room.allowWallDecoration      = roomData.doWallDecoration;
            room.usesProceduralLighting   = roomData.doLighting;
        }
示例#40
0
    public string getOneAI()
    {
        lock (m_dataList)
        {
            string uid         = "";
            int    restAICount = 0;

            {
                for (int i = 0; i < m_dataList.Count; i++)
                {
                    if (!m_dataList[i].m_isUsed)
                    {
                        ++restAICount;
                    }
                }

                if (restAICount == 0)
                {
                    return(uid);
                }
            }

            if (restAICount >= (m_dataList.Count / 2))
            {
                while (true)
                {
                    int r = RandomUtil.getRandom(0, m_dataList.Count - 1);
                    if (!m_dataList[r].m_isUsed)
                    {
                        uid = m_dataList[r].m_uid;

                        RoomData room = GameUtil.getRoomByUid(uid);
                        if (room == null)
                        {
                            m_dataList[r].m_isUsed = true;

                            {
                                int num = 0;
                                for (int i = 0; i < m_dataList.Count; i++)
                                {
                                    if (!m_dataList[i].m_isUsed)
                                    {
                                        ++num;
                                    }
                                }
                                TLJ_PlayService.PlayService.log.Error("AIDataScript.getOneAI()----借出去机器人:" + uid + "    剩余机器人:" + num);
                            }

                            return(uid);
                        }
                        else
                        {
                            TLJ_PlayService.PlayService.log.Error("AIDataScript.getOneAI()----该机器人没有被使用,却在房间中:" + room.getRoomId() + "   " + uid);
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < m_dataList.Count; i++)
                {
                    if (!m_dataList[i].m_isUsed)
                    {
                        uid = m_dataList[i].m_uid;

                        RoomData room = GameUtil.getRoomByUid(uid);
                        if (room == null)
                        {
                            m_dataList[i].m_isUsed = true;

                            {
                                int num = 0;
                                for (int j = 0; j < m_dataList.Count; j++)
                                {
                                    if (!m_dataList[j].m_isUsed)
                                    {
                                        ++num;
                                    }
                                }
                                TLJ_PlayService.PlayService.log.Error("AIDataScript.getOneAI()----借出去机器人:" + uid + "    剩余机器人:" + num);
                            }

                            return(uid);
                        }
                        else
                        {
                            TLJ_PlayService.PlayService.log.Error("AIDataScript.getOneAI()----该机器人没有被使用,却在房间中:" + room.getRoomId() + "   " + uid);
                        }
                    }
                }
            }

            return(uid);
        }
    }
示例#41
0
    private IEnumerator MoveMinerWilly(Mob minerWilly, RoomData data)
    {
        //throw new NotImplementedException();
        //yield return null;

        //float speed = 0.25f;
        //float speed = 0.125f;
        float speed = 0.1f;

        while (state == GameState.Playing)
        {
            // walls
            int attrRight = data.Attributes[minerWilly.Y * 32 + (minerWilly.X + 1)];
            int attrLeft  = data.Attributes[minerWilly.Y * 32 + (minerWilly.X - 1)];

            bool wallRight = data.Blocks[attrRight].Type == BlockType.Wall;
            bool wallLeft  = data.Blocks[attrLeft].Type == BlockType.Wall;
            // /walls

            bool move = false;

            if (Input.GetKey(KeyCode.W))
            {
                if (minerWilly.Frame > 3)
                {
                    minerWilly.Frame -= 4;
                }

                //if (!wallRight || (wallRight && minerWilly.Frame != 4))
                if (!wallRight)
                {
                    minerWilly.Frame += 1;
                }

                if (minerWilly.Frame > 3)
                {
                    minerWilly.Frame = 0;
                    if (!wallRight)
                    {
                        minerWilly.X++;
                    }
                }

                move = true;
            }
            else if (Input.GetKey(KeyCode.Q))
            {
                if (minerWilly.Frame < 4)
                {
                    minerWilly.Frame += 4;
                }

                if (!wallLeft || (wallLeft && minerWilly.Frame != 4))
                {
                    minerWilly.Frame -= 1;
                }

                if (minerWilly.Frame < 4)
                {
                    minerWilly.Frame = 7;
                    if (!wallLeft)
                    {
                        minerWilly.X--;
                    }
                }

                move = true;
            }

            if (move)
            {
                yield return(new WaitForSeconds(speed));
            }
            else
            {
                yield return(null);
            }

            //yield return null;
        }
    }
示例#42
0
        /// <summary>
        ///     Serializes the search result list statics.
        /// </summary>
        /// <param name="staticId">The static identifier.</param>
        /// <param name="direct">if set to <c>true</c> [direct].</param>
        /// <param name="message">The message.</param>
        /// <param name="session">The session.</param>
        /// <param name="opened"></param>
        /// <param name="showImage"></param>
        internal static void SerializeSearchResultListStatics(string staticId, bool direct, ServerMessage message, GameClient session, bool opened = false, bool showImage = false)
        {
            if (string.IsNullOrEmpty(staticId) || staticId == "official")
            {
                staticId = "official_view";
            }

            if (staticId != "hotel_view" && staticId != "roomads_view" && staticId != "myworld_view" && !staticId.StartsWith("category__") && staticId != "official_view")
            {
                message.AppendString(staticId);
                message.AppendString(string.Empty);
                message.AppendInteger(1);
                message.AppendBool(!opened); // staticId != "my" && staticId != "popular" && staticId != "official-root"
                message.AppendInteger(showImage ? 1 : 0);
            }

            KeyValuePair <RoomData, uint>[] rooms;

            switch (staticId)
            {
            case "hotel_view":
            {
                NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);

                foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
                {
                    SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
                }

                foreach (PublicCategory flat in Yupi.GetGame().GetNavigator().PrivateCategories.Values)
                {
                    SerializeSearchResultListFlatcats(flat.Id, false, message);
                }

                break;
            }

            case "official_view":
            {
                NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);

                foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
                {
                    SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
                }
            }
            break;

            case "myworld_view":
            {
                NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);

                foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
                {
                    SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
                }
            }
            break;

            case "roomads_view":
            {
                foreach (PublicCategory flat in Yupi.GetGame().GetNavigator().PrivateCategories.Values)
                {
                    SerializePromotionsResultListFlatcats(flat.Id, false, message);
                }

                NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);

                foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
                {
                    SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
                }

                break;
            }

            case "official-root":
            {
                message.AppendServerMessage(Yupi.GetGame().GetNavigator().NewPublicRooms);

                break;
            }

            case "staffpicks":
            {
                message.AppendServerMessage(Yupi.GetGame().GetNavigator().NewStaffPicks);

                break;
            }

            case "my":
            {
                int i = 0;

                message.StartArray();

                foreach (RoomData data in session.GetHabbo().UsersRooms)
                {
                    if (data != null)
                    {
                        data.Serialize(message);

                        message.SaveArray();

                        if (i++ == (direct ? 100 : 8))
                        {
                            break;
                        }
                    }
                }

                message.EndArray();

                break;
            }

            case "favorites":
            {
                if (session.GetHabbo().FavoriteRooms == null)
                {
                    message.AppendInteger(0);

                    return;
                }

                int i = 0;

                message.AppendInteger(session.GetHabbo().FavoriteRooms.Count > (direct ? 40 : 8)
                            ? (direct ? 40 : 8)
                            : session.GetHabbo().FavoriteRooms.Count);

                foreach (
                    RoomData data in
                    session.GetHabbo()
                    .FavoriteRooms.Select(dataId => Yupi.GetGame().GetRoomManager().GenerateRoomData(dataId))
                    .Where(data => data != null))
                {
                    data.Serialize(message);

                    i++;

                    if (i == (direct ? 40 : 8))
                    {
                        break;
                    }
                }

                break;
            }

            case "friends_rooms":
            {
                int i = 0;

                if (session?.GetHabbo() == null || session.GetHabbo().GetMessenger() == null ||
                    session.GetHabbo().GetMessenger().GetActiveFriendsRooms() == null)
                {
                    message.AppendInteger(0);

                    return;
                }

                List <RoomData> roomsFriends =
                    session.GetHabbo()
                    .GetMessenger()
                    .GetActiveFriendsRooms()
                    .OrderByDescending(p => p.UsersNow)
                    .Take(direct ? 40 : 8)
                    .ToList();

                message.AppendInteger(roomsFriends.Count);

                foreach (RoomData data in roomsFriends.Where(data => data != null))
                {
                    data.Serialize(message);

                    i++;

                    if (i == (direct ? 40 : 8))
                    {
                        break;
                    }
                }

                break;
            }

            case "recommended":
            {
                break;
            }

            case "popular":
            {
                rooms = Yupi.GetGame().GetRoomManager().GetActiveRooms();

                if (rooms == null)
                {
                    message.AppendInteger(0);

                    break;
                }

                message.AppendInteger(rooms.Length);

                foreach (KeyValuePair <RoomData, uint> room in rooms)
                {
                    room.Key.Serialize(message);
                }

                break;
            }

            case "top_promotions":
            {
                rooms = Yupi.GetGame().GetRoomManager().GetEventRooms();

                message.AppendInteger(rooms.Length);

                foreach (KeyValuePair <RoomData, uint> room in rooms)
                {
                    room.Key.Serialize(message);
                }

                break;
            }

            case "my_groups":
            {
                int i = 0;

                message.StartArray();

                foreach (uint xGroupId in session.GetHabbo().MyGroups)
                {
                    Group xGroup = Yupi.GetGame().GetGroupManager().GetGroup(xGroupId);

                    if (xGroup != null)
                    {
                        RoomData data = Yupi.GetGame().GetRoomManager().GenerateRoomData(xGroup.RoomId);

                        if (data != null)
                        {
                            data.Serialize(message);
                            message.SaveArray();

                            if (i++ == (direct ? 40 : 8))
                            {
                                break;
                            }
                        }
                    }
                }

                message.EndArray();

                break;
            }

            case "history":
            {
                int i = 0;

                message.StartArray();

                foreach (
                    RoomData roomData in
                    session.GetHabbo()
                    .RecentlyVisitedRooms.Select(
                        roomId => Yupi.GetGame().GetRoomManager().GenerateRoomData(roomId))
                    .Where(roomData => roomData != null))
                {
                    roomData.Serialize(message);
                    message.SaveArray();

                    if (i++ == (direct ? 40 : 8))
                    {
                        break;
                    }
                }

                message.EndArray();

                break;
            }

            default:
            {
                if (staticId.StartsWith("category__"))
                {
                    SerializeSearchResultListFlatcats(
                        Yupi.GetGame()
                        .GetNavigator()
                        .GetFlatCatIdByName(staticId.Replace("category__", string.Empty)), true, message);
                }
                else
                {
                    message.AppendInteger(0);
                }

                break;
            }
            }
        }
示例#43
0
 public void Setup(RoomData staticData)
 {
     StaticData = staticData;
 }
示例#44
0
 internal void JoinRoom(RoomData roomData)
 {
     ColyseusRoom.Instance.JoinRoom(roomData);
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
 }
示例#45
0
        public ChatlogEntry(int PlayerId, int RoomId, string Message, double Timestamp, Habbo Player = null, RoomData Instance = null)
        {
            this.PlayerId  = PlayerId;
            this.RoomId    = RoomId;
            this.Message   = Message;
            this.Timestamp = Timestamp;

            if (Player != null)
            {
                _playerReference = new WeakReference(Player);
            }

            if (Instance != null)
            {
                _roomReference = new WeakReference(Instance);
            }
        }
        public GetGuestRoomResultComposer(Player session, RoomData data, bool isLoading, bool checkEntry)
            : base(ServerPacketHeader.GetGuestRoomResultMessageComposer)
        {
            WriteBoolean(isLoading);
            WriteInteger(data.Id);
            WriteString(data.Name);
            WriteInteger(data.OwnerId);
            WriteString(data.OwnerName);
            WriteInteger(RoomAccessUtility.GetRoomAccessPacketNum(data.Access));
            WriteInteger(data.UsersNow);
            WriteInteger(data.UsersMax);
            WriteString(data.Description);
            WriteInteger(data.TradeSettings);
            WriteInteger(data.Score);
            WriteInteger(0);//Top rated room rank.
            WriteInteger(data.Category);

            WriteInteger(data.Tags.Count);
            foreach (var tag in data.Tags)
            {
                WriteString(tag);
            }

            if (data.Group != null && data.Promotion != null)
            {
                WriteInteger(62);

                WriteInteger(data.Group == null ? 0 : data.Group.Id);
                WriteString(data.Group == null ? "" : data.Group.Name);
                WriteString(data.Group == null ? "" : data.Group.Badge);

                WriteString(data.Promotion != null ? data.Promotion.Name : "");
                WriteString(data.Promotion != null ? data.Promotion.Description : "");
                WriteInteger(data.Promotion != null ? data.Promotion.MinutesLeft : 0);
            }
            else if (data.Group != null && data.Promotion == null)
            {
                WriteInteger(58);
                WriteInteger(data.Group == null ? 0 : data.Group.Id);
                WriteString(data.Group == null ? "" : data.Group.Name);
                WriteString(data.Group == null ? "" : data.Group.Badge);
            }
            else if (data.Group == null && data.Promotion != null)
            {
                WriteInteger(60);
                WriteString(data.Promotion != null ? data.Promotion.Name : "");
                WriteString(data.Promotion != null ? data.Promotion.Description : "");
                WriteInteger(data.Promotion != null ? data.Promotion.MinutesLeft : 0);
            }
            else
            {
                WriteInteger(56);
            }


            WriteBoolean(checkEntry);
            WriteBoolean(false);
            WriteBoolean(false);
            WriteBoolean(false);

            WriteInteger(data.WhoCanMute);
            WriteInteger(data.WhoCanKick);
            WriteInteger(data.WhoCanBan);

            WriteBoolean(session.GetHabbo().GetPermissions().HasRight("mod_tool") || data.OwnerName == session.GetHabbo().Username);
            WriteInteger(data.ChatMode);
            WriteInteger(data.ChatSize);
            WriteInteger(data.ChatSpeed);
            WriteInteger(data.ExtraFlood);
            WriteInteger(data.ChatDistance);
        }
 public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary<String, System.Object> properties)
 {
     Log("Notification for User Changed Room Property received");
     Log(roomData.getId());
     Log(sender);
     foreach (KeyValuePair<String, System.Object> entry in properties)
     {
         Log("KEY:" + entry.Key);
         Log("VALUE:" + entry.Value.ToString());
     }
 }
示例#48
0
 public ServerMessage SerializeUserChatlog(uint UserId)
 {
     using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
     {
         DataTable     dataTable = adapter.ReadDataTable("SELECT room_id,entry_timestamp,exit_timestamp FROM user_roomvisits WHERE user_id = '" + UserId + "' ORDER BY entry_timestamp DESC LIMIT 5");
         ServerMessage Message   = new ServerMessage(536u);
         Message.AppendUInt(UserId);
         Message.AppendStringWithBreak(PhoenixEnvironment.GetGame().GetClientManager().GetNameById(UserId));
         if (dataTable != null)
         {
             Message.AppendInt32(dataTable.Rows.Count);
             IEnumerator enumerator = dataTable.Rows.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     DataRow   dataRow = (DataRow)enumerator.Current;
                     DataTable dataTable2;
                     if ((double)dataRow["exit_timestamp"] <= 0.0)
                     {
                         dataTable2 = adapter.ReadDataTable(string.Concat(new object[]
                         {
                             "SELECT user_id,user_name,hour,minute,message FROM chatlogs WHERE room_id = '",
                             (uint)dataRow["room_id"],
                             "' AND timestamp > ",
                             (double)dataRow["entry_timestamp"],
                             " AND timestamp < UNIX_TIMESTAMP() ORDER BY timestamp DESC LIMIT 100"
                         }));
                     }
                     else
                     {
                         dataTable2 = adapter.ReadDataTable(string.Concat(new object[]
                         {
                             "SELECT user_id,user_name,hour,minute,message FROM chatlogs WHERE room_id = '",
                             (uint)dataRow["room_id"],
                             "' AND timestamp > ",
                             (double)dataRow["entry_timestamp"],
                             " AND timestamp < ",
                             (double)dataRow["exit_timestamp"],
                             " ORDER BY timestamp DESC LIMIT 100"
                         }));
                     }
                     RoomData class2 = PhoenixEnvironment.GetGame().GetRoomManager().GenerateNullableRoomData((uint)dataRow["room_id"]);
                     Message.AppendBoolean(class2.IsPublicRoom);
                     Message.AppendUInt(class2.Id);
                     Message.AppendStringWithBreak(class2.Name);
                     if (dataTable2 != null)
                     {
                         Message.AppendInt32(dataTable2.Rows.Count);
                         IEnumerator enumerator2 = dataTable2.Rows.GetEnumerator();
                         try
                         {
                             while (enumerator2.MoveNext())
                             {
                                 DataRow dataRow2 = (DataRow)enumerator2.Current;
                                 Message.AppendInt32((int)dataRow2["hour"]);
                                 Message.AppendInt32((int)dataRow2["minute"]);
                                 Message.AppendUInt((uint)dataRow2["user_id"]);
                                 Message.AppendStringWithBreak((string)dataRow2["user_name"]);
                                 Message.AppendStringWithBreak((string)dataRow2["message"]);
                             }
                             continue;
                         }
                         finally
                         {
                             IDisposable disposable = enumerator2 as IDisposable;
                             if (disposable != null)
                             {
                                 disposable.Dispose();
                             }
                         }
                     }
                     Message.AppendInt32(0);
                 }
             }
             finally
             {
                 IDisposable disposable = enumerator as IDisposable;
                 if (disposable != null)
                 {
                     disposable.Dispose();
                 }
             }
         }
         Message.AppendInt32(0);
         return(Message);
     }
 }
 public void onUserLeftRoom(RoomData eventObj, string username)
 {
     Log ("onUserLeftRoom : " + username);
     m_apppwarp.onUserLeft(username);
 }
示例#50
0
        public void Handle(GameClient session, ClientMessage message)
        {
            int request = message.PopWiredInt32();

            DataTable friendStream = null;

            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
            {
                friendStream = dbClient.ReadDataTable("SELECT * FROM user_friend_stream ORDER BY timestamp DESC LIMIT 15"); //check if the user is my friend xo xo
            }

            ServerMessage message_ = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);

            message_.Init(r63aOutgoing.FriendStream);
            message_.AppendInt32(friendStream.Rows.Count); //count

            foreach (DataRow dataRow in friendStream.Rows)
            {
                int      type      = (int)dataRow["type"];
                uint     userId    = (uint)dataRow["user_id"];
                string[] extraData = ((string)dataRow["extra_data"]).Split((char)9);

                message_.AppendInt32((int)dataRow["id"]);
                message_.AppendInt32(type);
                message_.AppendString(userId.ToString());
                if (type != 2) //0 = friend made, 1 = room liked, 3 = motto changed, 4 = room decorated
                {
                    string username = "******";
                    string gender   = "m";
                    string look     = "";

                    GameClient target = Skylight.GetGame().GetGameClientManager().GetGameClientById(userId);
                    if (target != null)
                    {
                        username = target.GetHabbo().Username;
                        gender   = target.GetHabbo().Gender;
                        look     = target.GetHabbo().Look;
                    }
                    else
                    {
                        DataRow userData = null;
                        using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                        {
                            dbClient.AddParamWithValue("userId", userId);
                            userData = dbClient.ReadDataRow("SELECT username, gender, look FROM users WHERE id = @userId LIMIT 1");
                        }

                        if (userData != null)
                        {
                            username = (string)userData["username"];
                            gender   = (string)userData["gender"];
                            look     = (string)userData["look"];
                        }
                    }

                    message_.AppendString(username);                                                      //user name
                    message_.AppendString(gender.ToLower());                                              //gender
                    message_.AppendString("http://localhost:7977/habbo-imaging/head.gif?figure=" + look); //user head
                }
                else //2 = achievement earned
                {
                    message_.AppendString(Skylight.GetGame().GetGameClientManager().GetUsernameByID(userId));        //user name
                    message_.AppendString("");                                                                       //gender
                    message_.AppendString("http://25.76.128.47/habway/c_images/album1584/" + extraData[0] + ".gif"); //image
                }

                message_.AppendInt32((int)Math.Ceiling((TimeUtilies.GetUnixTimestamp() - (double)dataRow["timestamp"]) / 60.0)); //time as minutes
                if (type != 0)                                                                                                   //1 = room liked, 2 = achievement earned, 3 = motto changed, 4 = room decorated
                {
                    if (type == 4)
                    {
                        message_.AppendInt32(2); //link action
                    }
                    else
                    {
                        message_.AppendInt32(1 + type); //link action
                    }
                }
                else //0 = friend made
                {
                    if (session.GetHabbo().GetMessenger().IsFriendWith(uint.Parse(extraData[0])))
                    {
                        message_.AppendInt32(1); //link action
                    }
                    else
                    {
                        message_.AppendInt32(5); //link action
                    }
                }
                message_.AppendInt32(0);                                                                                        //likes
                message_.AppendBoolean(false);                                                                                  //can like?

                if (type == 0)                                                                                                  //friend made
                {
                    message_.AppendString(extraData[0]);                                                                        //friend id
                    message_.AppendString(Skylight.GetGame().GetGameClientManager().GetUsernameByID(uint.Parse(extraData[0]))); //friend name
                }
                else if (type == 1)                                                                                             //room liked
                {
                    RoomData roomData = Skylight.GetGame().GetRoomManager().TryGetRoomData(uint.Parse(extraData[0]));
                    if (roomData != null)
                    {
                        message_.AppendString(roomData.ID.ToString()); //room id
                        message_.AppendString(roomData.Name);          //room name
                    }
                    else
                    {
                        message_.AppendString(extraData[0]);     //room id
                        message_.AppendString("Room not found"); //room name
                    }
                }
                else if (type == 2)                      //achievement earned
                {
                    message_.AppendString(extraData[0]); //badge code
                }
                else if (type == 3)                      //motto changed
                {
                    message_.AppendString(extraData[0]); //new motto
                }
                else if (type == 4)                      //room decorated
                {
                    RoomData roomData = Skylight.GetGame().GetRoomManager().TryGetRoomData(uint.Parse(extraData[0]));
                    if (roomData != null)
                    {
                        message_.AppendString(roomData.ID.ToString()); //room id
                        message_.AppendString(roomData.Name);          //room name
                    }
                    else
                    {
                        message_.AppendString(extraData[0]);     //room id
                        message_.AppendString("Room not found"); //room name
                    }
                }
            }

            session.SendMessage(message_);
        }
示例#51
0
		public void onUserJoinedRoom(RoomData eventObj, string username){}
 public void SetMapCreator(MapCreator mapCreator, RoomData roomAsset)
 {
     _map       = mapCreator;
     _roomAsset = roomAsset;
 }
示例#53
0
 public void onRoomDestroyed(RoomData eventObj)
 {
 }
示例#54
0
        /// <summary>
        ///     Serializes the user chatlog.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage SerializeUserChatlog(uint userId)
        {
            ServerMessage result;

            using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                commitableQueryReactor.SetQuery($"SELECT DISTINCT room_id FROM users_chatlogs WHERE user_id = '{userId}' ORDER BY timestamp DESC LIMIT 4");

                DataTable table = commitableQueryReactor.GetTable();

                ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolUserChatlogMessageComposer"));
                serverMessage.AppendInteger(userId);
                serverMessage.AppendString(Yupi.GetGame().GetClientManager().GetNameById(userId));

                if (table != null)
                {
                    serverMessage.AppendInteger(table.Rows.Count);
                    IEnumerator enumerator = table.Rows.GetEnumerator();

                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow dataRow = (DataRow)enumerator.Current;

                            commitableQueryReactor.SetQuery($"SELECT user_id,timestamp,message FROM users_chatlogs WHERE room_id = {dataRow["room_id"]} AND user_id = {userId} ORDER BY timestamp DESC LIMIT 30");

                            DataTable table2   = commitableQueryReactor.GetTable();
                            RoomData  roomData = Yupi.GetGame().GetRoomManager().GenerateRoomData((uint)dataRow["room_id"]);

                            if (table2 != null)
                            {
                                serverMessage.AppendByte(1);
                                serverMessage.AppendShort(2);
                                serverMessage.AppendString("roomName");
                                serverMessage.AppendByte(2);
                                serverMessage.AppendString(roomData == null ? "This room was deleted" : roomData.Name);
                                serverMessage.AppendString("roomId");
                                serverMessage.AppendByte(1);
                                serverMessage.AppendInteger((uint)dataRow["room_id"]);
                                serverMessage.AppendShort(table2.Rows.Count);
                                IEnumerator enumerator2 = table2.Rows.GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        DataRow dataRow2 = (DataRow)enumerator2.Current;

                                        Habbo habboForId = Yupi.GetHabboById((uint)dataRow2["user_id"]);
                                        Yupi.UnixToDateTime((double)dataRow2["timestamp"]);

                                        if (habboForId == null)
                                        {
                                            return(null);
                                        }

                                        serverMessage.AppendInteger(
                                            (int)(Yupi.GetUnixTimeStamp() - (double)dataRow2["timestamp"]));

                                        serverMessage.AppendInteger(habboForId.Id);
                                        serverMessage.AppendString(habboForId.UserName);
                                        serverMessage.AppendString(dataRow2["message"].ToString());
                                        serverMessage.AppendBool(false);
                                    }
                                    continue;
                                }
                                finally
                                {
                                    IDisposable disposable = enumerator2 as IDisposable;

                                    disposable?.Dispose();
                                }
                            }

                            serverMessage.AppendByte(1);
                            serverMessage.AppendShort(0);
                            serverMessage.AppendShort(0);
                        }

                        result = serverMessage;
                        return(result);
                    }
                    finally
                    {
                        IDisposable disposable2 = enumerator as IDisposable;

                        disposable2?.Dispose();
                    }
                }

                serverMessage.AppendInteger(0);
                result = serverMessage;
            }
            return(result);
        }
示例#55
0
 public void onUserJoinedRoom(RoomData eventObj, String username)
 {
     //_game_page.showResult(username + " joined " + eventObj.getId());
 }
示例#56
0
 public EscapeInteraction(RoomData data) : base(data)
 {
 }
 public RoomData method_11(uint uint_0)
 {
     RoomData result;
     if (this.method_12(uint_0) != null)
     {
         result = this.method_12(uint_0);
     }
     else
     {
         RoomData @class = new RoomData();
         @class.FillNull(uint_0);
         result = @class;
     }
     return result;
 }
    //HandleResult OnPointerDataReceive(IntPtr connId, IntPtr pData, int length)
    //{
    //    // 数据到达了
    //    try
    //    {
    //        if (m_tcpServer.Send(connId, pData, length))
    //        {
    //            return HandleResult.Ok;
    //        }

    //        return HandleResult.Error;
    //    }
    //    catch (Exception)
    //    {
    //        return HandleResult.Ignore;
    //    }
    //}

    HandleResult OnReceive(IntPtr connId, byte[] bytes)
    {
        try
        {
            string text = Encoding.UTF8.GetString(bytes, 0, bytes.Length);

            // 日志
            {
                PlayerData playerData = GameUtil.getPlayerDataByConnId(connId);
                if (playerData != null)
                {
                    RoomData room = GameUtil.getRoomByUid(playerData.m_uid);
                    if (room != null)
                    {
                        LogUtil.getInstance().writeRoomLog(room, "收到客户端原始消息:" + text);
                    }
                    else
                    {
                        LogUtil.getInstance().addDebugLog("收到客户端原始消息:" + text);
                    }
                }
                else
                {
                    LogUtil.getInstance().addDebugLog("收到客户端原始消息:" + text);
                }
            }

            {
                text = m_endStr + text;
                text = text.Replace("\r\n", "");

                List <string> list = new List <string>();
                bool          b    = CommonUtil.splitStrIsPerfect(text, list, m_packEndFlag);

                if (b)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        ReceiveObj obj = new ReceiveObj(connId, list[i]);
                        //Thread thread = new Thread(doAskCilentReq);
                        //thread.Start(obj);

                        Task t = new Task(() => { doAskCilentReq(obj); });
                        t.Start();
                    }

                    //text = "";
                    m_endStr = "";
                }
                else
                {
                    for (int i = 0; i < list.Count - 1; i++)
                    {
                        ReceiveObj obj = new ReceiveObj(connId, list[i]);
                        //Thread thread = new Thread(doAskCilentReq);
                        //thread.Start(obj);

                        Task t = new Task(() => { doAskCilentReq(obj); });
                        t.Start();
                    }

                    m_endStr = list[list.Count - 1];
                }
            }
        }
        catch (Exception ex)
        {
            TLJ_PlayService.PlayService.log.Error("OnReceive:" + ex.Message);
        }

        return(HandleResult.Ok);
    }
 public RoomData method_17(uint uint_0, DataRow dataRow_0)
 {
     RoomData result;
     if (this.hashtable_0.ContainsKey(uint_0))
     {
         result = (this.hashtable_0[uint_0] as RoomData);
     }
     else
     {
         RoomData @class = new RoomData();
         if (this.method_13(uint_0))
         {
             @class = this.GetRoom(uint_0).Class27_0;
         }
         else
         {
             @class.method_1(dataRow_0);
         }
         if (!this.hashtable_0.ContainsKey(uint_0))
         {
             this.hashtable_0.Add(uint_0, @class);
         }
         result = @class;
     }
     return result;
 }
    // 处理客户端的请求
    void doAskCilentReq(object obj)
    {
        ReceiveObj receiveObj = (ReceiveObj)obj;
        string     text       = receiveObj.m_data;

        // 日志
        {
            PlayerData playerData = GameUtil.getPlayerDataByConnId(receiveObj.m_connId);
            if (playerData != null)
            {
                RoomData room = GameUtil.getRoomByUid(playerData.m_uid);
                if (room != null)
                {
                    LogUtil.getInstance().writeRoomLog(room, "收到客户端消息:" + text);
                }
                else
                {
                    LogUtil.getInstance().addDebugLog("收到客户端消息:" + text);
                }
            }
            else
            {
                LogUtil.getInstance().addDebugLog("收到客户端消息:" + text);
            }
        }

        JObject jo;

        try
        {
            jo = JObject.Parse(text);
        }
        catch (JsonReaderException ex)
        {
            // 传过来的数据不是json格式的,一律不理
            // 日志
            {
                PlayerData playerData = GameUtil.getPlayerDataByConnId(receiveObj.m_connId);
                if (playerData != null)
                {
                    RoomData room = GameUtil.getRoomByUid(playerData.m_uid);
                    if (room != null)
                    {
                        LogUtil.getInstance().writeRoomLog(room, "客户端传来非json数据:" + text);
                    }
                    else
                    {
                        LogUtil.getInstance().addDebugLog("客户端传来非json数据:" + text);
                    }
                }
                else
                {
                    LogUtil.getInstance().addDebugLog("客户端传来非json数据:" + text);
                }
            }

            m_endStr = "";

            return;
        }

        if (jo.GetValue("tag") != null)
        {
            string tag = jo.GetValue("tag").ToString();

            // 休闲场相关
            if (tag.CompareTo(TLJCommon.Consts.Tag_XiuXianChang) == 0)
            {
                PlayLogic_Relax.getInstance().OnReceive(receiveObj.m_connId, text);
            }
            // 比赛场相关
            else if (tag.CompareTo(TLJCommon.Consts.Tag_JingJiChang) == 0)
            {
                PlayLogic_PVP.getInstance().OnReceive(receiveObj.m_connId, text);
            }
            // 获取pvp场次信息
            else if (tag.CompareTo(TLJCommon.Consts.Tag_GetPVPGameRoom) == 0)
            {
                NetRespond_GetPVPGameRoom.doAskCilentReq_GetPVPGameRoom(receiveObj.m_connId, text);
            }
            // 请求服务器在线玩家信息接口
            else if (tag.CompareTo(TLJCommon.Consts.Tag_OnlineInfo) == 0)
            {
                NetRespond_OnlineInfo.doAskCilentReq_OnlineInfo(receiveObj.m_connId, text);
            }
            // 使用buff
            else if (tag.CompareTo(TLJCommon.Consts.Tag_UseBuff) == 0)
            {
                NetRespond_UseBuff.doAskCilentReq_UseBuff(receiveObj.m_connId, text);
            }
            // 是否已经加入游戏
            else if (tag.CompareTo(TLJCommon.Consts.Tag_IsJoinGame) == 0)
            {
                NetRespond_IsJoinGame.doAskCilentReq_IsJoinGame(receiveObj.m_connId, text);
            }
            // 请求恢复房间
            else if (tag.CompareTo(TLJCommon.Consts.Tag_RetryJoinGame) == 0)
            {
                NetRespond_RetryJoinGame.doAskCilentReq_RetryJoinGame(receiveObj.m_connId, text);
            }
            // 自定义牌型
            else if (tag.CompareTo(TLJCommon.Consts.Tag_DebugSetPoker) == 0)
            {
                NetRespond_DebugSetPoker.doAskCilentReq_DebugSetPoker(receiveObj.m_connId, text);
            }
            // 心跳
            else if (tag.CompareTo(TLJCommon.Consts.Tag_HeartBeat_Play) == 0)
            {
                NetRespond_HeartBeat_Play.doAskCilentReq_HeartBeat_Play(receiveObj.m_connId, text);
            }
            // 解散房间
            else if (tag.CompareTo(TLJCommon.Consts.Tag_BreakRoom) == 0)
            {
                NetRespond_BreakRoom.doAskCilentReq_BreakRoom(receiveObj.m_connId, text);
            }
            // 斗地主相关
            else if (tag.CompareTo(TLJCommon.Consts.Tag_DouDiZhu_Game) == 0)
            {
                PlayLogic_DDZ.getInstance().OnReceive(receiveObj.m_connId, text);
            }
            // 未知Tag
            else
            {
                LogUtil.getInstance().addDebugLog("未知Tag:" + tag);
            }
        }
        else
        {
            // 传过来的数据没有tag字段的,一律不理
            // 日志
            {
                PlayerData playerData = GameUtil.getPlayerDataByConnId(receiveObj.m_connId);
                if (playerData != null)
                {
                    RoomData room = GameUtil.getRoomByUid(playerData.m_uid);
                    if (room != null)
                    {
                        LogUtil.getInstance().writeRoomLog(room, "客户端传来的数据没有Tag:" + text);
                    }
                    else
                    {
                        LogUtil.getInstance().addDebugLog("客户端传来的数据没有Tag:" + text);
                    }
                }
                else
                {
                    LogUtil.getInstance().addDebugLog("客户端传来的数据没有Tag:" + text);
                }
            }
            return;
        }
    }