📄 equip.java
字号:
package com.swing.game.crystal.utils;
import java.io.*;
import java.nio.*;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.Logger;
public class Equip {
public static Logger logger = Logger.getLogger(Equip.class);
static {
PropertyConfigurator.configure("./cfg/Log4j.properties");
}
public String id;
public String name;
public String description;
/**
* demonstrate which kind of equip this one is
* a : attack weapon
* d : defense equip
* m : amulet
*/
public int level;
public int role;
public String kind;
public int attack;
public int defense;
/**
* increace the energy up limit
*/
public int usePower;
public int agility;
public int resurrection;
public int capacity;
public int accuracy;
public String target;
public int special;
/**
* increase the blood resurect speed
*/
public String path;
public byte [] image;
public Equip (String id, String name, String description,
String level, String role, String kind, String attack,
String defense, String usePower, String agility,
String resurrection, String capacity, String accuracy,
String target, String special, String path, String dir) {
File f = null;
InputStream in = null;
try {
this.id = id;
this.name = name;
this.description = description;
this.level = Integer.parseInt(level);
this.role = Integer.parseInt(role);
this.kind = kind;
this.attack = Integer.parseInt(attack);
this.defense = Integer.parseInt(defense);
this.usePower = Integer.parseInt(usePower);
this.agility = Integer.parseInt(agility);
this.resurrection = Integer.parseInt(resurrection);
this.capacity = Integer.parseInt(capacity);
this.accuracy = Integer.parseInt(accuracy);
this.target = target;
this.special = Integer.parseInt(special);
this.path = path;
f = new File(dir);
in = new FileInputStream(f);
int length = 0;
ByteBuffer bb = ByteBuffer.allocate(10000);
byte[] temp = new byte[1000];
int len = 0;
while ( (len = in.read(temp, 0, 1000)) != -1) {
bb.put(temp);
length += len;
}
this.image = new byte[length];
System.arraycopy(bb.array(), 0, image, 0, length);
}
catch (Exception e) {
logger.error(e);
}
finally {
try {
if (in != null)
in.close();
f = null;
}
catch (Exception e) {
logger.error(e);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -