bwapi 4 cleanup

This commit is contained in:
vjurenka 2015-02-10 16:47:28 +01:00
parent 1e64116ff9
commit 3e067cf841
261 changed files with 34898 additions and 5355 deletions

Binary file not shown.

BIN
bwapi_bridge2_0.exp Normal file

Binary file not shown.

BIN
bwapi_bridge_v2_0.exp Normal file

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Color.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Error.class Normal file

Binary file not shown.

BIN
compiled4/bwapi/Event.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Force.class Normal file

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Game.class Normal file

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Key.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Order.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Race.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Unit.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
compiled4/bwapi/Utils.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,130 @@
package bwapi;
import bwapi.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

@ -0,0 +1,30 @@
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 getDistance(AbstractPoint<T> otherPosition) {
return getDistance(otherPosition.getX(), otherPosition.getY());
}
public double getDistance(int x, int y) {
double dx = x - getX();
double dy = y - getY();
return Math.sqrt(dx * dx + dy * dy);
}
}

View file

@ -0,0 +1,53 @@
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 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

@ -0,0 +1,34 @@
package bwapi;
import bwapi.*;
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

@ -0,0 +1,31 @@
package bwapi;
import bwapi.*;
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;
}

118
generated/bwapi/Bullet.java Normal file
View file

@ -0,0 +1,118 @@
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 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

@ -0,0 +1,114 @@
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 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

@ -0,0 +1,34 @@
package bwapi;
import bwapi.*;
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

@ -0,0 +1,15 @@
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

@ -0,0 +1,58 @@
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

@ -0,0 +1,73 @@
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

@ -0,0 +1,41 @@
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),
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

@ -0,0 +1,34 @@
package bwapi;
import bwapi.*;
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

@ -0,0 +1,27 @@
package bwapi.CoordinateType;
import bwapi.*;
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

@ -0,0 +1,54 @@
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 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

@ -0,0 +1,103 @@
package bwapi;
import bwapi.BWEventListener;
import bwapi.Player;
import bwapi.Position;
import bwapi.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

@ -0,0 +1,126 @@
package bwapi.Enum;
import bwapi.*;
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

@ -0,0 +1,96 @@
package bwapi;
import bwapi.*;
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

@ -0,0 +1,64 @@
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

@ -0,0 +1,41 @@
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);
private int value;
public int getValue(){
return value;
}
Enum(int value){
this.value = value;
}
}

View file

@ -0,0 +1,90 @@
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 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

@ -0,0 +1,25 @@
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

@ -0,0 +1,52 @@
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);
}

View file

@ -0,0 +1,40 @@
package bwapi;
import bwapi.*;
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);
}

1330
generated/bwapi/Game.java Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,70 @@
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 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);
}

251
generated/bwapi/Key.java Normal file
View file

@ -0,0 +1,251 @@
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),
__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

@ -0,0 +1,29 @@
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;
}
}

262
generated/bwapi/Mirror.java Normal file
View file

@ -0,0 +1,262 @@
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 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[] = {"bwapi_bridge" + VERSION};
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

@ -0,0 +1,27 @@
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),
M_MAX(3);
private int value;
public int getValue(){
return value;
}
MouseButton(int value){
this.value = value;
}
}

346
generated/bwapi/Order.java Normal file
View file

@ -0,0 +1,346 @@
package bwapi;
import bwapi.*;
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;
}

400
generated/bwapi/Player.java Normal file
View file

@ -0,0 +1,400 @@
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() {
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

@ -0,0 +1,74 @@
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 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

@ -0,0 +1,58 @@
package bwapi;
import bwapi.*;
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

@ -0,0 +1,86 @@
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 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;
}
}

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