|
|
@ -15,6 +15,9 @@ import engine.gameManager.DbManager; |
|
|
|
import engine.objects.AbstractCharacter; |
|
|
|
import engine.objects.AbstractCharacter; |
|
|
|
import engine.objects.CharacterItemManager; |
|
|
|
import engine.objects.CharacterItemManager; |
|
|
|
import engine.objects.Item; |
|
|
|
import engine.objects.Item; |
|
|
|
|
|
|
|
import engine.objects.ItemTemplate; |
|
|
|
|
|
|
|
import org.json.simple.JSONObject; |
|
|
|
|
|
|
|
import org.json.simple.parser.JSONParser; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection; |
|
|
|
import java.sql.Connection; |
|
|
@ -163,6 +166,28 @@ public class dbItemHandler extends dbHandlerBase { |
|
|
|
return itemList; |
|
|
|
return itemList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void LOAD_ITEM_TEMPLATES() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONParser jsonParser = new JSONParser(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `cache_data_items`;")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = (JSONObject) jsonParser.parse(rs.getString("template")); |
|
|
|
|
|
|
|
ItemTemplate itemTemplate = new ItemTemplate(jsonObject); |
|
|
|
|
|
|
|
ItemTemplate.itemTemplates.put(rs.getInt("id"), itemTemplate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
Logger.error(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Item GET_ITEM(final int itemUUID) { |
|
|
|
public Item GET_ITEM(final int itemUUID) { |
|
|
|
|
|
|
|
|
|
|
|
Item item; |
|
|
|
Item item; |
|
|
|