예제 #1
0
 protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     ClubPenguin.Net.Offline.ConsumableInventory value = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>();
     value.Inventory = Response.inventory.Data.inventoryMap;
     offlineDatabase.Write(value);
     ClubPenguin.Net.Offline.PlayerAssets value2 = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
     value2.Assets = Response.assets;
     offlineDatabase.Write(value2);
 }
예제 #2
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            IglooEntity value = offlineDatabase.Read <IglooEntity>();

            value.Init();
            offlineDatabase.Write(value);
            SceneLayoutEntity value2 = offlineDatabase.Read <SceneLayoutEntity>();

            value2.Init();
            offlineDatabase.Write(value2);
        }
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            SceneLayoutEntity value = offlineDatabase.Read <SceneLayoutEntity>();

            if (value.Layouts.Count == 0)
            {
                IglooEntity value2 = offlineDatabase.Read <IglooEntity>();
                value2.Data.activeLayout   = ResponseBody;
                value2.Data.activeLayoutId = ResponseBody.layoutId;
                offlineDatabase.Write(value2);
            }
            value.Layouts.Add(ResponseBody);
            offlineDatabase.Write(value);
        }
예제 #4
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            SceneLayoutEntity value       = offlineDatabase.Read <SceneLayoutEntity>();
            SceneLayout       sceneLayout = value[SceneLayoutId];

            sceneLayout.lastModifiedDate = DateTime.UtcNow.GetTimeInMilliseconds();
            if (RequestBody.zoneId != null)
            {
                sceneLayout.zoneId = RequestBody.zoneId;
            }
            if (RequestBody.name != null)
            {
                sceneLayout.name = RequestBody.name;
            }
            sceneLayout.lightingId = RequestBody.lightingId;
            sceneLayout.musicId    = RequestBody.musicId;
            if (RequestBody.decorationsLayout != null)
            {
                sceneLayout.decorationsLayout = RequestBody.decorationsLayout;
            }
            if (RequestBody.extraInfo != null)
            {
                sceneLayout.extraInfo = RequestBody.extraInfo;
            }
            offlineDatabase.Write(value);
            ResponseBody = SavedSceneLayout.FromSceneLayout(sceneLayout, SceneLayoutId);
        }
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            TutorialData value = offlineDatabase.Read <TutorialData>();

            value.Init();
            offlineDatabase.Write(value);
        }
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            CustomEquipmentCollection value = offlineDatabase.Read <CustomEquipmentCollection>();

            value.Equipment.Clear();
            offlineDatabase.Write(value);
        }
예제 #7
0
 protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     ClubPenguin.Net.Offline.ConsumableInventory value = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>();
     if (value.Inventory.ContainsKey(Type))
     {
         value.Inventory[Type].itemCount += Count;
     }
     else
     {
         value.Inventory[Type] = new InventoryItemStock
         {
             itemCount = Count
         };
     }
     value.Inventory[Type].lastPurchaseTimestamp = DateTime.UtcNow.GetTimeInMilliseconds();
     offlineDatabase.Write(value);
     offlineDefinitions.SubtractConsumableCost(Type, Count);
     Response = new PurchaseConsumableResponse
     {
         assets    = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>().Assets,
         inventory = new SignedResponse <ClubPenguin.Net.Domain.ConsumableInventory>
         {
             Data = new ClubPenguin.Net.Domain.ConsumableInventory
             {
                 inventoryMap = value.Inventory
             }
         }
     };
 }
 protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     createEquipment(CustomEquipmentResponse.equipmentId, offlineDatabase, offlineDefinitions);
     ClubPenguin.Net.Offline.PlayerAssets value = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
     value.Assets = CustomEquipmentResponse.assets;
     offlineDatabase.Write(value);
 }
 protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     AddDecoration(ResponseBody.decorationId, Count, offlineDatabase);
     ClubPenguin.Net.Offline.PlayerAssets value = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
     value.Assets = ResponseBody.assets;
     offlineDatabase.Write(value);
 }
