Skip to content

Commit b21f576

Browse files
committed
rename item_values_cache -> itemvalue_rule_cache to remove confusion with world.item_values
1 parent 1c41df3 commit b21f576

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Rules.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,21 +375,21 @@ def ItemValue(world: World, multiworld: MultiWorld, state: CollectionState, play
375375
value_name = valueCount[0].lower().strip()
376376
requested_count = int(valueCount[1].strip())
377377

378-
if not hasattr(world, 'item_values_cache'): #Cache made for optimization purposes
379-
world.item_values_cache = {}
378+
if not hasattr(world, 'itemvalue_rule_cache'): #Cache made for optimization purposes
379+
world.itemvalue_rule_cache = {}
380380

381-
if not world.item_values_cache.get(player, {}):
382-
world.item_values_cache[player] = {}
381+
if not world.itemvalue_rule_cache.get(player, {}):
382+
world.itemvalue_rule_cache[player] = {}
383383

384384
if not skipCache:
385-
if not world.item_values_cache[player].get(value_name, {}):
386-
world.item_values_cache[player][value_name] = {
385+
if not world.itemvalue_rule_cache[player].get(value_name, {}):
386+
world.itemvalue_rule_cache[player][value_name] = {
387387
'state': {},
388388
'count': -1,
389389
}
390390

391-
if (skipCache or world.item_values_cache[player][value_name].get('count', -1) == -1
392-
or world.item_values_cache[player][value_name].get('state') != dict(state.prog_items[player])):
391+
if (skipCache or world.itemvalue_rule_cache[player][value_name].get('count', -1) == -1
392+
or world.itemvalue_rule_cache[player][value_name].get('state') != dict(state.prog_items[player])):
393393
# Run First Time, if state changed since last check or if skipCache has a value
394394
existing_item_values = get_items_with_value(world, multiworld, value_name)
395395
total_Count = 0
@@ -399,9 +399,9 @@ def ItemValue(world: World, multiworld: MultiWorld, state: CollectionState, play
399399
total_Count += count * value
400400
if skipCache:
401401
return total_Count >= requested_count
402-
world.item_values_cache[player][value_name]['count'] = total_Count
403-
world.item_values_cache[player][value_name]['state'] = dict(state.prog_items[player])
404-
return world.item_values_cache[player][value_name]['count'] >= requested_count
402+
world.itemvalue_rule_cache[player][value_name]['count'] = total_Count
403+
world.itemvalue_rule_cache[player][value_name]['state'] = dict(state.prog_items[player])
404+
return world.itemvalue_rule_cache[player][value_name]['count'] >= requested_count
405405

406406
# Two useful functions to make require work if an item is disabled instead of making it inaccessible
407407
def OptOne(world: World, multiworld: MultiWorld, state: CollectionState, player: int, item: str, items_counts: Optional[dict] = None):

0 commit comments

Comments
 (0)