forked from MagicBane/Server
Refactor boon handling
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user