Example #1
0
 private static void drawShopItem(int i, int x, int y) {
   if (i + 10 * page < shopList.size()
       && shopList.get(i + 10 * page) != null
       && StuffManager.getStuff(shopList.get(i + 10 * page).getId()) != null) {
     Draw.drawQuad(
         IconsManager.getSprite35(
             StuffManager.getStuff(shopList.get(i + 10 * page).getId()).getSpriteId()),
         Display.getWidth() / 2 + x + 3,
         Display.getHeight() / 2 + y + 3);
     Draw.drawQuad(
         Sprites.shop_border, Display.getWidth() / 2 + x - 1, Display.getHeight() / 2 + y);
   }
 }
Example #2
0
 public static void loadStuffs() throws SQLException, CloneNotSupportedException {
   JDOStatement statement = Mideas.getJDO().prepare("SELECT id, class, price FROM shop");
   statement.execute();
   while (statement.fetch()) {
     int id = statement.getInt();
     short classeTemp = statement.getShort();
     ClassType[] classeType = StuffManager.getClasses(classeTemp);
     int sellPrice = statement.getInt();
     shopList.add(new Shop(id, classeType, sellPrice));
   }
 }
Example #3
0
 private static boolean checkInventory(Shop item) throws FileNotFoundException, SQLException {
   int i = 0;
   while (i < Mideas.bag().getBag().length) {
     if (Mideas.bag().getBag(i) == null) {
       Mideas.bag().setBag(i, StuffManager.getClone(item.getId()));
       CharacterStuff.setBagItems();
       return true;
     }
     i++;
   }
   LogChat.setStatusText3("Votre inventaire est pleins");
   return false;
 }
Example #4
0
 public static void buyItems(boolean slot_hover, Shop stuff)
     throws FileNotFoundException, SQLException {
   if (Mouse.getEventButton() == 1 && slot_hover && stuff != null) {
     if (Mouse.getEventButtonState()) {
     } else {
       if (Mideas.getCurrentGold() >= stuff.getSellPrice()) {
         /*if(stuff.get) {
         	EndFightFrame.dropItem(stuff, 1);
         	LogChat.setStatusText3("Vous avez bien acheté "+stuff.getStuffName());
         	Mideas.setGold(-stuff.getSellPrice());
         }*/
         if (checkInventory(stuff)) {
           Mideas.setGold(-stuff.getSellPrice());
           LogChat.setStatusText3(
               "Vous avez bien acheté " + StuffManager.getStuff(stuff.getId()).getStuffName());
         }
       } else {
         LogChat.setStatusText3("Vous n'avez pas assez d'argent");
       }
     }
   }
 }