Refactor boon handling

This commit is contained in:
2024-03-11 00:53:14 -04:00
parent 56b89b7080
commit 15d2f2b9d8
6 changed files with 4 additions and 131 deletions
+2 -15
View File
@@ -18,7 +18,6 @@ import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
@@ -254,28 +253,16 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
if (boonItem == null)
return false;
ItemBase ib = boonItem.getItemBase();
if (ib == null)
return false;
if (!boonOwner.getCharItemManager().doesCharOwnThisItem(boonItem.getObjectUUID()))
return false;
ArrayList<Boon> boonList = Boon.GetBoonsForItemBase.get(ib.getUUID());
if (boonList == null)
return false;
for (Boon boon : boonList) {
ShrineType boonShrineType = boon.getShrineType();
for (ShrineType boonShrineType : boonItem.template.item_offering_info.keySet()) {
if (boonShrineType != shrineType)
continue;
//Same Shrine Type, add favors and stop loop.
int amount = boon.getAmount() * boonItem.getNumOfItems();
int amount = boonItem.template.item_offering_info.get(boonShrineType) * boonItem.getNumOfItems();
int oldAmount = this.favors;
if (!DbManager.ShrineQueries.updateFavors(this, this.favors + amount, oldAmount)) {