This commit is contained in:
vjurenka 2015-02-10 20:17:14 +01:00
commit 7b6214822b
227 changed files with 4 additions and 28162 deletions

2
.gitignore vendored
View file

@ -218,3 +218,5 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
*.log

View file

@ -1,6 +1,6 @@
BWMirror API
BWMirror API
=========
BWMirror API allows you to treat native BWAPI C/C++ objects as if they were Java objects.
The main class of the generator is generator.CJavaPipeline
The main class of the generator is generator.CJavaPipeline

View file

@ -1,130 +0,0 @@
package bwapi;
import bwapi.BWEventListener;
/**
* This class receives all events from Broodwar.
* To process them, receive an AIModule's instance from {@link bwapi.Mirror} and call {@link #setEventListener(BWEventListener)}
* to set you own {@link bwapi.BWEventListener listener}.
* There's also a stub class ({@link bwapi.DefaultBWListener}) provided, so you don't have to implement all of the methods.
*/
public class AIModule {
AIModule(){}
private BWEventListener eventListener;
public void setEventListener(BWEventListener eventListener) {
this.eventListener = eventListener;
}
public void onStart() {
if (eventListener != null) {
eventListener.onStart();
}
}
public void onEnd(boolean isWinner) {
if (eventListener != null) {
eventListener.onEnd(isWinner);
}
}
public void onFrame() {
if (eventListener != null) {
eventListener.onFrame();
}
}
public void onSendText(String text) {
if (eventListener != null)
{
eventListener.onSendText(text);
}
}
public void onReceiveText(Player player, String text) {
if (eventListener != null) {
eventListener.onReceiveText(player, text);
}
}
public void onPlayerLeft(Player player) {
if (eventListener != null) {
eventListener.onPlayerLeft(player);
}
}
public void onNukeDetect(Position target) {
if (eventListener != null) {
eventListener.onNukeDetect(target);
}
}
public void onUnitDiscover(Unit unit) {
if (eventListener != null) {
eventListener.onUnitDiscover(unit);
}
}
public void onUnitEvade(Unit unit) {
if (eventListener != null) {
eventListener.onUnitEvade(unit);
}
}
public void onUnitShow(Unit unit) {
if (eventListener != null) {
eventListener.onUnitShow(unit);
}
}
public void onUnitHide(Unit unit) {
if (eventListener != null) {
eventListener.onUnitHide(unit);
}
}
public void onUnitCreate(Unit unit) {
if (eventListener != null) {
eventListener.onUnitCreate(unit);
}
}
public void onUnitDestroy(Unit unit) {
if (eventListener != null) {
eventListener.onUnitDestroy(unit);
}
}
public void onUnitMorph(Unit unit) {
if (eventListener != null) {
eventListener.onUnitMorph(unit);
}
}
public void onUnitRenegade(Unit unit) {
if (eventListener != null) {
eventListener.onUnitRenegade(unit);
}
}
public void onSaveGame(String gameName) {
if (eventListener != null) {
eventListener.onSaveGame(gameName);
}
}
public void onUnitComplete(Unit unit) {
if (eventListener != null) {
eventListener.onUnitComplete(unit);
}
}
public void onPlayerDropped(Player player) {
if (eventListener != null) {
eventListener.onPlayerDropped(player);
}
}
}

View file

@ -1,30 +0,0 @@
package bwapi;
/**
* Common ancestor for location based objects to simplify distance computation.
* This will be refactored into interface with default methods when java 8 becomes widely used.
*
* Idea by Rafa³ Poniatowski
*/
public abstract class AbstractPoint<T extends AbstractPoint> {
public abstract T getPoint();
public int getX(){
return getPoint().getX();
}
public int getY(){
return getPoint().getY();
}
public double distanceTo(AbstractPoint<T> otherPosition) {
return distanceTo(otherPosition.getX(), otherPosition.getY());
}
public double distanceTo(int x, int y) {
double dx = x - getX();
double dy = y - getY();
return Math.sqrt(dx * dx + dy * dy);
}
}

View file

@ -1,53 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
/**
* Implement this interface and call {@link bwapi.AIModule#setEventListener(bwapi.BWEventListener)} to receive all of the in game events.
*/
public interface BWEventListener {
public void onStart();
public void onEnd(boolean isWinner);
public void onFrame();
public void onSendText(String text);
public void onReceiveText(Player player, String text);
public void onPlayerLeft(Player player);
public void onNukeDetect(Position target);
public void onUnitDiscover(Unit unit);
public void onUnitEvade(Unit unit);
public void onUnitShow(Unit unit);
public void onUnitHide(Unit unit);
public void onUnitCreate(Unit unit);
public void onUnitDestroy(Unit unit);
public void onUnitMorph(Unit unit);
public void onUnitRenegade(Unit unit);
public void onSaveGame(String gameName);
public void onUnitComplete(Unit unit);
public void onPlayerDropped(Player player);
}

View file

