Skip to content

Commit

Permalink
Improve detection precision 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay13Jeong committed Jun 26, 2024
1 parent a5215ca commit e7e59f2
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gbfr-logs",
"private": true,
"version": "0.141.8",
"version": "0.141.9",
"type": "module",
"scripts": {
"dev": "cargo build --release --package hook --features hook/console && vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "GBFR Logs",
"version": "0.141.8"
"version": "0.141.9"
},
"tauri": {
"allowlist": {
Expand Down
28 changes: 13 additions & 15 deletions src/components/PlayerRowExtension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,11 @@ export const PlayerEquipment = ({
// const [supDmgPlusCount, setSupDmgPlusCount] = useState<number>(0);
const [invalidSigilIdx, setInvalidSigilIdx] = useState("-1");

useEffect(() => {
// const getSupDmgPlusCountAsync = async () => {
// const cnt : number = getSupDmgPlusCount(playerData!.sigils)
// setSupDmgPlusCount(() => cnt);
// }
// getSupDmgPlusCountAsync();
}, [playerData, partyData]);

useEffect(() => {
checkCheatingSimpleAsync(playerData!);
const characterTypeResult = t(`characters:${playerData?.characterType}`, `ui:characters.${playerData?.characterType}`);
setCharacterType(() => characterTypeResult);
}, [playerData]);
}, [playerData, partyData]);

const checkCheatingSimpleAsync = async (player: PlayerData) => {
const checkInfoes = checkCheating(player);
Expand Down Expand Up @@ -143,6 +135,7 @@ export const DmgCheckRow = ({
const [characterType, setCharacterType] = useState<string>("");
const playerData = partyData[partySlotIndex];
// const [calcStatus, setCalcStatus] = useState("");
// const [calcStatus2, setCalcStatus2] = useState("");

useEffect(() => {
dmgCheckAsync();
Expand All @@ -154,8 +147,9 @@ export const DmgCheckRow = ({
setDmgChecker(() => ({status: "", cheat: false}));
const zetaDmg = playerData!.characterType === "Pl1600" ? 1.0627 : 1 //arvess
const dmgBuff : number = checkDmgBuff(partyData);
const djeetaDmg = dmgBuff !== 0 &&
const djeetaDmg : number = dmgBuff !== 1 &&
(playerData!.characterType === "Pl0000" || playerData!.characterType === "Pl0100") ? 1.25 : 1 //kataBuff except
const kataAwake : number = (playerData!.characterType === "Pl0200") ? 0.15 : 0
const baseCap = characterToBaseDmgCapMap.get(playerData!.characterType);
const baseLinkCap = characterToBaseLinkDmgCapMap.get(playerData!.characterType);
const dmgCap : number = 2.5;
Expand Down Expand Up @@ -186,10 +180,12 @@ export const DmgCheckRow = ({
alpha = parseFloat(checkAlpha(playerData).toFixed(2));
}

const finalDmgCap = (baseCap + (baseCap * (dmgCap + gamma + boundary + glassCannonCap + superJustCap + dmgBuff)) +
(baseCap * (normalCap + overMstCap + alpha))) * warElmt * warPath * zetaDmg * djeetaDmg;
const finalLinkDmgCap = (baseLinkCap + (baseLinkCap * (dmgCap + gamma + boundary + glassCannonCap + superJustCap + dmgBuff)) +
(baseLinkCap * (normalCap + overMstCap + alpha))) * warElmt * warPath * zetaDmg * djeetaDmg;
const finalDmgCap = (baseCap + (baseCap * (dmgCap + gamma + boundary + glassCannonCap + superJustCap + kataAwake)) +
(baseCap * (normalCap + overMstCap + alpha))) * warElmt * warPath * zetaDmg * djeetaDmg * dmgBuff;
const finalLinkDmgCap = (baseLinkCap + (baseLinkCap * (dmgCap + gamma + boundary + glassCannonCap + superJustCap + kataAwake)) +
(baseLinkCap * (normalCap + overMstCap + alpha))) * warElmt * warPath * zetaDmg * djeetaDmg * dmgBuff;
// setCalcStatus(() => "N: " + ((finalDmgCap + 0.1) / 1000).toFixed(1) + "k" + dmgBuff) ;
// setCalcStatus2(() => "Link: " + ((finalLinkDmgCap + 0.1) / 1000).toFixed(1) + "k");
const checkResult : string = checkDmgDPS(player, playerData!, finalDmgCap, finalLinkDmgCap);
if (checkResult !== "") {
setDmgChecker(() => ({status: checkResult + " Cheat", cheat: true}));
Expand All @@ -206,7 +202,9 @@ export const DmgCheckRow = ({
<td>
{/*{calcStatus}*/}
</td>
<td></td>
<td>
{/*{calcStatus2}*/}
</td>
<td></td>
</tr>
</Fragment>
Expand Down
6 changes: 3 additions & 3 deletions src/sigils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const heartSigilsDec: sampleDecSigil[] = [
{ firstTrait: 2233052490, sigilId: 2982223883},
{ firstTrait: 3092382396, sigilId: 885485713},
{ firstTrait: 251817200, sigilId: 2217767143},
{ firstTrait: 2738476610, sigilId: 1081314525},
{ firstTrait: 2738476610, sigilId: 1081314525}, //ferryHeart
{ firstTrait: 4258376996, sigilId: 4145664405},
{ firstTrait: 1662438379, sigilId: 3849363521},
{ firstTrait: 3640028188, sigilId: 1032687881},
Expand All @@ -120,8 +120,8 @@ export const heartSigilMap = new Map<string, string>();
export const heartSigilTraitMap = new Map<string, string>();

heartSigilsDec.forEach(sigil => {
const trait1Hex = toHashString(sigil.firstTrait ?? 0);
const sigilIdHex = toHashString(sigil.firstTrait ?? 0);
const trait1Hex = toHashString(sigil.firstTrait);
const sigilIdHex = toHashString(sigil.sigilId);
heartSigilMap.set(sigilIdHex, trait1Hex);
heartSigilTraitMap.set(trait1Hex, sigilIdHex);
});
52 changes: 36 additions & 16 deletions src/utils2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const checkCheating = (player: PlayerData) => {
if (player !== undefined && player.overmasteryInfo !== null){
const overmasteries = player.overmasteryInfo.overmasteries;
for (const mastery of overmasteries) {
const checkArrCnt = overmasteries.filter(om => om === mastery).length;
const checkArrCnt = overmasteries.filter(om => om.id === mastery.id).length;
if (checkArrCnt > 1){
cheats.push("Duplicate Overmasteries");
if (status === NP) invalidIdx = "-3";
Expand Down Expand Up @@ -297,6 +297,10 @@ export const checkDmgDPS = (
});
computedSkills.sort((a, b) => b.totalDamage - a.totalDamage);
const characterType : CharacterType = playerData.characterType;
const isKata = characterType === "Pl0200";
const isSdp = characterType === "Pl2100";
const isPcv = characterType === "Pl1000";
const isSeofon = characterType === "Pl2200";
const limitDmg = characterToDmgCap2Map.get(characterType);
if (limitDmg === undefined){
return "Character";
Expand All @@ -310,14 +314,16 @@ export const checkDmgDPS = (
const skillID = actionType["Normal"];

if (skillID === 100){
if (maxDmg > finalDmgCap || maxDmg > limitDmg){
if (maxDmg > (finalDmgCap + 100) || maxDmg > limitDmg){
// if (maxDmg > finalDmgCap * (characterType === "Pl2100" ? 0.953 : 1)){
return "DMG";
}
break;
}

if (skill.actionType === "LinkAttack"){
if (maxDmg > finalLinkDmgCap){
if (maxDmg > finalLinkDmgCap + (isKata ? 22000 : 0) + (isSdp ? 40000 : 0) +
(isPcv ? 230000 : 0) + (isSeofon ? 22000 : 0) + 100){
// if (maxDmg > finalDmgCap * (characterType === "Pl2100" ? 0.953 : 1)){
return "DMG";
}
Expand Down Expand Up @@ -350,15 +356,15 @@ export const checkCheatingController = (player: PlayerData) => {
export const checkDmgBuff = (partyData : Array<PlayerData | null>) => {
for (const player of partyData){
if (player === null) continue;
if ((player.characterType as string) === "Pl0200"){
if (player.characterType === "Pl0200"){
for (const sigil of player.sigils) {
if (sigil.firstTraitId === 2600336030 || sigil.secondTraitId === 2600336030){
return 0.25;
if (sigil.firstTraitId === 2600336030){
return 1.25;
}
}
}
}
return 0;
return 1;
}

export const checkGlassCannon = (player: PlayerData) => {
Expand All @@ -384,24 +390,38 @@ export const checkSuperJust = (player: PlayerData) => {
}

export const checkWarElmt = (player: PlayerData) => {
if (player !== null){
for (const sigil of player.sigils) {
if (toHashString(sigil.firstTraitId) === "4c588c27"){
return 1.2;
}
}
}
return 1;
player;
return 1.2;
// todo : To make it work according to the field
// if (player !== null){
// for (const sigil of player.sigils) {
// if (toHashString(sigil.firstTraitId) === "4c588c27"){
// return 1.2;
// }
// }
// }
// return 1;
}

export const checkWarpath = (player: PlayerData) => {
if (player !== null){
if (player.characterType === "Pl0000" || player.characterType === "Pl0100"){
return 1;
}
if (player.characterType === "Pl2300"){ //송
for (const sigil of player.sigils) {
if (toHashString(sigil.firstTraitId) === tweyenSigils[0].firstTrait){//마안
return 1.20;
}
if (toHashString(sigil.secondTraitId) === tweyenSigils[0].firstTrait){//마안
return 1.20;
}
}
return 1;
}
for (const sigil of player.sigils) {
if (heartSigilTraitMap.get(toHashString(sigil.firstTraitId)) !== undefined){
return 1.15;
return 1.20;
}
}
}
Expand Down

0 comments on commit e7e59f2

Please sign in to comment.