|
|
|
@ -2,6 +2,7 @@ package engine.gameManager;
@@ -2,6 +2,7 @@ package engine.gameManager;
|
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
|
import engine.objects.*; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
import java.util.EnumSet; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
@ -192,4 +193,31 @@ public enum ItemManager {
@@ -192,4 +193,31 @@ public enum ItemManager {
|
|
|
|
|
return item.template.item_value != 0 || Kit.IsNoobGear(item.templateID); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean MakeItemForPlayer(int templateID, PlayerCharacter reciever, int amount) { |
|
|
|
|
|
|
|
|
|
boolean itemWorked = false; |
|
|
|
|
|
|
|
|
|
Item item = new Item(templateID); |
|
|
|
|
|
|
|
|
|
item.ownerID = reciever.getObjectUUID(); |
|
|
|
|
item.ownerType = Enum.OwnerType.PlayerCharacter; |
|
|
|
|
item.containerType = Enum.ItemContainerType.INVENTORY; |
|
|
|
|
item.numberOfItems = amount; |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
item = DbManager.ItemQueries.PERSIST(item); |
|
|
|
|
itemWorked = true; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
Logger.error(e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!itemWorked) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
reciever.charItemManager.addItemToInventory(item); |
|
|
|
|
reciever.charItemManager.updateInventory(); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|