Esempio n. 1
0
    public static bool EqualsIgnoreInstanceId(string roomIdentifierString1, string roomIdentifierString2)
    {
        RoomIdentifier roomIdentifier  = new RoomIdentifier(roomIdentifierString1);
        RoomIdentifier roomIdentifier2 = new RoomIdentifier(roomIdentifierString2);

        return(roomIdentifier.world == roomIdentifier2.world && roomIdentifier.language == roomIdentifier2.language && roomIdentifier.zoneId.name == roomIdentifier2.zoneId.name && roomIdentifier.contentIdentifier == roomIdentifier2.contentIdentifier);
    }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LockingDownEventArgs"/> class.
 /// </summary>
 /// <param name="player"><inheritdoc cref="Player"/></param>
 /// <param name="roomIdentifier"><inheritdoc cref="RoomGameObject"/></param>
 /// <param name="auxiliaryPowerCost"><inheritdoc cref="AuxiliaryPowerCost"/></param>
 public LockingDownEventArgs(Player player, RoomIdentifier roomIdentifier, float auxiliaryPowerCost)
 {
     Player             = player;
     RoomGameObject     = roomIdentifier;
     AuxiliaryPowerCost = auxiliaryPowerCost;
     IsAllowed          = auxiliaryPowerCost <= player.Role.As <Scp079Role>().Energy;
 }
        public static SignedResponse <JoinRoomData> JoinRoom(string world, string language, ZoneId zoneId, OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            Dictionary <string, long> earnedRewards = new Dictionary <string, long>();

            foreach (ClubPenguin.Net.Offline.InRoomRewards.InRoomReward item in offlineDatabase.Read <ClubPenguin.Net.Offline.InRoomRewards>().Collected)
            {
                if (item.Room == zoneId.name)
                {
                    earnedRewards = item.Collected;
                    break;
                }
            }
            ClubPenguin.Net.Offline.Profile profile = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>();
            PlayerRoomData playerRoomData           = default(PlayerRoomData);

            playerRoomData.assets = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>().Assets;
            playerRoomData.consumableInventory = new ClubPenguin.Net.Domain.ConsumableInventory
            {
                inventoryMap = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>().Inventory
            };
            playerRoomData.dailyTaskProgress = new TaskProgressList();
            playerRoomData.member            = true;
            playerRoomData.outfit            = new ClubPenguin.Net.Domain.PlayerOutfitDetails
            {
                parts = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerOutfitDetails>().Parts.ToArray()
            };
            playerRoomData.profile = new ClubPenguin.Net.Domain.Profile
            {
                colour  = profile.Colour,
                daysOld = profile.DaysOld
            };
            playerRoomData.quests = SetProgressOperation.GetQuestStateCollection(offlineDatabase.Read <QuestStates>(), offlineDefinitions, includeComplete: true);
            PlayerRoomData playerRoomData2 = playerRoomData;
            RoomIdentifier roomIdentifier  = new RoomIdentifier(world, LocalizationLanguage.GetLanguageFromLanguageString(language), zoneId, new ContentIdentifier("1.13.0", "offline", DateTime.UtcNow.ToString("yyyy-MM-dd"), "NONE").ToString());
            int            equippedTubeId  = offlineDatabase.Read <TubeData>().EquippedTubeId;
            Random         random          = new Random();

            byte[] array = new byte[8];
            random.NextBytes(array);
            SignedResponse <JoinRoomData> signedResponse = new SignedResponse <JoinRoomData>();

            signedResponse.Data = new JoinRoomData
            {
                earnedRewards    = earnedRewards,
                membershipRights = new MembershipRights
                {
                    member = true
                },
                playerRoomData = playerRoomData2,
                room           = roomIdentifier.ToString(),
                selectedTubeId = equippedTubeId,
                sessionId      = Math.Abs(BitConverter.ToInt64(array, 0)),
                host           = Service.Get <ICommonGameSettings>().GameServerHost,
                tcpPort        = 9933,
                userName       = offlineDatabase.Read <RegistrationProfile>().userName,
                swid           = offlineDatabase.AccessToken
            };
            signedResponse.swid = offlineDatabase.AccessToken;
            return(signedResponse);
        }
Esempio n. 4
0
 public JoinRoomInWorldSequence(ClubPenguinClient client, RoomIdentifier room, IJoinRoomErrorHandler errorHandler, System.Action successHandler = null)
 {
     clubPenguinClient   = client;
     roomToJoin          = room;
     this.successHandler = successHandler;
     this.errorHandler   = errorHandler;
 }
