Preserve EbonReach changes after Windows recovery

This commit is contained in:
Rob
2026-07-11 22:46:00 +01:00
parent 3649c629b7
commit 52e2619a81
3 changed files with 47 additions and 41 deletions
+2
View File
@@ -24,3 +24,5 @@
hs_err_pid*
replay_pid*
.idea/
*.iml
+39 -40
View File
@@ -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) {
+6 -1
View File
@@ -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();