예제 #10
0
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            TubeData value = offlineDatabase.Read <TubeData>();

            value.EquippedTubeId = TubeId;
            offlineDatabase.Write(value);
        }
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            IglooEntity value = offlineDatabase.Read <IglooEntity>();

            value.Data = SignedResponseBody.Data;
            offlineDatabase.Write(value);
        }
예제 #12
0
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            CustomEquipmentCollection value = offlineDatabase.Read <CustomEquipmentCollection>();

            value.Equipment = CustomEquipmentResponses;
            offlineDatabase.Write(value);
        }
예제 #13
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            CustomEquipmentCollection customEquipmentCollection = offlineDatabase.Read <CustomEquipmentCollection>();

            ClubPenguin.Net.Offline.PlayerOutfitDetails value = default(ClubPenguin.Net.Offline.PlayerOutfitDetails);
            value.Init();
            long[] parts = RequestBody.parts;
            foreach (long num in parts)
            {
                foreach (CustomEquipment item in customEquipmentCollection.Equipment)
                {
                    if (item.equipmentId == num)
                    {
                        value.Parts.Add(item);
                        break;
                    }
                }
            }
            offlineDatabase.Write(value);
            ResponseBody = new SignedResponse <ClubPenguin.Net.Domain.PlayerOutfitDetails>
            {
                Data = new ClubPenguin.Net.Domain.PlayerOutfitDetails
                {
                    parts = value.Parts.ToArray()
                }
            };
        }
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            DecorationInventoryEntity value = offlineDatabase.Read <DecorationInventoryEntity>();

            value.Init();
            offlineDatabase.Write(value);
        }
예제 #15
0
        private BreadcrumbCollection updateBreadCrumbs(OfflineDatabase offlineDatabase)
        {
            BreadcrumbCollection breadcrumbCollection = offlineDatabase.Read <BreadcrumbCollection>();

            breadcrumbCollection.breadcrumbs.Clear();
            offlineDatabase.Write(breadcrumbCollection);
            return(breadcrumbCollection);
        }
예제 #16
0
        public static QuestChangeResponse SetProgress(QuestObjectives objectives, OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            QuestStates.QuestState questState          = null;
            QuestStates            questStates         = offlineDatabase.Read <QuestStates>();
            QuestChangeResponse    questChangeResponse = new QuestChangeResponse();

            foreach (QuestStates.QuestState quest in questStates.Quests)
            {
                if (quest.status == QuestStatus.ACTIVE)
                {
                    questState = quest;
                    break;
                }
            }
            if (questState == null)
            {
                return(questChangeResponse);
            }
            if (questState.completedObjectives == null)
            {
                questState.completedObjectives = new QuestObjectives();
            }
            Reward reward = null;

            if (questState.timesCompleted == 0)
            {
                Dictionary <string, Reward> objectiveRewards = offlineDefinitions.QuestRewards(questState.questId).ObjectiveRewards;
                foreach (string objective in objectives)
                {
                    if (!questState.completedObjectives.Contains(objective) && objectiveRewards.ContainsKey(objective))
                    {
                        if (reward == null)
                        {
                            reward = new Reward();
                        }
                        reward.AddReward(objectiveRewards[objective]);
                    }
                }
            }
            if (reward != null)
            {
                offlineDefinitions.AddReward(reward, questChangeResponse);
            }
            questState.completedObjectives = objectives;
            offlineDatabase.Write(questStates);
            questChangeResponse.questId = questState.questId;
            questChangeResponse.questStateCollection = new SignedResponse <QuestStateCollection>
            {
                Data = GetQuestStateCollection(questStates, offlineDefinitions, includeComplete: false)
            };
            if (reward != null)
            {
                JsonService jsonService = Service.Get <JsonService>();
                questChangeResponse.reward = jsonService.Deserialize <RewardJsonReader>(jsonService.Serialize(RewardJsonWritter.FromReward(reward)));
            }
            return(questChangeResponse);
        }
예제 #17
0
 protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     if (offlineDefinitions.IsOwnIgloo(IglooId))
     {
         IglooEntity value = offlineDatabase.Read <IglooEntity>();
         value.Data.activeLayout = SignedJoinRoomData.Data.extraLayoutData;
         offlineDatabase.Write(value);
     }
 }