Esempio n. 5
0
 public SelfRoomJoinedEvent(long sessionId, string name, RoomIdentifier room, SceneLayout extraLayoutData, string roomOwnerName, bool isRoomOwner)
 {
     SessionId       = sessionId;
     Name            = name;
     Room            = room;
     ExtraLayoutData = extraLayoutData;
     RoomOwnerName   = roomOwnerName;
     IsRoomOwner     = isRoomOwner;
 }
Esempio n. 6
0
 /// <summary>
 /// Gets the room capacity.
 /// </summary>
 /// <returns>The room capacity.</returns>
 /// <param name="roomId">Room identifier.</param>
 public int GetRoomCapacity(RoomIdentifier roomId)
 {
     int val;
     using (var ctx = new DatabaseContexts.MainContext())
     {
         var query = from room in ctx.Rooms
                     where room.RoomID.ToString().Equals(roomId.Value)
                     select room.Capacity;
         val = query.First();
     }
     return val;
 }
    internal bool TryClearJoinRoomDataIfRoom(string room, out JoinRoomData joinRoomData)
    {
        bool result = false;

        joinRoomData = default(JoinRoomData);
        lock (joinRoomDataLock)
        {
            if (signedJoinRoomData != null && RoomIdentifier.EqualsIgnoreInstanceId(signedJoinRoomData.Data.room, room))
            {
                result             = true;
                joinRoomData       = signedJoinRoomData.Data;
                signedJoinRoomData = null;
            }
        }
        return(result);
    }
Esempio n. 8
0
        private void onRoomJoin(BaseEvent evt)
        {
            Room room = (Room)evt.Params["room"];

            if (RoomIdentifier.EqualsIgnoreInstanceId(room.Name, mt.JoinRoomDataRoom))
            {
                mt.ClientRoomName = mt.JoinRoomDataRoom;
                if (SmartFoxGameServerClient.EnableUDP)
                {
                    mt.initUDP();
                }
                else
                {
                    fetchServerTimestamp(fetchEncryptionKeyAfterwards: true);
                }
            }
        }
Esempio n. 9
0
    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return(true);
        }
        if (obj == null)
        {
            return(false);
        }
        if (!(obj instanceof RoomIdentifier))
        {
            return(false);
        }
        RoomIdentifier other = (RoomIdentifier)obj;

        return(id == other.id);
    }
Esempio n. 10
0
    //the start room is always at 0,0
    public RoomIdentifier[] GetRoomIdentifiers()
    {
        RoomIdentifier[] roomTypes = new RoomIdentifier[numRooms];
        int curRoom = 0;

        for (int x = 0; x < maxSize; x++)
        {
            for (int y = 0; y < maxSize; y++)
            {
                if (rooms[x, y].type != RoomType.NULL)
                {
                    roomTypes[curRoom] = new RoomIdentifier(x - startOffset, y - startOffset, rooms[x, y].connections, rooms[x, y].type);
                    curRoom++;
                }
            }
        }
        return(roomTypes);
    }
Esempio n. 11
0
        internal Room(RoomIdentifier identifier)
        {
            Identifier = identifier;
            if (Identifier == null)
            {
                Logger.Get.Warn("NULL Room");
            }
            RoomType   = Identifier.Name;
            RoomShape  = Identifier.Shape;
            GameObject = identifier.gameObject;
            ID         = Identifier.UniqueId;

            LightController = GameObject.GetComponentInChildren <FlickerableLightController>();

            foreach (var cam in GameObject.GetComponentsInChildren <Camera079>())
            {
                Cameras.Add(new Camera(cam, this));
            }
        }
Esempio n. 12
0
    void createRoom(RoomIdentifier r)
    {
        GameObject northWall  = (r.connections & NORTH) > 0 ? doorway : wall;
        GameObject eastWall   = (r.connections & EAST) > 0 ? doorway : wall;
        GameObject southWall  = (r.connections & SOUTH) > 0 ? doorway : wall;
        GameObject westWall   = (r.connections & WEST) > 0 ? doorway : wall;
        GameObject floor      = this.floor;
        GameObject ceiling    = this.ceiling;
        Vector3    roomOrigin = ROOM_SIZE * new Vector3(r.x, 0, r.y);

        GameObject newRoom = new GameObject("room" + r.x + r.y);

        newRoom.transform.position = roomOrigin;
        newRoom.transform.parent   = this.transform;

        Instantiate(floor, roomOrigin, Quaternion.Euler(0, 0, 0), newRoom.transform);
        Instantiate(ceiling, roomOrigin, Quaternion.Euler(0, 0, 0), newRoom.transform);
        Instantiate(northWall, roomOrigin, Quaternion.Euler(0, 270, 0), newRoom.transform);
        Instantiate(eastWall, roomOrigin, Quaternion.Euler(0, 180, 0), newRoom.transform);
        Instantiate(southWall, roomOrigin, Quaternion.Euler(0, 90, 0), newRoom.transform);
        Instantiate(westWall, roomOrigin, Quaternion.Euler(0, 0, 0), newRoom.transform);
    }
Esempio n. 13
0
 /// <summary>
 /// Gets the name of the given room.
 /// </summary>
 /// <returns>The room name.</returns>
 /// <param name="roomId">Room identifier.</param>
 public string GetRoomName(RoomIdentifier roomId)
 {
     string val;
     using (var ctx = new DatabaseContexts.MainContext())
     {
         var query = from room in ctx.Rooms
                     where room.RoomID.ToString().Equals(roomId.Value)
                     select room.Name;
         val = query.First();
     }
     return val;
 }
Esempio n. 14
0
 /// <summary>
 /// Checks if the given room exists.
 /// </summary>
 /// <param name="roomId">room identifier.</param>
 public bool RoomExists(RoomIdentifier roomId)
 {
     bool val;
     using (var ctx = new DatabaseContexts.MainContext())
     {
         var query = from room in ctx.Rooms
                     where room.RoomID.ToString().Equals(roomId.Value.ToString())
                     select room;
         val = query.Count() > 0;
     }
     return val;
 }
Esempio n. 15
0
 /// <summary>
 /// Gets the room particularities.
 /// </summary>
 /// <returns>The room particularities.</returns>
 /// <param name="roomId">Room identifier.</param>
 public List<ParticularityIdentifier> GetRoomParticularities(RoomIdentifier roomId)
 {
     List<ParticularityIdentifier> val;
     using (var ctx = new DatabaseContexts.MainContext())
     {
         var query = from room in ctx.Rooms
                     where room.RoomID.ToString().Equals(roomId.Value)
                     select room.Particularities;
         val = query.First().ToList().ConvertAll(part => new ParticularityIdentifier(part.ParticularityID.ToString()));
     }
     return val;
 }
Esempio n. 16
0
 public RoomFoundEvent(RoomIdentifier room)
 {
     Room = room;
 }
        /// <summary>
        /// Gets a list containing every booking between the given startDate and endDate.
        /// The bookings which are not totally covered by the given time period (startDate -> endDate)
        /// are also included.
        /// The bookings are represented by their id.
        /// The bookings must be sorted by StartDate (ascending).
        /// </summary>
        /// <returns>The bookings.</returns>
        /// <param name="startDate">Start date.</param>
        /// <param name="endDate">End date.</param>
        public List<BookingIdentifier> GetBookings(RoomIdentifier identifier, DateTime startDate, DateTime endDate)
        {
            List<BookingIdentifier> val;
            using (var ctx = new DatabaseContexts.BookingContext())
            {
                var query = from booking in ctx.Bookings
                            where booking.EndDate > startDate && booking.StartDate < endDate &&
                            booking.RoomID.ToString().Equals(identifier.Value)
                            orderby booking.StartDate ascending
                            select booking.BookingID;

                val = query.ToList().ConvertAll(id => new BookingIdentifier(id.ToString()));
            }
            return val;
        }
Esempio n. 18
0
 public static Room GetSynapseRoom(this RoomIdentifier identifier) => Map.Get.Rooms.FirstOrDefault(x => x.Identifier == identifier);
    void CreateRoom(RoomIdentifier r, Transform level)
    {
        GameObject northWall  = (r.connections & NORTH) > 0 ? doorway : wall;
        GameObject eastWall   = (r.connections & EAST) > 0 ? doorway : wall;
        GameObject southWall  = (r.connections & SOUTH) > 0 ? doorway : wall;
        GameObject westWall   = (r.connections & WEST) > 0 ? doorway : wall;
        GameObject floor      = this.floor;
        GameObject ceiling    = this.ceiling;
        Vector3    roomOrigin = ROOM_SIZE * new Vector3(r.x, 0, r.y);

        GameObject newRoomObj = new GameObject("room" + r.x + r.y);

        newRoomObj.transform.position = roomOrigin;
        newRoomObj.transform.parent   = level;

        Instantiate(floor, roomOrigin, Quaternion.Euler(0, 0, 0), newRoomObj.transform);
        Instantiate(ceiling, roomOrigin, Quaternion.Euler(0, 0, 0), newRoomObj.transform);
        Instantiate(northWall, roomOrigin, Quaternion.Euler(0, 270, 0), newRoomObj.transform);
        Instantiate(eastWall, roomOrigin, Quaternion.Euler(0, 180, 0), newRoomObj.transform);
        Instantiate(southWall, roomOrigin, Quaternion.Euler(0, 90, 0), newRoomObj.transform);
        Instantiate(westWall, roomOrigin, Quaternion.Euler(0, 0, 0), newRoomObj.transform);

        switch (r.type)
        {
        case (RoomType.START):
            newRoomObj.AddComponent <SpawnRoom>();
            break;

        case (RoomType.END):
            GameObject teleporter = Instantiate(bossTeleporter, roomOrigin, Quaternion.Euler(0, 0, 0), newRoomObj.transform);
            teleporter.GetComponent <Teleporter>().SetDestination(new Vector3(0, 0, 0));
            teleporter.SetActive(false);
            BossWaveCombatRoom bossRoom = newRoomObj.AddComponent <BossWaveCombatRoom>();
            //GameObject boss = bosses[Random.Range(0, bosses.Length)];
            bossRoom.generateEnemies(enemies, numEnemiesPerRoom, 3, curLevel + 1);
            bossRoom.teleporter = teleporter;
            break;

        case (RoomType.DEAD_END):
        case (RoomType.ENEMY):
            CombatRoom combatRoom = newRoomObj.AddComponent <CombatRoom>();
            combatRoom.generateEnemies(enemies, numEnemiesPerRoom, curLevel + 1);

            if (Random.Range(0f, 1f) < RewardChance)
            {
                WandPickup wp   = Instantiate(wandPickup, newRoomObj.transform.position + (Vector3.up * PICKUP_HEIGHT), Quaternion.identity, newRoomObj.transform).GetComponent <WandPickup>();
                GameObject wand = wands[Random.Range(0, wands.Length)];
                wp.SetWand(wand);
                wp.gameObject.SetActive(false);
                combatRoom.SetReward(wp.gameObject);
            }

            break;

        default:
            break;
        }

        BoxCollider boxCollider = newRoomObj.AddComponent <BoxCollider>();

        boxCollider.size      = new Vector3(ROOM_SIZE, ROOM_SIZE, ROOM_SIZE);
        boxCollider.isTrigger = true;
        newRoomObj.tag        = "Invisible";
    }
Esempio n. 20
0
 /// <summary>
 /// Gets the room from the database with the given identifier.
 /// </summary>
 public static Room Get(RoomIdentifier id)
 {
     return s_cache.Get(id);
 }
Esempio n. 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SopraProject.ObjectApi.Room"/> class.
 /// </summary>
 /// <param name="id">Identifier.</param>
 private Room(RoomIdentifier id)
 {
     Identifier = id;
 }
Esempio n. 22
0
 public RoomPopulation(RoomIdentifier identifier, RoomPopulationScale populationScaled)
 {
     this.identifier       = identifier;
     this.populationScaled = populationScaled;
 }
 /// <summary>
 /// Gets the booking room.
 /// </summary>
 /// <returns>The booking room.</returns>
 /// <param name="bookingId">Booking identifier.</param>
 public RoomIdentifier GetBookingRoom(BookingIdentifier bookingId)
 {
     RoomIdentifier val;
     using (var ctx = new DatabaseContexts.BookingContext())
     {
         var query = from booking in ctx.Bookings
                     where booking.BookingID.ToString().Equals(bookingId.Value)
                     select booking.RoomID;
         val = new RoomIdentifier(query.First().ToString());
     }
     return val;
 }
Esempio n. 24
0
    public void JoinRoomInWorld(RoomIdentifier room, IJoinRoomErrorHandler errorHandler)
    {
        JoinRoomInWorldSequence joinRoomInWorldSequence = new JoinRoomInWorldSequence(clubPenguinClient, room, errorHandler);

        joinRoomInWorldSequence.JoinRoom();
    }
Esempio n. 25
0
 public void Init()
 {
     CurrentRoom = new RoomIdentifier();
 }