Commit 953529a3 authored by fallenstardust's avatar fallenstardust

新cdb数据解析归类

parent 39b7dbec
......@@ -114,9 +114,6 @@ public interface Constants {
String PREF_READ_EX = "pref_settings_read_ex";
boolean DEF_PREF_READ_EX = false;
String PREF_DECK_MANAGER_V2 = "pref_settings_deck_manager_v2";
boolean DEF_PREF_DECK_MANAGER_V2 = false;
String PREF_KEEP_SCALE = "pref_settings_keep_scale";
boolean DEF_PREF_KEEP_SCALE = false;
......@@ -125,18 +122,11 @@ public interface Constants {
int REQUEST_CHOOSE_IMG = 0x1000 + 0x21;
int REQUEST_CHOOSE_FOLDER = 0x1000 + 0x22;
int REQUEST_SETTINGS_CODE = 0x1000 + 0x23;
int STRING_TYPE_START = 1050;
int STRING_ATTRIBUTE_START = 1010;
int STRING_RACE_START = 1020;
int STRING_OT_START = 1480;
int UNSORT_TIMES = 0x80;
int CARD_RESULT_GRAVITY = Gravity.LEFT;
int CARD_SEARCH_GRAVITY = Gravity.RIGHT;
int STRING_LIMIT_START = 1315;
int STRING_CATEGORY_START = 1100;
int DEFAULT_CARD_COUNT = 500;
int DECK_WIDTH_MAX_COUNT = 15;
int DECK_WIDTH_COUNT = 10;
......@@ -145,10 +135,8 @@ public interface Constants {
int DECK_SIDE_MAX = 15;
int DECK_EXTRA_COUNT = (DECK_SIDE_MAX / DECK_WIDTH_COUNT * DECK_WIDTH_COUNT < DECK_SIDE_MAX) ? DECK_WIDTH_COUNT * 2 : DECK_WIDTH_COUNT;
int DECK_SIDE_COUNT = DECK_EXTRA_COUNT;
String URL_DONATE_CN= "https://afdian.net/@ygomobile";
String URL_DONATE= "https://www.paypal.me/ygomobile1";
String URL_HELP = "http://note.youdao.com/noteshare?id=8ae2dc824b7dc04a95a4665a938e2251";
String URL_MASTERRULE_CN = "https://ocg-rule.readthedocs.io/zh_CN/master/";
String URL_MASTER_RULE_CN = "https://ocg-rule.readthedocs.io/zh_CN/master/";
String WIKI_SEARCH_URL = "https://www.ourocg.cn/S.aspx?key=";
String SERVER_FILE = "server_list.xml";
......@@ -169,7 +157,7 @@ public interface Constants {
/***
* 长按删除
*/
long LONG_PRESS_DRAG = 600;
long LONG_PRESS_DRAG = 800;
/***
* adb shell am start -n cn.garymb.ygomobile/cn.garymb.ygomobile.ui.home.MainActivity -a ygomobile.intent.action.DECK --es android.intent.extra.TEXT 青眼白龙.ydk
* <p>
......@@ -222,4 +210,8 @@ public interface Constants {
//打开ydk,是否复制到文件夹
boolean COPY_YDK_FILE = false;
String TAG = "ygo-java";
String DEF_ENCODING = "utf-8";
}
......@@ -5,6 +5,7 @@ import android.text.TextUtils;
import java.util.List;
import ocgcore.data.Card;
import ocgcore.enums.CardOt;
import ocgcore.enums.CardType;
class CardSearchInfo {
......@@ -111,19 +112,18 @@ class CardSearchInfo {
}
}
}
if (ot > 0) {
if (ot == 8) {//8为简中的位数
if((ot&card.Ot) !=ot)
return false;
} else {
if (ot != card.Ot) {
if (ot > CardOt.ALL.getId()) {
if(ot == CardOt.NO_EXCLUSIVE.getId()){
if(card.Ot == CardOt.OCG.getId() || card.Ot == CardOt.TCG.getId()){
return false;
}
} else if ((card.Ot & ot) == 0) {
return false;
}
}
if (pscale != -1) {
if (!card.isType(CardType.Pendulum) || card.LScale != pscale && card.RScale != pscale) {
if (!card.isType(CardType.Pendulum) || card.LeftScale != pscale && card.RightScale != pscale) {
return false;
}
}
......@@ -141,7 +141,7 @@ class CardSearchInfo {
if (types.length > 0) {
boolean st = false;
for (long cardType : types) {
if (cardType == CardType.Spell.value() || cardType == CardType.Trap.value()) {
if (cardType == CardType.Spell.getId() || cardType == CardType.Trap.getId()) {
st = true;
break;
}
......@@ -150,46 +150,52 @@ class CardSearchInfo {
for (long type : types) {
if (type > 0) {
if (st) {
//效果以外
if (type == CardType.Non_Effect.getId()) {
if (card.isType(CardType.Effect)) {
return false;
}
}
//魔法
if (type == CardType.Normal.value()) {
else if (type == CardType.Normal.getId()) {
//通常
if (card.isType(CardType.Normal)) {
//带通常的魔法陷阱
if (card.Type != (CardType.Spell.value() | CardType.Normal.value())
&& card.Type != (CardType.Trap.value() | CardType.Normal.value())) {
if (card.Type != (CardType.Spell.getId() | CardType.Normal.getId())
&& card.Type != (CardType.Trap.getId() | CardType.Normal.getId())) {
return false;
}
} else {
//只有魔法/陷阱
if (card.Type != CardType.Spell.value() && card.Type != CardType.Trap.value())
if (card.Type != CardType.Spell.getId() && card.Type != CardType.Trap.getId())
return false;
}
continue;
}
} else {
//排除通常怪兽里的token卡
if (type == CardType.Normal.value()) {
if ((card.Type & CardType.Token.value()) == CardType.Token.value())
if (type == CardType.Normal.getId()) {
if ((card.Type & CardType.Token.getId()) == CardType.Token.getId())
return false;
}
}
//效果怪兽
if (type == CardType.Effect.value()) {
if ((card.Type & CardType.Effect.value()) == CardType.Effect.value()) {
if (type == CardType.Effect.getId()) {
if ((card.Type & CardType.Effect.getId()) == CardType.Effect.getId()) {
//如果是融合/仪式/同调/超量/连接
if ((card.Type & CardType.Fusion.value()) == CardType.Fusion.value()
|| (card.Type & CardType.Ritual.value()) == CardType.Ritual.value()
|| (card.Type & CardType.Synchro.value()) == CardType.Synchro.value()
|| (card.Type & CardType.Xyz.value()) == CardType.Xyz.value()
|| (card.Type & CardType.Link.value()) == CardType.Link.value()
if ((card.Type & CardType.Fusion.getId()) == CardType.Fusion.getId()
|| (card.Type & CardType.Ritual.getId()) == CardType.Ritual.getId()
|| (card.Type & CardType.Synchro.getId()) == CardType.Synchro.getId()
|| (card.Type & CardType.Xyz.getId()) == CardType.Xyz.getId()
|| (card.Type & CardType.Link.getId()) == CardType.Link.getId()
)
return false;
} else {
return false;
}
} else if (type == CardType.Non_Effect.value()) {
} else if (type == CardType.Non_Effect.getId()) {
//非效果怪兽
if ((card.Type & CardType.Effect.value()) == CardType.Effect.value())
if ((card.Type & CardType.Effect.getId()) == CardType.Effect.getId())
return false;
} else if ((card.Type & type) != type) {
return false;
......
......@@ -101,15 +101,15 @@ public class DeckLoader {
IOUtils.close(in);
}
DeckInfo deckInfo = new DeckInfo();
SparseArray<Card> tmp = cardLoader.readCards(deck.getMainlist(), limitList, true);
SparseArray<Card> tmp = cardLoader.readCards(deck.getMainlist(), true);
for (Integer id : deck.getMainlist()) {
deckInfo.addMainCards(tmp.get(id));
}
tmp = cardLoader.readCards(deck.getExtraList(), limitList, true);
tmp = cardLoader.readCards(deck.getExtraList(), true);
for (Integer id : deck.getExtraList()) {
deckInfo.addExtraCards(tmp.get(id));
}
tmp = cardLoader.readCards(deck.getSideList(), limitList, true);
tmp = cardLoader.readCards(deck.getSideList(), true);
// Log.i("kk", "desk:" + tmp.size()+"/"+side.size());
for (Integer id : deck.getSideList()) {
deckInfo.addSideCards(tmp.get(id));
......
......@@ -14,7 +14,7 @@ public class CardUtils {
if (card.isType(CardType.Spell)) {
for (CardType type : cardTypes) {
if (card.isType(type)) {
stringBuilder.append(stringManager.getTypeString(type.value()));
stringBuilder.append(stringManager.getTypeString(type.getId()));
// break;
}
}
......@@ -22,7 +22,7 @@ public class CardUtils {
} else if (card.isType(CardType.Trap)) {
for (CardType type : cardTypes) {
if (card.isType(type)) {
stringBuilder.append(stringManager.getTypeString(type.value()));
stringBuilder.append(stringManager.getTypeString(type.getId()));
}
// break;
}
......@@ -35,10 +35,10 @@ public class CardUtils {
} else {
isFrst = false;
}
String str = stringManager.getTypeString(type.value());
String str = stringManager.getTypeString(type.getId());
if (TextUtils.isEmpty(str)) {
stringBuilder.append("0x");
stringBuilder.append(String.format("%X", type.value()));
stringBuilder.append(String.format("%X", type.getId()));
} else {
stringBuilder.append(str);
}
......@@ -47,4 +47,24 @@ public class CardUtils {
}
return stringBuilder.toString();
}
public int value2Index(long type) {
//0 1 2 3 4
//1 2 4 8 16
int i = 0;
long start;
do {
start = (long) Math.pow(2, i);
if (start == type) {
return i;
} else if (start > type) {
return -1;
}
i++;
}
while (start < type);
return i;
}
}
......@@ -28,6 +28,8 @@ import cn.garymb.ygomobile.App;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.utils.IOUtils;
import ocgcore.data.Card;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardOt;
public class CardManager {
......@@ -35,7 +37,12 @@ public class CardManager {
private final SparseArray<Card> cardDataHashMap = new SparseArray<>();
private String dbDir, exDbPath;
public CardManager(String dbDir, String exPath) {
/**
* @see DataManager#getCardManager()
* @param dbDir
* @param exPath
*/
CardManager(String dbDir, String exPath) {
this.dbDir = dbDir;
this.exDbPath = exPath;
}
......@@ -110,7 +117,13 @@ public class CardManager {
}
public Card getCard(int code) {
return cardDataHashMap.get(Integer.valueOf(code));
Card card = cardDataHashMap.get(code);
if(card == null){
card = new Card(code);
cardDataHashMap.put(code, new Card(code));
return card;
}
return card;
}
public int getCount() {
......@@ -182,12 +195,12 @@ public class CardManager {
cardData.Code = reader.getInt(0);
cardData.Ot = reader.getInt(1);
cardData.Alias = reader.getInt(2);
cardData.Setcode = reader.getLong(3);
cardData.SetCode = reader.getLong(3);
cardData.Type = reader.getLong(4);
int levelInfo = reader.getInt(5);
cardData.Level = levelInfo & 0xff;
cardData.LScale = (levelInfo >> 24) & 0xff;
cardData.RScale = (levelInfo >> 16) & 0xff;
cardData.LeftScale = (levelInfo >> 24) & 0xff;
cardData.RightScale = (levelInfo >> 16) & 0xff;
cardData.Race = reader.getLong(6);
cardData.Attribute = reader.getInt(7);
cardData.Attack = reader.getInt(8);
......
......@@ -22,7 +22,7 @@ public class DataManager {
private final StringManager mStringManager;
private final LimitManager mLimitManager;
private CardManager mCardManager;
private final CardManager mCardManager;
private DataManager() {
mStringManager = new StringManager();
......@@ -40,10 +40,6 @@ public class DataManager {
return mLimitManager;
}
public static ConfigManager openConfig(File conf) {
return new ConfigManager(conf);
}
public CardManager getCardManager() {
return mCardManager;
}
......
......@@ -11,6 +11,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
......@@ -22,7 +23,12 @@ import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.StringUtils;
import ocgcore.data.CardSet;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardCategory;
import ocgcore.enums.CardOt;
import ocgcore.enums.CardRace;
import ocgcore.enums.CardType;
import ocgcore.enums.LimitType;
public class StringManager implements Closeable {
private static final String PRE_SYSTEM = "!system";
......@@ -125,7 +131,7 @@ public class StringManager implements Closeable {
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
in = new InputStreamReader(inputStream, "utf-8");
in = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(in);
String line = null;
while ((line = reader.readLine()) != null) {
......@@ -195,71 +201,86 @@ public class StringManager implements Closeable {
return 0;
}
public String getSystemString(int key) {
return mSystem.get(Integer.valueOf(key));
}
public String getSystemString(int start, long value) {
return getSystemString(start + value2Index(value));
/**
* @param index 索引
* @param def 默认值
*/
public String getSystemString(Integer index, String def){
if(index <= 0){
return def;
}
try {
String str = mSystem.get(index);
if (TextUtils.isEmpty(str)) {
return def;
}
return StringUtils.toDBC(str);
} catch (Exception e) {
return def;
}
}
public String getLimitString(long value) {
// String str =
// Log.d("kk", value + "=" + str);
return getSystemString((int) (Constants.STRING_LIMIT_START + value));
public String getLimitString(long id) {
LimitType value = LimitType.valueOf(id);
if(value == null){
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getTypeString(long value) {
return getSystemString(Constants.STRING_TYPE_START, value);
public String getTypeString(long id) {
CardType value = CardType.valueOf(id);
if(value == null){
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getAttributeString(long value) {
return getSystemString(Constants.STRING_ATTRIBUTE_START, value);
public String getAttributeString(long id) {
CardAttribute value = CardAttribute.valueOf(id);
if(value == null){
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getRaceString(long value) {
String race = getSystemString(Constants.STRING_RACE_START, value);
if (TextUtils.isEmpty(race)) {
return String.format("0x%X", value);
public String getRaceString(long id) {
CardRace value = CardRace.valueOf(id);
if(value == null){
return String.format("0x%x", id);
}
return race;
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getOtString(int ot, String def) {
if (ot == CardOt.All.ordinal()) {
return "-";
public String getOtString(int ot, boolean full) {
if(!full || ot == 0){
CardOt value = CardOt.valueOf(ot);
if(value == null){
return String.valueOf(ot);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
try {
String str = getSystemString(Constants.STRING_OT_START + ot);
if (TextUtils.isEmpty(str)) {
return def;//String.valueOf(CardOt.values()[ot]);
StringBuilder stringBuilder = new StringBuilder();
boolean first = true;
for(CardOt _ot : CardOt.values()){
if((_ot.getId() & ot) != 0){
if(first){
first = false;
} else {
stringBuilder.append("|");
}
stringBuilder.append(getSystemString(_ot.getLanguageIndex(), _ot.name()));
}
return StringUtils.toDBC(str);
} catch (Exception e) {
return def;
}
return stringBuilder.toString();
}
public String getCategoryString(long value) {
return getSystemString(Constants.STRING_CATEGORY_START, value);
}
public int value2Index(long type) {
//0 1 2 3 4
//1 2 4 8 16
int i = 0;
long start;
do {
start = (long) Math.pow(2, i);
if (start == type) {
return i;
} else if (start > type) {
return -1;
}
i++;
public String getCategoryString(long id) {
CardCategory value = CardCategory.valueOf(id);
if(value == null){
return String.valueOf(id);
}
while (start < type);
return i;
return getSystemString(value.getLanguageIndex(), value.name());
}
private long toNumber(String str) {
......
......@@ -35,6 +35,7 @@ public class Card extends CardData implements Parcelable {
public Card(int code) {
super(code);
this.Name = "Unknown";
}
public Card(CardData cardData) {
......@@ -42,15 +43,15 @@ public class Card extends CardData implements Parcelable {
if (cardData != null) {
this.Code = cardData.Code;
this.Alias = cardData.Alias;
this.Setcode = cardData.Setcode;
this.SetCode = cardData.SetCode;
this.Type = cardData.Type;
this.Level = cardData.Level;
this.Attribute = cardData.Attribute;
this.Race = cardData.Race;
this.Attack = cardData.Attack;
this.Defense = cardData.Defense;
this.LScale = cardData.LScale;
this.RScale = cardData.RScale;
this.LeftScale = cardData.LeftScale;
this.RightScale = cardData.RightScale;
this.Category = cardData.Category;
}
}
......@@ -62,7 +63,7 @@ public class Card extends CardData implements Parcelable {
}
public static boolean isType(long Type, CardType type) {
return ((Type & type.value()) != 0);
return ((Type & type.getId()) != 0);
}
public static boolean isSpellTrap(long Type) {
......@@ -82,12 +83,16 @@ public class Card extends CardData implements Parcelable {
return (Level & 0xff);
}
public int getLinkNumber(){
return getStar();
}
public boolean isType(CardType type) {
return ((Type & type.value()) != 0);
return ((Type & type.getId()) != 0);
}
public boolean onlyType(CardType type) {
return (Type == type.value());
return (Type == type.getId());
}
public boolean isSpellTrap() {
......@@ -101,17 +106,17 @@ public class Card extends CardData implements Parcelable {
public long[] getSetCode() {
long[] setcodes = new long[SETCODE_MAX];
for (int i = 0, k = 0; i < SETCODE_MAX; k += 0x10, i++) {
setcodes[i] = (Setcode >> k) & 0xffff;
setcodes[i] = (SetCode >> k) & 0xffff;
}
return setcodes;
}
public void setSetCode(long[] setcodes) {
int i = 0;
this.Setcode = 0;
this.SetCode = 0;
if (setcodes != null) {
for (long sc : setcodes) {
this.Setcode += (sc << i);
this.SetCode += (sc << i);
i += 0x10;
}
}
......@@ -128,20 +133,24 @@ public class Card extends CardData implements Parcelable {
return false;
}
public boolean isAlias(Card c){
return c.Code == this.Code || c.Alias == this.Code || c.Code == this.Alias;
}
@Override
public String toString() {
return "Card{" +
"Code=" + Code +
", Alias=" + Alias +
", Setcode=" + Setcode +
", Setcode=" + SetCode +
", Type=" + Type +
", Level=" + Level +
", Attribute=" + Attribute +
", Race=" + Race +
", Attack=" + Attack +
", Defense=" + Defense +
", LScale=" + LScale +
", RScale=" + RScale +
", LScale=" + LeftScale +
", RScale=" + RightScale +
", Name='" + Name + '\'' +
", Desc='" + Desc + '\'' +
'}';
......
......@@ -3,6 +3,9 @@ package ocgcore.data;
import android.os.Parcel;
import android.os.Parcelable;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardOt;
public class CardData implements Parcelable{
public CardData() {
......@@ -11,19 +14,18 @@ public class CardData implements Parcelable{
public CardData(int code) {
Code = code;
}
public int Code;
public int Ot;
public int Alias;
public long Setcode;
public long SetCode;
public long Type;
public int Level;
public int Attribute;
public long Race;
public int Attack;
public int Defense;
public int LScale;
public int RScale;
public int LeftScale;
public int RightScale;
public long Category;
@Override
......@@ -32,15 +34,15 @@ public class CardData implements Parcelable{
"Code=" + Code +
", Ot=" + Ot +
", Alias=" + Alias +
", Setcode=" + Setcode +
", Setcode=" + SetCode +
", Type=" + Type +
", Level=" + Level +
", Attribute=" + Attribute +
", Race=" + Race +
", Attack=" + Attack +
", Defense=" + Defense +
", LScale=" + LScale +
", RScale=" + RScale +
", LScale=" + LeftScale +
", RScale=" + RightScale +
", Category=" + Category +
'}';
}
......@@ -55,15 +57,15 @@ public class CardData implements Parcelable{
dest.writeInt(this.Code);
dest.writeInt(this.Ot);
dest.writeInt(this.Alias);
dest.writeLong(this.Setcode);
dest.writeLong(this.SetCode);
dest.writeLong(this.Type);
dest.writeInt(this.Level);
dest.writeInt(this.Attribute);
dest.writeLong(this.Race);
dest.writeInt(this.Attack);
dest.writeInt(this.Defense);
dest.writeInt(this.LScale);
dest.writeInt(this.RScale);
dest.writeInt(this.LeftScale);
dest.writeInt(this.RightScale);
dest.writeLong(this.Category);
}
......@@ -71,15 +73,15 @@ public class CardData implements Parcelable{
this.Code = in.readInt();
this.Ot = in.readInt();
this.Alias = in.readInt();
this.Setcode = in.readLong();
this.SetCode = in.readLong();
this.Type = in.readLong();
this.Level = in.readInt();
this.Attribute = in.readInt();
this.Race = in.readLong();
this.Attack = in.readInt();
this.Defense = in.readInt();
this.LScale = in.readInt();
this.RScale = in.readInt();
this.LeftScale = in.readInt();
this.RightScale = in.readInt();
this.Category = in.readLong();
}
......@@ -94,4 +96,5 @@ public class CardData implements Parcelable{
return new CardData[size];
}
};
}
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardAttribute {
None(0),
Earth(0x01),
Water(0x02),
Fire(0x04),
Wind(0x08),
Light(0x10),
Dark(0x20),
Divine(0x40);
Earth(0x01, 1010),
Water(0x02, 1011),
Fire(0x04, 1012),
Wind(0x08, 1013),
Light(0x10, 1014),
Dark(0x20, 1015),
Divine(0x40, 1016);
private long value = 0;
private final int lang_index;
private int value = 0;
public int getLanguageIndex() {
return lang_index;
}
CardAttribute(long value){
this(value, 0);
}
private CardAttribute(int value) {
CardAttribute(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardAttribute valueOf(int value) {
public static @Nullable CardAttribute valueOf(long value) {
CardAttribute[] attributes = CardAttribute.values();
for (CardAttribute attribute : attributes) {
if (attribute.value() == value) {
if (attribute.getId() == value) {
return attribute;
}
}
return null;
}
public int value() {
public long getId() {
return this.value;
}
}
\ No newline at end of file
......@@ -2,42 +2,53 @@ package ocgcore.enums;
public enum CardCategory {
None(0),
DESTROY(0x1),//破坏效果
RELEASE(0x2),//解放效果
REMOVE(0x4),//除外效果
TOHAND(0x8),//加入手牌效果
TODECK(0x10),//回卡组效果
TOGRAVE(0x20),//送去墓地效果
DECKDES(0x40),//卡组破坏效果
HANDES(0x80),//手牌破坏效果
SUMMON(0x100),//含召唤的效果
SPECIAL_SUMMON(0x200),//含特殊召唤的效果
TOKEN(0x400),//含衍生物效果
FLIP(0x800),//含翻转效果
POSITION(0x1000),//改变表示形式效果
CONTROL(0x2000),//改变控制权效果
DISABLE(0x4000),//使效果无效效果
DISABLE_SUMMON(0x8000),//无效召唤效果
DRAW(0x10000),//抽卡效果
SEARCH(0x20000),//检索卡组效果
EQUIP(0x40000),//装备效果
DAMAGE(0x80000),//伤害效果
RECOVER(0x100000),//回复效果
ATKCHANGE(0x200000),//改变攻击效果
DEFCHANGE(0x400000),//改变防御效果
COUNTER(0x800000),//指示物效果
COIN(0x1000000),//硬币效果
DICE(0x2000000),//骰子效果
LEAVE_GRAVE(0x4000000),//离开墓地效果
LVCHANGE(0x8000000),//改变等级效果
NEGATE(0x10000000),//使发动无效效果
ANNOUNCE(0x20000000),//發動時宣言卡名的效果
FUSION_SUMMON(0x40000000),
NEGATE_EFFECT(0x80000000L);//效果无效
DESTROY(0x1, 1100),//破坏效果
RELEASE(0x2, 1101),//解放效果
REMOVE(0x4, 1102),//除外效果
TOHAND(0x8, 1103),//加入手牌效果
TODECK(0x10, 1104),//回卡组效果
TOGRAVE(0x20, 1105),//送去墓地效果
DECKDES(0x40, 1106),//卡组破坏效果
HANDES(0x80, 1107),//手牌破坏效果
SUMMON(0x100, 1108),//含召唤的效果
SPECIAL_SUMMON(0x200, 1109),//含特殊召唤的效果
TOKEN(0x400, 1110),//含衍生物效果
FLIP(0x800, 1111),//含翻转效果
POSITION(0x1000, 1112),//改变表示形式效果
CONTROL(0x2000, 1113),//改变控制权效果
DISABLE(0x4000, 1114),//使效果无效效果
DISABLE_SUMMON(0x8000, 1115),//无效召唤效果
DRAW(0x10000, 1116),//抽卡效果
SEARCH(0x20000, 1117),//检索卡组效果
EQUIP(0x40000, 1118),//装备效果
DAMAGE(0x80000, 1119),//伤害效果
RECOVER(0x100000, 1120),//回复效果
ATKCHANGE(0x200000, 1121),//改变攻击效果
DEFCHANGE(0x400000, 1122),//改变防御效果
COUNTER(0x800000, 1123),//指示物效果
COIN(0x1000000, 1124),//硬币效果
DICE(0x2000000, 1125),//骰子效果
LEAVE_GRAVE(0x4000000, 1126),//离开墓地效果
LVCHANGE(0x8000000, 1127),//改变等级效果
NEGATE(0x10000000, 1128),//融合相关
ANNOUNCE(0x20000000, 1129),//同调相关
FUSION_SUMMON(0x40000000, 1130),//超量相关
NEGATE_EFFECT(0x80000000L, 1131);//效果无效
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
CardCategory(long value){
this(value, 0);
}
private CardCategory(long value) {
CardCategory(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardCategory valueOf(long value) {
......
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardOt {
All,
OCG,
TCG,
SC_OCG,
CUSTOM,
OCG_TCG
ALL(0, 1486),
OCG(1, 1481),
TCG(2, 1482),
CUSTOM(4, 1484),
SC_OCG(8, 1483),
NO_EXCLUSIVE(3, 1485);
private final int value;
//1240
private final int lang_index;
CardOt(int value) {
this(value, 0);
}
CardOt(int value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public int getLanguageIndex() {
return lang_index;
}
public int getId() {
return value;
}
public static @Nullable CardOt valueOf(int value) {
for (CardOt cardOt : values()) {
if (cardOt.value == value) {
return cardOt;
}
}
return null;
}
}
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardRace {
None(0),
Warrior(0x1),
BestWarrior(0x8000),
SpellCaster(0x2),
Fairy(0x4),
Fiend(0x8),
Zombie(0x10),
Machine(0x20),
Aqua(0x40),
Pyro(0x80),
Rock(0x100),
WindBeast(0x200),
Plant(0x400),
Insect(0x800),
Thunder(0x1000),
Dragon(0x2000),
Beast(0x4000),
Dinosaur(0x10000),
Fish(0x20000),
SeaSerpent(0x40000),
Reptile(0x80000),
Psycho(0x100000),
DivineBeast(0x200000),
Creatorgod(0x400000),
Wyrm(0x800000),
Cyberse(0x1000000);
Warrior(0x1, 1020),
BestWarrior(0x8000, 1021),
SpellCaster(0x2, 1022),
Fairy(0x4, 1023),
Fiend(0x8, 1024),
Zombie(0x10, 1025),
Machine(0x20, 1026),
Aqua(0x40, 1027),
Pyro(0x80, 1028),
Rock(0x100, 1029),
WindBeast(0x200, 1030),
Plant(0x400, 1031),
Insect(0x800, 1032),
Thunder(0x1000, 1033),
Dragon(0x2000, 1034),
Beast(0x4000, 1035),
Dinosaur(0x10000, 1036),
Fish(0x20000, 1037),
SeaSerpent(0x40000, 1038),
Reptile(0x80000, 1039),
Psycho(0x100000, 1040),
DivineBeast(0x200000, 1041),
Creatorgod(0x400000, 1042),
Wyrm(0x800000, 1043),
Cyberse(0x1000000, 1044);
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
CardRace(long value){
this(value, 0);
}
private CardRace(long value) {
CardRace(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardRace valueOf(long value) {
public static @Nullable CardRace valueOf(long value) {
CardRace[] attributes = CardRace.values();
for (CardRace attribute : attributes) {
if (attribute.value() == value) {
......
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardType {
None(0),
Normal(0x10),
Effect(0x20),
Fusion(0x40),
Ritual(0x80),
Synchro(0x2000),
Pendulum(0x1000000L),
Xyz(0x800000L),
Link(0x4000000L),
Non_Effect(0x8000000L),
Spirit(0x200),
Union(0x400),
Dual(0x800),
Tuner(0x1000),
Flip(0x200000),
Toon(0x400000),
Sp_Summon(0x2000000),
QuickPlay(0x10000),
Continuous(0x20000),
Equip(0x40000),
Field(0x80000),
Counter(0x100000),
Monster(0x1),
Spell(0x2),
TrapMonster(0x100),
Trap(0x4),
Token(0x4000);
Monster(0x1, 1050),
Spell(0x2, 1051),
Trap(0x4, 1052),
UNK1(0x8, 1053),
Normal(0x10, 1054),
Effect(0x20, 1055),
Fusion(0x40, 1056),
Ritual(0x80, 1057),
TrapMonster(0x100, 1058),
Spirit(0x200, 1059),
Union(0x400, 1060),
Dual(0x800, 1061),
Tuner(0x1000, 1062),
Synchro(0x2000, 1063),
Token(0x4000, 1064),
UNK2(0x8000, 1065),
QuickPlay(0x10000, 1066),
Continuous(0x20000, 1067),
Equip(0x40000, 1068),
Field(0x80000, 1069),
Counter(0x100000, 1070),
Flip(0x200000, 1071),
Toon(0x400000, 1072),
Xyz(0x800000, 1073),
Pendulum(0x1000000, 1074),
Sp_Summon(0x2000000, 1075),
Link(0x4000000, 1076),
Non_Effect(0x8000000, 1077);
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
CardType(long value){
this(value, 0);
}
private CardType(long value) {
CardType(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardType valueOf(long value) {
public static @Nullable CardType valueOf(long value) {
CardType[] attributes = CardType.values();
for (CardType attribute : attributes) {
if (attribute.value() == value) {
if (attribute.getId() == value) {
return attribute;
}
}
return null;
}
public long value() {
public long getId() {
return this.value;
}
}
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum LimitType {
None(0),
All(999),
Forbidden(1),
Limit(2),
SemiLimit(3);
All(999, 1310),
Forbidden(1, 1316),
Limit(2, 1317),
SemiLimit(3, 1318);
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
LimitType(long value){
this(value, 0);
}
private LimitType(long value) {
LimitType(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static LimitType valueOf(long value) {
public static @Nullable LimitType valueOf(long value) {
LimitType[] attributes = LimitType.values();
for (LimitType attribute : attributes) {
if (attribute.value() == value) {
if (attribute.getId() == value) {
return attribute;
}
}
return null;
}
public long value() {
public long getId() {
return this.value;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment