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; }
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"); } } } }