Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Creating a new cog to support getting the latest death for a player in Albion Online and calculating regear costs.

Plan:

  • Create albion_regear directory with standard cog structure
  • Create init.py with cog registration (using async setup for Red-bot 3.4+)
  • Create info.json with metadata and httpx dependency
  • Create regear.py with main cog implementation
    • Implement player search via gameinfo API
    • Implement latest death retrieval
    • Implement equipment cost calculation using pricing API
    • Format output with total cost and killboard link
  • Validate Python syntax
  • Run linting to ensure code quality
  • Address code review feedback
    • Fix retry loop condition to be more conventional
    • Move sleep calls inside error branches for efficiency
    • Use httpx.RequestError instead of HTTPError for proper exception handling
  • Run security checks (0 alerts found)
  • Fix get_item_prices to use correct API endpoint format
    • Changed from query params to path-based item list
    • Added Bridgewatch location parameter
    • Added qualities=1 parameter

Implementation details:

  • Uses gameinfo-ams.albiononline.com API for player search and death events
  • Uses europe.albion-online-data.com API for item pricing with correct endpoint format: /api/v2/stats/prices/{itemList}
  • Prices from Bridgewatch location with quality 1
  • Prefers buy_price_max for pricing as specified
  • Excludes inventory items, only calculates equipment costs
  • Formats killboard links as specified
  • Uses async setup pattern for Red-bot 3.4+ compatibility
Original prompt

Create a new cog to support getting the latest death for a player in the game Albion Online.
Using the unofficial apis for https://gameinfo-ams.albiononline.com/api/gameinfo create a new command "regear"

This should work like this ".regear " (.regear psykzz for example)

Using the name we should look up the character exists, then get their latest death.
Looping through their lost equipment (ignoring anything in their inventory) try to calculate the cost.

Use prices from https://europe.albion-online-data.com/api/v2/stats/prices
Never use sell_price_max or buy_price_min as these typically have extreme values that are never useful.
Prefer to use the buy_price_max value.

The output should be a simple price, with a link to the killboard.
Killboard links should be like https://albiononline.com/killboard/kill/ (https://albiononline.com/killboard/kill/280196653)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 5, 2025
Copilot AI and others added 2 commits November 5, 2025 13:14
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add regear command to fetch latest death of player Add Albion Online regear cost calculator cog Nov 5, 2025
Copilot AI requested a review from psykzz November 5, 2025 13:21
Copilot finished work on behalf of psykzz November 5, 2025 13:21
@psykzz
Copy link
Owner

psykzz commented Nov 5, 2025

@copilot The function get_item_prices doesn't work.

You are not able to search using query params for the items.
You can review the swagger at https://old.west.albion-online-data.com/api/v2/swagger.json

You should use the endpoint /api/v2/stats/Prices/{itemList}.{format}

Always using the json format.

For example you could call https://europe.albion-online-data.com/api/v2/stats/prices/T4_BAG,T5_BAG?locations=Bridgewatch&qualities=1 to get the prices of bags in Bridgewatch

We should always make sure we check the location Bridgewatch, we should also set quantities=1 to ensure we only give 1 item

Co-authored-by: psykzz <1134201+psykzz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 5, 2025

@copilot The function get_item_prices doesn't work.

You are not able to search using query params for the items....

Fixed in c338f5f. The get_item_prices function now:

  • Uses the correct endpoint format: /api/v2/stats/prices/{itemList}
  • Passes item IDs in the URL path instead of query params
  • Always uses location "Bridgewatch" with qualities=1

Example URL: https://europe.albion-online-data.com/api/v2/stats/prices/T4_BAG,T5_BAG?locations=Bridgewatch&qualities=1

Copilot finished work on behalf of psykzz November 5, 2025 13:30
@psykzz psykzz marked this pull request as ready for review November 5, 2025 13:31
@psykzz psykzz merged commit 0fa586d into main Nov 5, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants