use koko-boya's resources

This commit is contained in:
muhammadeko 2022-05-15 10:21:01 +07:00
parent 3abc2ccea1
commit ccdd986967
No known key found for this signature in database
GPG Key ID: 51366716C10E98B1
2 changed files with 19 additions and 19 deletions

View File

@ -89,10 +89,10 @@ export default function Artifacts() {
}; };
const getPercent = (affix:IReliquaryAffix)=>{ const getPercent = (affix:IReliquaryAffix)=>{
if (affix.propType.indexOf("PERCENT") !== -1 || affix.propType.indexOf("CRITICAL") !== -1 || affix.propType.indexOf("EFFICIENCY") !== -1 || affix.propType.indexOf("HURT") !== -1 || affix.propType.indexOf("RATIO") !== -1 || affix.propType.indexOf("ADD") !== -1) { if (affix.PropType.indexOf("PERCENT") !== -1 || affix.PropType.indexOf("CRITICAL") !== -1 || affix.PropType.indexOf("EFFICIENCY") !== -1 || affix.PropType.indexOf("HURT") !== -1 || affix.PropType.indexOf("RATIO") !== -1 || affix.PropType.indexOf("ADD") !== -1) {
return parseFloat(String(affix.propValue*100)).toPrecision(3) + "%"; return parseFloat(String(affix.PropValue*100)).toPrecision(3) + "%";
} }
return parseInt(String(affix.propValue)); return parseInt(String(affix.PropValue));
}; };
const handleGeneratedArtifact = () => { const handleGeneratedArtifact = () => {
@ -156,7 +156,7 @@ export default function Artifacts() {
aria-label="Artifact Main Stats" id="ArtifactMainStats" aria-label="Artifact Main Stats" id="ArtifactMainStats"
className="block w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300 rounded-md" className="block w-full shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300 rounded-md"
options={reliquaryMains} options={reliquaryMains}
getOptionLabel={(option) => t(option.propType)} getOptionLabel={(option) => t(option.PropType)}
onChange={handleMainStatChange} onChange={handleMainStatChange}
renderInput={(params) => <TextField {...params} label="Main Stats" variant="outlined"/>} renderInput={(params) => <TextField {...params} label="Main Stats" variant="outlined"/>}
/> />
@ -173,9 +173,9 @@ export default function Artifacts() {
{reliquaryAffixes.map((affix, index) => { {reliquaryAffixes.map((affix, index) => {
return ( return (
<div key={index} className="flex"> <div key={index} className="flex">
<input type="checkbox" className="mr-4 ml-4 focus:ring-indigo-500 h-4 w-4 mt-1 text-indigo-600 border-gray-300 rounded" value={affix.id} id={"select-"+affix.id} onChange={(e)=>handleAffixSelected(e,false,0)}/> <input type="checkbox" className="mr-4 ml-4 focus:ring-indigo-500 h-4 w-4 mt-1 text-indigo-600 border-gray-300 rounded" value={affix.Id} id={"select-"+affix.Id} onChange={(e)=>handleAffixSelected(e,false,0)}/>
<label className="flex-grow" htmlFor={"select-"+affix.id}>{t(affix.propType) +" - "+getPercent(affix)}</label> <label className="flex-grow" htmlFor={"select-"+affix.Id}>{t(affix.PropType) +" - "+getPercent(affix)}</label>
<input type="number" defaultValue="1" min="1" className="flex-none block shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300 rounded-md" onChange={(e)=>handleAffixSelected(e,true, affix.id)}/> <input type="number" defaultValue="1" min="1" className="flex-none block shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300 rounded-md" onChange={(e)=>handleAffixSelected(e,true, affix.Id)}/>
</div> </div>
); );
})} })}

View File

@ -1,15 +1,15 @@
export interface IReliquaryMain { export interface IReliquaryMain {
id: number; Id: number;
propDepotId: number; PropDepotId: number;
propType:string; PropType:string;
affixName:string; AffixName:string;
} }
export interface IReliquaryAffix { export interface IReliquaryAffix {
id: number; Id: number;
depotId: number; DepotId: number;
groupId: number; GroupId: number;
propType:string; PropType:string;
propValue:number; PropValue:number;
} }
export default class ReliquaryDataProvider { export default class ReliquaryDataProvider {
private static reliquaryMains:IReliquaryMain[] = []; private static reliquaryMains:IReliquaryMain[] = [];
@ -21,17 +21,17 @@ export default class ReliquaryDataProvider {
} }
private static async loadReliquaryMain(){ private static async loadReliquaryMain(){
let data = await fetch("https://raw.githubusercontent.com/Dimbreath/GenshinData/master/ExcelBinOutput/ReliquaryMainPropExcelConfigData.json"); let data = await fetch("https://raw.githubusercontent.com/Koko-boya/Grasscutter_Resources/main/Resources/ExcelBinOutput/ReliquaryMainPropExcelConfigData.json");
let json:IReliquaryMain[] = await data.json(); let json:IReliquaryMain[] = await data.json();
this.reliquaryMains = []; this.reliquaryMains = [];
json.forEach(element => { json.forEach(element => {
if (this.reliquaryMains.filter(x => x.propType === element.propType).length === 0) if (this.reliquaryMains.filter(x => x.PropType === element.PropType).length === 0)
this.reliquaryMains.push(element) this.reliquaryMains.push(element)
}); });
} }
private static async loadReliquaryAffixes(){ private static async loadReliquaryAffixes(){
let data = await fetch("https://raw.githubusercontent.com/Dimbreath/GenshinData/master/ExcelBinOutput/ReliquaryAffixExcelConfigData.json"); let data = await fetch("https://raw.githubusercontent.com/Koko-boya/Grasscutter_Resources/main/Resources/ExcelBinOutput/ReliquaryAffixExcelConfigData.json");
let json = await data.json(); let json = await data.json();
this.reliquaryAffixes = json; this.reliquaryAffixes = json;
} }