示例#1
0
  static {
    String p;
    if ((p = getprop("haven.authck", null)) != null) authck = Utils.hex2byte(p);
    File f = new File(userhome);
    if (!f.exists()) {
      f.mkdirs();
    }

    InputStream in = ErrorHandler.class.getResourceAsStream("/buildinfo");
    try {
      try {
        if (in != null) {
          Properties info = new Properties();
          info.load(in);
          for (Map.Entry<Object, Object> e : info.entrySet())
            buildinfo.put((String) e.getKey(), e.getValue());
        }
      } finally {
        in.close();
      }
    } catch (IOException e) {
      throw (new Error(e));
    }
    version = (String) buildinfo.get("git-rev");
    loadOptions();
    window_props = loadProps("windows.conf");

    Wiki.init(getFile("cache"), 3);
  }
示例#2
0
 public static BufferedImage getFood(String name) {
   Item itm = Wiki.get(name);
   if (itm != null) {
     Map<String, Float[]> food = itm.food;
     if (food != null) {
       Float[] heal = food.get("Heals");
       Float[] salt = food.get("Salt");
       Float[] merc = food.get("Mercury");
       Float[] sulph = food.get("Sulphur");
       Float[] lead = food.get("Lead");
       int[] tempers = new int[4];
       int[][] evs = new int[4][4];
       for (int i = 0; i < 4; i++) {
         tempers[i] = (int) (1000 * heal[i]);
         evs[0][i] = (int) (1000 * salt[i]);
         evs[1][i] = (int) (1000 * merc[i]);
         evs[2][i] = (int) (1000 * sulph[i]);
         evs[3][i] = (int) (1000 * lead[i]);
       }
       FoodInfo fi = new FoodInfo(null, tempers);
       GobbleInfo gi = new GobbleInfo(null, evs, 0);
       return ItemInfo.catimgs(3, fi.longtip(), gi.longtip());
     }
   }
   return null;
 }
示例#3
0
 public Object tooltip(Coord c, Widget prev) {
   Pagina pag = bhit(c);
   long now = System.currentTimeMillis();
   if ((pag != null) && (pag.act() != null)) {
     if (prev != this) hoverstart = now;
     boolean ttl = (now - hoverstart) > 500;
     Item itm = Wiki.get(pag.res().layer(Resource.action).name);
     if ((pag != curttp) || (ttl != curttl) || itm != ttitem) {
       ttitem = itm;
       curtt = rendertt(pag.res(), ttl, true);
       curttp = pag;
       curttl = ttl;
     }
     return (curtt);
   } else {
     hoverstart = now;
     return ("");
   }
 }
示例#4
0
 public static BufferedImage getXPgain(String name) {
   Item itm = Wiki.get(name);
   if (itm != null) {
     Map<String, Integer> props = itm.attgive;
     if (props != null) {
       int n = props.size();
       String attrs[] = new String[n];
       int exp[] = new int[n];
       n = 0;
       for (String attr : props.keySet()) {
         Integer val = props.get(attr);
         attrs[n] = attr;
         exp[n] = val;
         n++;
       }
       Inspiration i = new Inspiration(null, attrs, exp);
       return i.longtip();
     }
   }
   return null;
 }