Package net.coljac.pirates

Examples of net.coljac.pirates.CardDatabase


    process("linkdata2.txt");
    process("linkdata3.txt");
    process("linkdata4.txt");
    process("linkdata5.txt");
    try {
      CardDatabase db = CardDatabase.init("cards.db");
      for(String name: links.keySet()) {
        List<Card> cards = db.getCardsByName(name);
        if(cards.size()==0) {
          System.out.println("Can't find " + name);
        } else if (cards.size()==1) {
          ((Crew)cards.get(0)).setLink(links.get(name));
        } else {
          System.out.println("Several results " + name);
        }

      }
      db.save();

    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here


*/
public class ImportTreasure {

  public static void main(String[] args) {
    List<String> lines = FileTools.getFileContentsAsList("treasures.txt");
    CardDatabase db = MakeDB.db;
//    try {
//      db  = CardDatabase.init("cards.db");
//    } catch (IOException e) {
//      e.printStackTrace();
//      System.exit(1);
//    }
    for(Iterator<Card> it = db.getCards().iterator(); it.hasNext(); ) {
      if(it.next().getCardType().equals("Treasure")) {
        it.remove();
      }
    }
    for(String line: lines) {
      String[] tokens = line.split("\t");
      Card treasure = new Treasure();
      treasure.setExpansion("Pirates of the " + tokens[1]);
      treasure.setName(tokens[3]);
      treasure.setPoints(0);
      treasure.setRarity(tokens[2]);
      treasure.setRules(tokens[4]);
      treasure.setNumber(tokens[0]);
      db.getCards().add(treasure);
    }

    db.save();
  }
View Full Code Here

    initCrew();
  }


  private void initCrew() {
    CardDatabase db = ManagerMain.instance.db;
    for (Crew c : db.getCrew()) {
      if (c.isGeneric()) {
        crew.put(c.getName(), c);
      }
    }
  }
View Full Code Here

    if (new File(cardDB).exists()) {
      try {
        db = CardDatabase.init(cardDB);
      } catch (IOException e) {
        e.printStackTrace();
        db = new CardDatabase(cardDB);
      }
    } else {
      try {
        InputStream is = ManagerMain.class.getResourceAsStream("/cards.db");
        if (is != null) {
          db = CardDatabase.init(is, cardDB);
        } else {
          db = new CardDatabase(cardDB);
        }
      } catch (Exception e) {
        db = new CardDatabase(cardDB);
      }
    }
//    for(Card card:db.getCards()) {
//      card.setOwned(0);
//      card.setWanted(0);
View Full Code Here

TOP

Related Classes of net.coljac.pirates.CardDatabase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.