protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     RoomsFound = new List <RoomIdentifier>();
     string[] array = string.IsNullOrEmpty(Worlds) ? new string[1]
     {
         "Alpine"
     } : Worlds.Split(',');
     string[] array2 = string.IsNullOrEmpty(Rooms) ? new string[1]
     {
         "Boardwalk"
     } : Rooms.Split(',');
     string[] array3 = array;
     foreach (string world in array3)
     {
         string[] array4 = array2;
         foreach (string name in array4)
         {
             RoomsFound.Add(new RoomIdentifier
             {
                 contentIdentifier = "",
                 language          = LocalizationLanguage.GetLanguageFromLanguageString(Language),
                 world             = world,
                 zoneId            = new ZoneId
                 {
                     name = name
                 }
             });
         }
     }
 }
        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);
        }
Exemplo n.º 3
0
 public RoomIdentifier(string roomIdentifierString)
 {
     string[] array = roomIdentifierString.Split(':');
     world             = array[0];
     language          = LocalizationLanguage.GetLanguageFromLanguageString(array[1]);
     zoneId            = new ZoneId();
     zoneId.name       = array[2];
     zoneId.instanceId = array[3];
     contentIdentifier = array[4];
 }
Exemplo n.º 4
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            string world = "Igloo";

            switch (LocalizationLanguage.GetLanguageFromLanguageString(Language))
            {
            case DevonLocalization.Core.Language.es_LA:
                world = "Iglú";
                break;

            case DevonLocalization.Core.Language.fr_FR:
                world = "Iglou";
                break;

            case DevonLocalization.Core.Language.pt_BR:
                world = "Iglu";
                break;
            }
            SignedJoinRoomData = PostRoomPlayersOperation.JoinRoom(world, Language, IglooId, offlineDatabase, offlineDefinitions);
            SignedJoinRoomData.Data.extraLayoutData = offlineDatabase.Read <IglooEntity>().Data.activeLayout;
            if (SignedJoinRoomData.Data.extraLayoutData == null)
            {
                SignedJoinRoomData.Data.extraLayoutData = new SceneLayout
                {
                    zoneId = IglooId.name
                };
            }
            RegistrationProfile registrationProfile = offlineDatabase.Read <RegistrationProfile>();

            SignedJoinRoomData.Data.roomOwnerName = registrationProfile.displayName;
            if (string.IsNullOrEmpty(SignedJoinRoomData.Data.roomOwnerName))
            {
                SignedJoinRoomData.Data.roomOwnerName = registrationProfile.userName;
            }
            SignedJoinRoomData.Data.roomOwner = true;
        }