From 52e2619a81b4eb29f2a97d9f59ee263dd369cf67 Mon Sep 17 00:00:00 2001 From: Rob Date: Sat, 11 Jul 2026 22:46:00 +0100 Subject: [PATCH] Preserve EbonReach changes after Windows recovery --- .gitignore | 2 + src/engine/objects/Item.java | 79 ++++++++++++------------- src/engine/objects/PlayerCharacter.java | 7 ++- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 9154f4c7..ca4e4e00 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ hs_err_pid* replay_pid* +.idea/ +*.iml diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index cc74c165..148754f6 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -674,46 +674,6 @@ public class Item extends AbstractWorldObject { public static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType) { return newGoldItem(awo, ib, containerType, true); } - - //used for vault! - public static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType) { - return newGoldItem(accountID, ib, containerType, true); - } - - private static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) { - - int ownerID; - OwnerType ownerType; - - ownerID = accountID; - ownerType = OwnerType.Account; - - - Item newGold = new Item(ib, ownerID, ownerType, - (byte) 0, (byte) 0, (short) 0, (short) 0, true, false, containerType, (byte) 0, - new ArrayList<>(), ""); - - synchronized (newGold) { - newGold.numberOfItems = 0; - } - - if (persist) { - try { - newGold = DbManager.ItemQueries.ADD_ITEM(newGold); - if (newGold != null) { - synchronized (newGold) { - newGold.numberOfItems = 0; - } - } - } catch (Exception e) { - Logger.error(e); - } - DbManager.ItemQueries.ZERO_ITEM_STACK(newGold); - } - - return newGold; - } - private static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) { int ownerID; @@ -771,10 +731,49 @@ public class Item extends AbstractWorldObject { } DbManager.ItemQueries.ZERO_ITEM_STACK(newGold); } + newGold.containerType = containerType; return newGold; } + //used for vault! + public static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType) { + return newGoldItem(accountID, ib, containerType, true); + } + + private static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) { + + int ownerID; + OwnerType ownerType; + + ownerID = accountID; + ownerType = OwnerType.Account; + + + Item newGold = new Item(ib, ownerID, ownerType, + (byte) 0, (byte) 0, (short) 0, (short) 0, true, false, containerType, (byte) 0, + new ArrayList<>(), ""); + + synchronized (newGold) { + newGold.numberOfItems = 0; + } + + if (persist) { + try { + newGold = DbManager.ItemQueries.ADD_ITEM(newGold); + if (newGold != null) { + synchronized (newGold) { + newGold.numberOfItems = 0; + } + } + } catch (Exception e) { + Logger.error(e); + } + DbManager.ItemQueries.ZERO_ITEM_STACK(newGold); + } + + return newGold; + } // This is to be used for trades - the new item is not stored in the database public static Item newGoldItemTemp(AbstractWorldObject awo, ItemBase ib) { diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 35dd8c5a..126da06d 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -1239,12 +1239,17 @@ public class PlayerCharacter extends AbstractCharacter { playerCharacter.deactivateCharacter(); return null; } + // Ebonreach: give new characters starter gold. + Item starterGold = Item.newGoldItem(playerCharacter, ItemBase.getItemBase(7), Enum.ItemContainerType.INVENTORY); + + if (starterGold != null) + DbManager.ItemQueries.UPDATE_GOLD(starterGold, 10000); // Get any new skills that belong to the player playerCharacter.calculateSkills(); a.setLastCharacter(playerCharacter.getObjectUUID()); - playerCharacter.charItemManager.load(); + playerCharacter.getCharItemManager().load(); playerCharacter.activateCharacter();