001package com.fs.starfarer.api.campaign;
002
003import com.fs.starfarer.api.campaign.econ.CommoditySpecAPI;
004import com.fs.starfarer.api.loading.FighterWingSpecAPI;
005import com.fs.starfarer.api.loading.HullModSpecAPI;
006import com.fs.starfarer.api.loading.WeaponSpecAPI;
007
008
009public interface CargoStackAPI {
010        
011        public boolean isWeaponStack();
012        /**
013         * Use isCommodityStack() instead.
014         * @return
015         */
016        @Deprecated public boolean isResourceStack();
017        boolean isCommodityStack();
018        boolean isMarineStack();
019        boolean isFuelStack();
020        boolean isSupplyStack();
021        boolean isCrewStack();
022        boolean isPersonnelStack();
023        
024        /**
025         * Returns null if it's not a commodity stack.
026         * @return
027         */
028        String getCommodityId();
029        
030        public float getCargoSpace();
031        public float getCargoSpacePerUnit();
032
033        
034        public float getSize();
035        public float getFree();
036        public void setSize(float size);
037        public void add(float quantity);
038        public void subtract(float quantity);
039        
040        public float getMaxSize();
041        public boolean isFull();
042
043        public CargoAPI.CargoItemType getType();
044        public void setType(CargoAPI.CargoItemType type);
045        
046        /**
047         * If true, it's an empty cargo stack. These get created for spacing, a result of the player moving cargo around.
048         * @return
049         */
050        public boolean isNull();
051        
052        
053        /**
054         * Usually a String. Its contents (i.e. the resource id) is how you can tell apart different types of resources.
055         * @return
056         */
057        public Object getData();
058
059        // these concepts might not survive an actual economy implementation
060//      public int getBaseValue();
061//      public int getBaseValuePerUnit();
062        
063        public String getDisplayName();
064        
065        /**
066         * @return CargoAPI that contains this stack.
067         */
068        public CargoAPI getCargo();
069        
070        int getBaseValuePerUnit();
071        WeaponSpecAPI getWeaponSpecIfWeapon();
072        
073        /**
074         * Call isSpecialStack() and check specialData.getId().equals(Items.MODSPEC) instead.
075         * @return
076         */
077        @Deprecated boolean isModSpecStack();
078        boolean isFighterWingStack();
079        FighterWingSpecAPI getFighterWingSpecIfWing();
080        HullModSpecAPI getHullModSpecIfHullMod();
081        CommoditySpecAPI getResourceIfResource();
082        
083        boolean isSpecialStack();
084        SpecialItemData getSpecialDataIfSpecial();
085        SpecialItemSpecAPI getSpecialItemSpecIfSpecial();
086        
087        /**
088         * Returns a new instance of the plugin. The special item plugin is transient and many instances may be
089         * in existence at any time - i.e. one for rendering the item in cargo, one for creating the tooltip,
090         * one for executing a right-click action, etc. 
091         * @return
092         */
093        SpecialItemPlugin getPlugin();
094        void setCargo(CargoAPI cargo);
095        boolean isInPlayerCargo();
096        boolean isPickedUp();
097        void setPickedUp(boolean isPickedUp);
098
099
100}