genshin-crafter
v0.1.2
Published
Genshin Inventory Crafter
Readme
Mechanism
First, calculate the items in the same class Afterwards, each 11 crafting procedure is performed and the final value is returned.
우선 같은 등급에서 재화를 계산합니다. 이후 총 11번의 합성 절차를 거친 후 값을 리턴합니다. |procedure|Before|After| |------|---|---| |5star <-- 4star|0,3,0,0|1,0,0,0| |4star <-- 3star|0,0,3,0|0,1,0,0| |5star <-- 3star|0,0,9,0|1,0,0,0| |3star <-- 2star|0,0,0,3|0,0,1,0| |4star <-- 2star|0,0,0,9|0,1,0,0| |5star <-- 2star|0,0,0,27|1,0,0,0| |5star <-- 3star + 4star|0,2,3,0|1,0,0,0| |5star <-- 2star + 3star|0,0,8,3|1,0,0,0| |5star <-- 2star + 4star|0,2,0,9|1,0,0,0| |4star <-- 2star + 3star|0,0,2,3|0,1,0,0| |5star <-- 2star + 3star + 4star|0,2,2,3|1,0,0,0|
Install
installing via npm
npm으로 설치 및 사용
npm install genshin-crafterUsage
You can use only 1 function. Make sure the arrays are correctly aligned starting from 5star to 2star. If the number of item's class is not 4 but 3, you can put 0 value in 5star.
함수는 아래 하나만 쓰시면 됩니다. 배열은 5성에서 2성 순으로 만드시면 됩니다. 만일 아이템 등급이 총 3개라면 5성 부분에 0을 넣으시면 됩니다.
const possess = { 5: 0, 4: 0, 3: 3, 2: 112 } // 보유한 아이템
const target = { 5: 6, 4: 9, 3: 0, 2: 0 } // 목표 아이템
const result = craftify ( { possess }, { target } );return value may like below
리턴값은 아래와 같이 나옵니다
count : {5: 5star up, 4: 4star up, 3: 3star up},
remain : { remained } ,
required : { required }
requiredTotal : required item totalsExample
const result = craftify ({5: 0, 4: 0, 3: 1, 2: 112}, {5: 6, 4: 9, 3: 0, 2: 0});
console.log(result.count); // 1,12,36
console.log(result.remain); // 0,0,1,4
console.log(result.required); // 5,0,0,0
console.log(result.requiredTotal); // 128const result = craftify ({5: 6, 4: 0, 3: 11, 2: 0}, {5: 6, 4: 9, 3: 9, 2: 1});
console.log(result.count); // 0,0,0
console.log(result.remain); // 0,0,2,0
console.log(result.required); // 0,9,0,1
console.log(result.requiredTotal); // 76// App.tsx (React)
import "./App.css";
import craft from "genshin-crafter";
function App() {
const input = {
5: 0,
4: 0,
3: 3,
2: 112,
};
const target = {
5: 6,
4: 9,
3: 0,
2: 0,
};
const testCraft = craft(input, target);
return (
<>
<main
style={{
display: "flex",
flexDirection: "column",
gap: "10px",
justifyContent: "center",
alignItems: "start",
padding: "2rem",
}}
>
<h1>My Items</h1>
<div style={{ display: "flex", flexDirection: "row", gap: "10px" }}>
<a>5star: {input["5"]}</a>
<a>4star: {input["4"]}</a>
<a>3star: {input["3"]}</a>
<a>2star: {input["2"]}</a>
</div>
<h1>Target Items</h1>
<div style={{ display: "flex", flexDirection: "row", gap: "10px" }}>
<a>5star: {target["5"]}</a>
<a>4star: {target["4"]}</a>
<a>3star: {target["3"]}</a>
<a>2star: {target["2"]}</a>
</div>
<h1>Required Items</h1>
<div style={{ display: "flex", flexDirection: "row", gap: "10px" }}>
<a>5star: {testCraft.required["5"]}</a>
<a>4star: {testCraft.required["4"]}</a>
<a>3star: {testCraft.required["3"]}</a>
<a>2star: {testCraft.required["2"]}</a>
</div>
<h1>Total craft Counts</h1>
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
<a>4star >> 5star: {testCraft.count["5"]}</a>
<a>3star >> 4star: {testCraft.count["4"]}</a>
<a>2star >> 3star: {testCraft.count["3"]}</a>
</div>
<h1>Needed</h1>
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
<a>Total Needed 2star: {testCraft.requiredTotal}</a>
</div>
<h1>Progress</h1>
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
<a>
{(testCraft.requiredTotal /
(target['2'] + target['3'] * 3 + target['4'] * 9 + target['5'] * 27)) *
100}
%
</a>
</div>
</main>
</>
);
}