예제 #18
0
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            ClubPenguin.Net.Offline.PlayerAssets value = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
            value.Assets = Response.assets;
            offlineDatabase.Write(value);
            DecorationInventoryEntity value2     = offlineDatabase.Read <DecorationInventoryEntity>();
            Dictionary <string, int>  dictionary = new Dictionary <string, int>();

            foreach (DecorationInventoryItem item in Response.decorationInventory.Data.items)
            {
                dictionary.Add(item.decorationId.ToString(), item.count);
            }
            value2.inventory = dictionary;
            offlineDatabase.Write(value2);
            ClubPenguin.Net.Offline.ConsumableInventory value3 = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>();
            value3.Inventory = Response.inventory.Data.inventoryMap;
            offlineDatabase.Write(value3);
        }
예제 #19
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            DecorationInventoryEntity value = offlineDatabase.Read <DecorationInventoryEntity>();

            if (value.inventory.ContainsKey(DecorationId))
            {
                value.inventory.Remove(DecorationId);
                offlineDatabase.Write(value);
            }
        }
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            TutorialData value = offlineDatabase.Read <TutorialData>();

            value.Init();
            offlineDatabase.Write(value);
            TutorialResponse = new TutorialResponse
            {
                tutorialBytes = new List <sbyte>(value.Bytes)
            };
        }
        private BreadcrumbCollection updateBreadCrumbs(OfflineDatabase offlineDatabase)
        {
            BreadcrumbCollection breadcrumbCollection = offlineDatabase.Read <BreadcrumbCollection>();

            foreach (Breadcrumb breadcrumb in BreadcrumbList)
            {
                breadcrumbCollection.breadcrumbs.Remove(breadcrumb);
            }
            offlineDatabase.Write(breadcrumbCollection);
            return(breadcrumbCollection);
        }
예제 #22
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            string room = RequestBody.Data.room;

            ResponseBody = new RewardGrantedResponse();
            ClubPenguin.Net.Offline.InRoomRewards value = offlineDatabase.Read <ClubPenguin.Net.Offline.InRoomRewards>();
            int index = -1;
            Dictionary <string, long> dictionary = null;

            for (int i = 0; i < value.Collected.Count; i++)
            {
                if (value.Collected[i].Room == room)
                {
                    dictionary = value.Collected[i].Collected;
                    index      = i;
                    break;
                }
            }
            if (dictionary == null)
            {
                dictionary = new Dictionary <string, long>();
                value.Collected.Add(new ClubPenguin.Net.Offline.InRoomRewards.InRoomReward
                {
                    Collected = dictionary,
                    Room      = room
                });
                index = value.Collected.Count - 1;
            }
            List <string> list = new List <string>();

            foreach (KeyValuePair <string, long> item in RequestBody.Data.collected)
            {
                if (!dictionary.ContainsKey(item.Key) || dictionary[item.Key] < item.Value)
                {
                    dictionary[item.Key] = item.Value;
                    list.Add(item.Key);
                }
            }
            value.Collected[index] = new ClubPenguin.Net.Offline.InRoomRewards.InRoomReward
            {
                Collected = dictionary,
                Room      = room
            };
            offlineDatabase.Write(value);
            if (list.Count > 0)
            {
                Reward inRoomReward = offlineDefinitions.GetInRoomReward(list);
                if (!inRoomReward.isEmpty())
                {
                    offlineDefinitions.AddReward(inRoomReward, ResponseBody);
                }
            }
            ResponseBody.assets = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>().Assets;
        }
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            SceneLayoutEntity value = offlineDatabase.Read <SceneLayoutEntity>();
            int    count            = value.Layouts.Count;
            Random random           = new Random();

            byte[] array = new byte[8];
            random.NextBytes(array);
            SavedSceneLayout savedSceneLayout = new SavedSceneLayout();

            savedSceneLayout.createdDate       = DateTime.UtcNow.GetTimeInMilliseconds();
            savedSceneLayout.decorationsLayout = RequestBody.decorationsLayout;
            savedSceneLayout.extraInfo         = RequestBody.extraInfo;
            savedSceneLayout.lastModifiedDate  = DateTime.UtcNow.GetTimeInMilliseconds();
            savedSceneLayout.layoutId          = BitConverter.ToInt64(array, 0);
            savedSceneLayout.lightingId        = RequestBody.lightingId;
            savedSceneLayout.memberOnly        = true;
            savedSceneLayout.musicId           = RequestBody.musicId;
            savedSceneLayout.name   = RequestBody.name;
            savedSceneLayout.zoneId = RequestBody.zoneId;
            SavedSceneLayout savedSceneLayout2 = savedSceneLayout;

            if (savedSceneLayout2.decorationsLayout == null)
            {
                savedSceneLayout2.decorationsLayout = new List <DecorationLayout>();
            }
            if (savedSceneLayout2.extraInfo == null)
            {
                savedSceneLayout2.extraInfo = new Dictionary <string, string>();
            }
            if (count == 0)
            {
                IglooEntity value2 = offlineDatabase.Read <IglooEntity>();
                value2.Data.activeLayout   = savedSceneLayout2;
                value2.Data.activeLayoutId = savedSceneLayout2.layoutId;
                offlineDatabase.Write(value2);
            }
            value.Layouts.Add(savedSceneLayout2);
            offlineDatabase.Write(value);
            ResponseBody = savedSceneLayout2;
        }
