Skip to content

Commit

Permalink
Merge pull request #26 from gw2efficiency/export-crafting-decision-pr…
Browse files Browse the repository at this point in the history
…ice-2

Add craft decision price as a property
  • Loading branch information
queicherius authored Sep 5, 2024
2 parents 52beccd + 577d94b commit cbc4a55
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/calculateTreePrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function calculateTreePrices(
buyPrice,
decisionPrice,
craftResultPrice,
craftDecisionPrice: decisionPrice,
}
}

Expand Down Expand Up @@ -68,5 +69,6 @@ export function calculateTreePrices(
craftPrice,
decisionPrice,
craftResultPrice,
craftDecisionPrice,
}
}
3 changes: 3 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export type RecipeTreeWithPrices = ExtendRecipeTree<

/** The sum of this price is used to calculate the craftPrice */
craftResultPrice: number | false

/** The unaltered decision price for crafting */
craftDecisionPrice: number | false
}
>

Expand Down
5 changes: 5 additions & 0 deletions tests/__snapshots__/calculateTreeCraftFlags.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Object {
"buyPriceEach": 1,
"components": Array [],
"craft": false,
"craftDecisionPrice": 1,
"craftPrice": 123,
"craftResultPrice": 1,
"decisionPrice": 1,
Expand All @@ -28,6 +29,7 @@ Object {
"buyPriceEach": false,
"components": Array [],
"craft": true,
"craftDecisionPrice": 123,
"craftPrice": 123,
"craftResultPrice": 123,
"decisionPrice": 123,
Expand All @@ -46,6 +48,7 @@ Object {
"buyPriceEach": 277,
"components": Array [],
"craft": true,
"craftDecisionPrice": 123,
"craftPrice": 123,
"craftResultPrice": 123,
"decisionPrice": 123,
Expand All @@ -64,6 +67,7 @@ Object {
"buyPriceEach": 277,
"components": Array [],
"craft": false,
"craftDecisionPrice": 1,
"craftPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
Expand All @@ -79,6 +83,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 248,
"craftPrice": 123,
"craftResultPrice": 123,
"decisionPrice": 123,
Expand Down
13 changes: 13 additions & 0 deletions tests/__snapshots__/calculateTreePrices.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Object {
"buyPrice": 1,
"buyPriceEach": 1,
"components": undefined,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -25,6 +26,7 @@ Object {
"buyPrice": 4,
"buyPriceEach": 2,
"components": undefined,
"craftDecisionPrice": 4,
"craftResultPrice": 4,
"decisionPrice": 4,
"disciplines": Array [],
Expand All @@ -41,6 +43,7 @@ Object {
"buyPrice": 10,
"buyPriceEach": 1,
"components": undefined,
"craftDecisionPrice": 10,
"craftResultPrice": 10,
"decisionPrice": 10,
"disciplines": Array [],
Expand All @@ -57,6 +60,7 @@ Object {
"buyPrice": false,
"buyPriceEach": false,
"components": undefined,
"craftDecisionPrice": 10,
"craftResultPrice": false,
"decisionPrice": 10,
"disciplines": Array [],
Expand All @@ -70,6 +74,7 @@ Object {
"usedQuantity": 10,
},
],
"craftDecisionPrice": 25,
"craftPrice": 15,
"craftResultPrice": 15,
"decisionPrice": 25,
Expand All @@ -95,6 +100,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -112,6 +118,7 @@ Object {
"buyPriceEach": 2,
"components": undefined,
"craft": false,
"craftDecisionPrice": 4,
"craftResultPrice": 4,
"decisionPrice": 4,
"disciplines": Array [],
Expand All @@ -126,6 +133,7 @@ Object {
},
],
"craft": false,
"craftDecisionPrice": 5,
"craftPrice": 5,
"craftResultPrice": 123,
"decisionPrice": 123,
Expand All @@ -150,6 +158,7 @@ Object {
"buyPrice": 1,
"buyPriceEach": 1,
"components": undefined,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -170,6 +179,7 @@ Object {
"buyPrice": false,
"buyPriceEach": false,
"components": undefined,
"craftDecisionPrice": false,
"craftResultPrice": false,
"decisionPrice": false,
"disciplines": Array [],
Expand All @@ -186,6 +196,7 @@ Object {
"buyPrice": 20,
"buyPriceEach": 10,
"components": undefined,
"craftDecisionPrice": 20,
"craftResultPrice": 20,
"decisionPrice": 20,
"disciplines": Array [],
Expand All @@ -199,6 +210,7 @@ Object {
"usedQuantity": 2,
},
],
"craftDecisionPrice": 20,
"craftPrice": 20,
"craftResultPrice": 4,
"decisionPrice": 4,
Expand All @@ -213,6 +225,7 @@ Object {
"usedQuantity": 2,
},
],
"craftDecisionPrice": 5,
"craftPrice": 5,
"craftResultPrice": 5,
"decisionPrice": 5,
Expand Down
18 changes: 18 additions & 0 deletions tests/__snapshots__/calculateTreeQuantity.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -834,6 +835,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -848,6 +850,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand Down Expand Up @@ -876,6 +879,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -890,6 +894,7 @@ Object {
},
],
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand Down Expand Up @@ -918,6 +923,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -932,6 +938,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand All @@ -953,6 +960,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand Down Expand Up @@ -992,6 +1000,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -1006,6 +1015,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand All @@ -1027,6 +1037,7 @@ Object {
},
],
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand Down Expand Up @@ -1059,6 +1070,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -1073,6 +1085,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand All @@ -1094,6 +1107,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand Down Expand Up @@ -1126,6 +1140,7 @@ Object {
"buyPriceEach": 1,
"components": undefined,
"craft": false,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [],
Expand All @@ -1140,6 +1155,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand All @@ -1161,6 +1177,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand All @@ -1182,6 +1199,7 @@ Object {
},
],
"craft": true,
"craftDecisionPrice": 1,
"craftResultPrice": 1,
"decisionPrice": 1,
"disciplines": Array [
Expand Down
Loading

0 comments on commit cbc4a55

Please sign in to comment.