Items Module

The items module defines items, weapons, tools, and consumables.

Base Item

class simulation_framework.src.items.item.Item(id: 'int', name: 'str', item_type: 'str', properties: 'Dict[str, Any]' = <factory>, description: 'str' = '', value: 'int' = 0, weight: 'float' = 1.0, max_stack_size: 'int' = 99)[source]

Bases: object

can_stack() bool[source]
description: str = ''
classmethod from_dict(data: Dict[str, Any]) Item[source]
get_property(key: str, default: Any | None = None) Any[source]
id: int
item_type: str
max_stack_size: int = 99
name: str
properties: Dict[str, Any]
set_property(key: str, value: Any) None[source]
to_dict() Dict[str, Any][source]
value: int = 0
weight: float = 1.0

Weapon

class simulation_framework.src.items.weapon.Weapon(**kwargs)[source]

Bases: Item

classmethod create_bow() Weapon[source]
classmethod create_staff() Weapon[source]
classmethod create_sword() Weapon[source]
get_attack_speed() float[source]
get_attack_type() str[source]
get_critical_chance() float[source]
get_critical_multiplier() float[source]
get_damage() int[source]
get_damage_type() str[source]
get_magic_cost() int[source]
get_range() int[source]
get_stamina_cost() int[source]

Tool

class simulation_framework.src.items.tool.Tool(**kwargs)[source]

Bases: Item

classmethod create_axe() Tool[source]
classmethod create_fishing_rod() Tool[source]
classmethod create_hoe() Tool[source]
classmethod create_pickaxe() Tool[source]
get_durability() int[source]
get_durability_percentage() float[source]
get_efficiency() float[source]
get_max_durability() int[source]
get_tool_type() str[source]
is_broken() bool[source]
repair(amount: int) int[source]
use(wear_amount: int = 1) bool[source]

Consumable

class simulation_framework.src.items.consumable.Consumable(**kwargs)[source]

Bases: Item

consume(entity: Entity) bool[source]
classmethod create_food(name: str = 'Bread') Consumable[source]
classmethod create_health_potion() Consumable[source]
classmethod create_magic_potion() Consumable[source]
classmethod create_poison() Consumable[source]
classmethod create_stamina_potion() Consumable[source]
classmethod create_strength_elixir() Consumable[source]
get_cooldown() int[source]
get_effect() Dict[str, Any][source]

Loot Table

class simulation_framework.src.items.loot_table.LootEntry(item: Item, probability: float, min_quantity: int = 1, max_quantity: int = 1)[source]

Bases: object

roll_quantity() int[source]
class simulation_framework.src.items.loot_table.LootTable(entries: List[LootEntry] | None = None)[source]

Bases: object

add_entry(item: Item, probability: float, min_quantity: int = 1, max_quantity: int = 1) None[source]
classmethod create_basic_monster_loot() LootTable[source]
classmethod create_rare_monster_loot() LootTable[source]
classmethod create_resource_node_loot(resource_type: str) LootTable[source]
generate_loot(luck_modifier: float = 0.0) List[Tuple[Item, int]][source]
get_guaranteed_loot() List[Tuple[Item, int]][source]
get_possible_loot() List[Item][source]
get_total_probability() float[source]
is_empty() bool[source]
merge(other: LootTable) LootTable[source]

Starting Equipment

Starting equipment helper functions for agents. Provides appropriate tools and items based on agent goals and character class.

simulation_framework.src.items.starting_equipment.create_basic_tool_set() List[Tool][source]

Create a basic set of tools for testing.

Returns:

List containing one of each basic tool type

simulation_framework.src.items.starting_equipment.equip_agent_for_task(agent: Agent, task: str) bool[source]

Equip an agent with the appropriate tool for a specific task.

Parameters:
  • agent – The agent to equip

  • task – The task type (e.g., “woodcutting”, “mining”, “fishing”)

Returns:

True if the agent was successfully equipped, False otherwise

simulation_framework.src.items.starting_equipment.get_class_equipment(class_name: str) List[Item][source]

Get starting equipment based on character class.

Parameters:

class_name – Name of the character class

Returns:

List of starting items for the class

simulation_framework.src.items.starting_equipment.get_goal_equipment(goals: List[Goal]) List[Item][source]

Get equipment based on agent’s current goals.

Parameters:

goals – List of agent’s current goals

Returns:

List of tools needed for the goals

simulation_framework.src.items.starting_equipment.give_starting_equipment(agent: Agent) None[source]

Give an agent appropriate starting equipment based on their goals and class.

Parameters:

agent – The agent to equip