forked from MagicBane/Server
MagicBot
8 months ago
6 changed files with 4 additions and 131 deletions
@ -1,51 +0,0 @@
@@ -1,51 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.db.handlers; |
||||
|
||||
import engine.gameManager.DbManager; |
||||
import engine.objects.Boon; |
||||
import org.pmw.tinylog.Logger; |
||||
|
||||
import java.sql.Connection; |
||||
import java.sql.PreparedStatement; |
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.util.ArrayList; |
||||
|
||||
public class dbBoonHandler extends dbHandlerBase { |
||||
|
||||
public dbBoonHandler() { |
||||
} |
||||
|
||||
|
||||
public ArrayList<Boon> GET_BOON_AMOUNTS_FOR_ITEMBASE(int itemBaseUUID) { |
||||
|
||||
ArrayList<Boon> boons = new ArrayList<>(); |
||||
Boon thisBoon; |
||||
|
||||
try (Connection connection = DbManager.getConnection(); |
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?")) { |
||||
|
||||
preparedStatement.setInt(1, itemBaseUUID); |
||||
|
||||
ResultSet rs = preparedStatement.executeQuery(); |
||||
|
||||
while (rs.next()) { |
||||
thisBoon = new Boon(rs); |
||||
boons.add(thisBoon); |
||||
} |
||||
|
||||
} catch (SQLException e) { |
||||
Logger.error(e); |
||||
} |
||||
|
||||
return boons; |
||||
} |
||||
} |
@ -1,59 +0,0 @@
@@ -1,59 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.objects; |
||||
|
||||
import engine.Enum.ShrineType; |
||||
import engine.gameManager.DbManager; |
||||
|
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
|
||||
|
||||
public class Boon { |
||||
|
||||
public static HashMap<Integer, ArrayList<Boon>> GetBoonsForItemBase = new HashMap<>(); |
||||
private ShrineType shrineType; |
||||
private int amount; |
||||
private int itemBaseID; |
||||
|
||||
|
||||
/** |
||||
* ResultSet Constructor |
||||
*/ |
||||
public Boon(ResultSet rs) throws SQLException { |
||||
|
||||
this.shrineType = ShrineType.valueOf(rs.getString("shrineType")); |
||||
this.itemBaseID = rs.getInt("itemBaseID"); |
||||
this.amount = rs.getInt("amount"); |
||||
} |
||||
|
||||
public static void HandleBoonListsForItemBase(int itemBaseID) { |
||||
ArrayList<Boon> boons = null; |
||||
boons = DbManager.BoonQueries.GET_BOON_AMOUNTS_FOR_ITEMBASE(itemBaseID); |
||||
if (boons != null) |
||||
GetBoonsForItemBase.put(itemBaseID, boons); |
||||
} |
||||
|
||||
public int getAmount() { |
||||
return this.amount; |
||||
} |
||||
|
||||
public int getItemBaseID() { |
||||
return itemBaseID; |
||||
} |
||||
|
||||
public ShrineType getShrineType() { |
||||
return shrineType; |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue