@ -213,22 +213,18 @@ public class Warehouse extends AbstractWorldObject {
@@ -213,22 +213,18 @@ public class Warehouse extends AbstractWorldObject {
if ( wh = = null )
return ;
int itemBaseID = ItemBase . getItemHashIDMap ( ) . get ( hashID ) ;
ItemBase ib = ItemBase . getItemBase ( itemBaseID ) ;
if ( ib = = null )
return ;
Enum . ResourceType resourceType = Enum . ResourceType . hashLookup . get ( hashID ) ;
if ( isResourceLocked ( wh , ib ) ) {
if ( isResourceLocked ( wh , ItemBase . getItemBase ( resourceType . templateID ) ) ) {
boolean worked ;
EnumBitSet < Enum . ResourceType > bitSet = EnumBitSet . asEnumBitSet ( wh . lockedResourceTypes . toLong ( ) , Enum . ResourceType . class ) ;
bitSet . remove ( Enum . ResourceType . resourceLookup . get ( itemBaseID ) ) ;
bitSet . remove ( Enum . ResourceType . resourceLookup . get ( ItemBase . getItemBase ( resourceType . templateID ) ) ) ;
worked = DbManager . WarehouseQueries . updateLocks ( wh , bitSet . toLong ( ) ) ;
if ( worked ) {
wh . lockedResourceTypes . remove ( Enum . ResourceType . resourceLookup . get ( itemBaseID ) ) ;
wh . lockedResourceTypes . remove ( Enum . ResourceType . resourceLookup . get ( ItemBase . getItemBase ( resourceType . templateID ) ) ) ;
ViewResourcesMessage vrm = new ViewResourcesMessage ( player ) ;
vrm . setGuild ( player . getGuild ( ) ) ;
vrm . setWarehouseBuilding ( warehouse ) ;
@ -241,12 +237,12 @@ public class Warehouse extends AbstractWorldObject {
@@ -241,12 +237,12 @@ public class Warehouse extends AbstractWorldObject {
EnumBitSet < Enum . ResourceType > bitSet = EnumBitSet . asEnumBitSet ( wh . lockedResourceTypes . toLong ( ) , Enum . ResourceType . class ) ;
bitSet . add ( Enum . ResourceType . resourceLookup . get ( itemBaseID ) ) ;
bitSet . add ( Enum . ResourceType . resourceLookup . get ( ItemBase . getItemBase ( resourceType . templateID ) ) ) ;
if ( ! DbManager . WarehouseQueries . updateLocks ( wh , bitSet . toLong ( ) ) )
return ;
wh . lockedResourceTypes . add ( Enum . ResourceType . resourceLookup . get ( itemBaseID ) ) ;
wh . lockedResourceTypes . add ( Enum . ResourceType . resourceLookup . get ( ItemBase . getItemBase ( resourceType . templateID ) ) ) ;
ViewResourcesMessage vrm = new ViewResourcesMessage ( player ) ;
vrm . setGuild ( player . getGuild ( ) ) ;
vrm . setWarehouseBuilding ( warehouse ) ;
@ -538,7 +534,8 @@ public class Warehouse extends AbstractWorldObject {
@@ -538,7 +534,8 @@ public class Warehouse extends AbstractWorldObject {
if ( oldAmount < amount )
return false ;
int hashID = ib . getHashID ( ) ;
Enum . ResourceType resourceType = Enum . ResourceType . resourceLookup . get ( ib . getUUID ( ) ) ;
int hashID = resourceType . hash ;
int newAmount = oldAmount - amount ;
boolean worked = false ;
@ -658,7 +655,8 @@ public class Warehouse extends AbstractWorldObject {
@@ -658,7 +655,8 @@ public class Warehouse extends AbstractWorldObject {
int amount = ( int ) ( warehouse . resources . get ( ib ) * taxPercent ) ;
if ( amount < = 0 ) {
msg . getResources ( ) . put ( ib . getHashID ( ) , 0 ) ;
Enum . ResourceType resourceType = Enum . ResourceType . resourceLookup . get ( ib . getUUID ( ) ) ;
msg . getResources ( ) . put ( resourceType . hash , 0 ) ;
continue ;
}
@ -672,23 +670,25 @@ public class Warehouse extends AbstractWorldObject {
@@ -672,23 +670,25 @@ public class Warehouse extends AbstractWorldObject {
if ( newAmount < amount )
continue ;
Enum . ResourceType resourceType = Enum . ResourceType . resourceLookup . get ( ib . getUUID ( ) ) ;
if ( ! WithdrawApproved ( ib , amount , warehouse ) ) {
msg . getResources ( ) . put ( ib . getHashID ( ) , 0 ) ;
msg . getResources ( ) . put ( resourceType . hash , 0 ) ;
continue ;
}
msg . getResources ( ) . put ( ib . getHashID ( ) , amount ) ;
msg . getResources ( ) . put ( resourceType . hash , amount ) ;
warehouse . resources . put ( ib , newAmount ) ;
depositRealmTaxes ( taxer , ib , amount , warehouse ) ;
Resource resourceType ;
Resource resource ;
if ( ib . getUUID ( ) = = 7 )
resourceType = Resource . GOLD ;
if ( resourceType . equals ( Enum . ResourceType . GOLD ) )
resource = Resource . GOLD ;
else
resourceType = Resource . valueOf ( template . item_base_name . toUpperCase ( ) ) ;
resource = Resource . valueOf ( template . item_base_name . toUpperCase ( ) ) ;
AddTransactionToWarehouse ( warehouse , taxer . getObjectType ( ) , taxer . getObjectUUID ( ) , Enum . TransactionType . TAXRESOURCE , resourceType , amount ) ;
AddTransactionToWarehouse ( warehouse , taxer . getObjectType ( ) , taxer . getObjectUUID ( ) , Enum . TransactionType . TAXRESOURCE , resource , amount ) ;
}
}