Non-active, non-idle VTank states (nav, turn_in_quests, etc.) now display in red instead of amber/yellow in both: - Map sidebar: .ml-meta-pill.other (red background + text) - Dashboard cards: .badge-other (red background + text) Green = combat/hunt, Red = nav/other states, Gray = idle/default Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 line
8 KiB
JavaScript
1 line
8 KiB
JavaScript
import{r as A,a as B,j as t,D as L}from"./index-BNR09N5o.js";import"./react-DlyoauG8.js";const w=["Typeless","Slash","Pierce","Bludgeon","Fire","Cold","Acid","Electric"];function f(n,a,x){var c,h,u,k;return(((h=(c=n==null?void 0:n[a])==null?void 0:c[x])==null?void 0:h.total_normal_damage)??0)+(((k=(u=n==null?void 0:n[a])==null?void 0:u[x])==null?void 0:k.total_crit_damage)??0)}function G(n){let a={attacks:0,failed:0,crits:0,normalDmg:0,maxNormal:0,critDmg:0,maxCrit:0};if(!n)return a;for(const x of Object.values(n))for(const c of Object.values(x))a.attacks+=c.total_attacks??0,a.failed+=c.failed_attacks??0,a.crits+=c.crits??0,a.normalDmg+=c.total_normal_damage??0,a.maxNormal=Math.max(a.maxNormal,c.max_normal_damage??0),a.critDmg+=c.total_crit_damage??0,a.maxCrit=Math.max(a.maxCrit,c.max_crit_damage??0);return a}function F(n,a){let x={attacks:0,failed:0};const c=n==null?void 0:n[a];if(!c)return x;for(const h of Object.values(c))x.attacks+=h.total_attacks??0,x.failed+=h.failed_attacks??0;return x}const Y=({id:n,charName:a,zIndex:x})=>{const[c,h]=A.useState(null),[u,k]=A.useState("session"),[p,O]=A.useState(null);A.useEffect(()=>{B(`/combat-stats/${encodeURIComponent(a)}`).then(h).catch(()=>{});const e=setInterval(()=>{B(`/combat-stats/${encodeURIComponent(a)}`).then(h).catch(()=>{})},1e4);return()=>clearInterval(e)},[a]);const m=c==null?void 0:c[u],_=(m==null?void 0:m.monsters)??{},S=Object.keys(_).filter(e=>e!=="__cloak_surges__").sort(),r=A.useMemo(()=>{let e={},l={},v=0,$=0;const T=p?[_[p]].filter(Boolean):S.map(j=>_[j]);for(const j of T)if(j){for(const[g,D]of Object.entries(j.offense??{})){e[g]||(e[g]={});for(const[y,E]of Object.entries(D)){e[g][y]||(e[g][y]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const i=e[g][y],d=E;i.total_attacks+=d.total_attacks??0,i.failed_attacks+=d.failed_attacks??0,i.crits+=d.crits??0,i.total_normal_damage+=d.total_normal_damage??0,i.max_normal_damage=Math.max(i.max_normal_damage,d.max_normal_damage??0),i.total_crit_damage+=d.total_crit_damage??0,i.max_crit_damage=Math.max(i.max_crit_damage,d.max_crit_damage??0)}}for(const[g,D]of Object.entries(j.defense??{})){l[g]||(l[g]={});for(const[y,E]of Object.entries(D)){l[g][y]||(l[g][y]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const i=l[g][y],d=E;i.total_attacks+=d.total_attacks??0,i.failed_attacks+=d.failed_attacks??0,i.total_normal_damage+=d.total_normal_damage??0,i.max_normal_damage=Math.max(i.max_normal_damage,d.max_normal_damage??0),i.total_crit_damage+=d.total_crit_damage??0,i.max_crit_damage=Math.max(i.max_crit_damage,d.max_crit_damage??0)}}v+=j.aetheria_surges??0,$+=j.cloak_surges??0}return _.__cloak_surges__&&!p&&($+=_.__cloak_surges__.cloak_surges??0),{offense:e,defense:l,aeth:v,cloak:$}},[_,S,p]),o=G(r.offense),M=F(r.defense,"MeleeMissile"),b=F(r.defense,"Magic");o.attacks>0&&((o.attacks-o.failed)/o.attacks*100).toFixed(0);const N=M.attacks>0?(M.failed/M.attacks*100).toFixed(0):"0",W=b.attacks>0?(b.failed/b.attacks*100).toFixed(0):"0",C=o.attacks-o.failed,R=C-o.crits,z=R>0?Math.round(o.normalDmg/R):0;o.crits>0&&Math.round(o.critDmg/o.crits);const I=C>0?(o.crits/C*100).toFixed(1):"0",s=e=>e===0?"":e.toLocaleString();return t.jsxs(L,{id:n,title:`Combat: ${a}`,zIndex:x,width:640,height:520,children:[t.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid #333"},children:[t.jsx("button",{className:`ml-stats-range-btn ${u==="session"?"active":""}`,onClick:()=>k("session"),children:"Session"}),t.jsx("button",{className:`ml-stats-range-btn ${u==="lifetime"?"active":""}`,onClick:()=>k("lifetime"),children:"Lifetime"})]}),t.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[t.jsxs("div",{style:{width:240,borderRight:"1px solid #333",overflowY:"auto",fontSize:"0.72rem"},children:[t.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#777",fontSize:"0.65rem",fontWeight:600},children:[t.jsx("span",{style:{width:14}}),t.jsx("span",{style:{flex:1},children:"Monster"}),t.jsx("span",{style:{width:40,textAlign:"right"},children:"Kills"}),t.jsx("span",{style:{width:55,textAlign:"right"},children:"Dmg"})]}),t.jsxs("div",{style:{display:"flex",padding:"3px 6px",cursor:"pointer",background:p===null?"#2a3a4a":"",borderBottom:"1px solid #222",color:"#ddd"},onClick:()=>O(null),children:[t.jsx("span",{style:{width:14,color:"#888"},children:p===null?"*":""}),t.jsx("span",{style:{flex:1},children:"All"}),t.jsx("span",{style:{width:40,textAlign:"right"},children:s((m==null?void 0:m.total_kills)??0)}),t.jsx("span",{style:{width:55,textAlign:"right"},children:s((m==null?void 0:m.total_damage_given)??0)})]}),S.map(e=>{const l=_[e];return t.jsxs("div",{style:{display:"flex",padding:"2px 6px",cursor:"pointer",background:p===e?"#2a3a4a":"",borderBottom:"1px solid #1a1a1a",color:"#ccc"},onClick:()=>O(e),children:[t.jsx("span",{style:{width:14,color:"#888"},children:p===e?"*":""}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t.jsx("span",{style:{width:40,textAlign:"right"},children:s(l.kill_count)}),t.jsx("span",{style:{width:55,textAlign:"right"},children:s(l.damage_given)})]},e)})]}),t.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.72rem"},children:t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{color:"#777",fontSize:"0.65rem"},children:[t.jsx("th",{style:{textAlign:"left",padding:"1px 4px"}}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given M/M"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given Mag"}),t.jsx("th",{style:{width:4}}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv M/M"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv Mag"}),t.jsx("th",{style:{width:4}}),t.jsx("th",{style:{textAlign:"left",padding:"1px 3px"},children:"Stats"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"}})]})}),t.jsxs("tbody",{children:[w.map((e,l)=>{const v=[["Evades",M.attacks>0?`${s(M.attacks)} (${N}%)`:""],["Resists",b.attacks>0?`${s(b.attacks)} (${W}%)`:""],["A.Surges",r.aeth>0?`${s(r.aeth)}`:""],["C.Surges",r.cloak>0?`${s(r.cloak)}`:""],["",""],["",""],["Av/Mx",z>0?`${s(z)} / ${s(o.maxNormal)}`:""],["Crits",o.crits>0?`${s(o.crits)} (${I}%)`:""]][l]??["",""];return t.jsxs("tr",{children:[t.jsx("td",{style:{padding:"1px 4px",color:"#888"},children:e}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(f(r.offense,"MeleeMissile",e))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(f(r.offense,"Magic",e))}),t.jsx("td",{}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(f(r.defense,"MeleeMissile",e))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(f(r.defense,"Magic",e))}),t.jsx("td",{}),t.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:v[0]}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:v[1]})]},e)}),t.jsx("tr",{children:t.jsx("td",{colSpan:9,style:{height:4}})}),t.jsxs("tr",{children:[t.jsx("td",{style:{padding:"1px 4px",color:"#888",fontWeight:600},children:"Total"}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+f(r.offense,"MeleeMissile",l),0))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+f(r.offense,"Magic",l),0))}),t.jsx("td",{}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+f(r.defense,"MeleeMissile",l),0))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+f(r.defense,"Magic",l),0))}),t.jsx("td",{}),t.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:"Total"}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(o.normalDmg+o.critDmg)})]})]})]})})]})]})};export{Y as CombatStatsWindow};
|