ff14-advanced-market-search / saddlebag-with-pockets

This is the Frontend for the FF14 Marketplace

Home Page:https://saddlebagexchange.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ffxiv craftsim

cohenaj194 opened this issue · comments

this tells people what to craft, it first finds items matching sales stats, then finds their ingredients. last it finds the costs of the ingredients and outputs to figure out whats profitable.

the difference for this one and all previous apis is that this has 2 apis. one api generates the post data for the 2nd api

  • http://{{LOCAL}}/api/recipelookup
  • http://{{LOCAL}}/api/craftsim

theres a guide here with more info on how this works

also look at the html pages on the temp site

1st api recipe lookup

http://{{LOCAL}}/api/recipelookup

first api takes user input and then generates json for the 2nd api

1st api post data

{
    "home_server": "Famfrit",
    "cost_metric": "material_median_cost",
    "revenue_metric": "revenue_home_min_listing",
    "sales_per_week": 10,
    "median_sale_price": 100000,
    "max_material_cost": 50000,
    "jobs": [0, 8,9],
    "filters": [0],
    "stars": -1,
    "lvl_lower_limit": -1,
    "lvl_upper_limit": 91,
    "yields": -1,
    "hide_expert_recipes": true
}

note that the jobs will be like filters in ffxiv and allow players to select multiple jobs here is the list of their values

  • value="8" Carpenter
  • value="9" Blacksmith
  • value="10" Armorer
  • value="11" Goldsmith
  • value="12" Leatherworker
  • value="13" Weaver
  • value="14" Alchemist
  • value="15" Culinarian
  • value="0" Omnicrafter with max level in all jobs

for the cost_metric and revenue_metric values take a look at the html

2nd api craftsim

http://{{LOCAL}}/api/craftsim

the output of the 1st api will be the input for the 2nd

this will contain a few values that are basically just carried over from what the user selects in the 1st api input:

  • cost_metric
  • revenue_metric
  • home_server
  • max_material_cost

The two big changes are the values filled into the crafting_list_hq and crafting_list_nq

each one will be a dictionary of key value pairs where:

  • the key will be the item id of the craft
  • this will have an hq and nq dictionary with key value pairs of the item ids of the ingredients and the amount required of each
  • the yields value will show how many of the item the craft makes. note that while most crafts only make 1 of the output item some crafts make 2 to 5 outputs per craft.
{
    "cost_metric": "material_median_cost",
    "crafting_list_hq": {
        "7535": {
            "hq": {
                "5282": 1,
                "5326": 1,
                "5338": 1
            },
            "nq": {
                "10": 2,
                "12": 3,
                "7772": 2
            },
            "yields": 1
        },
        "7540": {
            "hq": {
                "5330": 1,
                "5338": 1
            },
            "nq": {
                "16": 1,
                "18": 2,
                "4843": 1,
                "7771": 2
            },
            "yields": 1
        },
        "7541": {
            "hq": {
                "5330": 1,
                "5338": 1
            },
            "nq": {
                "16": 1,
                "18": 2,
                "7771": 2
            },
            "yields": 1
        }
    },
    "crafting_list_nq": {
        "2993": {
            "hq": {},
            "nq": {
                "12590": 2,
                "12595": 1,
                "12658": 3,
                "16": 1,
                "18": 1,
                "5068": 1
            },
            "yields": 1
        },
        "6483": {
            "hq": {},
            "nq": {
                "5371": 2,
                "5515": 4,
                "6": 4,
                "7": 4,
                "7032": 1
            },
            "yields": 1
        },
        "6522": {
            "hq": {},
            "nq": {
                "14": 1,
                "17": 1,
                "5060": 1,
                "5061": 4,
                "5068": 3,
                "6219": 1
            },
            "yields": 1
        }
    },
    "home_server": "Famfrit",
    "max_material_cost": 50000,
    "revenue_metric": "revenue_home_min_listing"
}

the final output will be a list that we put into a table where the costEst and revenueEst values should be made into columns like everything else. I can flatten it if needed.

{
    "data": [
        {
            "itemID": 13855,
            "itemName": "Replica High Allagan Gauntlets of Maiming",
            "yieldsPerCraft": 1,
            "itemData": "https://saddlebagexchange.com/queries/item-data/13855",
            "universalisLink": "https://universalis.app/market/13855",
            "costEst": {
                "material_min_listing_cost": 10256,
                "material_avg_cost": 17868,
                "material_median_cost": 14636
            },
            "revenueEst": {
                "revenue_home_min_listing": 999999999,
                "revenue_region_min_listing": 10500,
                "revenue_avg": 121277,
                "revenue_median": 123999
            },
            "hq": true,
            "soldPerWeek": 11,
            "profitEst": 999985363
        },
        {
            "itemID": 8047,
            "itemName": "Choral Attire Augmentation",
            "yieldsPerCraft": 1,
            "itemData": "https://saddlebagexchange.com/queries/item-data/8047",
            "universalisLink": "https://universalis.app/market/8047",
            "costEst": {
                "material_min_listing_cost": 8485,
                "material_avg_cost": 17390,
                "material_median_cost": 15363
            },
            "revenueEst": {
                "revenue_home_min_listing": 100000,
                "revenue_region_min_listing": 52500,
                "revenue_avg": 109654,
                "revenue_median": 119999
            },
            "hq": false,
            "soldPerWeek": 16,
            "profitEst": 50000
        }
    ]
}
``