protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { ResponseBody = new SignedResponse <QuestStateCollection> { Data = SetProgressOperation.GetQuestStateCollection(offlineDatabase.Read <QuestStates>(), offlineDefinitions, includeComplete: false) }; }
protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { QuestChangeResponse responseBody = new QuestChangeResponse(); if (ResponseBody.reward != null) { offlineDefinitions.AddReward(ResponseBody.reward.ToReward(), responseBody); } SetProgressOperation.SetOfflineQuestStateCollection(offlineDatabase, ResponseBody.questStateCollection.Data); }
protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { QuestStates questStates = offlineDatabase.Read <QuestStates>(); for (int i = 0; i < questStates.Quests.Count; i++) { if (questStates.Quests[i].questId == QuestId) { questStates.Quests.RemoveAt(i); break; } } offlineDatabase.Write(questStates); ResponseBody = new SignedResponse <QuestStateCollection> { Data = SetProgressOperation.GetQuestStateCollection(questStates, offlineDefinitions, includeComplete: false) }; }
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); }
public APICall <SetProgressOperation> SetProgress(SignedResponse <QuestObjectives> objectives) { SetProgressOperation operation = new SetProgressOperation(objectives); return(new APICall <SetProgressOperation>(clubPenguinClient, operation)); }
private void onQuestProgressionError(SetProgressOperation operation, HttpResponse httpResponse) { onQuestProgressionError(); }
private void objectiveCompleteQuestDataReturned(SetProgressOperation operation, HttpResponse httpResponse) { questDataReturned(operation.ResponseBody, RewardSource.QUEST_OBJECTIVE); }
protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { ResponseBody = SetProgressOperation.SetProgress(RequestBody, offlineDatabase, offlineDefinitions); }
protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { SetProgressOperation.SetOfflineQuestStateCollection(offlineDatabase, ResponseBody.Data); }
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; } }
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) { ClubPenguin.Net.Offline.InRoomRewards.InRoomReward current = item; if (current.Room == zoneId.name) { earnedRewards = current.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); }
public static QuestChangeResponse SetStatus(QuestStatus status, string questId, OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { QuestChangeResponse questChangeResponse = new QuestChangeResponse(); QuestStates questStates = offlineDatabase.Read <QuestStates>(); QuestStates.QuestState questState = null; int num = -1; for (int i = 0; i < questStates.Quests.Count; i++) { if (questStates.Quests[i].questId == questId) { questState = questStates.Quests[i]; num = i; break; } } QuestRewardsCollection questRewardsCollection = offlineDefinitions.QuestRewards(questId); Reward reward = null; if (questState == null) { reward = questRewardsCollection.StartReward; if (reward != null) { if (reward.isEmpty()) { reward = null; } else { offlineDefinitions.AddReward(reward, questChangeResponse); } } questState = new QuestStates.QuestState(); questState.questId = questId; } if (status == QuestStatus.ACTIVE) { for (int i = 0; i < questStates.Quests.Count; i++) { if (questStates.Quests[i].status == QuestStatus.ACTIVE) { questStates.Quests[i].status = QuestStatus.SUSPENDED; } } if (questState.status == QuestStatus.COMPLETED) { questState.completedObjectives.Clear(); } } if (status == QuestStatus.COMPLETED) { int timesCompleted = questState.timesCompleted; if (timesCompleted == 0) { questState.completedTime = DateTime.UtcNow; reward = questRewardsCollection.CompleteReward; if (reward != null) { if (reward.isEmpty()) { reward = null; } else { offlineDefinitions.AddReward(reward, questChangeResponse); } } } questState.timesCompleted = timesCompleted + 1; } questState.status = status; if (num >= 0) { questStates.Quests[num] = questState; } else { questStates.Quests.Add(questState); } offlineDatabase.Write(questStates); JsonService jsonService = Service.Get <JsonService>(); if (reward != null) { questChangeResponse.reward = jsonService.Deserialize <RewardJsonReader>(jsonService.Serialize(RewardJsonWritter.FromReward(reward))); } questChangeResponse.questId = questId; questChangeResponse.questStateCollection = new SignedResponse <QuestStateCollection> { Data = SetProgressOperation.GetQuestStateCollection(questStates, offlineDefinitions, includeComplete: false) }; return(questChangeResponse); }