001package com.fs.starfarer.api.campaign;
002
003import java.util.List;
004
005import com.fs.starfarer.api.fleet.FleetMemberType;
006import com.fs.starfarer.api.util.MutableValue;
007
008/**
009 * @author Alex Mosolov
010 *
011 * Copyright 2012 Fractal Softworks, LLC
012 */
013public interface CargoAPI {
014
015        public static class CargoItemQuantity<T> {
016                T item;
017                int count;
018                
019                public CargoItemQuantity(T item, int count) {
020                        this.item = item;
021                        this.count = count;
022                }
023                
024                public int getCount() {
025                        return count;
026                }
027                
028                public T getItem() {
029                        return item;
030                }
031        }
032
033//      public static enum CrewXPLevel {
034//              GREEN("green_crew", "icon_crew_green", "Green"),
035//              REGULAR("regular_crew", "icon_crew_regular", "Regular"),
036//              VETERAN("veteran_crew", "icon_crew_veteran", "Veteran"),
037//              ELITE("elite_crew", "icon_crew_elite", "Elite");
038//              
039//              private String id;
040//              private String rankIconKey;
041//              private String prefix;
042//              private CrewXPLevel(String id, String iconKey, String prefix) {
043//                      this.id = id;
044//                      this.rankIconKey = iconKey;
045//                      this.prefix = prefix;
046//              }
047//              public String getPrefix() {
048//                      return prefix;
049//              }
050//              public String getId() {
051//                      return id;
052//              }
053//              public String getRankIconKey() {
054//                      return rankIconKey;
055//              }
056//      }
057        
058        
059        public static enum CargoItemType {
060                RESOURCES,
061                WEAPONS,
062                FIGHTER_CHIP,
063                //MOD_SPEC, // replaced with SPECIAL and SpecialItemData.id for type; see Items class for possible values.
064                //BLUEPRINTS,
065                SPECIAL,
066                NULL,
067        }
068        
069        
070        List<CargoItemQuantity<String>> getWeapons();
071        
072        int getNumWeapons(String id);
073        void removeWeapons(String id, int count);
074        void addWeapons(String id, int count);
075        
076        float getSupplies();
077        float getFuel();
078        
079        int getTotalCrew();
080        void addCrew(int quantity);
081        int getCrew();
082        int getMarines();
083        void addMarines(int quantity);
084        void removeMarines(int quantity);
085        
086        void addFuel(float quantity);
087        void removeFuel(float quantity);
088        void addSupplies(float quantity);
089        void removeSupplies(float quantity);
090        public void removeCrew(int quantity);
091        
092        public void addItems(CargoAPI.CargoItemType itemType, Object data, float quantity);
093        public boolean removeItems(CargoAPI.CargoItemType itemType, Object data, float quantity);
094        public float getQuantity(CargoAPI.CargoItemType type, Object data);
095        
096        
097        
098        public void addMothballedShip(FleetMemberType type, String variantOrWingId, String optionalName);
099        
100        void initMothballedShips(String factionId);
101        /**
102         * Call initMothballedShips(String factionId) before using this method.
103         * @return
104         */
105        FleetDataAPI getMothballedShips();
106        
107        
108        public void clear();
109        
110        /**
111         * Use SectorEntityToken.setFreeTransfer() instead.
112         * Whether moving items to and from this entity has a cost.
113         * @param freeTransfer
114         */
115        @Deprecated public void setFreeTransfer(boolean freeTransfer);
116        @Deprecated public boolean isFreeTransfer();
117        
118        public MutableValue getCredits();
119        
120        public List<CargoStackAPI> getStacksCopy();
121
122        void gainCrewXP(float xp);
123
124        void sort();
125
126        float getMaxFuel();
127        float getMaxCapacity();
128        float getMaxPersonnel();
129
130        float getSpaceUsed();
131        float getSpaceLeft();
132
133        boolean isEmpty();
134
135        void removeEmptyStacks();
136
137        void addFromStack(CargoStackAPI stack);
138
139        void addCommodity(String commodityId, float quantity);
140
141        float getCommodityQuantity(String id);
142
143        int getTotalPersonnel();
144
145        void removeCommodity(String id, float quantity);
146
147        void removeStack(CargoStackAPI stack);
148
149        List<CargoItemQuantity<String>> getFighters();
150
151        int getNumFighters(String id);
152
153        void addAll(CargoAPI other);
154
155        void addFighters(String id, int count);
156
157        void addHullmods(String id, int count);
158
159        int getFreeCrewSpace();
160
161        int getFreeFuelSpace();
162
163        void addSpecial(SpecialItemData data, float quantity);
164
165        CargoAPI createCopy();
166
167        void initPartialsIfNeeded();
168
169        void removeAll(CargoAPI other);
170
171        void addAll(CargoAPI other, boolean includeMothballedShips);
172
173        CargoAPI getOrigSource();
174        void setOrigSource(CargoAPI origSource);
175
176        FleetDataAPI getFleetData();
177
178        void updateSpaceUsed();
179
180        void removeFighters(String id, int count);
181
182        boolean isUnlimitedStacks();
183        void setUnlimitedStacks(boolean unlimitedStacks);       
184}
185
186
187
188
189
190
191
192
193
194
195
196