public static PurchaseDisneyStoreItemResponse Purchase(int itemId, int count, OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { PurchaseDisneyStoreItemResponse purchaseDisneyStoreItemResponse = new PurchaseDisneyStoreItemResponse(); Reward disneyStoreItemReward = offlineDefinitions.GetDisneyStoreItemReward(itemId, count); offlineDefinitions.AddReward(disneyStoreItemReward, purchaseDisneyStoreItemResponse); offlineDefinitions.SubtractDisneyStoreItemCost(itemId, count); purchaseDisneyStoreItemResponse.assets = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>().Assets; purchaseDisneyStoreItemResponse.inventory = new SignedResponse <ClubPenguin.Net.Domain.ConsumableInventory> { Data = new ClubPenguin.Net.Domain.ConsumableInventory { inventoryMap = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>().Inventory } }; DecorationInventory decorationInventory = new DecorationInventory(); decorationInventory.items = new List <DecorationInventoryItem>(); foreach (KeyValuePair <string, int> item in offlineDatabase.Read <DecorationInventoryEntity>().inventory) { decorationInventory.items.Add(new DecorationInventoryItem { count = item.Value, decorationId = DecorationId.FromString(item.Key) }); } purchaseDisneyStoreItemResponse.decorationInventory = new SignedResponse <DecorationInventory> { Data = decorationInventory }; return(purchaseDisneyStoreItemResponse); }
protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { DecorationInventory = new DecorationInventory(); DecorationInventory.items = new List <DecorationInventoryItem>(); foreach (KeyValuePair <string, int> item in offlineDatabase.Read <DecorationInventoryEntity>().inventory) { DecorationInventory.items.Add(new DecorationInventoryItem { decorationId = DecorationId.FromString(item.Key), count = item.Value }); } }
public DecorationsLoaded(DecorationInventory decorationInventory) { DecorationInventory = decorationInventory; }
private void onDecorationsLoaded(GetDecorationsOperation operation, HttpResponse httpResponse) { DecorationInventory decorationInventory = operation.DecorationInventory; Service.Get <EventDispatcher>().DispatchEvent(new IglooServiceEvents.DecorationsLoaded(decorationInventory)); }