@ -1,118 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Bullet {
public int getID() {
return getID_native(pointer);
}
public Player getPlayer() {
return getPlayer_native(pointer);
}
public BulletType getType() {
return getType_native(pointer);
}
public Unit getSource() {
return getSource_native(pointer);
}
public Position getPosition() {
return getPosition_native(pointer);
}
public double getAngle() {
return getAngle_native(pointer);
}
public double getVelocityX() {
return getVelocityX_native(pointer);
}
public double getVelocityY() {
return getVelocityY_native(pointer);
}
public Unit getTarget() {
return getTarget_native(pointer);
}
public Position getTargetPosition() {
return getTargetPosition_native(pointer);
}
public int getRemoveTimer() {
return getRemoveTimer_native(pointer);
}
public boolean exists() {
return exists_native(pointer);
}
public boolean isVisible() {
return isVisible_native(pointer);
}
public boolean isVisible(Player player) {
return isVisible_native(pointer, player);
}
private static Map<Long, Bullet> instances = new HashMap<Long, Bullet>();
private Bullet(long pointer) {
this.pointer = pointer;
}
private static Bullet get(long pointer) {
if (pointer == 0 ) {
return null;
}
Bullet instance = instances.get(pointer);
if (instance == null ) {
instance = new Bullet(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native Player getPlayer_native(long pointer);
private native BulletType getType_native(long pointer);
private native Unit getSource_native(long pointer);
private native Position getPosition_native(long pointer);
private native double getAngle_native(long pointer);
private native double getVelocityX_native(long pointer);
private native double getVelocityY_native(long pointer);
private native Unit getTarget_native(long pointer);
private native Position getTargetPosition_native(long pointer);
private native int getRemoveTimer_native(long pointer);
private native boolean exists_native(long pointer);
private native boolean isVisible_native(long pointer);
private native boolean isVisible_native(long pointer, Player player);
}

View file

@ -1,118 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class BulletType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static BulletType Melee;
public static BulletType Fusion_Cutter_Hit;
public static BulletType Gauss_Rifle_Hit;
public static BulletType C_10_Canister_Rifle_Hit;
public static BulletType Gemini_Missiles;
public static BulletType Fragmentation_Grenade;
public static BulletType Longbolt_Missile;
public static BulletType ATS_ATA_Laser_Battery;
public static BulletType Burst_Lasers;
public static BulletType Arclite_Shock_Cannon_Hit;
public static BulletType EMP_Missile;
public static BulletType Dual_Photon_Blasters_Hit;
public static BulletType Particle_Beam_Hit;
public static BulletType Anti_Matter_Missile;
public static BulletType Pulse_Cannon;
public static BulletType Psionic_Shockwave_Hit;
public static BulletType Psionic_Storm;
public static BulletType Yamato_Gun;
public static BulletType Phase_Disruptor;
public static BulletType STA_STS_Cannon_Overlay;
public static BulletType Sunken_Colony_Tentacle;
public static BulletType Acid_Spore;
public static BulletType Glave_Wurm;
public static BulletType Seeker_Spores;
public static BulletType Queen_Spell_Carrier;
public static BulletType Plague_Cloud;
public static BulletType Consume;
public static BulletType Ensnare;
public static BulletType Needle_Spine_Hit;
public static BulletType Invisible;
public static BulletType Optical_Flare_Grenade;
public static BulletType Halo_Rockets;
public static BulletType Subterranean_Spines;
public static BulletType Corrosive_Acid_Shot;
public static BulletType Neutron_Flare;
public static BulletType None;
public static BulletType Unknown;
private static Map<Long, BulletType> instances = new HashMap<Long, BulletType>();
private BulletType(long pointer) {
this.pointer = pointer;
}
private static BulletType get(long pointer) {
if (pointer == 0 ) {
return null;
}
BulletType instance = instances.get(pointer);
if (instance == null ) {
instance = new BulletType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,15 +0,0 @@
package bwapi;
import bwapi.Position;
/**
* Interrmediate class used to translate getPoint() calls to getCenter() calls.
*/
public abstract class CenteredObject extends AbstractPoint<Position> {
public Position getPoint(){
return getCenter();
}
public abstract Position getCenter();
}

View file

@ -1,58 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Client {
public boolean isConnected() {
return isConnected_native(pointer);
}
public boolean connect() {
return connect_native(pointer);
}
public void disconnect() {
disconnect_native(pointer);
}
public void update() {
update_native(pointer);
}
private static Map<Long, Client> instances = new HashMap<Long, Client>();
private Client(long pointer) {
this.pointer = pointer;
}
private static Client get(long pointer) {
if (pointer == 0 ) {
return null;
}
Client instance = instances.get(pointer);
if (instance == null ) {
instance = new Client(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native boolean isConnected_native(long pointer);
private native boolean connect_native(long pointer);
private native void disconnect_native(long pointer);
private native void update_native(long pointer);
}

View file

@ -1,73 +0,0 @@
package bwapi;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
/**
* Starcraft uses a 256 color palette to render everything,
* so the colors available for draw shapes using BWAPI is limited to the colors available in the <a href="http://bwapi.googlecode.com/svn/wiki/colorPalette.gif" target="_blank">Pallete</a>.
* Several predefined colors from the pallete are provided.
*/
public class Color {
private int r, g, b;
/**
* Create a color using the color in the palette that is closest to the RGB color specified. This will check a number of colors in the pallet to see which is closest to the specified color so this function is relatively slow.
* @param r
* @param g
* @param b
*/
public Color(int r, int g, int b) {
this.r = r;
this.g = g;
this.b = b;
}
public static Color Red;
public static Color Blue;
public static Color Teal;
public static Color Purple;
public static Color Orange;
public static Color Brown;
public static Color White;
public static Color Yellow;
public static Color Green;
public static Color Cyan;
public static Color Black;
public static Color Grey;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Color)) return false;
Color color = (Color) o;
if (b != color.b) return false;
if (g != color.g) return false;
if (r != color.r) return false;
return true;
}
@Override
public int hashCode() {
int result = r;
result = 31 * result + g;
result = 31 * result + b;
return result;
}
}

View file

@ -1,44 +0,0 @@
package bwapi.CommandType;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
None(0),
SetScreenPosition(1),
PingMinimap(2),
EnableFlag(3),
Printf(4),
SendText(5),
ChangeRace(6),
StartGame(7),
PauseGame(8),
ResumeGame(9),
LeaveGame(10),
RestartGame(11),
SetLocalSpeed(12),
SetLatCom(13),
SetGui(14),
SetFrameSkip(15),
SetMap(16),
SetAllies(17),
SetVision(18),
SetCommandOptimizerLevel(19),
SetReplayVision(20);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,26 +0,0 @@
package bwapi.CoordinateType;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
Screen(1),
Map(2),
Mouse(3);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,58 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class DamageType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static DamageType Independent;
public static DamageType Explosive;
public static DamageType Concussive;
public static DamageType Normal;
public static DamageType Ignore_Armor;
public static DamageType None;
public static DamageType Unknown;
private static Map<Long, DamageType> instances = new HashMap<Long, DamageType>();
private DamageType(long pointer) {
this.pointer = pointer;
}
private static DamageType get(long pointer) {
if (pointer == 0 ) {
return null;
}
DamageType instance = instances.get(pointer);
if (instance == null ) {
instance = new DamageType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,103 +0,0 @@
package bwapi;
import bwapi.BWEventListener;
import bwapi.Player;
import bwapi.Position;
import bwapi.Unit;
/**
* A utility stub class providing a default implementation of {@link bwapi.BWEventListener},
* override it's methods if you want to handle only some events.
*/
public class DefaultBWListener implements BWEventListener {
@Override
public void onStart() {
}
@Override
public void onEnd(boolean b) {
}
@Override
public void onFrame() {
}
@Override
public void onSendText(String s) {
}
@Override
public void onReceiveText(Player player, String s) {
}
@Override
public void onPlayerLeft(Player player) {
}
@Override
public void onNukeDetect(Position position) {
}
@Override
public void onUnitDiscover(Unit unit) {
}
@Override
public void onUnitEvade(Unit unit) {
}
@Override
public void onUnitShow(Unit unit) {
}
@Override
public void onUnitHide(Unit unit) {
}
@Override
public void onUnitCreate(Unit unit) {
}
@Override
public void onUnitDestroy(Unit unit) {
}
@Override
public void onUnitMorph(Unit unit) {
}
@Override
public void onUnitRenegade(Unit unit) {
}
@Override
public void onSaveGame(String s) {
}
@Override
public void onUnitComplete(Unit unit) {
}
@Override
public void onPlayerDropped(Player player) {
}
}

View file

@ -1,100 +0,0 @@
package bwapi;
import java.util.HashMap;
import java.util.Map;
/**
* Functions in BWAPI may set an error code. To retrieve the error code, call Game::getLastError.
*/
public class Error {
private int id;
private Error(int id) {
this.id = id;
}
public static Error Unit_Does_Not_Exist;
public static Error Unit_Not_Visible;
public static Error Unit_Not_Owned;
public static Error Unit_Busy;
public static Error Incompatible_UnitType;
public static Error Incompatible_TechType;
public static Error Incompatible_State;
public static Error Already_Researched;
public static Error Fully_Upgraded;
public static Error Currently_Researching;
public static Error Currently_Upgrading;
public static Error Insufficient_Minerals;
public static Error Insufficient_Gas;
public static Error Insufficient_Supply;
public static Error Insufficient_Energy;
public static Error Insufficient_Tech;
public static Error Insufficient_Ammo;
public static Error Insufficient_Space;
public static Error Invalid_Tile_Position;
public static Error Unbuildable_Location;
public static Error Unreachable_Location;
public static Error Out_Of_Range;
public static Error Unable_To_Hit;
public static Error Access_Denied;
public static Error File_Not_Found;
public static Error Invalid_Parameter;
public static Error None;
public static Error Unknown;
private static Map<Long, Error> instances = new HashMap<Long, Error>();
private Error(long pointer) {
this.pointer = pointer;
}
private static Error get(long pointer) {
Error instance = instances.get(pointer);
if (instance == null) {
instance = new Error(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
private native String c_str_native(long pointer);
}

View file

@ -1,64 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Event {
public Position getPosition() {
return getPosition_native(pointer);
}
public String getText() {
return getText_native(pointer);
}
public Unit getUnit() {
return getUnit_native(pointer);
}
public Player getPlayer() {
return getPlayer_native(pointer);
}
public boolean isWinner() {
return isWinner_native(pointer);
}
private static Map<Long, Event> instances = new HashMap<Long, Event>();
private Event(long pointer) {
this.pointer = pointer;
}
private static Event get(long pointer) {
if (pointer == 0 ) {
return null;
}
Event instance = instances.get(pointer);
if (instance == null ) {
instance = new Event(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native Position getPosition_native(long pointer);
private native String getText_native(long pointer);
private native Unit getUnit_native(long pointer);
private native Player getPlayer_native(long pointer);
private native boolean isWinner_native(long pointer);
}

View file

@ -1,42 +0,0 @@
package bwapi.EventType;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
MatchStart(0),
MatchEnd(1),
MatchFrame(2),
MenuFrame(3),
SendText(4),
ReceiveText(5),
PlayerLeft(6),
NukeDetect(7),
UnitDiscover(8),
UnitEvade(9),
UnitShow(10),
UnitHide(11),
UnitCreate(12),
UnitDestroy(13),
UnitMorph(14),
UnitRenegade(15),
SaveGame(16),
UnitComplete(17),
PlayerDropped(18);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,94 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class ExplosionType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static ExplosionType None;
public static ExplosionType Normal;
public static ExplosionType Radial_Splash;
public static ExplosionType Enemy_Splash;
public static ExplosionType Lockdown;
public static ExplosionType Nuclear_Missile;
public static ExplosionType Parasite;
public static ExplosionType Broodlings;
public static ExplosionType EMP_Shockwave;
public static ExplosionType Irradiate;
public static ExplosionType Ensnare;
public static ExplosionType Plague;
public static ExplosionType Stasis_Field;
public static ExplosionType Dark_Swarm;
public static ExplosionType Consume;
public static ExplosionType Yamato_Gun;
public static ExplosionType Restoration;
public static ExplosionType Disruption_Web;
public static ExplosionType Corrosive_Acid;
public static ExplosionType Mind_Control;
public static ExplosionType Feedback;
public static ExplosionType Optical_Flare;
public static ExplosionType Maelstrom;
public static ExplosionType Air_Splash;
public static ExplosionType Unknown;
private static Map<Long, ExplosionType> instances = new HashMap<Long, ExplosionType>();
private ExplosionType(long pointer) {
this.pointer = pointer;
}
private static ExplosionType get(long pointer) {
if (pointer == 0 ) {
return null;
}
ExplosionType instance = instances.get(pointer);
if (instance == null ) {
instance = new ExplosionType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,25 +0,0 @@
package bwapi.Flag;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
CompleteMapInformation(0),
UserInput(1);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,52 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Force {
public int getID() {
return getID_native(pointer);
}
public String getName() {
return getName_native(pointer);
}
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
private static Map<Long, Force> instances = new HashMap<Long, Force>();
private Force(long pointer) {
this.pointer = pointer;
}
private static Force get(long pointer) {
if (pointer == 0 ) {
return null;
}
Force instance = instances.get(pointer);
if (instance == null ) {
instance = new Force(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native String getName_native(long pointer);
private native List<Player> getPlayers_native(long pointer);
}

File diff suppressed because it is too large Load diff

View file

@ -1,76 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class GameType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static GameType Melee;
public static GameType Free_For_All;
public static GameType One_on_One;
public static GameType Capture_The_Flag;
public static GameType Greed;
public static GameType Slaughter;
public static GameType Sudden_Death;
public static GameType Ladder;
public static GameType Use_Map_Settings;
public static GameType Team_Melee;
public static GameType Team_Free_For_All;
public static GameType Team_Capture_The_Flag;
public static GameType Top_vs_Bottom;
public static GameType Pro_Gamer_League;
public static GameType None;
public static GameType Unknown;
private static Map<Long, GameType> instances = new HashMap<Long, GameType>();
private GameType(long pointer) {
this.pointer = pointer;
}
private static GameType get(long pointer) {
if (pointer == 0 ) {
return null;
}
GameType instance = instances.get(pointer);
if (instance == null ) {
instance = new GameType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,219 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Key {
K_LBUTTON(1),
K_RBUTTON(2),
K_CANCEL(3),
K_MBUTTON(4),
K_XBUTTON1(5),
K_XBUTTON2(6),
K_BACK(8),
K_TAB(9),
K_CLEAR(12),
K_RETURN(13),
K_SHIFT(16),
K_CONTROL(17),
K_MENU(18),
K_PAUSE(19),
K_CAPITAL(20),
K_KANA(21),
K_HANGEUL(21),
K_HANGUL(21),
K_JUNJA(23),
K_FINAL(24),
K_HANJA(25),
K_KANJI(25),
K_ESCAPE(27),
K_CONVERT(28),
K_NONCONVERT(29),
K_ACCEPT(30),
K_MODECHANGE(31),
K_SPACE(32),
K_PRIOR(33),
K_NEXT(34),
K_END(35),
K_HOME(36),
K_LEFT(37),
K_UP(38),
K_RIGHT(39),
K_DOWN(40),
K_SELECT(41),
K_PRINT(42),
K_EXECUTE(43),
K_SNAPSHOT(44),
K_INSERT(45),
K_DELETE(46),
K_HELP(47),
K_0(48),
K_1(49),
K_2(50),
K_3(51),
K_4(52),
K_5(53),
K_6(54),
K_7(55),
K_8(56),
K_9(57),
K_A(65),
K_B(66),
K_C(67),
K_D(68),
K_E(69),
K_F(70),
K_G(71),
K_H(72),
K_I(73),
K_J(74),
K_K(75),
K_L(76),
K_M(77),
K_N(78),
K_O(79),
K_P(80),
K_Q(81),
K_R(82),
K_S(83),
K_T(84),
K_U(85),
K_V(86),
K_W(87),
K_X(88),
K_Y(89),
K_Z(90),
K_LWIN(91),
K_RWIN(92),
K_APPS(93),
K_SLEEP(95),
K_NUMPAD0(96),
K_NUMPAD1(97),
K_NUMPAD2(98),
K_NUMPAD3(99),
K_NUMPAD4(100),
K_NUMPAD5(101),
K_NUMPAD6(102),
K_NUMPAD7(103),
K_NUMPAD8(104),
K_NUMPAD9(105),
K_MULTIPLY(106),
K_ADD(107),
K_SEPARATOR(108),
K_SUBTRACT(109),
K_DECIMAL(110),
K_DIVIDE(111),
K_F1(112),
K_F2(113),
K_F3(114),
K_F4(115),
K_F5(116),
K_F6(117),
K_F7(118),
K_F8(119),
K_F9(120),
K_F10(121),
K_F11(122),
K_F12(123),
K_F13(124),
K_F14(125),
K_F15(126),
K_F16(127),
K_F17(128),
K_F18(129),
K_F19(130),
K_F20(131),
K_F21(132),
K_F22(133),
K_F23(134),
K_F24(135),
K_NUMLOCK(144),
K_SCROLL(145),
K_OEM_NEC_EQUAL(146),
K_OEM_FJ_JISHO(146),
K_OEM_FJ_MASSHOU(147),
K_OEM_FJ_TOUROKU(148),
K_OEM_FJ_LOYA(149),
K_OEM_FJ_ROYA(150),
K_LSHIFT(160),
K_RSHIFT(161),
K_LCONTROL(162),
K_RCONTROL(163),
K_LMENU(164),
K_RMENU(165),
K_BROWSER_BACK(166),
K_BROWSER_FORWARD(167),
K_BROWSER_REFRESH(168),
K_BROWSER_STOP(169),
K_BROWSER_SEARCH(170),
K_BROWSER_FAVORITES(171),
K_BROWSER_HOME(172),
K_VOLUME_MUTE(173),
K_VOLUME_DOWN(174),
K_VOLUME_UP(175),
K_MEDIA_NEXT_TRACK(176),
K_MEDIA_PREV_TRACK(177),
K_MEDIA_STOP(178),
K_MEDIA_PLAY_PAUSE(179),
K_LAUNCH_MAIL(180),
K_LAUNCH_MEDIA_SELECT(181),
K_LAUNCH_APP1(182),
K_LAUNCH_APP2(183),
K_OEM_1(186),
K_OEM_PLUS(187),
K_OEM_COMMA(188),
K_OEM_MINUS(189),
K_OEM_PERIOD(190),
K_OEM_2(191),
K_OEM_3(192),
K_OEM_4(219),
K_OEM_5(220),
K_OEM_6(221),
K_OEM_7(222),
K_OEM_8(223),
K_OEM_AX(225),
K_OEM_102(226),
K_ICO_HELP(227),
K_ICO_00(228),
K_PROCESSKEY(229),
K_ICO_CLEAR(230),
K_PACKET(231),
K_OEM_RESET(233),
K_OEM_JUMP(234),
K_OEM_PA1(235),
K_OEM_PA2(236),
K_OEM_PA3(237),
K_OEM_WSCTRL(238),
K_OEM_CUSEL(239),
K_OEM_ATTN(240),
K_OEM_FINISH(241),
K_OEM_COPY(242),
K_OEM_AUTO(243),
K_OEM_ENLW(244),
K_OEM_BACKTAB(245),
K_ATTN(246),
K_CRSEL(247),
K_EXSEL(248),
K_EREOF(249),
K_PLAY(250),
K_ZOOM(251),
K_NONAME(252),
K_PA1(253),
K_OEM_CLEAR(254);
private int value;
public int getValue(){
return value;
}
Key(int value){
this.value = value;
}
}

View file

@ -1,29 +0,0 @@
package bwapi.Latency;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
SinglePlayer(2),
LanLow(5),
LanMedium(7),
LanHigh(9),
BattlenetLow(14),
BattlenetMedium(19);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,262 +0,0 @@
package bwapi;
import bwapi.AIModule;
import bwapi.BWEventListener;
import java.io.*;
import java.io.File;
import java.lang.Exception;
import java.lang.UnsupportedOperationException;
import java.util.*;
import java.util.zip.*;
/**
* <p>The API entry point. Standard use case:</p>
* <ul>
* <li>Create a Mirror object and use {@link #getModule()} and then set an {@link bwapi.AIModule}'s {@link bwapi.BWEventListener}<br/>
* <li>Call {@link #startGame()} to init the API and connect to Broodwar, then launch Broodwar from ChaosLauncher.</li>
* <li>In you {@link bwapi.BWEventListener#onStart()} method, receive the Game object by calling {@link #getGame()}</li>
* </ul>
* <br/>
* <b>Example</b>
* <pre>
* {@code
*
* mirror.getModule().setEventListener(new DefaultBWListener()
* {
* public void onStart() {
* game = mirror.getGame();
* self = game.self();
* //initialization
* ....
* }
*
* public void onUpdate() {
* for (Unit myUnit : self.getUnits()) {
* //give orders to unit
* ...
* }
* }
* });
* }
* mirror.startGame();
* </pre>
* <p><b>Note:</b> The Game object is initialized during the {@link #startGame()} as well as other BWMirror API's constants.
* Do not use any API releated methods/fields prior to {@link #startGame()}.</p>
*/
public class Mirror {
private Game game;
private AIModule module = new AIModule();
private FrameCallback frameCallback;
private static final boolean EXTRACT_JAR = true;
private static final String VERSION = "1_2";
static {
String arch = System.getProperty("os.arch");
String dllNames[] = {"bwapi_bridge" + VERSION, "gmp-vc90-mt", "mpfr-vc90-mt"};
if(!arch.equals("x86")){
throw new UnsupportedOperationException("BWMirror API supports only x86 architecture.");
}
try {
if (EXTRACT_JAR) {
System.setProperty("java.library.path", ".");
java.lang.reflect.Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
fieldSysPath.setAccessible(true);
fieldSysPath.set(null, null);
String path = Mirror.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = java.net.URLDecoder.decode(path, "UTF-8");
for (String dllName : dllNames) {
String dllNameExt = dllName + ".dll";
if (!new File(dllNameExt).exists()) {
JarResources jar = new JarResources(path);
byte[] correctDllData = jar.getResource(dllNameExt);
FileOutputStream funnyStream = new FileOutputStream(dllNameExt);
funnyStream.write(correctDllData);
funnyStream.close();
}
}
}
} catch (Exception e) {
System.err.println("Failed to extract native libraries.\n" + e);
}
System.loadLibrary(dllNames[0]);
File dataDir = new File("bwapi-data/BWTA");
if(!dataDir.exists()){
try {
dataDir.mkdirs();
} catch (Exception e) {
System.err.println("Unable to create /bwapi-data/BWTA folder, BWTA analysis will not be saved.");
}
}
}
public Game getGame() {
return game;
}
public AIModule getModule() {
return module;
}
/**
* Starts the API, initializes all constants ( {@link bwapi.UnitType}, {@link bwapi.WeaponType} ) and the {@link bwapi.Game} object.
* This method blocks until the end of game.
*/
public native void startGame();
private void update() {
if (frameCallback != null) {
frameCallback.update();
}
}
/*public void setFrameCallback(bwapi.Mirror.FrameCallback frameCallback) {
this.frameCallback = frameCallback;
} */
/**
* The simplest interface to receive update event from Broodwar. The {@link #update()} method is called once each frame.
* For a simple bot and implementation of this interface is enough, to receive all in game events, implement {@link bwapi.BWEventListener}.
*/
/*public*/ private interface FrameCallback {
public void update();
}
@SuppressWarnings({"unchecked"})
private static class JarResources {
// external debug flag
public boolean debugOn = false;
// jar resource mapping tables
private Hashtable htSizes = new Hashtable();
private Hashtable htJarContents = new Hashtable();
// a jar file
private String jarFileName;
/**
* creates a javabot.JarResources. It extracts all resources from a Jar
* into an internal hashtable, keyed by resource names.
*
* @param jarFileName a jar or zip file
*/
public JarResources(String jarFileName) {
this.jarFileName = jarFileName;
init();
}
/**
* Extracts a jar resource as a blob.
*
* @param name a resource name.
*/
public byte[] getResource(String name) {
return (byte[]) htJarContents.get(name);
}
/**
* initializes internal hash tables with Jar file resources.
*/
private void init() {
try {
// extracts just sizes only.
ZipFile zf = new ZipFile(jarFileName);
Enumeration e = zf.entries();
while (e.hasMoreElements()) {
ZipEntry ze = (ZipEntry) e.nextElement();
if (debugOn) {
System.out.println(dumpZipEntry(ze));
}
htSizes.put(ze.getName(), new Integer((int) ze.getSize()));
}
zf.close();
// extract resources and put them into the hashtable.
FileInputStream fis = new FileInputStream(jarFileName);
BufferedInputStream bis = new BufferedInputStream(fis);
ZipInputStream zis = new ZipInputStream(bis);
ZipEntry ze = null;
while ((ze = zis.getNextEntry()) != null) {
if (ze.isDirectory()) {
continue;
}
if (debugOn) {
System.out.println(
"ze.getName()=" + ze.getName() + "," + "getSize()=" + ze.getSize()
);
}
int size = (int) ze.getSize();
// -1 means unknown size.
if (size == -1) {
size = ((Integer) htSizes.get(ze.getName())).intValue();
}
byte[] b = new byte[(int) size];
int rb = 0;
int chunk = 0;
while (((int) size - rb) > 0) {
chunk = zis.read(b, rb, (int) size - rb);
if (chunk == -1) {
break;
}
rb += chunk;
}
// add to internal resource hashtable
htJarContents.put(ze.getName(), b);
if (debugOn) {
System.out.println(
ze.getName() + " rb=" + rb +
",size=" + size +
",csize=" + ze.getCompressedSize()
);
}
}
} catch (NullPointerException e) {
System.out.println("done.");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Dumps a zip entry into a string.
*
* @param ze a ZipEntry
*/
private String dumpZipEntry(ZipEntry ze) {
StringBuffer sb = new StringBuffer();
if (ze.isDirectory()) {
sb.append("d ");
} else {
sb.append("f ");
}
if (ze.getMethod() == ZipEntry.STORED) {
sb.append("stored ");
} else {
sb.append("defalted ");
}
sb.append(ze.getName());
sb.append("\t");
sb.append("" + ze.getSize());
if (ze.getMethod() == ZipEntry.DEFLATED) {
sb.append("/" + ze.getCompressedSize());
}
return (sb.toString());
}
}
}

View file

@ -1,26 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum MouseButton {
M_LEFT(0),
M_RIGHT(1),
M_MIDDLE(2);
private int value;
public int getValue(){
return value;
}
MouseButton(int value){
this.value = value;
}
}

View file

@ -1,358 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Order {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static Order Die;
public static Order Stop;
public static Order Guard;
public static Order PlayerGuard;
public static Order TurretGuard;
public static Order BunkerGuard;
public static Order Move;
public static Order AttackUnit;
public static Order AttackTile;
public static Order Hover;
public static Order AttackMove;
public static Order InfestedCommandCenter;
public static Order UnusedNothing;
public static Order UnusedPowerup;
public static Order TowerGuard;
public static Order VultureMine;
public static Order Nothing;
public static Order Nothing3;
public static Order CastInfestation;
public static Order InfestingCommandCenter;
public static Order PlaceBuilding;
public static Order BuildProtoss2;
public static Order ConstructingBuilding;
public static Order Repair;
public static Order PlaceAddon;
public static Order BuildAddon;
public static Order Train;
public static Order RallyPointUnit;
public static Order RallyPointTile;
public static Order ZergBirth;
public static Order ZergUnitMorph;
public static Order ZergBuildingMorph;
public static Order IncompleteBuilding;
public static Order BuildNydusExit;
public static Order EnterNydusCanal;
public static Order Follow;
public static Order Carrier;
public static Order ReaverCarrierMove;
public static Order CarrierIgnore2;
public static Order Reaver;
public static Order TrainFighter;
public static Order InterceptorAttack;
public static Order ScarabAttack;
public static Order RechargeShieldsUnit;
public static Order RechargeShieldsBattery;
public static Order ShieldBattery;
public static Order InterceptorReturn;
public static Order BuildingLand;
public static Order BuildingLiftOff;
public static Order DroneLiftOff;
public static Order LiftingOff;
public static Order ResearchTech;
public static Order Upgrade;
public static Order Larva;
public static Order SpawningLarva;
public static Order Harvest1;
public static Order Harvest2;
public static Order MoveToGas;
public static Order WaitForGas;
public static Order HarvestGas;
public static Order ReturnGas;
public static Order MoveToMinerals;
public static Order WaitForMinerals;
public static Order MiningMinerals;
public static Order Harvest3;
public static Order Harvest4;
public static Order ReturnMinerals;
public static Order Interrupted;
public static Order EnterTransport;
public static Order PickupIdle;
public static Order PickupTransport;
public static Order PickupBunker;
public static Order Pickup4;
public static Order PowerupIdle;
public static Order Sieging;
public static Order Unsieging;
public static Order InitCreepGrowth;
public static Order SpreadCreep;
public static Order StoppingCreepGrowth;
public static Order GuardianAspect;
public static Order ArchonWarp;
public static Order CompletingArchonsummon;
public static Order HoldPosition;
public static Order Cloak;
public static Order Decloak;
public static Order Unload;
public static Order MoveUnload;
public static Order FireYamatoGun;
public static Order CastLockdown;
public static Order Burrowing;
public static Order Burrowed;
public static Order Unburrowing;
public static Order CastDarkSwarm;
public static Order CastParasite;
public static Order CastSpawnBroodlings;
public static Order CastEMPShockwave;
public static Order NukeWait;
public static Order NukeTrain;
public static Order NukeLaunch;
public static Order NukePaint;
public static Order NukeUnit;
public static Order CastNuclearStrike;
public static Order NukeTrack;
public static Order CloakNearbyUnits;
public static Order PlaceMine;
public static Order RightClickAction;
public static Order CastRecall;
public static Order TeleporttoLocation;
public static Order CastScannerSweep;
public static Order Scanner;
public static Order CastDefensiveMatrix;
public static Order CastPsionicStorm;
public static Order CastIrradiate;
public static Order CastPlague;
public static Order CastConsume;
public static Order CastEnsnare;
public static Order CastStasisField;
public static Order CastHallucination;
public static Order Hallucination2;
public static Order ResetCollision;
public static Order Patrol;
public static Order CTFCOPInit;
public static Order CTFCOPStarted;
public static Order CTFCOP2;
public static Order ComputerAI;
public static Order AtkMoveEP;
public static Order HarassMove;
public static Order AIPatrol;
public static Order GuardPost;
public static Order RescuePassive;
public static Order Neutral;
public static Order ComputerReturn;
public static Order SelfDestrucing;
public static Order Critter;
public static Order HiddenGun;
public static Order OpenDoor;
public static Order CloseDoor;
public static Order HideTrap;
public static Order RevealTrap;
public static Order Enabledoodad;
public static Order Disabledoodad;
public static Order Warpin;
public static Order Medic;
public static Order MedicHeal1;
public static Order HealMove;
public static Order MedicHeal2;
public static Order CastRestoration;
public static Order CastDisruptionWeb;
public static Order CastMindControl;
public static Order DarkArchonMeld;
public static Order CastFeedback;
public static Order CastOpticalFlare;
public static Order CastMaelstrom;
public static Order JunkYardDog;
public static Order Fatal;
public static Order None;
public static Order Unknown;
private static Map<Long, Order> instances = new HashMap<Long, Order>();
private Order(long pointer) {
this.pointer = pointer;
}
private static Order get(long pointer) {
if (pointer == 0 ) {
return null;
}
Order instance = instances.get(pointer);
if (instance == null ) {
instance = new Order(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,358 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Player {
public int getID() {
return getID_native(pointer);
}
public String getName() {
return getName_native(pointer);
}
public List<Unit> getUnits() {
return getUnits_native(pointer);
}
public Race getRace() {
return getRace_native(pointer);
}
public PlayerType getType() {
return getType_native(pointer);
}
public Force getForce() {
return getForce_native(pointer);
}
public boolean isAlly(Player player) {
return isAlly_native(pointer, player);
}
public boolean isEnemy(Player player) {
return isEnemy_native(pointer, player);
}
public boolean isNeutral() {
return isNeutral_native(pointer);
}
public TilePosition getStartLocation() {
return getStartLocation_native(pointer);
}
public boolean isVictorious() {
return isVictorious_native(pointer);
}
public boolean isDefeated() {
return isDefeated_native(pointer);
}
public boolean leftGame() {
return leftGame_native(pointer);
}
public int minerals() {
return minerals_native(pointer);
}
public int gas() {
return gas_native(pointer);
}
public int gatheredMinerals() {
return gatheredMinerals_native(pointer);
}
public int gatheredGas() {
return gatheredGas_native(pointer);
}
public int repairedMinerals() {
return repairedMinerals_native(pointer);
}
public int repairedGas() {
return repairedGas_native(pointer);
}
public int refundedMinerals() {
return refundedMinerals_native(pointer);
}
public int refundedGas() {
return refundedGas_native(pointer);
}
public int spentMinerals() {
return spentMinerals_native(pointer);
}
public int spentGas() {
return spentGas_native(pointer);
}
public int supplyTotal() {
return supplyTotal_native(pointer);
}
public int supplyTotal(Race race) {
return supplyTotal_native(pointer, race);
}
public int supplyUsed() {
return supplyUsed_native(pointer);
}
public int supplyUsed(Race race) {
return supplyUsed_native(pointer, race);
}
public int allUnitCount(UnitType unit) {
return allUnitCount_native(pointer, unit);
}
public int visibleUnitCount(UnitType unit) {
return visibleUnitCount_native(pointer, unit);
}
public int completedUnitCount(UnitType unit) {
return completedUnitCount_native(pointer, unit);
}
public int incompleteUnitCount(UnitType unit) {
return incompleteUnitCount_native(pointer, unit);
}
public int deadUnitCount(UnitType unit) {
return deadUnitCount_native(pointer, unit);
}
public int killedUnitCount(UnitType unit) {
return killedUnitCount_native(pointer, unit);
}
public boolean hasResearched(TechType tech) {
return hasResearched_native(pointer, tech);
}
public boolean isResearching(TechType tech) {
return isResearching_native(pointer, tech);
}
public boolean isUpgrading(UpgradeType upgrade) {
return isUpgrading_native(pointer, upgrade);
}
public Color getColor() {
return getColor_native(pointer);
}
public int getTextColor() {
return getTextColor_native(pointer);
}
public int maxEnergy(UnitType unit) {
return maxEnergy_native(pointer, unit);
}
public double topSpeed(UnitType unit) {
return topSpeed_native(pointer, unit);
}
public int groundWeaponMaxRange(UnitType unit) {
return groundWeaponMaxRange_native(pointer, unit);
}
public int airWeaponMaxRange(UnitType unit) {
return airWeaponMaxRange_native(pointer, unit);
}
public int weaponMaxRange(WeaponType weapon) {
return weaponMaxRange_native(pointer, weapon);
}
public int sightRange(UnitType unit) {
return sightRange_native(pointer, unit);
}
public int groundWeaponDamageCooldown(UnitType unit) {
return groundWeaponDamageCooldown_native(pointer, unit);
}
public int armor(UnitType unit) {
return armor_native(pointer, unit);
}
public int getUnitScore() {
return getUnitScore_native(pointer);
}
public int getKillScore() {
return getKillScore_native(pointer);
}
public int getBuildingScore() {
return getBuildingScore_native(pointer);
}
public int getRazingScore() {
return getRazingScore_native(pointer);
}
public int getCustomScore() {
return getCustomScore_native(pointer);
}
public boolean isObserver() {
return isObserver_native(pointer);
}
public boolean isResearchAvailable(TechType tech) {
return isResearchAvailable_native(pointer, tech);
}
public boolean isUnitAvailable(UnitType unit) {
return isUnitAvailable_native(pointer, unit);
}
private static Map<Long, Player> instances = new HashMap<Long, Player>();
private Player(long pointer) {
this.pointer = pointer;
}
private static Player get(long pointer) {
if (pointer == 0 ) {
return null;
}
Player instance = instances.get(pointer);
if (instance == null ) {
instance = new Player(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native String getName_native(long pointer);
private native List<Unit> getUnits_native(long pointer);
private native Race getRace_native(long pointer);
private native PlayerType getType_native(long pointer);
private native Force getForce_native(long pointer);
private native boolean isAlly_native(long pointer, Player player);
private native boolean isEnemy_native(long pointer, Player player);
private native boolean isNeutral_native(long pointer);
private native TilePosition getStartLocation_native(long pointer);
private native boolean isVictorious_native(long pointer);
private native boolean isDefeated_native(long pointer);
private native boolean leftGame_native(long pointer);
private native int minerals_native(long pointer);
private native int gas_native(long pointer);
private native int gatheredMinerals_native(long pointer);
private native int gatheredGas_native(long pointer);
private native int repairedMinerals_native(long pointer);
private native int repairedGas_native(long pointer);
private native int refundedMinerals_native(long pointer);
private native int refundedGas_native(long pointer);
private native int spentMinerals_native(long pointer);
private native int spentGas_native(long pointer);
private native int supplyTotal_native(long pointer);
private native int supplyTotal_native(long pointer, Race race);
private native int supplyUsed_native(long pointer);
private native int supplyUsed_native(long pointer, Race race);
private native int allUnitCount_native(long pointer, UnitType unit);
private native int visibleUnitCount_native(long pointer, UnitType unit);
private native int completedUnitCount_native(long pointer, UnitType unit);
private native int incompleteUnitCount_native(long pointer, UnitType unit);
private native int deadUnitCount_native(long pointer, UnitType unit);
private native int killedUnitCount_native(long pointer, UnitType unit);
private native boolean hasResearched_native(long pointer, TechType tech);
private native boolean isResearching_native(long pointer, TechType tech);
private native boolean isUpgrading_native(long pointer, UpgradeType upgrade);
private native Color getColor_native(long pointer);
private native int getTextColor_native(long pointer);
private native int maxEnergy_native(long pointer, UnitType unit);
private native double topSpeed_native(long pointer, UnitType unit);
private native int groundWeaponMaxRange_native(long pointer, UnitType unit);
private native int airWeaponMaxRange_native(long pointer, UnitType unit);
private native int weaponMaxRange_native(long pointer, WeaponType weapon);
private native int sightRange_native(long pointer, UnitType unit);
private native int groundWeaponDamageCooldown_native(long pointer, UnitType unit);
private native int armor_native(long pointer, UnitType unit);
private native int getUnitScore_native(long pointer);
private native int getKillScore_native(long pointer);
private native int getBuildingScore_native(long pointer);
private native int getRazingScore_native(long pointer);
private native int getCustomScore_native(long pointer);
private native boolean isObserver_native(long pointer);
private native boolean isResearchAvailable_native(long pointer, TechType tech);
private native boolean isUnitAvailable_native(long pointer, UnitType unit);
}

View file

@ -1,66 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class PlayerType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static PlayerType None;
public static PlayerType Computer;
public static PlayerType Player;
public static PlayerType RescuePassive;
public static PlayerType EitherPreferComputer;
public static PlayerType EitherPreferHuman;
public static PlayerType Neutral;
public static PlayerType Closed;
public static PlayerType PlayerLeft;
public static PlayerType ComputerLeft;
public static PlayerType Unknown;
private static Map<Long, PlayerType> instances = new HashMap<Long, PlayerType>();
private PlayerType(long pointer) {
this.pointer = pointer;
}
private static PlayerType get(long pointer) {
if (pointer == 0 ) {
return null;
}
PlayerType instance = instances.get(pointer);
if (instance == null ) {
instance = new PlayerType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,90 +0,0 @@
package bwapi;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
/**
* Positions are measured in pixels and are the highest resolution.
*/
public class Position extends AbstractPoint<Position>{
private int x, y;
public Position(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "[" + x + ", " + y + "]";
}
public native boolean isValid();
public native Position makeValid();
public native double getDistance(Position position);
public native int getApproxDistance(Position position);
public native double getLength();
public native boolean hasPath(Position position);
public int getX() {
return x;
}
public int getY() {
return y;
}
public static Position Invalid;
public static Position None;
public static Position Unknown;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Position)) return false;
Position position = (Position) o;
if (x != position.x) return false;
if (y != position.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
private static Map<Long, Position> instances = new HashMap<Long, Position>();
private Position(long pointer) {
this.pointer = pointer;
}
private static Position get(long pointer) {
Position instance = instances.get(pointer);
if (instance == null) {
instance = new Position(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
public Position getPoint(){
return this;
}
}

View file

@ -1,15 +0,0 @@
package bwapi;
import bwapi.Position;
/**
* Interrmediate class used to translate getPoint() calls to getPosition() calls.
*/
public abstract class PositionedObject extends AbstractPoint<Position> {
public Position getPoint(){
return getPosition();
}
public abstract Position getPosition();
}

View file

@ -1,88 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Race {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public UnitType getWorker() {
return getWorker_native(pointer);
}
public UnitType getCenter() {
return getCenter_native(pointer);
}
public UnitType getRefinery() {
return getRefinery_native(pointer);
}
public UnitType getTransport() {
return getTransport_native(pointer);
}
public UnitType getSupplyProvider() {
return getSupplyProvider_native(pointer);
}
public static Race Zerg;
public static Race Terran;
public static Race Protoss;
public static Race Random;
public static Race Other;
public static Race None;
public static Race Unknown;
private static Map<Long, Race> instances = new HashMap<Long, Race>();
private Race(long pointer) {
this.pointer = pointer;
}
private static Race get(long pointer) {
if (pointer == 0 ) {
return null;
}
Race instance = instances.get(pointer);
if (instance == null ) {
instance = new Race(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
private native UnitType getWorker_native(long pointer);
private native UnitType getCenter_native(long pointer);
private native UnitType getRefinery_native(long pointer);
private native UnitType getTransport_native(long pointer);
private native UnitType getSupplyProvider_native(long pointer);
}

View file

@ -1,114 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
import bwapi.CenteredObject;
public class Region extends CenteredObject
{
public int getID() {
return getID_native(pointer);
}
public int getRegionGroupID() {
return getRegionGroupID_native(pointer);
}
public Position getCenter() {
return getCenter_native(pointer);
}
public boolean isHigherGround() {
return isHigherGround_native(pointer);
}
public int getDefensePriority() {
return getDefensePriority_native(pointer);
}
public boolean isWalkable() {
return isWalkable_native(pointer);
}
public int getBoundsLeft() {
return getBoundsLeft_native(pointer);
}
public int getBoundsTop() {
return getBoundsTop_native(pointer);
}
public int getBoundsRight() {
return getBoundsRight_native(pointer);
}
public int getBoundsBottom() {
return getBoundsBottom_native(pointer);
}
public Region getClosestAccessibleRegion() {
return getClosestAccessibleRegion_native(pointer);
}
public Region getClosestInaccessibleRegion() {
return getClosestInaccessibleRegion_native(pointer);
}
public int getDistance(Region other) {
return getDistance_native(pointer, other);
}
private static Map<Long, Region> instances = new HashMap<Long, Region>();
private Region(long pointer) {
this.pointer = pointer;
}
private static Region get(long pointer) {
if (pointer == 0 ) {
return null;
}
Region instance = instances.get(pointer);
if (instance == null ) {
instance = new Region(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native int getRegionGroupID_native(long pointer);
private native Position getCenter_native(long pointer);
private native boolean isHigherGround_native(long pointer);
private native int getDefensePriority_native(long pointer);
private native boolean isWalkable_native(long pointer);
private native int getBoundsLeft_native(long pointer);
private native int getBoundsTop_native(long pointer);
private native int getBoundsRight_native(long pointer);
private native int getBoundsBottom_native(long pointer);
private native Region getClosestAccessibleRegion_native(long pointer);
private native Region getClosestInaccessibleRegion_native(long pointer);
private native int getDistance_native(long pointer, Region other);
}

View file

@ -1,30 +0,0 @@
package bwapi.ShapeType;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
None(0),
Text(1),
Box(2),
Triangle(3),
Circle(4),
Ellipse(5),
Dot(6);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,182 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class TechType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public Race getRace() {
return getRace_native(pointer);
}
public int mineralPrice() {
return mineralPrice_native(pointer);
}
public int gasPrice() {
return gasPrice_native(pointer);
}
public int researchTime() {
return researchTime_native(pointer);
}
public int energyUsed() {
return energyUsed_native(pointer);
}
public UnitType whatResearches() {
return whatResearches_native(pointer);
}
public WeaponType getWeapon() {
return getWeapon_native(pointer);
}
public boolean targetsUnit() {
return targetsUnit_native(pointer);
}
public boolean targetsPosition() {
return targetsPosition_native(pointer);
}
public List<UnitType> whatUses() {
return whatUses_native(pointer);
}
public Order getOrder() {
return getOrder_native(pointer);
}
public static TechType Stim_Packs;
public static TechType Lockdown;
public static TechType EMP_Shockwave;
public static TechType Spider_Mines;
public static TechType Scanner_Sweep;
public static TechType Tank_Siege_Mode;
public static TechType Defensive_Matrix;
public static TechType Irradiate;
public static TechType Yamato_Gun;
public static TechType Cloaking_Field;
public static TechType Personnel_Cloaking;
public static TechType Burrowing;
public static TechType Infestation;
public static TechType Spawn_Broodlings;
public static TechType Dark_Swarm;
public static TechType Plague;
public static TechType Consume;
public static TechType Ensnare;
public static TechType Parasite;
public static TechType Psionic_Storm;
public static TechType Hallucination;
public static TechType Recall;
public static TechType Stasis_Field;
public static TechType Archon_Warp;
public static TechType Restoration;
public static TechType Disruption_Web;
public static TechType Mind_Control;
public static TechType Dark_Archon_Meld;
public static TechType Feedback;
public static TechType Optical_Flare;
public static TechType Maelstrom;
public static TechType Lurker_Aspect;
public static TechType Healing;
public static TechType None;
public static TechType Unknown;
public static TechType Nuclear_Strike;
private static Map<Long, TechType> instances = new HashMap<Long, TechType>();
private TechType(long pointer) {
this.pointer = pointer;
}
private static TechType get(long pointer) {
if (pointer == 0 ) {
return null;
}
TechType instance = instances.get(pointer);
if (instance == null ) {
instance = new TechType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
private native Race getRace_native(long pointer);
private native int mineralPrice_native(long pointer);
private native int gasPrice_native(long pointer);
private native int researchTime_native(long pointer);
private native int energyUsed_native(long pointer);
private native UnitType whatResearches_native(long pointer);
private native WeaponType getWeapon_native(long pointer);
private native boolean targetsUnit_native(long pointer);
private native boolean targetsPosition_native(long pointer);
private native List<UnitType> whatUses_native(long pointer);
private native Order getOrder_native(long pointer);
}

View file

@ -1,89 +0,0 @@
package bwapi;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
/**
* Build Tiles - each build tile is a 4x4 square of walk tiles, or a 32x32 square of pixels.
* These are called build tiles because buildability data is available at this resolution, and correspond to the tiles seen in game.
* For example, a Command Center occupies an area of 4x3 build tiles.
*/
public class TilePosition extends AbstractPoint<TilePosition>{
private int x, y;
public TilePosition(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "[" + x + ", " + y + "]";
}
public native boolean hasPath(TilePosition position);
public native boolean isValid();
public native TilePosition makeValid();
public native double getDistance(TilePosition position);
public native double getLength();
public int getX() {
return x;
}
public int getY() {
return y;
}
public static TilePosition Invalid;
public static TilePosition None;
public static TilePosition Unknown;
private static Map<Long, TilePosition> instances = new HashMap<Long, TilePosition>();
private TilePosition(long pointer) {
this.pointer = pointer;
}
private static TilePosition get(long pointer) {
TilePosition instance = instances.get(pointer);
if (instance == null) {
instance = new TilePosition(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TilePosition)) return false;
TilePosition that = (TilePosition) o;
if (x != that.x) return false;
if (y != that.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
public TilePosition getPoint(){
return this;
}
}

View file

@ -1,38 +0,0 @@
package bwapi.Tournament;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum ActionID {
EnableFlag(0),
ChangeRace(1),
StartGame(2),
PauseGame(3),
ResumeGame(4),
LeaveGame(5),
RestartGame(6),
SetLocalSpeed(7),
SetTextSize(8),
SetLatCom(9),
SetGUI(10),
SetMap(11),
SetFrameSkip(12),
Printf(13),
SendText(14);
private int value;
public int getValue(){
return value;
}
ActionID(int value){
this.value = value;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,40 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitCommand {
public UnitCommandType getType() {
return getType_native(pointer);
}
private static Map<Long, UnitCommand> instances = new HashMap<Long, UnitCommand>();
private UnitCommand(long pointer) {
this.pointer = pointer;
}
private static UnitCommand get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitCommand instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitCommand(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native UnitCommandType getType_native(long pointer);
}

View file

@ -1,136 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitCommandType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static UnitCommandType Attack_Move;
public static UnitCommandType Attack_Unit;
public static UnitCommandType Build;
public static UnitCommandType Build_Addon;
public static UnitCommandType Train;
public static UnitCommandType Morph;
public static UnitCommandType Research;
public static UnitCommandType Upgrade;
public static UnitCommandType Set_Rally_Position;
public static UnitCommandType Set_Rally_Unit;
public static UnitCommandType Move;
public static UnitCommandType Patrol;
public static UnitCommandType Hold_Position;
public static UnitCommandType Stop;
public static UnitCommandType Follow;
public static UnitCommandType Gather;
public static UnitCommandType Return_Cargo;
public static UnitCommandType Repair;
public static UnitCommandType Burrow;
public static UnitCommandType Unburrow;
public static UnitCommandType Cloak;
public static UnitCommandType Decloak;
public static UnitCommandType Siege;
public static UnitCommandType Unsiege;
public static UnitCommandType Lift;
public static UnitCommandType Land;
public static UnitCommandType Load;
public static UnitCommandType Unload;
public static UnitCommandType Unload_All;
public static UnitCommandType Unload_All_Position;
public static UnitCommandType Right_Click_Position;
public static UnitCommandType Right_Click_Unit;
public static UnitCommandType Halt_Construction;
public static UnitCommandType Cancel_Construction;
public static UnitCommandType Cancel_Addon;
public static UnitCommandType Cancel_Train;
public static UnitCommandType Cancel_Train_Slot;
public static UnitCommandType Cancel_Morph;
public static UnitCommandType Cancel_Research;
public static UnitCommandType Cancel_Upgrade;
public static UnitCommandType Use_Tech;
public static UnitCommandType Use_Tech_Position;
public static UnitCommandType Use_Tech_Unit;
public static UnitCommandType Place_COP;
public static UnitCommandType None;
public static UnitCommandType Unknown;
private static Map<Long, UnitCommandType> instances = new HashMap<Long, UnitCommandType>();
private UnitCommandType(long pointer) {
this.pointer = pointer;
}
private static UnitCommandType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitCommandType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitCommandType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,56 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitSizeType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public static UnitSizeType Independent;
public static UnitSizeType Small;
public static UnitSizeType Medium;
public static UnitSizeType Large;
public static UnitSizeType None;
public static UnitSizeType Unknown;
private static Map<Long, UnitSizeType> instances = new HashMap<Long, UnitSizeType>();
private UnitSizeType(long pointer) {
this.pointer = pointer;
}
private static UnitSizeType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitSizeType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitSizeType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
}

View file

@ -1,886 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public Race getRace() {
return getRace_native(pointer);
}
public TechType requiredTech() {
return requiredTech_native(pointer);
}
public TechType cloakingTech() {
return cloakingTech_native(pointer);
}
public List<TechType> abilities() {
return abilities_native(pointer);
}
public List<UpgradeType> upgrades() {
return upgrades_native(pointer);
}
public UpgradeType armorUpgrade() {
return armorUpgrade_native(pointer);
}
public int maxHitPoints() {
return maxHitPoints_native(pointer);
}
public int maxShields() {
return maxShields_native(pointer);
}
public int maxEnergy() {
return maxEnergy_native(pointer);
}
public int armor() {
return armor_native(pointer);
}
public int mineralPrice() {
return mineralPrice_native(pointer);
}
public int gasPrice() {
return gasPrice_native(pointer);
}
public int buildTime() {
return buildTime_native(pointer);
}
public int supplyRequired() {
return supplyRequired_native(pointer);
}
public int supplyProvided() {
return supplyProvided_native(pointer);
}
public int spaceRequired() {
return spaceRequired_native(pointer);
}
public int spaceProvided() {
return spaceProvided_native(pointer);
}
public int buildScore() {
return buildScore_native(pointer);
}
public int destroyScore() {
return destroyScore_native(pointer);
}
public UnitSizeType size() {
return size_native(pointer);
}
public int tileWidth() {
return tileWidth_native(pointer);
}
public int tileHeight() {
return tileHeight_native(pointer);
}
public int dimensionLeft() {
return dimensionLeft_native(pointer);
}
public int dimensionUp() {
return dimensionUp_native(pointer);
}
public int dimensionRight() {
return dimensionRight_native(pointer);
}
public int dimensionDown() {
return dimensionDown_native(pointer);
}
public int seekRange() {
return seekRange_native(pointer);
}
public int sightRange() {
return sightRange_native(pointer);
}
public WeaponType groundWeapon() {
return groundWeapon_native(pointer);
}
public int maxGroundHits() {
return maxGroundHits_native(pointer);
}
public WeaponType airWeapon() {
return airWeapon_native(pointer);
}
public int maxAirHits() {
return maxAirHits_native(pointer);
}
public double topSpeed() {
return topSpeed_native(pointer);
}
public int acceleration() {
return acceleration_native(pointer);
}
public int haltDistance() {
return haltDistance_native(pointer);
}
public int turnRadius() {
return turnRadius_native(pointer);
}
public boolean canProduce() {
return canProduce_native(pointer);
}
public boolean canAttack() {
return canAttack_native(pointer);
}
public boolean canMove() {
return canMove_native(pointer);
}
public boolean isFlyer() {
return isFlyer_native(pointer);
}
public boolean regeneratesHP() {
return regeneratesHP_native(pointer);
}
public boolean isSpellcaster() {
return isSpellcaster_native(pointer);
}
public boolean hasPermanentCloak() {
return hasPermanentCloak_native(pointer);
}
public boolean isInvincible() {
return isInvincible_native(pointer);
}
public boolean isOrganic() {
return isOrganic_native(pointer);
}
public boolean isMechanical() {
return isMechanical_native(pointer);
}
public boolean isRobotic() {
return isRobotic_native(pointer);
}
public boolean isDetector() {
return isDetector_native(pointer);
}
public boolean isResourceContainer() {
return isResourceContainer_native(pointer);
}
public boolean isResourceDepot() {
return isResourceDepot_native(pointer);
}
public boolean isRefinery() {
return isRefinery_native(pointer);
}
public boolean isWorker() {
return isWorker_native(pointer);
}
public boolean requiresPsi() {
return requiresPsi_native(pointer);
}
public boolean requiresCreep() {
return requiresCreep_native(pointer);
}
public boolean isTwoUnitsInOneEgg() {
return isTwoUnitsInOneEgg_native(pointer);
}
public boolean isBurrowable() {
return isBurrowable_native(pointer);
}
public boolean isCloakable() {
return isCloakable_native(pointer);
}
public boolean isBuilding() {
return isBuilding_native(pointer);
}
public boolean isAddon() {
return isAddon_native(pointer);
}
public boolean isFlyingBuilding() {
return isFlyingBuilding_native(pointer);
}
public boolean isNeutral() {
return isNeutral_native(pointer);
}
public boolean isHero() {
return isHero_native(pointer);
}
public boolean isPowerup() {
return isPowerup_native(pointer);
}
public boolean isBeacon() {
return isBeacon_native(pointer);
}
public boolean isFlagBeacon() {
return isFlagBeacon_native(pointer);
}
public boolean isSpecialBuilding() {
return isSpecialBuilding_native(pointer);
}
public boolean isSpell() {
return isSpell_native(pointer);
}
public boolean producesLarva() {
return producesLarva_native(pointer);
}
public boolean isMineralField() {
return isMineralField_native(pointer);
}
public boolean canBuildAddon() {
return canBuildAddon_native(pointer);
}
public static UnitType Terran_Marine;
public static UnitType Hero_Jim_Raynor_Marine;
public static UnitType Terran_Ghost;
public static UnitType Hero_Sarah_Kerrigan;
public static UnitType Hero_Samir_Duran;
public static UnitType Hero_Infested_Duran;
public static UnitType Hero_Alexei_Stukov;
public static UnitType Terran_Vulture;
public static UnitType Hero_Jim_Raynor_Vulture;
public static UnitType Terran_Goliath;
public static UnitType Hero_Alan_Schezar;
public static UnitType Terran_Siege_Tank_Tank_Mode;
public static UnitType Hero_Edmund_Duke_Tank_Mode;
public static UnitType Terran_SCV;
public static UnitType Terran_Wraith;
public static UnitType Hero_Tom_Kazansky;
public static UnitType Terran_Science_Vessel;
public static UnitType Hero_Magellan;
public static UnitType Terran_Dropship;
public static UnitType Terran_Battlecruiser;
public static UnitType Hero_Arcturus_Mengsk;
public static UnitType Hero_Hyperion;
public static UnitType Hero_Norad_II;
public static UnitType Hero_Gerard_DuGalle;
public static UnitType Terran_Vulture_Spider_Mine;
public static UnitType Terran_Nuclear_Missile;
public static UnitType Terran_Siege_Tank_Siege_Mode;
public static UnitType Hero_Edmund_Duke_Siege_Mode;
public static UnitType Terran_Firebat;
public static UnitType Hero_Gui_Montag;
public static UnitType Spell_Scanner_Sweep;
public static UnitType Terran_Medic;
public static UnitType Terran_Civilian;
public static UnitType Zerg_Larva;
public static UnitType Zerg_Egg;
public static UnitType Zerg_Zergling;
public static UnitType Hero_Devouring_One;
public static UnitType Hero_Infested_Kerrigan;
public static UnitType Zerg_Hydralisk;
public static UnitType Hero_Hunter_Killer;
public static UnitType Zerg_Ultralisk;
public static UnitType Hero_Torrasque;
public static UnitType Zerg_Broodling;
public static UnitType Zerg_Drone;
public static UnitType Zerg_Overlord;
public static UnitType Hero_Yggdrasill;
public static UnitType Zerg_Mutalisk;
public static UnitType Hero_Kukulza_Mutalisk;
public static UnitType Zerg_Guardian;
public static UnitType Hero_Kukulza_Guardian;
public static UnitType Zerg_Queen;
public static UnitType Hero_Matriarch;
public static UnitType Zerg_Defiler;
public static UnitType Hero_Unclean_One;
public static UnitType Zerg_Scourge;
public static UnitType Zerg_Infested_Terran;
public static UnitType Terran_Valkyrie;
public static UnitType Zerg_Cocoon;
public static UnitType Protoss_Corsair;
public static UnitType Hero_Raszagal;
public static UnitType Protoss_Dark_Templar;
public static UnitType Hero_Dark_Templar;
public static UnitType Hero_Zeratul;
public static UnitType Zerg_Devourer;
public static UnitType Protoss_Dark_Archon;
public static UnitType Protoss_Probe;
public static UnitType Protoss_Zealot;
public static UnitType Hero_Fenix_Zealot;
public static UnitType Protoss_Dragoon;
public static UnitType Hero_Fenix_Dragoon;
public static UnitType Protoss_High_Templar;
public static UnitType Hero_Tassadar;
public static UnitType Hero_Aldaris;
public static UnitType Protoss_Archon;
public static UnitType Hero_Tassadar_Zeratul_Archon;
public static UnitType Protoss_Shuttle;
public static UnitType Protoss_Scout;
public static UnitType Hero_Mojo;
public static UnitType Hero_Artanis;
public static UnitType Protoss_Arbiter;
public static UnitType Hero_Danimoth;
public static UnitType Protoss_Carrier;
public static UnitType Hero_Gantrithor;
public static UnitType Protoss_Interceptor;
public static UnitType Protoss_Reaver;
public static UnitType Hero_Warbringer;
public static UnitType Protoss_Observer;
public static UnitType Protoss_Scarab;
public static UnitType Critter_Rhynadon;
public static UnitType Critter_Bengalaas;
public static UnitType Special_Cargo_Ship;
public static UnitType Special_Mercenary_Gunship;
public static UnitType Critter_Scantid;
public static UnitType Critter_Kakaru;
public static UnitType Critter_Ragnasaur;
public static UnitType Critter_Ursadon;
public static UnitType Zerg_Lurker_Egg;
public static UnitType Zerg_Lurker;
public static UnitType Spell_Disruption_Web;
public static UnitType Terran_Command_Center;
public static UnitType Terran_Comsat_Station;
public static UnitType Terran_Nuclear_Silo;
public static UnitType Terran_Supply_Depot;
public static UnitType Terran_Refinery;
public static UnitType Terran_Barracks;
public static UnitType Terran_Academy;
public static UnitType Terran_Factory;
public static UnitType Terran_Starport;
public static UnitType Terran_Control_Tower;
public static UnitType Terran_Science_Facility;
public static UnitType Terran_Covert_Ops;
public static UnitType Terran_Physics_Lab;
public static UnitType Terran_Machine_Shop;
public static UnitType Terran_Engineering_Bay;
public static UnitType Terran_Armory;
public static UnitType Terran_Missile_Turret;
public static UnitType Terran_Bunker;
public static UnitType Special_Crashed_Norad_II;
public static UnitType Special_Ion_Cannon;
public static UnitType Zerg_Infested_Command_Center;
public static UnitType Zerg_Hatchery;
public static UnitType Zerg_Lair;
public static UnitType Zerg_Hive;
public static UnitType Zerg_Nydus_Canal;
public static UnitType Zerg_Hydralisk_Den;
public static UnitType Zerg_Defiler_Mound;
public static UnitType Zerg_Greater_Spire;
public static UnitType Zerg_Queens_Nest;
public static UnitType Zerg_Evolution_Chamber;
public static UnitType Zerg_Ultralisk_Cavern;
public static UnitType Zerg_Spire;
public static UnitType Zerg_Spawning_Pool;
public static UnitType Zerg_Creep_Colony;
public static UnitType Zerg_Spore_Colony;
public static UnitType Zerg_Sunken_Colony;
public static UnitType Special_Overmind_With_Shell;
public static UnitType Special_Overmind;
public static UnitType Zerg_Extractor;
public static UnitType Special_Mature_Chrysalis;
public static UnitType Special_Cerebrate;
public static UnitType Special_Cerebrate_Daggoth;
public static UnitType Protoss_Nexus;
public static UnitType Protoss_Robotics_Facility;
public static UnitType Protoss_Pylon;
public static UnitType Protoss_Assimilator;
public static UnitType Protoss_Observatory;
public static UnitType Protoss_Gateway;
public static UnitType Protoss_Photon_Cannon;
public static UnitType Protoss_Citadel_of_Adun;
public static UnitType Protoss_Cybernetics_Core;
public static UnitType Protoss_Templar_Archives;
public static UnitType Protoss_Forge;
public static UnitType Protoss_Stargate;
public static UnitType Special_Stasis_Cell_Prison;
public static UnitType Protoss_Fleet_Beacon;
public static UnitType Protoss_Arbiter_Tribunal;
public static UnitType Protoss_Robotics_Support_Bay;
public static UnitType Protoss_Shield_Battery;
public static UnitType Special_Khaydarin_Crystal_Form;
public static UnitType Special_Protoss_Temple;
public static UnitType Special_XelNaga_Temple;
public static UnitType Resource_Mineral_Field;
public static UnitType Resource_Mineral_Field_Type_2;
public static UnitType Resource_Mineral_Field_Type_3;
public static UnitType Special_Independant_Starport;
public static UnitType Resource_Vespene_Geyser;
public static UnitType Special_Warp_Gate;
public static UnitType Special_Psi_Disrupter;
public static UnitType Special_Power_Generator;
public static UnitType Special_Overmind_Cocoon;
public static UnitType Special_Zerg_Beacon;
public static UnitType Special_Terran_Beacon;
public static UnitType Special_Protoss_Beacon;
public static UnitType Special_Zerg_Flag_Beacon;
public static UnitType Special_Terran_Flag_Beacon;
public static UnitType Special_Protoss_Flag_Beacon;
public static UnitType Spell_Dark_Swarm;
public static UnitType Powerup_Uraj_Crystal;
public static UnitType Powerup_Khalis_Crystal;
public static UnitType Powerup_Flag;
public static UnitType Powerup_Young_Chrysalis;
public static UnitType Powerup_Psi_Emitter;
public static UnitType Powerup_Data_Disk;
public static UnitType Powerup_Khaydarin_Crystal;
public static UnitType Powerup_Mineral_Cluster_Type_1;
public static UnitType Powerup_Mineral_Cluster_Type_2;
public static UnitType Powerup_Protoss_Gas_Orb_Type_1;
public static UnitType Powerup_Protoss_Gas_Orb_Type_2;
public static UnitType Powerup_Zerg_Gas_Sac_Type_1;
public static UnitType Powerup_Zerg_Gas_Sac_Type_2;
public static UnitType Powerup_Terran_Gas_Tank_Type_1;
public static UnitType Powerup_Terran_Gas_Tank_Type_2;
public static UnitType Special_Map_Revealer;
public static UnitType Special_Floor_Missile_Trap;
public static UnitType Special_Floor_Hatch;
public static UnitType Special_Upper_Level_Door;
public static UnitType Special_Right_Upper_Level_Door;
public static UnitType Special_Pit_Door;
public static UnitType Special_Right_Pit_Door;
public static UnitType Special_Floor_Gun_Trap;
public static UnitType Special_Wall_Missile_Trap;
public static UnitType Special_Wall_Flame_Trap;
public static UnitType Special_Right_Wall_Missile_Trap;
public static UnitType Special_Right_Wall_Flame_Trap;
public static UnitType Special_Start_Location;
public static UnitType None;
public static UnitType AllUnits;
public static UnitType Men;
public static UnitType Buildings;
public static UnitType Factories;
public static UnitType Unknown;
private static Map<Long, UnitType> instances = new HashMap<Long, UnitType>();
private UnitType(long pointer) {
this.pointer = pointer;
}
private static UnitType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
private native Race getRace_native(long pointer);
private native TechType requiredTech_native(long pointer);
private native TechType cloakingTech_native(long pointer);
private native List<TechType> abilities_native(long pointer);
private native List<UpgradeType> upgrades_native(long pointer);
private native UpgradeType armorUpgrade_native(long pointer);
private native int maxHitPoints_native(long pointer);
private native int maxShields_native(long pointer);
private native int maxEnergy_native(long pointer);
private native int armor_native(long pointer);
private native int mineralPrice_native(long pointer);
private native int gasPrice_native(long pointer);
private native int buildTime_native(long pointer);
private native int supplyRequired_native(long pointer);
private native int supplyProvided_native(long pointer);
private native int spaceRequired_native(long pointer);
private native int spaceProvided_native(long pointer);
private native int buildScore_native(long pointer);
private native int destroyScore_native(long pointer);
private native UnitSizeType size_native(long pointer);
private native int tileWidth_native(long pointer);
private native int tileHeight_native(long pointer);
private native int dimensionLeft_native(long pointer);
private native int dimensionUp_native(long pointer);
private native int dimensionRight_native(long pointer);
private native int dimensionDown_native(long pointer);
private native int seekRange_native(long pointer);
private native int sightRange_native(long pointer);
private native WeaponType groundWeapon_native(long pointer);
private native int maxGroundHits_native(long pointer);
private native WeaponType airWeapon_native(long pointer);
private native int maxAirHits_native(long pointer);
private native double topSpeed_native(long pointer);
private native int acceleration_native(long pointer);
private native int haltDistance_native(long pointer);
private native int turnRadius_native(long pointer);
private native boolean canProduce_native(long pointer);
private native boolean canAttack_native(long pointer);
private native boolean canMove_native(long pointer);
private native boolean isFlyer_native(long pointer);
private native boolean regeneratesHP_native(long pointer);
private native boolean isSpellcaster_native(long pointer);
private native boolean hasPermanentCloak_native(long pointer);
private native boolean isInvincible_native(long pointer);
private native boolean isOrganic_native(long pointer);
private native boolean isMechanical_native(long pointer);
private native boolean isRobotic_native(long pointer);
private native boolean isDetector_native(long pointer);
private native boolean isResourceContainer_native(long pointer);
private native boolean isResourceDepot_native(long pointer);
private native boolean isRefinery_native(long pointer);
private native boolean isWorker_native(long pointer);
private native boolean requiresPsi_native(long pointer);
private native boolean requiresCreep_native(long pointer);
private native boolean isTwoUnitsInOneEgg_native(long pointer);
private native boolean isBurrowable_native(long pointer);
private native boolean isCloakable_native(long pointer);
private native boolean isBuilding_native(long pointer);
private native boolean isAddon_native(long pointer);
private native boolean isFlyingBuilding_native(long pointer);
private native boolean isNeutral_native(long pointer);
private native boolean isHero_native(long pointer);
private native boolean isPowerup_native(long pointer);
private native boolean isBeacon_native(long pointer);
private native boolean isFlagBeacon_native(long pointer);
private native boolean isSpecialBuilding_native(long pointer);
private native boolean isSpell_native(long pointer);
private native boolean producesLarva_native(long pointer);
private native boolean isMineralField_native(long pointer);
private native boolean canBuildAddon_native(long pointer);
}

View file

@ -1,238 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UpgradeType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public Race getRace() {
return getRace_native(pointer);
}
public int mineralPrice() {
return mineralPrice_native(pointer);
}
public int mineralPrice(int level) {
return mineralPrice_native(pointer, level);
}
public int mineralPriceFactor() {
return mineralPriceFactor_native(pointer);
}
public int gasPrice() {
return gasPrice_native(pointer);
}
public int gasPrice(int level) {
return gasPrice_native(pointer, level);
}
public int gasPriceFactor() {
return gasPriceFactor_native(pointer);
}
public int upgradeTime() {
return upgradeTime_native(pointer);
}
public int upgradeTime(int level) {
return upgradeTime_native(pointer, level);
}
public int upgradeTimeFactor() {
return upgradeTimeFactor_native(pointer);
}
public int maxRepeats() {
return maxRepeats_native(pointer);
}
public UnitType whatUpgrades() {
return whatUpgrades_native(pointer);
}
public UnitType whatsRequired() {
return whatsRequired_native(pointer);
}
public UnitType whatsRequired(int level) {
return whatsRequired_native(pointer, level);
}
public List<UnitType> whatUses() {
return whatUses_native(pointer);
}
public static UpgradeType Terran_Infantry_Armor;
public static UpgradeType Terran_Vehicle_Plating;
public static UpgradeType Terran_Ship_Plating;
public static UpgradeType Zerg_Carapace;
public static UpgradeType Zerg_Flyer_Carapace;
public static UpgradeType Protoss_Ground_Armor;
public static UpgradeType Protoss_Air_Armor;
public static UpgradeType Terran_Infantry_Weapons;
public static UpgradeType Terran_Vehicle_Weapons;
public static UpgradeType Terran_Ship_Weapons;
public static UpgradeType Zerg_Melee_Attacks;
public static UpgradeType Zerg_Missile_Attacks;
public static UpgradeType Zerg_Flyer_Attacks;
public static UpgradeType Protoss_Ground_Weapons;
public static UpgradeType Protoss_Air_Weapons;
public static UpgradeType Protoss_Plasma_Shields;
public static UpgradeType U_238_Shells;
public static UpgradeType Ion_Thrusters;
public static UpgradeType Titan_Reactor;
public static UpgradeType Ocular_Implants;
public static UpgradeType Moebius_Reactor;
public static UpgradeType Apollo_Reactor;
public static UpgradeType Colossus_Reactor;
public static UpgradeType Ventral_Sacs;
public static UpgradeType Antennae;
public static UpgradeType Pneumatized_Carapace;
public static UpgradeType Metabolic_Boost;
public static UpgradeType Adrenal_Glands;
public static UpgradeType Muscular_Augments;
public static UpgradeType Grooved_Spines;
public static UpgradeType Gamete_Meiosis;
public static UpgradeType Metasynaptic_Node;
public static UpgradeType Singularity_Charge;
public static UpgradeType Leg_Enhancements;
public static UpgradeType Scarab_Damage;
public static UpgradeType Reaver_Capacity;
public static UpgradeType Gravitic_Drive;
public static UpgradeType Sensor_Array;
public static UpgradeType Gravitic_Boosters;
public static UpgradeType Khaydarin_Amulet;
public static UpgradeType Apial_Sensors;
public static UpgradeType Gravitic_Thrusters;
public static UpgradeType Carrier_Capacity;
public static UpgradeType Khaydarin_Core;
public static UpgradeType Argus_Jewel;
public static UpgradeType Argus_Talisman;
public static UpgradeType Caduceus_Reactor;
public static UpgradeType Chitinous_Plating;
public static UpgradeType Anabolic_Synthesis;
public static UpgradeType Charon_Boosters;
public static UpgradeType None;
public static UpgradeType Unknown;
private static Map<Long, UpgradeType> instances = new HashMap<Long, UpgradeType>();
private UpgradeType(long pointer) {
this.pointer = pointer;
}
private static UpgradeType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UpgradeType instance = instances.get(pointer);
if (instance == null ) {
instance = new UpgradeType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
private native Race getRace_native(long pointer);
private native int mineralPrice_native(long pointer);
private native int mineralPrice_native(long pointer, int level);
private native int mineralPriceFactor_native(long pointer);
private native int gasPrice_native(long pointer);
private native int gasPrice_native(long pointer, int level);
private native int gasPriceFactor_native(long pointer);
private native int upgradeTime_native(long pointer);
private native int upgradeTime_native(long pointer, int level);
private native int upgradeTimeFactor_native(long pointer);
private native int maxRepeats_native(long pointer);
private native UnitType whatUpgrades_native(long pointer);
private native UnitType whatsRequired_native(long pointer);
private native UnitType whatsRequired_native(long pointer, int level);
private native List<UnitType> whatUses_native(long pointer);
}

View file

@ -1,52 +0,0 @@
package bwapi;
import java.lang.String;
import java.lang.System;
/**
*
*/
public class Utils {
public static final byte Previous = 0x01;
public static final byte Cyan = 0x02;
public static final byte Yellow = 0x03;
public static final byte White = 0x04;
public static final byte Grey = 0x05;
public static final byte Red = 0x06;
public static final byte Green = 0x07;
public static final byte Red_P1 = 0x08;
public static final byte Tab = 0x09;
public static final byte Newline = 0x0A;
public static final byte Invisible_no_override = 0x0B;
public static final byte Remove_beyond = 0x0C;
public static final byte Clear_formatting = 0x0D;
public static final byte Blue = 0x0E;
public static final byte Teal = 0x0F;
public static final byte Purple = 0x10;
public static final byte Orange = 0x11;
public static final byte Right_Align = 0x12;
public static final byte Center_Align = 0x13;
public static final byte Invisible = 0x14;
public static final byte Brown = 0x15;
public static final byte White_p7 = 0x16;
public static final byte Yellow_p8 = 0x17;
public static final byte Green_p9 = 0x18;
public static final byte Brighter_Yellow = 0x19;
public static final byte Cyan_default = 0x1A;
public static final byte Pinkish = 0x1B;
public static final byte Dark_Cyan = 0x1C;
public static final byte Greygreen = 0x1D;
public static final byte Bluegrey = 0x1E;
public static final byte Turquoise = 0x1F;
public static String formatText(String text, byte format){
byte[] textData = text.getBytes();
int textDataLength = text.length();
byte[] newTextData = new byte[textDataLength + 1];
newTextData[0] = format;
System.arraycopy(textData, 0, newTextData, 1, textDataLength);
return new String(newTextData);
}
}

View file

@ -1,386 +0,0 @@
package bwapi;
import bwapi.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class WeaponType {
public String c_str() {
return c_str_native(pointer);
}
public String toString(){
return c_str();
}
public TechType getTech() {
return getTech_native(pointer);
}
public UnitType whatUses() {
return whatUses_native(pointer);
}
public int damageAmount() {
return damageAmount_native(pointer);
}
public int damageBonus() {
return damageBonus_native(pointer);
}
public int damageCooldown() {
return damageCooldown_native(pointer);
}
public int damageFactor() {
return damageFactor_native(pointer);
}
public UpgradeType upgradeType() {
return upgradeType_native(pointer);
}
public DamageType damageType() {
return damageType_native(pointer);
}
public ExplosionType explosionType() {
return explosionType_native(pointer);
}
public int minRange() {
return minRange_native(pointer);
}
public int maxRange() {
return maxRange_native(pointer);
}
public int innerSplashRadius() {
return innerSplashRadius_native(pointer);
}
public int medianSplashRadius() {
return medianSplashRadius_native(pointer);
}
public int outerSplashRadius() {
return outerSplashRadius_native(pointer);
}
public boolean targetsAir() {
return targetsAir_native(pointer);
}
public boolean targetsGround() {
return targetsGround_native(pointer);
}
public boolean targetsMechanical() {
return targetsMechanical_native(pointer);
}
public boolean targetsOrganic() {
return targetsOrganic_native(pointer);
}
public boolean targetsNonBuilding() {
return targetsNonBuilding_native(pointer);
}
public boolean targetsNonRobotic() {
return targetsNonRobotic_native(pointer);
}
public boolean targetsTerrain() {
return targetsTerrain_native(pointer);
}
public boolean targetsOrgOrMech() {
return targetsOrgOrMech_native(pointer);
}
public boolean targetsOwn() {
return targetsOwn_native(pointer);
}
public static WeaponType Gauss_Rifle;
public static WeaponType Gauss_Rifle_Jim_Raynor;
public static WeaponType C_10_Canister_Rifle;
public static WeaponType C_10_Canister_Rifle_Sarah_Kerrigan;
public static WeaponType C_10_Canister_Rifle_Samir_Duran;
public static WeaponType C_10_Canister_Rifle_Infested_Duran;
public static WeaponType C_10_Canister_Rifle_Alexei_Stukov;
public static WeaponType Fragmentation_Grenade;
public static WeaponType Fragmentation_Grenade_Jim_Raynor;
public static WeaponType Spider_Mines;
public static WeaponType Twin_Autocannons;
public static WeaponType Twin_Autocannons_Alan_Schezar;
public static WeaponType Hellfire_Missile_Pack;
public static WeaponType Hellfire_Missile_Pack_Alan_Schezar;
public static WeaponType Arclite_Cannon;
public static WeaponType Arclite_Cannon_Edmund_Duke;
public static WeaponType Fusion_Cutter;
public static WeaponType Gemini_Missiles;
public static WeaponType Gemini_Missiles_Tom_Kazansky;
public static WeaponType Burst_Lasers;
public static WeaponType Burst_Lasers_Tom_Kazansky;
public static WeaponType ATS_Laser_Battery;
public static WeaponType ATS_Laser_Battery_Hero;
public static WeaponType ATS_Laser_Battery_Hyperion;
public static WeaponType ATA_Laser_Battery;
public static WeaponType ATA_Laser_Battery_Hero;
public static WeaponType ATA_Laser_Battery_Hyperion;
public static WeaponType Flame_Thrower;
public static WeaponType Flame_Thrower_Gui_Montag;
public static WeaponType Arclite_Shock_Cannon;
public static WeaponType Arclite_Shock_Cannon_Edmund_Duke;
public static WeaponType Longbolt_Missile;
public static WeaponType Claws;
public static WeaponType Claws_Devouring_One;
public static WeaponType Claws_Infested_Kerrigan;
public static WeaponType Needle_Spines;
public static WeaponType Needle_Spines_Hunter_Killer;
public static WeaponType Kaiser_Blades;
public static WeaponType Kaiser_Blades_Torrasque;
public static WeaponType Toxic_Spores;
public static WeaponType Spines;
public static WeaponType Acid_Spore;
public static WeaponType Acid_Spore_Kukulza;
public static WeaponType Glave_Wurm;
public static WeaponType Glave_Wurm_Kukulza;
public static WeaponType Seeker_Spores;
public static WeaponType Subterranean_Tentacle;
public static WeaponType Suicide_Infested_Terran;
public static WeaponType Suicide_Scourge;
public static WeaponType Particle_Beam;
public static WeaponType Psi_Blades;
public static WeaponType Psi_Blades_Fenix;
public static WeaponType Phase_Disruptor;
public static WeaponType Phase_Disruptor_Fenix;
public static WeaponType Psi_Assault;
public static WeaponType Psionic_Shockwave;
public static WeaponType Psionic_Shockwave_TZ_Archon;
public static WeaponType Dual_Photon_Blasters;
public static WeaponType Dual_Photon_Blasters_Mojo;
public static WeaponType Dual_Photon_Blasters_Artanis;
public static WeaponType Anti_Matter_Missiles;
public static WeaponType Anti_Matter_Missiles_Mojo;
public static WeaponType Anti_Matter_Missiles_Artanis;
public static WeaponType Phase_Disruptor_Cannon;
public static WeaponType Phase_Disruptor_Cannon_Danimoth;
public static WeaponType Pulse_Cannon;
public static WeaponType STS_Photon_Cannon;
public static WeaponType STA_Photon_Cannon;
public static WeaponType Scarab;
public static WeaponType Neutron_Flare;
public static WeaponType Halo_Rockets;
public static WeaponType Corrosive_Acid;
public static WeaponType Subterranean_Spines;
public static WeaponType Warp_Blades;
public static WeaponType Warp_Blades_Hero;
public static WeaponType Warp_Blades_Zeratul;
public static WeaponType Independant_Laser_Battery;
public static WeaponType Twin_Autocannons_Floor_Trap;
public static WeaponType Hellfire_Missile_Pack_Wall_Trap;
public static WeaponType Flame_Thrower_Wall_Trap;
public static WeaponType Hellfire_Missile_Pack_Floor_Trap;
public static WeaponType Yamato_Gun;
public static WeaponType Nuclear_Strike;
public static WeaponType Lockdown;
public static WeaponType EMP_Shockwave;
public static WeaponType Irradiate;
public static WeaponType Parasite;
public static WeaponType Spawn_Broodlings;
public static WeaponType Ensnare;
public static WeaponType Dark_Swarm;
public static WeaponType Plague;
public static WeaponType Consume;
public static WeaponType Stasis_Field;
public static WeaponType Psionic_Storm;
public static WeaponType Disruption_Web;
public static WeaponType Restoration;
public static WeaponType Mind_Control;
public static WeaponType Feedback;
public static WeaponType Optical_Flare;
public static WeaponType Maelstrom;
public static WeaponType None;
public static WeaponType Unknown;
private static Map<Long, WeaponType> instances = new HashMap<Long, WeaponType>();
private WeaponType(long pointer) {
this.pointer = pointer;
}
private static WeaponType get(long pointer) {
if (pointer == 0 ) {
return null;
}
WeaponType instance = instances.get(pointer);
if (instance == null ) {
instance = new WeaponType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String c_str_native(long pointer);
private native TechType getTech_native(long pointer);
private native UnitType whatUses_native(long pointer);
private native int damageAmount_native(long pointer);
private native int damageBonus_native(long pointer);
private native int damageCooldown_native(long pointer);
private native int damageFactor_native(long pointer);
private native UpgradeType upgradeType_native(long pointer);
private native DamageType damageType_native(long pointer);
private native ExplosionType explosionType_native(long pointer);
private native int minRange_native(long pointer);
private native int maxRange_native(long pointer);
private native int innerSplashRadius_native(long pointer);
private native int medianSplashRadius_native(long pointer);
private native int outerSplashRadius_native(long pointer);
private native boolean targetsAir_native(long pointer);
private native boolean targetsGround_native(long pointer);
private native boolean targetsMechanical_native(long pointer);
private native boolean targetsOrganic_native(long pointer);
private native boolean targetsNonBuilding_native(long pointer);
private native boolean targetsNonRobotic_native(long pointer);
private native boolean targetsTerrain_native(long pointer);
private native boolean targetsOrgOrMech_native(long pointer);
private native boolean targetsOwn_native(long pointer);
}

View file

@ -1,130 +0,0 @@
package bwapi4;
import bwapi4.BWEventListener;
/**
* This class receives all events from Broodwar.
* To process them, receive an AIModule's instance from {@link Mirror} and call {@link #setEventListener(bwapi.BWEventListener)}
* to set you own {@link BWEventListener listener}.
* There's also a stub class ({@link DefaultBWListener}) provided, so you don't have to implement all of the methods.
*/
public class AIModule {
AIModule(){}
private BWEventListener eventListener;
public void setEventListener(BWEventListener eventListener) {
this.eventListener = eventListener;
}
public void onStart() {
if (eventListener != null) {
eventListener.onStart();
}
}
public void onEnd(boolean isWinner) {
if (eventListener != null) {
eventListener.onEnd(isWinner);
}
}
public void onFrame() {
if (eventListener != null) {
eventListener.onFrame();
}
}
public void onSendText(String text) {
if (eventListener != null)
{
eventListener.onSendText(text);
}
}
public void onReceiveText(Player player, String text) {
if (eventListener != null) {
eventListener.onReceiveText(player, text);
}
}
public void onPlayerLeft(Player player) {
if (eventListener != null) {
eventListener.onPlayerLeft(player);
}
}
public void onNukeDetect(Position target) {
if (eventListener != null) {
eventListener.onNukeDetect(target);
}
}
public void onUnitDiscover(Unit unit) {
if (eventListener != null) {
eventListener.onUnitDiscover(unit);
}
}
public void onUnitEvade(Unit unit) {
if (eventListener != null) {
eventListener.onUnitEvade(unit);
}
}
public void onUnitShow(Unit unit) {
if (eventListener != null) {
eventListener.onUnitShow(unit);
}
}
public void onUnitHide(Unit unit) {
if (eventListener != null) {
eventListener.onUnitHide(unit);
}
}
public void onUnitCreate(Unit unit) {
if (eventListener != null) {
eventListener.onUnitCreate(unit);
}
}
public void onUnitDestroy(Unit unit) {
if (eventListener != null) {
eventListener.onUnitDestroy(unit);
}
}
public void onUnitMorph(Unit unit) {
if (eventListener != null) {
eventListener.onUnitMorph(unit);
}
}
public void onUnitRenegade(Unit unit) {
if (eventListener != null) {
eventListener.onUnitRenegade(unit);
}
}
public void onSaveGame(String gameName) {
if (eventListener != null) {
eventListener.onSaveGame(gameName);
}
}
public void onUnitComplete(Unit unit) {
if (eventListener != null) {
eventListener.onUnitComplete(unit);
}
}
public void onPlayerDropped(Player player) {
if (eventListener != null) {
eventListener.onPlayerDropped(player);
}
}
}

View file

@ -1,30 +0,0 @@
package bwapi4;
/**
* Common ancestor for location based objects to simplify distance computation.
* This will be refactored into interface with default methods when java 8 becomes widely used.
*
* Idea by Rafa³ Poniatowski
*/
public abstract class AbstractPoint<T extends AbstractPoint> {
public abstract T getPoint();
public int getX(){
return getPoint().getX();
}
public int getY(){
return getPoint().getY();
}
public double distanceTo(AbstractPoint<T> otherPosition) {
return distanceTo(otherPosition.getX(), otherPosition.getY());
}
public double distanceTo(int x, int y) {
double dx = x - getX();
double dy = y - getY();
return Math.sqrt(dx * dx + dy * dy);
}
}

View file

@ -1,53 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
/**
* Implement this interface and call {@link AIModule#setEventListener(bwapi.BWEventListener)} to receive all of the in game events.
*/
public interface BWEventListener {
public void onStart();
public void onEnd(boolean isWinner);
public void onFrame();
public void onSendText(String text);
public void onReceiveText(Player player, String text);
public void onPlayerLeft(Player player);
public void onNukeDetect(Position target);
public void onUnitDiscover(Unit unit);
public void onUnitEvade(Unit unit);
public void onUnitShow(Unit unit);
public void onUnitHide(Unit unit);
public void onUnitCreate(Unit unit);
public void onUnitDestroy(Unit unit);
public void onUnitMorph(Unit unit);
public void onUnitRenegade(Unit unit);
public void onSaveGame(String gameName);
public void onUnitComplete(Unit unit);
public void onPlayerDropped(Player player);
}

View file

@ -1,34 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class BestFilter {
private static Map<Long, BestFilter> instances = new HashMap<Long, BestFilter>();
private BestFilter(long pointer) {
this.pointer = pointer;
}
private static BestFilter get(long pointer) {
if (pointer == 0 ) {
return null;
}
BestFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new BestFilter(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

View file

@ -1,31 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class BestUnitFilter {
private static Map<Long, BestUnitFilter> instances = new HashMap<Long, BestUnitFilter>();
private BestUnitFilter(long pointer) {
this.pointer = pointer;
}
private static BestUnitFilter get(long pointer) {
BestUnitFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new BestUnitFilter(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

View file

@ -1,118 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Bullet {
public int getID() {
return getID_native(pointer);
}
public boolean exists() {
return exists_native(pointer);
}
public Player getPlayer() {
return getPlayer_native(pointer);
}
public BulletType getType() {
return getType_native(pointer);
}
public Unit getSource() {
return getSource_native(pointer);
}
public Position getPosition() {
return getPosition_native(pointer);
}
public double getAngle() {
return getAngle_native(pointer);
}
public double getVelocityX() {
return getVelocityX_native(pointer);
}
public double getVelocityY() {
return getVelocityY_native(pointer);
}
public Unit getTarget() {
return getTarget_native(pointer);
}
public Position getTargetPosition() {
return getTargetPosition_native(pointer);
}
public int getRemoveTimer() {
return getRemoveTimer_native(pointer);
}
public boolean isVisible() {
return isVisible_native(pointer);
}
public boolean isVisible(Player player) {
return isVisible_native(pointer, player);
}
private static Map<Long, Bullet> instances = new HashMap<Long, Bullet>();
private Bullet(long pointer) {
this.pointer = pointer;
}
private static Bullet get(long pointer) {
if (pointer == 0 ) {
return null;
}
Bullet instance = instances.get(pointer);
if (instance == null ) {
instance = new Bullet(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native boolean exists_native(long pointer);
private native Player getPlayer_native(long pointer);
private native BulletType getType_native(long pointer);
private native Unit getSource_native(long pointer);
private native Position getPosition_native(long pointer);
private native double getAngle_native(long pointer);
private native double getVelocityX_native(long pointer);
private native double getVelocityY_native(long pointer);
private native Unit getTarget_native(long pointer);
private native Position getTargetPosition_native(long pointer);
private native int getRemoveTimer_native(long pointer);
private native boolean isVisible_native(long pointer);
private native boolean isVisible_native(long pointer, Player player);
}

View file

@ -1,114 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class BulletType {
public String toString() {
return toString_native(pointer);
}
public static BulletType Melee;
public static BulletType Fusion_Cutter_Hit;
public static BulletType Gauss_Rifle_Hit;
public static BulletType C_10_Canister_Rifle_Hit;
public static BulletType Gemini_Missiles;
public static BulletType Fragmentation_Grenade;
public static BulletType Longbolt_Missile;
public static BulletType ATS_ATA_Laser_Battery;
public static BulletType Burst_Lasers;
public static BulletType Arclite_Shock_Cannon_Hit;
public static BulletType EMP_Missile;
public static BulletType Dual_Photon_Blasters_Hit;
public static BulletType Particle_Beam_Hit;
public static BulletType Anti_Matter_Missile;
public static BulletType Pulse_Cannon;
public static BulletType Psionic_Shockwave_Hit;
public static BulletType Psionic_Storm;
public static BulletType Yamato_Gun;
public static BulletType Phase_Disruptor;
public static BulletType STA_STS_Cannon_Overlay;
public static BulletType Sunken_Colony_Tentacle;
public static BulletType Acid_Spore;
public static BulletType Glave_Wurm;
public static BulletType Seeker_Spores;
public static BulletType Queen_Spell_Carrier;
public static BulletType Plague_Cloud;
public static BulletType Consume;
public static BulletType Ensnare;
public static BulletType Needle_Spine_Hit;
public static BulletType Invisible;
public static BulletType Optical_Flare_Grenade;
public static BulletType Halo_Rockets;
public static BulletType Subterranean_Spines;
public static BulletType Corrosive_Acid_Shot;
public static BulletType Neutron_Flare;
public static BulletType None;
public static BulletType Unknown;
private static Map<Long, BulletType> instances = new HashMap<Long, BulletType>();
private BulletType(long pointer) {
this.pointer = pointer;
}
private static BulletType get(long pointer) {
if (pointer == 0 ) {
return null;
}
BulletType instance = instances.get(pointer);
if (instance == null ) {
instance = new BulletType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

View file

@ -1,34 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Bulletset {
private static Map<Long, Bulletset> instances = new HashMap<Long, Bulletset>();
private Bulletset(long pointer) {
this.pointer = pointer;
}
private static Bulletset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Bulletset instance = instances.get(pointer);
if (instance == null ) {
instance = new Bulletset(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

View file

@ -1,15 +0,0 @@
package bwapi4;
import bwapi4.Position;
/**
* Interrmediate class used to translate getPoint() calls to getCenter() calls.
*/
public abstract class CenteredObject extends AbstractPoint<Position> {
public Position getPoint(){
return getCenter();
}
public abstract Position getCenter();
}

View file

@ -1,58 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Client {
public boolean isConnected() {
return isConnected_native(pointer);
}
public boolean connect() {
return connect_native(pointer);
}
public void disconnect() {
disconnect_native(pointer);
}
public void update() {
update_native(pointer);
}
private static Map<Long, Client> instances = new HashMap<Long, Client>();
private Client(long pointer) {
this.pointer = pointer;
}
private static Client get(long pointer) {
if (pointer == 0 ) {
return null;
}
Client instance = instances.get(pointer);
if (instance == null ) {
instance = new Client(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native boolean isConnected_native(long pointer);
private native boolean connect_native(long pointer);
private native void disconnect_native(long pointer);
private native void update_native(long pointer);
}

View file

@ -1,73 +0,0 @@
package bwapi4;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
/**
* Starcraft uses a 256 color palette to render everything,
* so the colors available for draw shapes using BWAPI is limited to the colors available in the <a href="http://bwapi.googlecode.com/svn/wiki/colorPalette.gif" target="_blank">Pallete</a>.
* Several predefined colors from the pallete are provided.
*/
public class Color {
private int r, g, b;
/**
* Create a color using the color in the palette that is closest to the RGB color specified. This will check a number of colors in the pallet to see which is closest to the specified color so this function is relatively slow.
* @param r
* @param g
* @param b
*/
public Color(int r, int g, int b) {
this.r = r;
this.g = g;
this.b = b;
}
public static Color Red;
public static Color Blue;
public static Color Teal;
public static Color Purple;
public static Color Orange;
public static Color Brown;
public static Color White;
public static Color Yellow;
public static Color Green;
public static Color Cyan;
public static Color Black;
public static Color Grey;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Color)) return false;
Color color = (Color) o;
if (b != color.b) return false;
if (g != color.g) return false;
if (r != color.r) return false;
return true;
}
@Override
public int hashCode() {
int result = r;
result = 31 * result + g;
result = 31 * result + b;
return result;
}
}

View file

@ -1,41 +0,0 @@
package bwapi4.CommandType;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
None(0),
SetScreenPosition(1),
PingMinimap(2),
EnableFlag(3),
Printf(4),
SendText(5),
PauseGame(6),
ResumeGame(7),
LeaveGame(8),
RestartGame(9),
SetLocalSpeed(10),
SetLatCom(11),
SetGui(12),
SetFrameSkip(13),
SetMap(14),
SetAllies(15),
SetVision(16),
SetCommandOptimizerLevel(17);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,34 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class CompareFilter {
private static Map<Long, CompareFilter> instances = new HashMap<Long, CompareFilter>();
private CompareFilter(long pointer) {
this.pointer = pointer;
}
private static CompareFilter get(long pointer) {
if (pointer == 0 ) {
return null;
}
CompareFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new CompareFilter(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

View file

@ -1,27 +0,0 @@
package bwapi4.CoordinateType;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
None(0),
Screen(1),
Map(2),
Mouse(3);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,54 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class DamageType {
public String toString() {
return toString_native(pointer);
}
public static DamageType Independent;
public static DamageType Explosive;
public static DamageType Concussive;
public static DamageType Normal;
public static DamageType Ignore_Armor;
public static DamageType None;
public static DamageType Unknown;
private static Map<Long, DamageType> instances = new HashMap<Long, DamageType>();
private DamageType(long pointer) {
this.pointer = pointer;
}
private static DamageType get(long pointer) {
if (pointer == 0 ) {
return null;
}
DamageType instance = instances.get(pointer);
if (instance == null ) {
instance = new DamageType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

View file

@ -1,103 +0,0 @@
package bwapi4;
import bwapi4.BWEventListener;
import bwapi4.Player;
import bwapi4.Position;
import bwapi4.Unit;
/**
* A utility stub class providing a default implementation of {@link BWEventListener},
* override it's methods if you want to handle only some events.
*/
public class DefaultBWListener implements BWEventListener {
@Override
public void onStart() {
}
@Override
public void onEnd(boolean b) {
}
@Override
public void onFrame() {
}
@Override
public void onSendText(String s) {
}
@Override
public void onReceiveText(Player player, String s) {
}
@Override
public void onPlayerLeft(Player player) {
}
@Override
public void onNukeDetect(Position position) {
}
@Override
public void onUnitDiscover(Unit unit) {
}
@Override
public void onUnitEvade(Unit unit) {
}
@Override
public void onUnitShow(Unit unit) {
}
@Override
public void onUnitHide(Unit unit) {
}
@Override
public void onUnitCreate(Unit unit) {
}
@Override
public void onUnitDestroy(Unit unit) {
}
@Override
public void onUnitMorph(Unit unit) {
}
@Override
public void onUnitRenegade(Unit unit) {
}
@Override
public void onSaveGame(String s) {
}
@Override
public void onUnitComplete(Unit unit) {
}
@Override
public void onPlayerDropped(Player player) {
}
}

View file

@ -1,126 +0,0 @@
package bwapi4.Enum;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
Gauss_Rifle(0),
Gauss_Rifle_Jim_Raynor(1),
C_10_Canister_Rifle(2),
C_10_Canister_Rifle_Sarah_Kerrigan(3),
Fragmentation_Grenade(4),
Fragmentation_Grenade_Jim_Raynor(5),
Spider_Mines(6),
Twin_Autocannons(7),
Hellfire_Missile_Pack(8),
Twin_Autocannons_Alan_Schezar(9),
Hellfire_Missile_Pack_Alan_Schezar(10),
Arclite_Cannon(11),
Arclite_Cannon_Edmund_Duke(12),
Fusion_Cutter(13),
Gemini_Missiles(15),
Burst_Lasers(16),
Gemini_Missiles_Tom_Kazansky(17),
Burst_Lasers_Tom_Kazansky(18),
ATS_Laser_Battery(19),
ATA_Laser_Battery(20),
ATS_Laser_Battery_Hero(21),
ATA_Laser_Battery_Hero(22),
ATS_Laser_Battery_Hyperion(23),
ATA_Laser_Battery_Hyperion(24),
Flame_Thrower(25),
Flame_Thrower_Gui_Montag(26),
Arclite_Shock_Cannon(27),
Arclite_Shock_Cannon_Edmund_Duke(28),
Longbolt_Missile(29),
Yamato_Gun(30),
Nuclear_Strike(31),
Lockdown(32),
EMP_Shockwave(33),
Irradiate(34),
Claws(35),
Claws_Devouring_One(36),
Claws_Infested_Kerrigan(37),
Needle_Spines(38),
Needle_Spines_Hunter_Killer(39),
Kaiser_Blades(40),
Kaiser_Blades_Torrasque(41),
Toxic_Spores(42),
Spines(43),
Acid_Spore(46),
Acid_Spore_Kukulza(47),
Glave_Wurm(48),
Glave_Wurm_Kukulza(49),
Seeker_Spores(52),
Subterranean_Tentacle(53),
Suicide_Infested_Terran(54),
Suicide_Scourge(55),
Parasite(56),
Spawn_Broodlings(57),
Ensnare(58),
Dark_Swarm(59),
Plague(60),
Consume(61),
Particle_Beam(62),
Psi_Blades(64),
Psi_Blades_Fenix(65),
Phase_Disruptor(66),
Phase_Disruptor_Fenix(67),
Psi_Assault(69),
Psionic_Shockwave(70),
Psionic_Shockwave_TZ_Archon(71),
Dual_Photon_Blasters(73),
Anti_Matter_Missiles(74),
Dual_Photon_Blasters_Mojo(75),
Anti_Matter_Missiles_Mojo(76),
Phase_Disruptor_Cannon(77),
Phase_Disruptor_Cannon_Danimoth(78),
Pulse_Cannon(79),
STS_Photon_Cannon(80),
STA_Photon_Cannon(81),
Scarab(82),
Stasis_Field(83),
Psionic_Storm(84),
Warp_Blades_Zeratul(85),
Warp_Blades_Hero(86),
Platform_Laser_Battery(92),
Independant_Laser_Battery(93),
Twin_Autocannons_Floor_Trap(96),
Hellfire_Missile_Pack_Wall_Trap(97),
Flame_Thrower_Wall_Trap(98),
Hellfire_Missile_Pack_Floor_Trap(99),
Neutron_Flare(100),
Disruption_Web(101),
Restoration(102),
Halo_Rockets(103),
Corrosive_Acid(104),
Mind_Control(105),
Feedback(106),
Optical_Flare(107),
Maelstrom(108),
Subterranean_Spines(109),
Warp_Blades(111),
C_10_Canister_Rifle_Samir_Duran(112),
C_10_Canister_Rifle_Infested_Duran(113),
Dual_Photon_Blasters_Artanis(114),
Anti_Matter_Missiles_Artanis(115),
C_10_Canister_Rifle_Alexei_Stukov(116),
None(130),
Unknown(131);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,96 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Error {
public String toString() {
return toString_native(pointer);
}
public static Error Unit_Does_Not_Exist;
public static Error Unit_Not_Visible;
public static Error Unit_Not_Owned;
public static Error Unit_Busy;
public static Error Incompatible_UnitType;
public static Error Incompatible_TechType;
public static Error Incompatible_State;
public static Error Already_Researched;
public static Error Fully_Upgraded;
public static Error Currently_Researching;
public static Error Currently_Upgrading;
public static Error Insufficient_Minerals;
public static Error Insufficient_Gas;
public static Error Insufficient_Supply;
public static Error Insufficient_Energy;
public static Error Insufficient_Tech;
public static Error Insufficient_Ammo;
public static Error Insufficient_Space;
public static Error Invalid_Tile_Position;
public static Error Unbuildable_Location;
public static Error Unreachable_Location;
public static Error Out_Of_Range;
public static Error Unable_To_Hit;
public static Error Access_Denied;
public static Error File_Not_Found;
public static Error Invalid_Parameter;
public static Error None;
public static Error Unknown;
private static Map<Long, Error> instances = new HashMap<Long, Error>();
private Error(long pointer) {
this.pointer = pointer;
}
private static Error get(long pointer) {
if (pointer == 0 ) {
return null;
}
Error instance = instances.get(pointer);
if (instance == null ) {
instance = new Error(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

View file

@ -1,64 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Event {
public Position getPosition() {
return getPosition_native(pointer);
}
public String getText() {
return getText_native(pointer);
}
public Unit getUnit() {
return getUnit_native(pointer);
}
public Player getPlayer() {
return getPlayer_native(pointer);
}
public boolean isWinner() {
return isWinner_native(pointer);
}
private static Map<Long, Event> instances = new HashMap<Long, Event>();
private Event(long pointer) {
this.pointer = pointer;
}
private static Event get(long pointer) {
if (pointer == 0 ) {
return null;
}
Event instance = instances.get(pointer);
if (instance == null ) {
instance = new Event(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native Position getPosition_native(long pointer);
private native String getText_native(long pointer);
private native Unit getUnit_native(long pointer);
private native Player getPlayer_native(long pointer);
private native boolean isWinner_native(long pointer);
}

View file

@ -1,41 +0,0 @@
package bwapi4.EventType;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
MatchStart(0),
MatchEnd(1),
MatchFrame(2),
MenuFrame(3),
SendText(4),
ReceiveText(5),
PlayerLeft(6),
NukeDetect(7),
UnitDiscover(8),
UnitEvade(9),
UnitShow(10),
UnitHide(11),
UnitCreate(12),
UnitDestroy(13),
UnitMorph(14),
UnitRenegade(15),
SaveGame(16),
UnitComplete(17);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,90 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class ExplosionType {
public String toString() {
return toString_native(pointer);
}
public static ExplosionType None;
public static ExplosionType Normal;
public static ExplosionType Radial_Splash;
public static ExplosionType Enemy_Splash;
public static ExplosionType Lockdown;
public static ExplosionType Nuclear_Missile;
public static ExplosionType Parasite;
public static ExplosionType Broodlings;
public static ExplosionType EMP_Shockwave;
public static ExplosionType Irradiate;
public static ExplosionType Ensnare;
public static ExplosionType Plague;
public static ExplosionType Stasis_Field;
public static ExplosionType Dark_Swarm;
public static ExplosionType Consume;
public static ExplosionType Yamato_Gun;
public static ExplosionType Restoration;
public static ExplosionType Disruption_Web;
public static ExplosionType Corrosive_Acid;
public static ExplosionType Mind_Control;
public static ExplosionType Feedback;
public static ExplosionType Optical_Flare;
public static ExplosionType Maelstrom;
public static ExplosionType Air_Splash;
public static ExplosionType Unknown;
private static Map<Long, ExplosionType> instances = new HashMap<Long, ExplosionType>();
private ExplosionType(long pointer) {
this.pointer = pointer;
}
private static ExplosionType get(long pointer) {
if (pointer == 0 ) {
return null;
}
ExplosionType instance = instances.get(pointer);
if (instance == null ) {
instance = new ExplosionType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

View file

@ -1,25 +0,0 @@
package bwapi4.Flag;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
CompleteMapInformation(0),
UserInput(1);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,52 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Force {
public int getID() {
return getID_native(pointer);
}
public String getName() {
return getName_native(pointer);
}
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
private static Map<Long, Force> instances = new HashMap<Long, Force>();
private Force(long pointer) {
this.pointer = pointer;
}
private static Force get(long pointer) {
if (pointer == 0 ) {
return null;
}
Force instance = instances.get(pointer);
if (instance == null ) {
instance = new Force(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native String getName_native(long pointer);
private native List<Player> getPlayers_native(long pointer);
}

View file

@ -1,40 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Forceset {
public List<Player> getPlayers() {
return getPlayers_native(pointer);
}
private static Map<Long, Forceset> instances = new HashMap<Long, Forceset>();
private Forceset(long pointer) {
this.pointer = pointer;
}
private static Forceset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Forceset instance = instances.get(pointer);
if (instance == null ) {
instance = new Forceset(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native List<Player> getPlayers_native(long pointer);
}

File diff suppressed because it is too large Load diff

View file

@ -1,70 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class GameType {
public String toString() {
return toString_native(pointer);
}
public static GameType Melee;
public static GameType Free_For_All;
public static GameType One_on_One;
public static GameType Capture_The_Flag;
public static GameType Greed;
public static GameType Slaughter;
public static GameType Sudden_Death;
public static GameType Ladder;
public static GameType Use_Map_Settings;
public static GameType Team_Melee;
public static GameType Team_Free_For_All;
public static GameType Team_Capture_The_Flag;
public static GameType Top_vs_Bottom;
public static GameType None;
public static GameType Unknown;
private static Map<Long, GameType> instances = new HashMap<Long, GameType>();
private GameType(long pointer) {
this.pointer = pointer;
}
private static GameType get(long pointer) {
if (pointer == 0 ) {
return null;
}
GameType instance = instances.get(pointer);
if (instance == null ) {
instance = new GameType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

View file

@ -1,40 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class GameWrapper {
public void flush() {
flush_native(pointer);
}
private static Map<Long, GameWrapper> instances = new HashMap<Long, GameWrapper>();
private GameWrapper(long pointer) {
this.pointer = pointer;
}
private static GameWrapper get(long pointer) {
if (pointer == 0 ) {
return null;
}
GameWrapper instance = instances.get(pointer);
if (instance == null ) {
instance = new GameWrapper(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native void flush_native(long pointer);
}

View file

@ -1,43 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class InterfaceEvent {
public boolean isFinished() {
return isFinished_native(pointer);
}
public void removeEvent() {
removeEvent_native(pointer);
}
private static Map<Long, InterfaceEvent> instances = new HashMap<Long, InterfaceEvent>();
private InterfaceEvent(long pointer) {
this.pointer = pointer;
}
private static InterfaceEvent get(long pointer) {
InterfaceEvent instance = instances.get(pointer);
if (instance == null ) {
instance = new InterfaceEvent(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native boolean isFinished_native(long pointer);
private native void removeEvent_native(long pointer);
}

View file

@ -1,251 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Key {
K_LBUTTON(1),
K_RBUTTON(2),
K_CANCEL(3),
K_MBUTTON(4),
K_XBUTTON1(5),
K_XBUTTON2(6),
__UNDEFINED_7(7),
K_BACK(8),
K_TAB(9),
__RESERVED_A(10),
__RESERVED_B(11),
K_CLEAR(12),
K_RETURN(13),
__UNDEFINED_E(14),
__UNDEFINED_F(15),
K_SHIFT(16),
K_CONTROL(17),
K_MENU(18),
K_PAUSE(19),
K_CAPITAL(20),
K_KANA(21),
K_UNDEFINED_16(22),
K_JUNJA(23),
K_FINAL(24),
K_KANJI(25),
__UNDEFINED_1A(26),
K_ESCAPE(27),
K_CONVERT(28),
K_NONCONVERT(29),
K_ACCEPT(30),
K_MODECHANGE(31),
K_SPACE(32),
K_PRIOR(33),
K_NEXT(34),
K_END(35),
K_HOME(36),
K_LEFT(37),
K_UP(38),
K_RIGHT(39),
K_DOWN(40),
K_SELECT(41),
K_PRINT(42),
K_EXECUTE(43),
K_SNAPSHOT(44),
K_INSERT(45),
K_DELETE(46),
K_HELP(47),
K_0(48),
K_1(49),
K_2(50),
K_3(51),
K_4(52),
K_5(53),
K_6(54),
K_7(55),
K_8(56),
K_9(57),
__UNDEFINED_3A(58),
__UNDEFINED_3B(59),
__UNDEFINED_3C(60),
__UNDEFINED_3D(61),
__UNDEFINED_3E(62),
__UNDEFINED_3F(63),
__UNDEFINED_40(64),
K_A(65),
K_B(66),
K_C(67),
K_D(68),
K_E(69),
K_F(70),
K_G(71),
K_H(72),
K_I(73),
K_J(74),
K_K(75),
K_L(76),
K_M(77),
K_N(78),
K_O(79),
K_P(80),
K_Q(81),
K_R(82),
K_S(83),
K_T(84),
K_U(85),
K_V(86),
K_W(87),
K_X(88),
K_Y(89),
K_Z(90),
K_LWIN(91),
K_RWIN(92),
K_APPS(93),
__RESERVED_5E(94),
K_SLEEP(95),
K_NUMPAD0(96),
K_NUMPAD1(97),
K_NUMPAD2(98),
K_NUMPAD3(99),
K_NUMPAD4(100),
K_NUMPAD5(101),
K_NUMPAD6(102),
K_NUMPAD7(103),
K_NUMPAD8(104),
K_NUMPAD9(105),
K_MULTIPLY(106),
K_ADD(107),
K_SEPARATOR(108),
K_SUBTRACT(109),
K_DECIMAL(110),
K_DIVIDE(111),
K_F1(112),
K_F2(113),
K_F3(114),
K_F4(115),
K_F5(116),
K_F6(117),
K_F7(118),
K_F8(119),
K_F9(120),
K_F10(121),
K_F11(122),
K_F12(123),
K_F13(124),
K_F14(125),
K_F15(126),
K_F16(127),
K_F17(128),
K_F18(129),
K_F19(130),
K_F20(131),
K_F21(132),
K_F22(133),
K_F23(134),
K_F24(135),
__UNASSIGNED_88(136),
__UNASSIGNED_89(137),
__UNASSIGNED_8A(138),
__UNASSIGNED_8B(139),
__UNASSIGNED_8C(140),
__UNASSIGNED_8D(141),
__UNASSIGNED_8E(142),
__UNASSIGNED_8F(143),
K_NUMLOCK(144),
K_SCROLL(145),
K_OEM_NEC_EQUAL(146),
K_OEM_FJ_JISHO(147),
K_OEM_FJ_MASSHOU(148),
K_OEM_FJ_TOUROKU(149),
K_OEM_FJ_LOYA(150),
__UNASSIGNED_97(151),
__UNASSIGNED_98(152),
__UNASSIGNED_99(153),
__UNASSIGNED_9A(154),
__UNASSIGNED_9B(155),
__UNASSIGNED_9C(156),
__UNASSIGNED_9D(157),
__UNASSIGNED_9E(158),
__UNASSIGNED_9F(159),
K_LSHIFT(160),
K_RSHIFT(161),
K_LCONTROL(162),
K_RCONTROL(163),
K_LMENU(164),
K_RMENU(165),
K_BROWSER_BACK(166),
K_BROWSER_FORWARD(167),
K_BROWSER_REFRESH(168),
K_BROWSER_STOP(169),
K_BROWSER_SEARCH(170),
K_BROWSER_FAVORITES(171),
K_BROWSER_HOME(172),
K_VOLUME_MUTE(173),
K_VOLUME_DOWN(174),
K_VOLUME_UP(175),
K_MEDIA_NEXT_TRACK(176),
K_MEDIA_PREV_TRACK(177),
K_MEDIA_STOP(178),
K_MEDIA_PLAY_PAUSE(179),
K_LAUNCH_MAIL(180),
K_LAUNCH_MEDIA_SELECT(181),
K_LAUNCH_APP1(182),
K_LAUNCH_APP2(183),
__RESERVED_B8(184),
__RESERVED_B9(185),
K_OEM_1(186),
K_OEM_PLUS(187),
K_OEM_COMMA(188),
K_OEM_MINUS(189),
K_OEM_PERIOD(190),
K_OEM_2(191),
K_OEM_3(192),
K_OEM_4(219),
K_OEM_5(220),
K_OEM_6(221),
K_OEM_7(222),
K_OEM_8(223),
__RESERVED_E0(224),
K_OEM_AX(225),
K_OEM_102(226),
K_ICO_HELP(227),
K_ICO_00(228),
K_PROCESSKEY(229),
K_ICO_CLEAR(230),
K_PACKET(231),
__UNASSIGNED_E8(232),
K_OEM_RESET(233),
K_OEM_JUMP(234),
K_OEM_PA1(235),
K_OEM_PA2(236),
K_OEM_PA3(237),
K_OEM_WSCTRL(238),
K_OEM_CUSEL(239),
K_OEM_ATTN(240),
K_OEM_FINISH(241),
K_OEM_COPY(242),
K_OEM_AUTO(243),
K_OEM_ENLW(244),
K_OEM_BACKTAB(245),
K_ATTN(246),
K_CRSEL(247),
K_EXSEL(248),
K_EREOF(249),
K_PLAY(250),
K_ZOOM(251),
K_NONAME(252),
K_PA1(253),
K_OEM_CLEAR(254);
private int value;
public int getValue(){
return value;
}
Key(int value){
this.value = value;
}
}

View file

@ -1,29 +0,0 @@
package bwapi4.Latency;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
SinglePlayer(2),
LanLow(5),
LanMedium(7),
LanHigh(9),
BattlenetLow(14),
BattlenetMedium(19);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,262 +0,0 @@
package bwapi4;
import bwapi4.AIModule;
import bwapi4.BWEventListener;
import java.io.*;
import java.io.File;
import java.lang.Exception;
import java.lang.UnsupportedOperationException;
import java.util.*;
import java.util.zip.*;
/**
* <p>The API entry point. Standard use case:</p>
* <ul>
* <li>Create a Mirror object and use {@link #getModule()} and then set an {@link AIModule}'s {@link BWEventListener}<br/>
* <li>Call {@link #startGame()} to init the API and connect to Broodwar, then launch Broodwar from ChaosLauncher.</li>
* <li>In you {@link BWEventListener#onStart()} method, receive the Game object by calling {@link #getGame()}</li>
* </ul>
* <br/>
* <b>Example</b>
* <pre>
* {@code
*
* mirror.getModule().setEventListener(new DefaultBWListener()
* {
* public void onStart() {
* game = mirror.getGame();
* self = game.self();
* //initialization
* ....
* }
*
* public void onUpdate() {
* for (Unit myUnit : self.getUnits()) {
* //give orders to unit
* ...
* }
* }
* });
* }
* mirror.startGame();
* </pre>
* <p><b>Note:</b> The Game object is initialized during the {@link #startGame()} as well as other BWMirror API's constants.
* Do not use any API releated methods/fields prior to {@link #startGame()}.</p>
*/
public class Mirror {
private Game game;
private AIModule module = new AIModule();
private FrameCallback frameCallback;
private static final boolean EXTRACT_JAR = true;
private static final String VERSION = "2_0";
static {
String arch = System.getProperty("os.arch");
String dllNames[] = {"BWAPI4", "gmp-vc90-mt", "mpfr-vc90-mt"};
if(!arch.equals("x86")){
throw new UnsupportedOperationException("BWMirror API supports only x86 architecture.");
}
try {
if (EXTRACT_JAR) {
System.setProperty("java.library.path", ".");
java.lang.reflect.Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
fieldSysPath.setAccessible(true);
fieldSysPath.set(null, null);
String path = Mirror.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = java.net.URLDecoder.decode(path, "UTF-8");
for (String dllName : dllNames) {
String dllNameExt = dllName + ".dll";
if (!new File(dllNameExt).exists()) {
JarResources jar = new JarResources(path);
byte[] correctDllData = jar.getResource(dllNameExt);
FileOutputStream funnyStream = new FileOutputStream(dllNameExt);
funnyStream.write(correctDllData);
funnyStream.close();
}
}
}
} catch (Exception e) {
System.err.println("Failed to extract native libraries.\n" + e);
}
System.loadLibrary(dllNames[0]);
File dataDir = new File("bwapi-data/BWTA");
if(!dataDir.exists()){
try {
dataDir.mkdirs();
} catch (Exception e) {
System.err.println("Unable to create /bwapi-data/BWTA folder, BWTA analysis will not be saved.");
}
}
}
public Game getGame() {
return game;
}
public AIModule getModule() {
return module;
}
/**
* Starts the API, initializes all constants ( {@link UnitType}, {@link WeaponType} ) and the {@link Game} object.
* This method blocks until the end of game.
*/
public native void startGame();
private void update() {
if (frameCallback != null) {
frameCallback.update();
}
}
/*public void setFrameCallback(bwapi.Mirror.FrameCallback frameCallback) {
this.frameCallback = frameCallback;
} */
/**
* The simplest interface to receive update event from Broodwar. The {@link #update()} method is called once each frame.
* For a simple bot and implementation of this interface is enough, to receive all in game events, implement {@link BWEventListener}.
*/
/*public*/ private interface FrameCallback {
public void update();
}
@SuppressWarnings({"unchecked"})
private static class JarResources {
// external debug flag
public boolean debugOn = false;
// jar resource mapping tables
private Hashtable htSizes = new Hashtable();
private Hashtable htJarContents = new Hashtable();
// a jar file
private String jarFileName;
/**
* creates a javabot.JarResources. It extracts all resources from a Jar
* into an internal hashtable, keyed by resource names.
*
* @param jarFileName a jar or zip file
*/
public JarResources(String jarFileName) {
this.jarFileName = jarFileName;
init();
}
/**
* Extracts a jar resource as a blob.
*
* @param name a resource name.
*/
public byte[] getResource(String name) {
return (byte[]) htJarContents.get(name);
}
/**
* initializes internal hash tables with Jar file resources.
*/
private void init() {
try {
// extracts just sizes only.
ZipFile zf = new ZipFile(jarFileName);
Enumeration e = zf.entries();
while (e.hasMoreElements()) {
ZipEntry ze = (ZipEntry) e.nextElement();
if (debugOn) {
System.out.println(dumpZipEntry(ze));
}
htSizes.put(ze.getName(), new Integer((int) ze.getSize()));
}
zf.close();
// extract resources and put them into the hashtable.
FileInputStream fis = new FileInputStream(jarFileName);
BufferedInputStream bis = new BufferedInputStream(fis);
ZipInputStream zis = new ZipInputStream(bis);
ZipEntry ze = null;
while ((ze = zis.getNextEntry()) != null) {
if (ze.isDirectory()) {
continue;
}
if (debugOn) {
System.out.println(
"ze.getName()=" + ze.getName() + "," + "getSize()=" + ze.getSize()
);
}
int size = (int) ze.getSize();
// -1 means unknown size.
if (size == -1) {
size = ((Integer) htSizes.get(ze.getName())).intValue();
}
byte[] b = new byte[(int) size];
int rb = 0;
int chunk = 0;
while (((int) size - rb) > 0) {
chunk = zis.read(b, rb, (int) size - rb);
if (chunk == -1) {
break;
}
rb += chunk;
}
// add to internal resource hashtable
htJarContents.put(ze.getName(), b);
if (debugOn) {
System.out.println(
ze.getName() + " rb=" + rb +
",size=" + size +
",csize=" + ze.getCompressedSize()
);
}
}
} catch (NullPointerException e) {
System.out.println("done.");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Dumps a zip entry into a string.
*
* @param ze a ZipEntry
*/
private String dumpZipEntry(ZipEntry ze) {
StringBuffer sb = new StringBuffer();
if (ze.isDirectory()) {
sb.append("d ");
} else {
sb.append("f ");
}
if (ze.getMethod() == ZipEntry.STORED) {
sb.append("stored ");
} else {
sb.append("defalted ");
}
sb.append(ze.getName());
sb.append("\t");
sb.append("" + ze.getSize());
if (ze.getMethod() == ZipEntry.DEFLATED) {
sb.append("/" + ze.getCompressedSize());
}
return (sb.toString());
}
}
}

View file

@ -1,27 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum MouseButton {
M_LEFT(0),
M_RIGHT(1),
M_MIDDLE(2),
M_MAX(3);
private int value;
public int getValue(){
return value;
}
MouseButton(int value){
this.value = value;
}
}

View file

@ -1,346 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Order {
public static Order Die;
public static Order Stop;
public static Order Guard;
public static Order PlayerGuard;
public static Order TurretGuard;
public static Order BunkerGuard;
public static Order Move;
public static Order AttackUnit;
public static Order AttackTile;
public static Order Hover;
public static Order AttackMove;
public static Order InfestedCommandCenter;
public static Order UnusedNothing;
public static Order UnusedPowerup;
public static Order TowerGuard;
public static Order VultureMine;
public static Order Nothing;
public static Order CastInfestation;
public static Order InfestingCommandCenter;
public static Order PlaceBuilding;
public static Order CreateProtossBuilding;
public static Order ConstructingBuilding;
public static Order Repair;
public static Order PlaceAddon;
public static Order BuildAddon;
public static Order Train;
public static Order RallyPointUnit;
public static Order RallyPointTile;
public static Order ZergBirth;
public static Order ZergUnitMorph;
public static Order ZergBuildingMorph;
public static Order IncompleteBuilding;
public static Order BuildNydusExit;
public static Order EnterNydusCanal;
public static Order Follow;
public static Order Carrier;
public static Order ReaverCarrierMove;
public static Order CarrierIgnore2;
public static Order Reaver;
public static Order TrainFighter;
public static Order InterceptorAttack;
public static Order ScarabAttack;
public static Order RechargeShieldsUnit;
public static Order RechargeShieldsBattery;
public static Order ShieldBattery;
public static Order InterceptorReturn;
public static Order BuildingLand;
public static Order BuildingLiftOff;
public static Order DroneLiftOff;
public static Order LiftingOff;
public static Order ResearchTech;
public static Order Upgrade;
public static Order Larva;
public static Order SpawningLarva;
public static Order Harvest1;
public static Order Harvest2;
public static Order MoveToGas;
public static Order WaitForGas;
public static Order HarvestGas;
public static Order ReturnGas;
public static Order MoveToMinerals;
public static Order WaitForMinerals;
public static Order MiningMinerals;
public static Order Harvest3;
public static Order Harvest4;
public static Order ReturnMinerals;
public static Order Interrupted;
public static Order EnterTransport;
public static Order PickupIdle;
public static Order PickupTransport;
public static Order PickupBunker;
public static Order Pickup4;
public static Order PowerupIdle;
public static Order Sieging;
public static Order Unsieging;
public static Order InitCreepGrowth;
public static Order SpreadCreep;
public static Order StoppingCreepGrowth;
public static Order GuardianAspect;
public static Order ArchonWarp;
public static Order CompletingArchonSummon;
public static Order HoldPosition;
public static Order Cloak;
public static Order Decloak;
public static Order Unload;
public static Order MoveUnload;
public static Order FireYamatoGun;
public static Order CastLockdown;
public static Order Burrowing;
public static Order Burrowed;
public static Order Unburrowing;
public static Order CastDarkSwarm;
public static Order CastParasite;
public static Order CastSpawnBroodlings;
public static Order CastEMPShockwave;
public static Order NukeWait;
public static Order NukeTrain;
public static Order NukeLaunch;
public static Order NukePaint;
public static Order NukeUnit;
public static Order CastNuclearStrike;
public static Order NukeTrack;
public static Order CloakNearbyUnits;
public static Order PlaceMine;
public static Order RightClickAction;
public static Order CastRecall;
public static Order Teleport;
public static Order CastScannerSweep;
public static Order Scanner;
public static Order CastDefensiveMatrix;
public static Order CastPsionicStorm;
public static Order CastIrradiate;
public static Order CastPlague;
public static Order CastConsume;
public static Order CastEnsnare;
public static Order CastStasisField;
public static Order CastHallucination;
public static Order Hallucination2;
public static Order ResetCollision;
public static Order Patrol;
public static Order CTFCOPInit;
public static Order CTFCOPStarted;
public static Order CTFCOP2;
public static Order ComputerAI;
public static Order AtkMoveEP;
public static Order HarassMove;
public static Order AIPatrol;
public static Order GuardPost;
public static Order RescuePassive;
public static Order Neutral;
public static Order ComputerReturn;
public static Order SelfDestructing;
public static Order Critter;
public static Order HiddenGun;
public static Order OpenDoor;
public static Order CloseDoor;
public static Order HideTrap;
public static Order RevealTrap;
public static Order EnableDoodad;
public static Order DisableDoodad;
public static Order WarpIn;
public static Order Medic;
public static Order MedicHeal;
public static Order HealMove;
public static Order MedicHealToIdle;
public static Order CastRestoration;
public static Order CastDisruptionWeb;
public static Order CastMindControl;
public static Order DarkArchonMeld;
public static Order CastFeedback;
public static Order CastOpticalFlare;
public static Order CastMaelstrom;
public static Order JunkYardDog;
public static Order Fatal;
public static Order None;
public static Order Unknown;
private static Map<Long, Order> instances = new HashMap<Long, Order>();
private Order(long pointer) {
this.pointer = pointer;
}
private static Order get(long pointer) {
if (pointer == 0 ) {
return null;
}
Order instance = instances.get(pointer);
if (instance == null ) {
instance = new Order(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

View file

@ -1,400 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Player {
public int getID() {
return getID_native(pointer);
}
public String getName() {
return getName_native(pointer);
}
public List<Unit> getUnits() {
return getUnits_native(pointer);
}
public Race getRace() {
return getRace_native(pointer);
}
public PlayerType getType() {
return getType_native(pointer);
}
public Force getForce() {
return getForce_native(pointer);
}
public boolean isAlly(Player player) {
return isAlly_native(pointer, player);
}
public boolean isEnemy(Player player) {
return isEnemy_native(pointer, player);
}
public boolean isNeutral() {
return isNeutral_native(pointer);
}
public TilePosition getStartLocation() {
return getStartLocation_native(pointer);
}
public boolean isVictorious() {
return isVictorious_native(pointer);
}
public boolean isDefeated() {
return isDefeated_native(pointer);
}
public boolean leftGame() {
return leftGame_native(pointer);
}
public int minerals() {
return minerals_native(pointer);
}
public int gas() {
return gas_native(pointer);
}
public int gatheredMinerals() {
return gatheredMinerals_native(pointer);
}
public int gatheredGas() {
return gatheredGas_native(pointer);
}
public int repairedMinerals() {
return repairedMinerals_native(pointer);
}
public int repairedGas() {
return repairedGas_native(pointer);
}
public int refundedMinerals() {
return refundedMinerals_native(pointer);
}
public int refundedGas() {
return refundedGas_native(pointer);
}
public int spentMinerals() {
return spentMinerals_native(pointer);
}
public int spentGas() {
return spentGas_native(pointer);
}
public int supplyTotal() {
return supplyTotal_native(pointer);
}
public int supplyTotal(Race race) {
return supplyTotal_native(pointer, race);
}
public int supplyUsed() {
return supplyUsed_native(pointer);
}
public int supplyUsed(Race race) {
return supplyUsed_native(pointer, race);
}
public int allUnitCount() {
return allUnitCount_native(pointer);
}
public int allUnitCount(UnitType unit) {
return allUnitCount_native(pointer, unit);
}
public int visibleUnitCount() {
return visibleUnitCount_native(pointer);
}
public int visibleUnitCount(UnitType unit) {
return visibleUnitCount_native(pointer, unit);
}
public int completedUnitCount() {
return completedUnitCount_native(pointer);
}
public int completedUnitCount(UnitType unit) {
return completedUnitCount_native(pointer, unit);
}
public int incompleteUnitCount() {
return incompleteUnitCount_native(pointer);
}
public int incompleteUnitCount(UnitType unit) {
return incompleteUnitCount_native(pointer, unit);
}
public int deadUnitCount() {
return deadUnitCount_native(pointer);
}
public int deadUnitCount(UnitType unit) {
return deadUnitCount_native(pointer, unit);
}
public int killedUnitCount() {
return killedUnitCount_native(pointer);
}
public int killedUnitCount(UnitType unit) {
return killedUnitCount_native(pointer, unit);
}
public int getUpgradeLevel(UpgradeType upgrade) {
return getUpgradeLevel_native(pointer, upgrade);
}
public boolean hasResearched(TechType tech) {
return hasResearched_native(pointer, tech);
}
public boolean isResearching(TechType tech) {
return isResearching_native(pointer, tech);
}
public boolean isUpgrading(UpgradeType upgrade) {
return isUpgrading_native(pointer, upgrade);
}
public Color getColor() {
return getColor_native(pointer);
}
public char getTextColor() {
return getTextColor_native(pointer);
}
public int maxEnergy(UnitType unit) {
return maxEnergy_native(pointer, unit);
}
public double topSpeed(UnitType unit) {
return topSpeed_native(pointer, unit);
}
public int weaponMaxRange(WeaponType weapon) {
return weaponMaxRange_native(pointer, weapon);
}
public int sightRange(UnitType unit) {
return sightRange_native(pointer, unit);
}
public int weaponDamageCooldown(UnitType unit) {
return weaponDamageCooldown_native(pointer, unit);
}
public int armor(UnitType unit) {
return armor_native(pointer, unit);
}
public int damage(WeaponType wpn) {
return damage_native(pointer, wpn);
}
public int getUnitScore() {
return getUnitScore_native(pointer);
}
public int getKillScore() {
return getKillScore_native(pointer);
}
public int getBuildingScore() {
return getBuildingScore_native(pointer);
}
public int getRazingScore() {
return getRazingScore_native(pointer);
}
public int getCustomScore() {
return getCustomScore_native(pointer);
}
public boolean isObserver() {
return isObserver_native(pointer);
}
public int getMaxUpgradeLevel(UpgradeType upgrade) {
return getMaxUpgradeLevel_native(pointer, upgrade);
}
public boolean isResearchAvailable(TechType tech) {
return isResearchAvailable_native(pointer, tech);
}
public boolean isUnitAvailable(UnitType unit) {
return isUnitAvailable_native(pointer, unit);
}
private static Map<Long, Player> instances = new HashMap<Long, Player>();
private Player(long pointer) {
this.pointer = pointer;
}
private static Player get(long pointer) {
if (pointer == 0 ) {
return null;
}
Player instance = instances.get(pointer);
if (instance == null ) {
instance = new Player(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native String getName_native(long pointer);
private native List<Unit> getUnits_native(long pointer);
private native Race getRace_native(long pointer);
private native PlayerType getType_native(long pointer);
private native Force getForce_native(long pointer);
private native boolean isAlly_native(long pointer, Player player);
private native boolean isEnemy_native(long pointer, Player player);
private native boolean isNeutral_native(long pointer);
private native TilePosition getStartLocation_native(long pointer);
private native boolean isVictorious_native(long pointer);
private native boolean isDefeated_native(long pointer);
private native boolean leftGame_native(long pointer);
private native int minerals_native(long pointer);
private native int gas_native(long pointer);
private native int gatheredMinerals_native(long pointer);
private native int gatheredGas_native(long pointer);
private native int repairedMinerals_native(long pointer);
private native int repairedGas_native(long pointer);
private native int refundedMinerals_native(long pointer);
private native int refundedGas_native(long pointer);
private native int spentMinerals_native(long pointer);
private native int spentGas_native(long pointer);
private native int supplyTotal_native(long pointer);
private native int supplyTotal_native(long pointer, Race race);
private native int supplyUsed_native(long pointer);
private native int supplyUsed_native(long pointer, Race race);
private native int allUnitCount_native(long pointer);
private native int allUnitCount_native(long pointer, UnitType unit);
private native int visibleUnitCount_native(long pointer);
private native int visibleUnitCount_native(long pointer, UnitType unit);
private native int completedUnitCount_native(long pointer);
private native int completedUnitCount_native(long pointer, UnitType unit);
private native int incompleteUnitCount_native(long pointer);
private native int incompleteUnitCount_native(long pointer, UnitType unit);
private native int deadUnitCount_native(long pointer);
private native int deadUnitCount_native(long pointer, UnitType unit);
private native int killedUnitCount_native(long pointer);
private native int killedUnitCount_native(long pointer, UnitType unit);
private native int getUpgradeLevel_native(long pointer, UpgradeType upgrade);
private native boolean hasResearched_native(long pointer, TechType tech);
private native boolean isResearching_native(long pointer, TechType tech);
private native boolean isUpgrading_native(long pointer, UpgradeType upgrade);
private native Color getColor_native(long pointer);
private native char getTextColor_native(long pointer);
private native int maxEnergy_native(long pointer, UnitType unit);
private native double topSpeed_native(long pointer, UnitType unit);
private native int weaponMaxRange_native(long pointer, WeaponType weapon);
private native int sightRange_native(long pointer, UnitType unit);
private native int weaponDamageCooldown_native(long pointer, UnitType unit);
private native int armor_native(long pointer, UnitType unit);
private native int damage_native(long pointer, WeaponType wpn);
private native int getUnitScore_native(long pointer);
private native int getKillScore_native(long pointer);
private native int getBuildingScore_native(long pointer);
private native int getRazingScore_native(long pointer);
private native int getCustomScore_native(long pointer);
private native boolean isObserver_native(long pointer);
private native int getMaxUpgradeLevel_native(long pointer, UpgradeType upgrade);
private native boolean isResearchAvailable_native(long pointer, TechType tech);
private native boolean isUnitAvailable_native(long pointer, UnitType unit);
}

View file

@ -1,74 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class PlayerType {
public String toString() {
return toString_native(pointer);
}
public boolean isLobbyType() {
return isLobbyType_native(pointer);
}
public boolean isGameType() {
return isGameType_native(pointer);
}
public static PlayerType None;
public static PlayerType Computer;
public static PlayerType Player;
public static PlayerType RescuePassive;
public static PlayerType EitherPreferComputer;
public static PlayerType EitherPreferHuman;
public static PlayerType Neutral;
public static PlayerType Closed;
public static PlayerType PlayerLeft;
public static PlayerType ComputerLeft;
public static PlayerType Unknown;
private static Map<Long, PlayerType> instances = new HashMap<Long, PlayerType>();
private PlayerType(long pointer) {
this.pointer = pointer;
}
private static PlayerType get(long pointer) {
if (pointer == 0 ) {
return null;
}
PlayerType instance = instances.get(pointer);
if (instance == null ) {
instance = new PlayerType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
private native boolean isLobbyType_native(long pointer);
private native boolean isGameType_native(long pointer);
}

View file

@ -1,58 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Playerset {
public List<Unit> getUnits() {
return getUnits_native(pointer);
}
public void setAlliance(boolean allies) {
setAlliance_native(pointer, allies);
}
public void setAlliance() {
setAlliance_native(pointer);
}
public void setAlliance(boolean allies, boolean alliedVictory) {
setAlliance_native(pointer, allies, alliedVictory);
}
private static Map<Long, Playerset> instances = new HashMap<Long, Playerset>();
private Playerset(long pointer) {
this.pointer = pointer;
}
private static Playerset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Playerset instance = instances.get(pointer);
if (instance == null ) {
instance = new Playerset(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native List<Unit> getUnits_native(long pointer);
private native void setAlliance_native(long pointer, boolean allies);
private native void setAlliance_native(long pointer);
private native void setAlliance_native(long pointer, boolean allies, boolean alliedVictory);
}

View file

@ -1,46 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Point {
public boolean isValid() {
return isValid_native(pointer);
}
public double getLength() {
return getLength_native(pointer);
}
private static Map<Long, Point> instances = new HashMap<Long, Point>();
private Point(long pointer) {
this.pointer = pointer;
}
private static Point get(long pointer) {
if (pointer == 0 ) {
return null;
}
Point instance = instances.get(pointer);
if (instance == null ) {
instance = new Point(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native boolean isValid_native(long pointer);
private native double getLength_native(long pointer);
}

View file

@ -1,88 +0,0 @@
package bwapi4;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
/**
* Positions are measured in pixels and are the highest resolution.
*/
public class Position extends AbstractPoint<Position>{
private int x, y;
public Position(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "[" + x + ", " + y + "]";
}
public native boolean isValid();
public native Position makeValid();
public native double getDistance(Position position);
public native int getApproxDistance(Position position);
public native double getLength();
public int getX() {
return x;
}
public int getY() {
return y;
}
public static Position Invalid;
public static Position None;
public static Position Unknown;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Position)) return false;
Position position = (Position) o;
if (x != position.x) return false;
if (y != position.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
private static Map<Long, Position> instances = new HashMap<Long, Position>();
private Position(long pointer) {
this.pointer = pointer;
}
private static Position get(long pointer) {
Position instance = instances.get(pointer);
if (instance == null) {
instance = new Position(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
public Position getPoint(){
return this;
}
}

View file

@ -1,55 +0,0 @@
package bwapi4;
import java.lang.IllegalArgumentException;
import java.lang.Object;
import java.lang.Override;
public class PositionOrUnit {
private Unit unit;
private Position position;
public PositionOrUnit(Unit unit){
if(unit == null){
throw new IllegalArgumentException("PositionOrUnit must not reference null!");
};
this.unit = unit;
}
public PositionOrUnit(Position position){
if(position == null){
throw new IllegalArgumentException("PositionOrUnit must not reference null!");
};
this.position = position;
}
public Unit getUnit(){
return unit;
}
public Position getPosition() {
return position;
}
public boolean isUnit(){
return unit != null;
}
public boolean isPosition(){
return position != null;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PositionOrUnit)) return false;
PositionOrUnit that = (PositionOrUnit) o;
if (position != null ? !position.equals(that.position) : that.position != null) return false;
if (unit != null ? !unit.equals(that.unit) : that.unit != null) return false;
return true;
}
}

View file

@ -1,15 +0,0 @@
package bwapi4;
import bwapi4.Position;
/**
* Interrmediate class used to translate getPoint() calls to getPosition() calls.
*/
public abstract class PositionedObject extends AbstractPoint<Position> {
public Position getPoint(){
return getPosition();
}
public abstract Position getPosition();
}

View file

@ -1,82 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Race {
public String toString() {
return toString_native(pointer);
}
public UnitType getWorker() {
return getWorker_native(pointer);
}
public UnitType getCenter() {
return getCenter_native(pointer);
}
public UnitType getRefinery() {
return getRefinery_native(pointer);
}
public UnitType getTransport() {
return getTransport_native(pointer);
}
public UnitType getSupplyProvider() {
return getSupplyProvider_native(pointer);
}
public static Race Zerg;
public static Race Terran;
public static Race Protoss;
public static Race Random;
public static Race None;
public static Race Unknown;
private static Map<Long, Race> instances = new HashMap<Long, Race>();
private Race(long pointer) {
this.pointer = pointer;
}
private static Race get(long pointer) {
if (pointer == 0 ) {
return null;
}
Race instance = instances.get(pointer);
if (instance == null ) {
instance = new Race(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
private native UnitType getWorker_native(long pointer);
private native UnitType getCenter_native(long pointer);
private native UnitType getRefinery_native(long pointer);
private native UnitType getTransport_native(long pointer);
private native UnitType getSupplyProvider_native(long pointer);
}

View file

@ -1,120 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
import bwapi4.CenteredObject;
public class Region extends CenteredObject
{
public int getID() {
return getID_native(pointer);
}
public int getRegionGroupID() {
return getRegionGroupID_native(pointer);
}
public Position getCenter() {
return getCenter_native(pointer);
}
public boolean isHigherGround() {
return isHigherGround_native(pointer);
}
public int getDefensePriority() {
return getDefensePriority_native(pointer);
}
public boolean isAccessible() {
return isAccessible_native(pointer);
}
public List<Region> getNeighbors() {
return getNeighbors_native(pointer);
}
public int getBoundsLeft() {
return getBoundsLeft_native(pointer);
}
public int getBoundsTop() {
return getBoundsTop_native(pointer);
}
public int getBoundsRight() {
return getBoundsRight_native(pointer);
}
public int getBoundsBottom() {
return getBoundsBottom_native(pointer);
}
public Region getClosestAccessibleRegion() {
return getClosestAccessibleRegion_native(pointer);
}
public Region getClosestInaccessibleRegion() {
return getClosestInaccessibleRegion_native(pointer);
}
public int getDistance(Region other) {
return getDistance_native(pointer, other);
}
private static Map<Long, Region> instances = new HashMap<Long, Region>();
private Region(long pointer) {
this.pointer = pointer;
}
private static Region get(long pointer) {
if (pointer == 0 ) {
return null;
}
Region instance = instances.get(pointer);
if (instance == null ) {
instance = new Region(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native int getID_native(long pointer);
private native int getRegionGroupID_native(long pointer);
private native Position getCenter_native(long pointer);
private native boolean isHigherGround_native(long pointer);
private native int getDefensePriority_native(long pointer);
private native boolean isAccessible_native(long pointer);
private native List<Region> getNeighbors_native(long pointer);
private native int getBoundsLeft_native(long pointer);
private native int getBoundsTop_native(long pointer);
private native int getBoundsRight_native(long pointer);
private native int getBoundsBottom_native(long pointer);
private native Region getClosestAccessibleRegion_native(long pointer);
private native Region getClosestInaccessibleRegion_native(long pointer);
private native int getDistance_native(long pointer, Region other);
}

View file

@ -1,40 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class Regionset {
public Position getCenter() {
return getCenter_native(pointer);
}
private static Map<Long, Regionset> instances = new HashMap<Long, Regionset>();
private Regionset(long pointer) {
this.pointer = pointer;
}
private static Regionset get(long pointer) {
if (pointer == 0 ) {
return null;
}
Regionset instance = instances.get(pointer);
if (instance == null ) {
instance = new Regionset(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native Position getCenter_native(long pointer);
}

View file

@ -1,30 +0,0 @@
package bwapi4.ShapeType;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
None(0),
Text(1),
Box(2),
Triangle(3),
Circle(4),
Ellipse(5),
Dot(6);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,172 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class TechType {
public String toString() {
return toString_native(pointer);
}
public Race getRace() {
return getRace_native(pointer);
}
public int mineralPrice() {
return mineralPrice_native(pointer);
}
public int gasPrice() {
return gasPrice_native(pointer);
}
public int researchTime() {
return researchTime_native(pointer);
}
public int energyCost() {
return energyCost_native(pointer);
}
public UnitType whatResearches() {
return whatResearches_native(pointer);
}
public WeaponType getWeapon() {
return getWeapon_native(pointer);
}
public boolean targetsUnit() {
return targetsUnit_native(pointer);
}
public boolean targetsPosition() {
return targetsPosition_native(pointer);
}
public Order getOrder() {
return getOrder_native(pointer);
}
public static TechType Stim_Packs;
public static TechType Lockdown;
public static TechType EMP_Shockwave;
public static TechType Spider_Mines;
public static TechType Scanner_Sweep;
public static TechType Tank_Siege_Mode;
public static TechType Defensive_Matrix;
public static TechType Irradiate;
public static TechType Yamato_Gun;
public static TechType Cloaking_Field;
public static TechType Personnel_Cloaking;
public static TechType Burrowing;
public static TechType Infestation;
public static TechType Spawn_Broodlings;
public static TechType Dark_Swarm;
public static TechType Plague;
public static TechType Consume;
public static TechType Ensnare;
public static TechType Parasite;
public static TechType Psionic_Storm;
public static TechType Hallucination;
public static TechType Recall;
public static TechType Stasis_Field;
public static TechType Archon_Warp;
public static TechType Restoration;
public static TechType Disruption_Web;
public static TechType Mind_Control;
public static TechType Dark_Archon_Meld;
public static TechType Feedback;
public static TechType Optical_Flare;
public static TechType Maelstrom;
public static TechType Lurker_Aspect;
public static TechType Healing;
public static TechType None;
public static TechType Nuclear_Strike;
public static TechType Unknown;
private static Map<Long, TechType> instances = new HashMap<Long, TechType>();
private TechType(long pointer) {
this.pointer = pointer;
}
private static TechType get(long pointer) {
if (pointer == 0 ) {
return null;
}
TechType instance = instances.get(pointer);
if (instance == null ) {
instance = new TechType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
private native Race getRace_native(long pointer);
private native int mineralPrice_native(long pointer);
private native int gasPrice_native(long pointer);
private native int researchTime_native(long pointer);
private native int energyCost_native(long pointer);
private native UnitType whatResearches_native(long pointer);
private native WeaponType getWeapon_native(long pointer);
private native boolean targetsUnit_native(long pointer);
private native boolean targetsPosition_native(long pointer);
private native Order getOrder_native(long pointer);
}

View file

@ -1,49 +0,0 @@
package bwapi4.Text;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
Previous(1),
Default(2),
Yellow(3),
White(4),
Grey(5),
Red(6),
Green(7),
BrightRed(8),
Invisible(11),
Blue(14),
Teal(15),
Purple(16),
Orange(17),
Align_Right(18),
Align_Center(19),
Invisible2(20),
Brown(21),
PlayerWhite(22),
PlayerYellow(23),
DarkGreen(24),
LightYellow(25),
Cyan(26),
Tan(27),
GreyBlue(28),
GreyGreen(29),
GreyCyan(30);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,26 +0,0 @@
package bwapi4.Text.Size;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum Enum {
Small(0),
Default(1),
Large(2);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -1,87 +0,0 @@
package bwapi4;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
/**
* Build Tiles - each build tile is a 4x4 square of walk tiles, or a 32x32 square of pixels.
* These are called build tiles because buildability data is available at this resolution, and correspond to the tiles seen in game.
* For example, a Command Center occupies an area of 4x3 build tiles.
*/
public class TilePosition extends AbstractPoint<TilePosition>{
private int x, y;
public TilePosition(int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "[" + x + ", " + y + "]";
}
public native boolean isValid();
public native TilePosition makeValid();
public native double getDistance(TilePosition position);
public native double getLength();
public int getX() {
return x;
}
public int getY() {
return y;
}
public static TilePosition Invalid;
public static TilePosition None;
public static TilePosition Unknown;
private static Map<Long, TilePosition> instances = new HashMap<Long, TilePosition>();
private TilePosition(long pointer) {
this.pointer = pointer;
}
private static TilePosition get(long pointer) {
TilePosition instance = instances.get(pointer);
if (instance == null) {
instance = new TilePosition(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TilePosition)) return false;
TilePosition that = (TilePosition) o;
if (x != that.x) return false;
if (y != that.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
public TilePosition getPoint(){
return this;
}
}

View file

@ -1,35 +0,0 @@
package bwapi4.Tournament;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public enum ActionID {
EnableFlag(0),
PauseGame(1),
ResumeGame(2),
LeaveGame(3),
SetLocalSpeed(4),
SetTextSize(5),
SetLatCom(6),
SetGUI(7),
SetMap(8),
SetFrameSkip(9),
Printf(10),
SendText(11);
private int value;
public int getValue(){
return value;
}
ActionID(int value){
this.value = value;
}
}

View file

@ -1,34 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnaryFilter {
private static Map<Long, UnaryFilter> instances = new HashMap<Long, UnaryFilter>();
private UnaryFilter(long pointer) {
this.pointer = pointer;
}
private static UnaryFilter get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnaryFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new UnaryFilter(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

File diff suppressed because it is too large Load diff

View file

@ -1,219 +0,0 @@
package bwapi4;
public class UnitCommand {
public static native UnitCommand attack(Unit unit, PositionOrUnit target);
public static native UnitCommand attack(Unit unit, PositionOrUnit target, boolean shiftQueueCommand);
public static native UnitCommand build(Unit unit, TilePosition target, UnitType type);
public static native UnitCommand buildAddon(Unit unit, UnitType type);
public static native UnitCommand train(Unit unit, UnitType type);
public static native UnitCommand morph(Unit unit, UnitType type);
public static native UnitCommand research(Unit unit, TechType tech);
public static native UnitCommand upgrade(Unit unit, UpgradeType upgrade);
public static native UnitCommand setRallyPoint(Unit unit, PositionOrUnit target);
public static native UnitCommand move(Unit unit, Position target);
public static native UnitCommand move(Unit unit, Position target, boolean shiftQueueCommand);
public static native UnitCommand patrol(Unit unit, Position target);
public static native UnitCommand patrol(Unit unit, Position target, boolean shiftQueueCommand);
public static native UnitCommand holdPosition(Unit unit);
public static native UnitCommand holdPosition(Unit unit, boolean shiftQueueCommand);
public static native UnitCommand stop(Unit unit);
public static native UnitCommand stop(Unit unit, boolean shiftQueueCommand);
public static native UnitCommand follow(Unit unit, Unit target);
public static native UnitCommand follow(Unit unit, Unit target, boolean shiftQueueCommand);
public static native UnitCommand gather(Unit unit, Unit target);
public static native UnitCommand gather(Unit unit, Unit target, boolean shiftQueueCommand);
public static native UnitCommand returnCargo(Unit unit);
public static native UnitCommand returnCargo(Unit unit, boolean shiftQueueCommand);
public static native UnitCommand repair(Unit unit, Unit target);
public static native UnitCommand repair(Unit unit, Unit target, boolean shiftQueueCommand);
public static native UnitCommand burrow(Unit unit);
public static native UnitCommand unburrow(Unit unit);
public static native UnitCommand cloak(Unit unit);
public static native UnitCommand decloak(Unit unit);
public static native UnitCommand siege(Unit unit);
public static native UnitCommand unsiege(Unit unit);
public static native UnitCommand lift(Unit unit);
public static native UnitCommand land(Unit unit, TilePosition target);
public static native UnitCommand load(Unit unit, Unit target);
public static native UnitCommand load(Unit unit, Unit target, boolean shiftQueueCommand);
public static native UnitCommand unload(Unit unit, Unit target);
public static native UnitCommand unloadAll(Unit unit);
public static native UnitCommand unloadAll(Unit unit, boolean shiftQueueCommand);
public static native UnitCommand unloadAll(Unit unit, Position target);
public static native UnitCommand unloadAll(Unit unit, Position target, boolean shiftQueueCommand);
public static native UnitCommand rightClick(Unit unit, PositionOrUnit target);
public static native UnitCommand rightClick(Unit unit, PositionOrUnit target, boolean shiftQueueCommand);
public static native UnitCommand haltConstruction(Unit unit);
public static native UnitCommand cancelConstruction(Unit unit);
public static native UnitCommand cancelAddon(Unit unit);
public static native UnitCommand cancelTrain(Unit unit);
public static native UnitCommand cancelTrain(Unit unit, int slot);
public static native UnitCommand cancelMorph(Unit unit);
public static native UnitCommand cancelResearch(Unit unit);
public static native UnitCommand cancelUpgrade(Unit unit);
public static native UnitCommand useTech(Unit unit, TechType tech);
public static native UnitCommand useTech(Unit unit, TechType tech, PositionOrUnit target);
public static native UnitCommand placeCOP(Unit unit, TilePosition target);
private Unit unit;
private UnitCommandType unitCommandType;
private Unit target;
private int x, y;
private int extra;
private UnitCommand(Unit unit, UnitCommandType unitCommandType, Unit target, int x, int y, int extra) {
this.unit = unit;
this.unitCommandType = unitCommandType;
this.target = target;
this.x = x;
this.y = y;
this.extra = extra;
}
public Unit getUnit() {
return unit;
}
public UnitCommandType getUnitCommandType() {
return unitCommandType;
}
public Unit getTarget() {
return target;
}
public int getSlot() {
if (unitCommandType == UnitCommandType.None) {
return extra;
}
return -1;
}
public Position getTargetPosition() {
if (unitCommandType == UnitCommandType.Build ||
unitCommandType == UnitCommandType.Land ||
unitCommandType == UnitCommandType.Place_COP) {
return new Position(x * 32, y * 32);
}
return new Position(x, y);
}
public TilePosition getTargetTilePosition() {
if (unitCommandType == UnitCommandType.Build ||
unitCommandType == UnitCommandType.Land ||
unitCommandType == UnitCommandType.Place_COP) {
return new TilePosition(x, y);
}
return new TilePosition(x / 32, y / 32);
}
public boolean isQueued() {
if (unitCommandType == UnitCommandType.Attack_Move ||
unitCommandType == UnitCommandType.Attack_Unit ||
unitCommandType == UnitCommandType.Move ||
unitCommandType == UnitCommandType.Patrol ||
unitCommandType == UnitCommandType.Hold_Position ||
unitCommandType == UnitCommandType.Stop ||
unitCommandType == UnitCommandType.Follow ||
unitCommandType == UnitCommandType.Gather ||
unitCommandType == UnitCommandType.Return_Cargo ||
unitCommandType == UnitCommandType.Repair ||
unitCommandType == UnitCommandType.Load ||
unitCommandType == UnitCommandType.Unload_All ||
unitCommandType == UnitCommandType.Unload_All_Position ||
unitCommandType == UnitCommandType.Right_Click_Position ||
unitCommandType == UnitCommandType.Right_Click_Unit) {
return extra != 0;
}
return false;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UnitCommand)) return false;
UnitCommand that = (UnitCommand) o;
if (extra != that.extra) return false;
if (x != that.x) return false;
if (y != that.y) return false;
if (target != null ? !target.equals(that.target) : that.target != null) return false;
if (unit != null ? !unit.equals(that.unit) : that.unit != null) return false;
if (unitCommandType != null ? !unitCommandType.equals(that.unitCommandType) : that.unitCommandType != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = unit != null ? unit.hashCode() : 0;
result = 31 * result + (unitCommandType != null ? unitCommandType.hashCode() : 0);
result = 31 * result + (target != null ? target.hashCode() : 0);
result = 31 * result + x;
result = 31 * result + y;
result = 31 * result + extra;
return result;
}
}

View file

@ -1,132 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitCommandType {
public String toString() {
return toString_native(pointer);
}
public static UnitCommandType Attack_Move;
public static UnitCommandType Attack_Unit;
public static UnitCommandType Build;
public static UnitCommandType Build_Addon;
public static UnitCommandType Train;
public static UnitCommandType Morph;
public static UnitCommandType Research;
public static UnitCommandType Upgrade;
public static UnitCommandType Set_Rally_Position;
public static UnitCommandType Set_Rally_Unit;
public static UnitCommandType Move;
public static UnitCommandType Patrol;
public static UnitCommandType Hold_Position;
public static UnitCommandType Stop;
public static UnitCommandType Follow;
public static UnitCommandType Gather;
public static UnitCommandType Return_Cargo;
public static UnitCommandType Repair;
public static UnitCommandType Burrow;
public static UnitCommandType Unburrow;
public static UnitCommandType Cloak;
public static UnitCommandType Decloak;
public static UnitCommandType Siege;
public static UnitCommandType Unsiege;
public static UnitCommandType Lift;
public static UnitCommandType Land;
public static UnitCommandType Load;
public static UnitCommandType Unload;
public static UnitCommandType Unload_All;
public static UnitCommandType Unload_All_Position;
public static UnitCommandType Right_Click_Position;
public static UnitCommandType Right_Click_Unit;
public static UnitCommandType Halt_Construction;
public static UnitCommandType Cancel_Construction;
public static UnitCommandType Cancel_Addon;
public static UnitCommandType Cancel_Train;
public static UnitCommandType Cancel_Train_Slot;
public static UnitCommandType Cancel_Morph;
public static UnitCommandType Cancel_Research;
public static UnitCommandType Cancel_Upgrade;
public static UnitCommandType Use_Tech;
public static UnitCommandType Use_Tech_Position;
public static UnitCommandType Use_Tech_Unit;
public static UnitCommandType Place_COP;
public static UnitCommandType None;
public static UnitCommandType Unknown;
private static Map<Long, UnitCommandType> instances = new HashMap<Long, UnitCommandType>();
private UnitCommandType(long pointer) {
this.pointer = pointer;
}
private static UnitCommandType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitCommandType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitCommandType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

View file

@ -1,31 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitFilter {
private static Map<Long, UnitFilter> instances = new HashMap<Long, UnitFilter>();
private UnitFilter(long pointer) {
this.pointer = pointer;
}
private static UnitFilter get(long pointer) {
UnitFilter instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitFilter(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
}

View file

@ -1,52 +0,0 @@
package bwapi4;
import bwapi4.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.util.List;
public class UnitSizeType {
public String toString() {
return toString_native(pointer);
}
public static UnitSizeType Independent;
public static UnitSizeType Small;
public static UnitSizeType Medium;
public static UnitSizeType Large;
public static UnitSizeType None;
public static UnitSizeType Unknown;
private static Map<Long, UnitSizeType> instances = new HashMap<Long, UnitSizeType>();
private UnitSizeType(long pointer) {
this.pointer = pointer;
}
private static UnitSizeType get(long pointer) {
if (pointer == 0 ) {
return null;
}
UnitSizeType instance = instances.get(pointer);
if (instance == null ) {
instance = new UnitSizeType(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
private native String toString_native(long pointer);
}

Some files were not shown because too many files have changed in this diff Show more