Skip to content

Commit

Permalink
fix : dmg detection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay13Jeong committed May 8, 2024
1 parent fb16ed5 commit 6e74059
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 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.3",
"version": "0.141.4",
"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.3"
"version": "0.141.4"
},
"tauri": {
"allowlist": {
Expand Down
5 changes: 3 additions & 2 deletions src/components/PlayerRowExtension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from "@/utils";
import { Fragment, useEffect, useState } from "react";
import {
checkCheating, checkDmgCap,
checkCheating, checkDmgBuff, checkDmgCap,
// getSupDmgPlusCount
} from "@/utils2.ts";
import { t } from "i18next";
Expand Down Expand Up @@ -140,7 +140,8 @@ export const DmgCheckRow = ({

const dmgCheckAsync = async () => {
setDmgChecker(() => ({status: "", cheat: false}));
if (!checkDmgCap(player, playerData!)){
const dmgBuff : number = checkDmgBuff(partyData);
if (!checkDmgCap(player, playerData!, dmgBuff)){
setDmgChecker(() => ({status: "Dmg Cheat", cheat: true}));
}
}
Expand Down
21 changes: 17 additions & 4 deletions src/utils2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ DmgCaps.forEach(dmgCap => {
characterToDmgCapMap.set(dmgCap.characterType, dmgCap.maxDmg);
});

export const checkDmgCap = (player: ComputedPlayerState, playerData: PlayerData) : boolean => {
export const checkDmgCap = (player: ComputedPlayerState, playerData: PlayerData, dmgBuff: number = 1.0) : boolean => {
const totalDamage = player.skillBreakdown.reduce((acc, skill) => acc + skill.totalDamage, 0);
const computedSkills = player.skillBreakdown.map((skill) => {
return {
Expand All @@ -266,15 +266,14 @@ export const checkDmgCap = (player: ComputedPlayerState, playerData: PlayerData)

for (const skill of computedSkills){
if (skill.maxDamage === null) continue;
//attack1만나면 if걸고 break
const maxDmg = skill.maxDamage!;
const characterType : CharacterType = playerData.characterType;
const maxDmg = skill.maxDamage!;
const actionType = skill.actionType as { Normal: number };
const skillID = actionType["Normal"];

if (skillID === 100){
const dmgCap = characterToDmgCapMap.get(characterType);
if (dmgCap !== undefined && maxDmg > dmgCap){
if (dmgCap !== undefined && maxDmg > (dmgCap * dmgBuff)){
return false;
}
break;
Expand Down Expand Up @@ -304,3 +303,17 @@ export const checkCheatingController = (player: PlayerData) => {

return checkInfo.slice(0, lastIndex).join("\n");
};

export const checkDmgBuff = (partyData : Array<PlayerData | null>) => {
for (const player of partyData){
if (player === null) continue;
if ((player.characterType as string) === "Pl0200"){
for (const sigil of player.sigils) {
if (sigil.firstTraitId === 2600336030 || sigil.secondTraitId === 2600336030){
return 1.25;
}
}
}
}
return 1.0;
}

0 comments on commit 6e74059

Please sign in to comment.