protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { ClubPenguin.Net.Offline.Profile value = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>(); value.Colour = ResponseBody.Data.colour; value.DateCreated = DateTime.UtcNow.AddDays(-1 * ResponseBody.Data.daysOld).GetTimeInMilliseconds(); offlineDatabase.Write(value); }
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); }
protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { ClubPenguin.Net.Offline.Profile value = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>(); value.Colour = RequestBody.colour; offlineDatabase.Write(value); ResponseBody = new SignedResponse <ClubPenguin.Net.Domain.Profile> { Data = new ClubPenguin.Net.Domain.Profile { colour = value.Colour, daysOld = value.DaysOld } }; }
protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { TubeData value = offlineDatabase.Read <TubeData>(); value.EquippedTubeId = SignedJoinRoomData.Data.selectedTubeId; offlineDatabase.Write(value); ClubPenguin.Net.Offline.ConsumableInventory value2 = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>(); value2.Inventory = SignedJoinRoomData.Data.playerRoomData.consumableInventory.inventoryMap; offlineDatabase.Write(value2); ClubPenguin.Net.Offline.PlayerAssets value3 = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>(); value3.Assets = SignedJoinRoomData.Data.playerRoomData.assets; offlineDatabase.Write(value3); ClubPenguin.Net.Offline.PlayerOutfitDetails value4 = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerOutfitDetails>(); value4.Parts = new List <CustomEquipment>(SignedJoinRoomData.Data.playerRoomData.outfit.parts); offlineDatabase.Write(value4); ClubPenguin.Net.Offline.Profile value5 = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>(); value5.Colour = SignedJoinRoomData.Data.playerRoomData.profile.colour; value5.DateCreated = DateTime.UtcNow.AddDays(-1 * SignedJoinRoomData.Data.playerRoomData.profile.daysOld).GetTimeInMilliseconds(); offlineDatabase.Write(value5); SetProgressOperation.SetOfflineQuestStateCollection(offlineDatabase, SignedJoinRoomData.Data.playerRoomData.quests); }
protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { BreadcrumbCollection value = offlineDatabase.Read <BreadcrumbCollection>(); value.breadcrumbs = ResponseBody.breadcrumbs.breadcrumbs; offlineDatabase.Write(value); ClaimableRewardData value2 = offlineDatabase.Read <ClaimableRewardData>(); value2.ClimedRewards = ResponseBody.claimedRewardIds; offlineDatabase.Write(value2); ClubPenguin.Net.Offline.DailySpinData value3 = offlineDatabase.Read <ClubPenguin.Net.Offline.DailySpinData>(); value3.CurrentChestId = ResponseBody.dailySpinData.currentChestId; value3.NumChestsReceivedOfCurrentChestId = ResponseBody.dailySpinData.numChestsReceivedOfCurrentChestId; value3.NumPunchesOnCurrentChest = ResponseBody.dailySpinData.numPunchesOnCurrentChest; value3.TimeOfLastSpinInMilliseconds = ResponseBody.dailySpinData.timeOfLastSpinInMilliseconds; offlineDatabase.Write(value3); ClubPenguin.Net.Offline.PlayerOutfitDetails value4 = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerOutfitDetails>(); value4.Parts = ResponseBody.outfit; offlineDatabase.Write(value4); ClubPenguin.Net.Offline.Profile value5 = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>(); value5.Colour = ResponseBody.profile.colour; value5.DateCreated = DateTime.UtcNow.AddDays(-1 * ResponseBody.profile.daysOld).GetTimeInMilliseconds(); offlineDatabase.Write(value5); SetProgressOperation.SetOfflineQuestStateCollection(offlineDatabase, ResponseBody.quests); TutorialData value6 = offlineDatabase.Read <TutorialData>(); for (int i = 0; i < value6.Bytes.Length; i++) { sbyte b = 0; if (i < ResponseBody.tutorialData.Count) { b = ResponseBody.tutorialData[i]; } value6.Bytes[i] = b; } offlineDatabase.Write(value6); }
protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { ResponseBody = new LocalPlayerData(); ResponseBody.member = true; ResponseBody.membershipExpireDate = DateTime.UtcNow.AddMonths(1).GetTimeInMilliseconds(); ResponseBody.trialAvailable = false; ResponseBody.subscriptionPaymentPending = false; ResponseBody.id = new PlayerId { id = offlineDatabase.AccessToken, type = PlayerId.PlayerIdType.SWID }; ClubPenguin.Net.Offline.Profile profile = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>(); ResponseBody.profile = new ClubPenguin.Net.Domain.Profile { colour = profile.Colour, daysOld = profile.DaysOld }; ResponseBody.outfit = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerOutfitDetails>().Parts; ResponseBody.mascotXP = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>().Assets.mascotXP; ResponseBody.minigameProgress = new List <MinigameProgress>(); ResponseBody.quests = SetProgressOperation.GetQuestStateCollection(offlineDatabase.Read <QuestStates>(), offlineDefinitions, includeComplete: true); ResponseBody.tutorialData = new List <sbyte>(offlineDatabase.Read <TutorialData>().Bytes); List <Breadcrumb> list = new List <Breadcrumb>(); foreach (Breadcrumb breadcrumb in offlineDatabase.Read <BreadcrumbCollection>().breadcrumbs) { list.Add(new Breadcrumb { id = breadcrumb.id, breadcrumbType = breadcrumb.breadcrumbType }); } ResponseBody.breadcrumbs = new BreadcrumbsResponse { breadcrumbs = list }; RegistrationProfile registrationProfile = offlineDatabase.Read <RegistrationProfile>(); ResponseBody.name = registrationProfile.displayName; if (string.IsNullOrEmpty(ResponseBody.name)) { ResponseBody.name = registrationProfile.userName; } ResponseBody.claimedRewardIds = offlineDatabase.Read <ClaimableRewardData>().ClimedRewards; ZoneId zoneId = new ZoneId(); zoneId.name = "DefaultIgloo"; zoneId.instanceId = registrationProfile.Id(); ZoneId zoneId2 = zoneId; IglooEntity iglooEntity = offlineDatabase.Read <IglooEntity>(); if (iglooEntity.Data.activeLayout != null) { string zoneId3 = iglooEntity.Data.activeLayout.zoneId; if (!string.IsNullOrEmpty(zoneId3)) { zoneId2.name = zoneId3; } } ResponseBody.zoneId = zoneId2; List <SavedIglooLayoutSummary> list2 = new List <SavedIglooLayoutSummary>(); foreach (SavedSceneLayout layout in offlineDatabase.Read <SceneLayoutEntity>().Layouts) { list2.Add(new SavedIglooLayoutSummary { createdDate = layout.createdDate.GetValueOrDefault(0L), lastUpdatedDate = layout.lastModifiedDate.GetValueOrDefault(0L), layoutId = layout.layoutId, lot = layout.zoneId, memberOnly = layout.memberOnly, name = layout.name }); } ResponseBody.iglooLayouts = new SavedIglooLayoutsSummary { activeLayoutId = iglooEntity.Data.activeLayoutId, activeLayoutServerChangeNotification = ActiveLayoutServerChangeNotification.NoServerChange, visibility = iglooEntity.Data.visibility.GetValueOrDefault(IglooVisibility.PRIVATE), layouts = list2 }; ClubPenguin.Net.Offline.DailySpinData dailySpinData = offlineDatabase.Read <ClubPenguin.Net.Offline.DailySpinData>(); ResponseBody.dailySpinData = new ClubPenguin.Net.Domain.DailySpinData { currentChestId = dailySpinData.CurrentChestId, numChestsReceivedOfCurrentChestId = dailySpinData.NumChestsReceivedOfCurrentChestId, numPunchesOnCurrentChest = dailySpinData.NumPunchesOnCurrentChest, timeOfLastSpinInMilliseconds = dailySpinData.TimeOfLastSpinInMilliseconds }; ClubPenguin.Net.Offline.SessionData sessionData = offlineDatabase.Read <ClubPenguin.Net.Offline.SessionData>(); if (sessionData.Data.sessionId != 0) { ResponseBody.onlineLocation = sessionData.CurrentRoom; } }