예제 #24
0
        private BreadcrumbCollection updateBreadCrumbs(OfflineDatabase offlineDatabase)
        {
            BreadcrumbCollection breadcrumbCollection = offlineDatabase.Read <BreadcrumbCollection>();

            breadcrumbCollection.breadcrumbs.AddRange(BreadcrumbList);
            if (breadcrumbCollection.breadcrumbs.Count > 50)
            {
                breadcrumbCollection.breadcrumbs.RemoveRange(0, breadcrumbCollection.breadcrumbs.Count - 50);
            }
            offlineDatabase.Write(breadcrumbCollection);
            return(breadcrumbCollection);
        }
        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);
        }
예제 #26
0
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            DecorationInventoryEntity value      = offlineDatabase.Read <DecorationInventoryEntity>();
            Dictionary <string, int>  dictionary = new Dictionary <string, int>();

            foreach (DecorationInventoryItem item in DecorationInventory.items)
            {
                dictionary.Add(item.decorationId.ToString(), item.count);
            }
            value.inventory = dictionary;
            offlineDatabase.Write(value);
        }
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            ClubPenguin.Net.Offline.PlayerAssets value = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
            int coinsForExchange = offlineDefinitions.GetCoinsForExchange(value.Assets.collectibleCurrencies);

            value.Assets.coins += coinsForExchange;
            value.Assets.collectibleCurrencies.Clear();
            offlineDatabase.Write(value);
            ResponseBody = new RewardGrantedResponse
            {
                assets = value.Assets
            };
        }
        protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            CustomEquipmentCollection value = offlineDatabase.Read <CustomEquipmentCollection>();

            foreach (CustomEquipment item in value.Equipment)
            {
                if (item.equipmentId == EquipmentId)
                {
                    value.Equipment.Remove(item);
                    break;
                }
            }
            offlineDatabase.Write(value);
        }
        public static void AddDecoration(DecorationId decoration, int count, OfflineDatabase offlineDatabase)
        {
            DecorationInventoryEntity value = offlineDatabase.Read <DecorationInventoryEntity>();

            if (value.Inventory.ContainsKey(decoration))
            {
                value.Inventory[decoration] += count;
            }
            else
            {
                value.Inventory[decoration] = count;
            }
            offlineDatabase.Write(value);
        }
예제 #30
0
        protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
        {
            SceneLayoutEntity value = offlineDatabase.Read <SceneLayoutEntity>();

            for (int i = 0; i < value.Layouts.Count; i++)
            {
                if (value.Layouts[i].layoutId == SceneLayoutId)
                {
                    value.Layouts.RemoveAt(i);
                    break;
                }
            }
            offlineDatabase.Write(value);
        }