예제 #1
0
        public void Execute(CommodityVO reward)
        {
            InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
            ItemVO         item      = inventory.Instantiate(reward.ID);

            if (item == null)
            {
                ItemConfig config = Resources.Load <ItemConfig>(Filepath.Items + reward.ID);
                inventory.Import(config);
                item = inventory.Instantiate(reward.ID);
            }
            if (item != null)
            {
                if (reward.Value > 0)
                {
                    item.Price = reward.Value;
                }
                item.Created = AmbitionApp.GetModel <CalendarModel>().Today;
                inventory.Inventory.Add(item);
                inventory.Broadcast();
            }
#if DEBUG
            else
            {
                Debug.LogWarningFormat("No inventory template matches reward ID '{0}'; synthesizing one", reward.ID);
            }
#endif
        }
예제 #2
0
        public void Execute()
        {
            InventoryModel inventory = AmbitionApp.Inventory;

            // Ensure that the same market values persist throughout the day
            if (inventory.Market == null)
            {
                OutfitVO        outfit;
                List <OutfitVO> defs = new List <OutfitVO>();
                inventory.Market = new List <ItemVO>();

                foreach (ItemVO definition in inventory.Items.Values)
                {
                    if (definition.Type == ItemType.Outfit && definition.Market && !string.IsNullOrEmpty(definition.AssetID))
                    {
                        defs.Add(inventory.Instantiate(definition.ID) as OutfitVO);
                    }
                }

                for (int i = inventory.NumMarketSlots - 1; i >= 0; --i)
                {
                    outfit = GenerateOutfit(inventory, defs);
                    inventory.Market.Add(outfit);
                }
            }
        }
예제 #3
0
        public void Execute(string playerID)
        {
            PlayerConfig config = Resources.Load <PlayerConfig>(Filepath.PLAYERS + playerID);

            if (config != null)
            {
                InventoryModel inventory = AmbitionApp.Inventory;
                AmbitionApp.Execute <RestorePlayerCmd, PlayerConfig>(config);
                AmbitionApp.Game.Livre = config.Livre;
                foreach (ItemConfig def in config.Inventory)
                {
                    inventory.Inventory.Add(inventory.Instantiate(def.name));
                }
            }
        }