示例#1
0
  private void printDetails(Graphics g, int x, int y, Ore ore) {
    String count_s = "", gold_s = "", goldPerHour_s = "", exp_s = "", expPerHour_s = "";
    long profit = ore.getCount() * ore.getPrice();
    long count = ore.getCount();

    g.setFont(font2);

    double d;
    if (MiningVars.miningStrategy.equalsIgnoreCase("banking")) {
      // COUNT
      g.setColor(Color.BLACK);
      count_s = String.format(":%,d ~ ", count);
      g.drawString(count_s, x, y);

      // GOLD
      if (profit >= 10000000) {
        g.setColor(new Color(0x00, 0x76, 0x33));
        gold_s = String.format("%,.2fM gp", (profit / 1000000.0));
      } else if (profit >= 100000) {
        g.setColor(new Color(0xff, 0xff, 0xff));
        gold_s = String.format("%,.1fk gp", (profit / 1000.0));
      } else if (profit >= 10000) {
        g.setColor(new Color(0xFF, 0x8B, 0x00));
        gold_s = String.format("%,.1fk gp", (profit / 1000.0));
      } else {
        g.setColor(new Color(0xff, 0xff, 0x00));
        gold_s = String.format("%,d gp", profit);
      }
      g.drawString(gold_s, x += (g.getFontMetrics().stringWidth(count_s) + 3), y);

      d = perHour(profit);
      if (d >= 10000000) {
        g.setColor(new Color(0x00, 0x76, 0x33));
        goldPerHour_s = String.format("(%,.1fM gp/hr)", d / 1000000.0);
      } else if (d >= 100000) {
        g.setColor(new Color(0xff, 0xff, 0xff));
        goldPerHour_s = String.format("(%,.1fk gp/hr)", d / 1000.0);
      } else if (d >= 10000) {
        g.setColor(new Color(0xFF, 0x8B, 0x00));
        goldPerHour_s = String.format("(%,.1fk gp/hr)", d / 1000.0);
      } else {
        g.setColor(new Color(0xff, 0xff, 0x00));
        goldPerHour_s = String.format("(%,.2f gp/hr)", d);
      }
      g.drawString(goldPerHour_s, x += (g.getFontMetrics().stringWidth(gold_s) + 3), y);
    }

    // EXP
    d = (ore.getCount()) * ore.getExp();
    if (d >= 10000000) {
      g.setColor(new Color(0x00, 0x76, 0x33));
      exp_s = String.format(" ~ %,.1fM exp", d / 1000000.0);
    } else if (d >= 100000) {
      g.setColor(new Color(0xff, 0xff, 0xff));
      exp_s = String.format(" ~ %,.1fk exp", d / 1000.0);
    } else if (d >= 10000) {
      g.setColor(new Color(0xFF, 0x8B, 0x00));
      exp_s = String.format(" ~ %,.1fk exp", d / 1000.0);
    } else {
      g.setColor(new Color(0xff, 0xff, 0x00));
      exp_s = String.format(" ~ %,.2f exp", d);
    }
    g.drawString(exp_s, x += (g.getFontMetrics().stringWidth(goldPerHour_s) + 3), y);

    d = perHour(ore.getCount() * ore.getExp());
    if (d >= 10000000) {
      g.setColor(new Color(0x00, 0x76, 0x33));
      expPerHour_s = String.format("(%,.1fM exp/hr)", d / 1000000.0);
    } else if (d >= 100000) {
      g.setColor(new Color(0xff, 0xff, 0xff));
      expPerHour_s = String.format("(%,.1fk exp/hr)", d / 1000.0);
    } else if (d >= 10000) {
      g.setColor(new Color(0xFF, 0x8B, 0x00));
      expPerHour_s = String.format("(%,.1fk exp/hr)", d / 1000.0);
    } else {
      g.setColor(new Color(0xff, 0xff, 0x00));
      expPerHour_s = String.format("(%,.2f exp/hr)", d);
    }
    g.drawString(expPerHour_s, x += (g.getFontMetrics().stringWidth(exp_s) + 3), y);
  }
示例#2
0
  public void onRepaint(Graphics g1) {
    Graphics2D g = (Graphics2D) g1;
    // TODO paint da walls?? testing shit here
    /*
    SceneObject[] blockages = SceneEntities.getLoaded(new Filter<SceneObject>() {
    	@Override
    	public boolean accept(SceneObject so)
    	{
    		return so != null && so.validate();
    	}
    });



    if (MiningVars.rockMining != null && MiningVars.rockMining.getBounds() != null)
    {
    	for (SceneObject b : blockages)
    	{
    		Polygon[] rmBounds = MiningVars.rockMining.getBounds();
    		long overlap = 0;

    		for (int i = 0 ; i < b.getBounds().length ; i++)
    		{
    			for (int j = 0 ; j < rmBounds.length ; j++)
    			{
    				for (int x = 0 ; x < rmBounds[j].xpoints.length ; x++)
    				{
    					for (int y = 0 ; y < rmBounds[j].ypoints.length ; y++)
    					{
    						if (b.getBounds()[i].contains(rmBounds[j].xpoints[x], rmBounds[j].ypoints[y]))
    						{
    							overlap++;
    						}
    					}
    				}
    			}
    		}

    		System.out.println(overlap);




    		/*
    	if (s.getLocation() != null)
    	{
    		int orientation = Players.getLocal().getOrientation();




    		switch (orientation)
    		{
    		case 0: //E

    				break;
    		case 90: //N

    			break;
    		case 180: //W

    			break;
    		case 270: //S

    			break;
    		default:
    			break;
    		}

    	}
    	}

    }
    */
    if (GUI.isFinished) {
      if (showPaint) {
        g.setColor(bgColor);
        g.fillRoundRect(1, 388, 517, 141, 20, 20);
        g.setFont(titleFont);
        g.setColor(titleColor);
        g.drawString("Loneleh Mining", 128, 387);

        g.drawImage(miningImg, 43, 431, null);

        g.drawImage(hideButtonImg, hideButtonRect.x, hideButtonRect.y, null);

        g.setFont(font1);
        g.setColor(color1);
        g.drawString(version_s, 477, 67);

        String gold_s, goldPerHour_s, exp_s, expPerHour_s;
        long profit = 0;
        double exp = 0;
        for (Ore o : MiningVars.oresToMine) {
          profit += (double) o.getCount() * o.getPrice();
          exp += o.getCount() * o.getExp();
        }

        int x = 160;
        int y = 418;
        int lineShift = 17;
        int valueShift = 106;
        g.setFont(font3);

        g.drawString("Time Elapsed:", x, y);
        if (MiningVars.miningStrategy.equalsIgnoreCase("banking")) {
          g.drawString("Ores mined: ", x, y + lineShift);
          g.drawString("Gems mined: ", x, y + (2 * lineShift));
          g.drawString("Profit: ", x, y + (3 * lineShift));
        }
        g.drawString("Exp: ", x, y + (4 * lineShift));
        g.setFont(font4);
        g.drawString(Variables.miningTimer.getElapsedTimeString(), x + valueShift, y);

        double d;
        if (MiningVars.miningStrategy.equalsIgnoreCase("banking")) {
          g.drawString(String.format("%,d", MiningVars.oresMined), x + valueShift, y + (lineShift));
          g.drawString(
              String.format("%,d", MiningVars.gemsMined), x + valueShift, y + (2 * lineShift));
          if (profit >= 10000000) {
            g.setColor(new Color(0x00, 0x76, 0x33));
            gold_s = String.format("%,.1fM gp", (profit / 1000000.0));
          } else if (profit >= 100000) {
            g.setColor(new Color(0xff, 0xff, 0xff));
            gold_s = String.format("%,.1fk gp", (profit / 1000.0));
          } else if (profit >= 10000) {
            g.setColor(new Color(0xFF, 0x8B, 0x00));
            gold_s = String.format("%,.1fk gp", (profit / 1000.0));
          } else {
            g.setColor(new Color(0xff, 0xff, 0x00));
            gold_s = String.format("%,d gp", profit);
          }
          g.drawString(gold_s, x + valueShift + 3, y + (3 * lineShift));

          d = perHour(profit);
          if (d >= 10000000) {
            g.setColor(new Color(0x00, 0x76, 0x33));
            goldPerHour_s = String.format("(%,.1fM gp/hr", d / 1000000.0);
          } else if (d >= 100000) {
            g.setColor(new Color(0xff, 0xff, 0xff));
            goldPerHour_s = String.format("(%,.1fk gp/hr)", d / 1000.0);
          } else if (d >= 10000) {
            g.setColor(new Color(0xFF, 0x8B, 0x00));
            goldPerHour_s = String.format("(%,.1fk gp/hr)", d / 1000.0);
          } else {
            g.setColor(new Color(0xff, 0xff, 0x00));
            goldPerHour_s = String.format("(%,.2f gp/hr)", d);
          }
          g.drawString(
              goldPerHour_s,
              x + valueShift + (g.getFontMetrics().stringWidth(gold_s) + 3),
              y + (3 * lineShift));
        }

        d = exp;
        if (d >= 10000000) {
          g.setColor(new Color(0x00, 0x76, 0x33));
          exp_s = String.format("%,.1fM exp", d / 1000000.0);
        } else if (d >= 100000) {
          g.setColor(new Color(0xff, 0xff, 0xff));
          exp_s = String.format("%,.1fk exp", d / 1000.0);
        } else if (d >= 10000) {
          g.setColor(new Color(0xFF, 0x8B, 0x00));
          exp_s = String.format("%,.1fk exp", d / 1000.0);
        } else {
          g.setColor(new Color(0xff, 0xff, 0x00));
          exp_s = String.format("%,.2f exp", d);
        }
        g.drawString(exp_s, x + valueShift + 3, y + (4 * lineShift));

        d = perHour(exp);
        if (d >= 10000000) {
          g.setColor(new Color(0x00, 0x76, 0x33));
          expPerHour_s = String.format("(%,.1fM exp/hr", d / 1000000.0);
        } else if (d >= 100000) {
          g.setColor(new Color(0xff, 0xff, 0xff));
          expPerHour_s = String.format("(%,.1fk exp/hr)", d / 1000.0);
        } else if (d >= 10000) {
          g.setColor(new Color(0xFF, 0x8B, 0x00));
          expPerHour_s = String.format("(%,.1fk exp/hr)", d / 1000.0);
        } else {
          g.setColor(new Color(0xff, 0xff, 0x00));
          expPerHour_s = String.format("(%,.2f exp/hr)", d);
        }
        g.drawString(
            expPerHour_s,
            x + valueShift + (g.getFontMetrics().stringWidth(exp_s) + 3),
            y + (4 * lineShift));

        x = 15;
        y = 500;
        d =
            ((double)
                        (Skills.getExperience(Skills.MINING)
                            - Variables.xpsToLevel[Skills.getLevel(Skills.MINING)])
                    / (double)
                        (Variables.xpsToLevel[Skills.getLevel(Skills.MINING) + 1]
                            - Variables.xpsToLevel[Skills.getLevel(Skills.MINING)]))
                * 100.0;
        String percent = String.format("%,.1f %%", d);
        percentBar(
            false,
            x,
            y,
            485,
            20,
            d,
            new Color(0xD3, 0xD3, 0xD3),
            new Color(0x70, 0x80, 0x90),
            new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f),
            g);
        g.setColor(Color.BLACK);
        g.drawString(String.format("%,d", Skills.getLevel(Skills.MINING)), x + 2, y + 17);
        x += printCenter(g, percent, x, y + 17, 485);
        printRight(
            g,
            Time.format(Functions.getTimeToNextLv(Skills.MINING, (int) perHour(exp)))
                + " to "
                + (Skills.getLevel(Skills.MINING) + 1),
            500,
            y + 17);

        if (showDetails) {
          g.drawImage(lessDetailsButtonImg, lessDetailsButtonRect.x, lessDetailsButtonRect.y, null);

          int detailX = 20;
          int detailY = 55;

          // start at (20, 55)
          if (MiningVars.oresToMine.size() < 9) {
            detailY += 23;
          }

          for (int i = 0; i < MiningVars.oresToMine.size(); i++) {
            Ore o = MiningVars.oresToMine.get(i);
            g.drawImage(o.getImage(), detailX, detailY + (35 * i), null);
            printDetails(g, detailX + 35, detailY + 17 + (35 * i), o);
          }

          if (Players.getLocal().getAnimation() != 16385) {
            if (MiningVars.rockMining != null
                && MiningVars.rockMining.isOnScreen()
                && Calculations.distanceTo(MiningVars.rockMining) <= 23
                && MiningVars.rockMining.validate()) {
              g.setColor(miningRockColor);
              MiningVars.rockMining.draw(g);
            }
            if (MiningVars.rockHover != null
                && MiningVars.rockHover.isOnScreen()
                && Calculations.distanceTo(MiningVars.rockHover) <= 23
                && MiningVars.rockHover.validate()) {
              if (MiningVars.rockHover.getLocation().getBounds().length > 0) {
                g.setColor(hoverTileColor);
                g.fillPolygon(MiningVars.rockHover.getLocation().getBounds()[0]);
              }
            }
          }
          /*
          //TODO paint da walls??
          SceneObject[] walls = SceneEntities.getLoaded(new Filter<SceneObject>() {
          	@Override
          	public boolean accept(SceneObject so)
          	{
          		return so != null && so.validate() &&
          				so.getDefinition() == null;
          	}
          });

          for (SceneObject w : walls)
          {
          	w.draw(g);
          }
           */
        } else {
          g.drawImage(showDetailButtonImg, showDetailButtonRect.x, showDetailButtonRect.y, null);
        }
      } else {
        g.drawImage(showButtonImg, showButtonRect.x, showButtonRect.y, null);
      }
    } // end if gui.isfinished
  }