From e73fca7eff6b24ef4ba4cc93ad737abef0f9b75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Karpi=C5=84ski?= Date: Sun, 14 Jan 2024 18:02:40 +0100 Subject: [PATCH] Remove changung token display name functionality --- scripts/main.js | 6 +++--- scripts/main.js.map | 8 +++---- src/actor.js | 2 -- src/api.js | 2 -- src/main.js | 3 +-- src/token.js | 51 +-------------------------------------------- 6 files changed, 9 insertions(+), 63 deletions(-) diff --git a/scripts/main.js b/scripts/main.js index 81770c7..6ee7a50 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -1,10 +1,10 @@ -(()=>{var ie=Object.defineProperty;var r=(e,n)=>ie(e,"name",{value:n,configurable:!0});var u="anonymous";function _(...e){return e=e.filter(n=>typeof n=="string"),`modules/${u}/templates/${e.join("/")}`}r(_,"templatePath");function I(){let e=game.data,n=e.users.find(t=>t._id===e.userId);return!!n&&n.role>=CONST.USER_ROLES.GAMEMASTER}r(I,"isGM");function z(e,n,t){return e.getFlag(u,n)??t}r(z,"getFlag");function C(e,n,t){return e.setFlag(u,n,t)}r(C,"setFlag");function g(...e){let[n,t]=e;return n=`${u}.${n}`,t?game.i18n.format(n,t):game.i18n.localize(n)}r(g,"localize");function R(e){let n=r((...t)=>g(`${e}.${t[0]}`,t[1]),"fn");return Object.defineProperties(n,{warn:{value:(...t)=>P(`${e}.${t[0]}`,t[1],t[2]),enumerable:!1,configurable:!1},info:{value:(...t)=>ce(`${e}.${t[0]}`,t[1],t[2]),enumerable:!1,configurable:!1},error:{value:(...t)=>le(`${e}.${t[0]}`,t[1],t[2]),enumerable:!1,configurable:!1},has:{value:t=>hasLocalization(`${e}.${t}`),enumerable:!1,configurable:!1},path:{value:t=>localizePath(`${e}.${t}`),enumerable:!1,configurable:!1},template:{value:(t,{hash:o})=>n(t,o),enumerable:!1,configurable:!1}}),n}r(R,"subLocalize");function U(e){return e.combat.turns.filter(n=>n.actorId===e.actorId)}r(U,"getSameCombatants");function f(e){return game.settings.get(u,e)}r(f,"getSetting");function G(e,n){return game.settings.set(u,e,n)}r(G,"setSetting");function se(e,n,t=!1){return e.tokens.filter(o=>o.actorId===n.id&&(!t||o.actorLink))}r(se,"getActorSceneTokens");function Y(e,n=!1){return game.scenes.map(t=>se(t,e,n)).flat()}r(Y,"getActorTokens");function F(e){return e?e[0].toUpperCase()+e.slice(1):""}r(F,"capitalize");function h(e){let n=e.name;e.scope=e.scope??"world",e.config=e.config??!1,e.config&&(e.name=p(n,"name"),e.hint=p(n,"hint")),Array.isArray(e.choices)&&(e.choices=e.choices.reduce((t,o)=>(t[o]=p(n,"choices",o),t),{})),game.settings.register(u,n,e)}r(h,"registerSetting");function j(e){let n=e.name;e.name=p("menus",n,"name"),e.label=p("menus",n,"label"),e.hint=p("menus",n,"hint"),e.restricted=e.restricted??!0,e.icon=e.icon??"fas fa-cogs",game.settings.registerMenu(u,n,e)}r(j,"registerSettingMenu");function p(...e){return`${u}.settings.${e.join(".")}`}r(p,"getSettingLocalizationPath");function O(){return game.modules.get(u)}r(O,"getCurrentModule");function v(e,n,t,o){let a=typeof n=="string"?n:"info",c=typeof n=="object"?n:typeof t=="object"?t:void 0,s=typeof n=="boolean"?n:typeof t=="boolean"?t:o??!1;ui.notifications.notify(g(e,c),a,{permanent:s})}r(v,"notify");function P(...e){let[n,t,o]=e;v(n,"warning",t,o)}r(P,"warn");function ce(...e){let[n,t,o]=e;v(n,"info",t,o)}r(ce,"info");function le(...e){let[n,t,o]=e;v(n,"error",t,o)}r(le,"error");function S(e,n,t,o=!1){let a=e.find("*");o&&(a=a.addBack()),a.contents().each((c,s)=>{s.nodeType===Node.TEXT_NODE&&s.textContent?.trim()&&$(s).replaceWith(s.textContent.replace(n,t))})}r(S,"replaceHTMLText");function E(e,n){e.token?V(e.token,n):Y(e,!0).forEach(t=>V(t,n))}r(E,"updateActorTokens");function W(e,n){let t=e.object.actor;if(!t||t.hasPlayerOwner)return;let o=fe(t);o.addEventListener("click",()=>y(t)),n.find(".col.right").append(o)}r(W,"renderTokenHUD");function B(e){if(e.actor?.hasPlayerOwner)return;let n=e.displayName,t=q(n);t!==n&&(e._source.displayName=t)}r(B,"preCreateToken");function fe(e){let n=document.createElement("template"),t=m(e);return n.innerHTML=`
+(()=>{var ee=Object.defineProperty;var r=(e,n)=>ee(e,"name",{value:n,configurable:!0});var u="anonymous";function O(...e){return e=e.filter(n=>typeof n=="string"),`modules/${u}/templates/${e.join("/")}`}r(O,"templatePath");function U(){let e=game.data,n=e.users.find(t=>t._id===e.userId);return!!n&&n.role>=CONST.USER_ROLES.GAMEMASTER}r(U,"isGM");function I(e,n,t){return e.getFlag(u,n)??t}r(I,"getFlag");function P(e,n,t){return e.setFlag(u,n,t)}r(P,"setFlag");function g(...e){let[n,t]=e;return n=`${u}.${n}`,t?game.i18n.format(n,t):game.i18n.localize(n)}r(g,"localize");function D(e){let n=r((...t)=>g(`${e}.${t[0]}`,t[1]),"fn");return Object.defineProperties(n,{warn:{value:(...t)=>T(`${e}.${t[0]}`,t[1],t[2]),enumerable:!1,configurable:!1},info:{value:(...t)=>te(`${e}.${t[0]}`,t[1],t[2]),enumerable:!1,configurable:!1},error:{value:(...t)=>ne(`${e}.${t[0]}`,t[1],t[2]),enumerable:!1,configurable:!1},has:{value:t=>hasLocalization(`${e}.${t}`),enumerable:!1,configurable:!1},path:{value:t=>localizePath(`${e}.${t}`),enumerable:!1,configurable:!1},template:{value:(t,{hash:o})=>n(t,o),enumerable:!1,configurable:!1}}),n}r(D,"subLocalize");function G(e){return e.combat.turns.filter(n=>n.actorId===e.actorId)}r(G,"getSameCombatants");function m(e){return game.settings.get(u,e)}r(m,"getSetting");function R(e,n){return game.settings.set(u,e,n)}r(R,"setSetting");function F(e){return e?e[0].toUpperCase()+e.slice(1):""}r(F,"capitalize");function h(e){let n=e.name;e.scope=e.scope??"world",e.config=e.config??!1,e.config&&(e.name=p(n,"name"),e.hint=p(n,"hint")),Array.isArray(e.choices)&&(e.choices=e.choices.reduce((t,o)=>(t[o]=p(n,"choices",o),t),{})),game.settings.register(u,n,e)}r(h,"registerSetting");function j(e){let n=e.name;e.name=p("menus",n,"name"),e.label=p("menus",n,"label"),e.hint=p("menus",n,"hint"),e.restricted=e.restricted??!0,e.icon=e.icon??"fas fa-cogs",game.settings.registerMenu(u,n,e)}r(j,"registerSettingMenu");function p(...e){return`${u}.settings.${e.join(".")}`}r(p,"getSettingLocalizationPath");function C(){return game.modules.get(u)}r(C,"getCurrentModule");function M(e,n,t,o){let a=typeof n=="string"?n:"info",c=typeof n=="object"?n:typeof t=="object"?t:void 0,s=typeof n=="boolean"?n:typeof t=="boolean"?t:o??!1;ui.notifications.notify(g(e,c),a,{permanent:s})}r(M,"notify");function T(...e){let[n,t,o]=e;M(n,"warning",t,o)}r(T,"warn");function te(...e){let[n,t,o]=e;M(n,"info",t,o)}r(te,"info");function ne(...e){let[n,t,o]=e;M(n,"error",t,o)}r(ne,"error");function k(e,n,t,o=!1){let a=e.find("*");o&&(a=a.addBack()),a.contents().each((c,s)=>{s.nodeType===Node.TEXT_NODE&&s.textContent?.trim()&&$(s).replaceWith(s.textContent.replace(n,t))})}r(k,"replaceHTMLText");function f(e){return e instanceof Combatant&&e.actor&&(e=e.actor),e instanceof Actor&&e.hasPlayerOwner?!0:!!I(e,"showName")}r(f,"playersSeeName");async function y(e){let n=!f(e);e instanceof Actor||!e.actor?await P(e,"showName",n):await P(e.actor,"showName",n),canvas.tokens.hud?.rendered&&canvas.tokens.hud.render();let t=e instanceof Actor?e:e.actor;return n}r(y,"toggleSeeName");function d(e){let n=g("unknown"),t=e instanceof Actor?e.type:e.actor?.type;return t?(E()[t]??"").trim()||H(n,t):n}r(d,"getName");function N(){ui.combat.render()}r(N,"refresh");function E(){return m("names")}r(E,"getSavedNames");function H(e,n){return`${e} ${F(n)}`}r(H,"formatUnknown");function _(e,n){re({entries:n,defaultData:{name:t=>g(`context.${t}`),icon:"fa-solid fa-signature",callback:t=>{let o=t.attr("data-document-id"),a=game.actors.get(o);a&&y(a)},condition:(t,o)=>{let a=t.attr("data-document-id"),c=game.actors.get(a);return!!c&&!c.hasPlayerOwner&&(o==="show"?!f(c):f(c))}},choices:["show","hide"]})}r(_,"getActorDirectoryEntryContext");function B(e,n){let t=getProperty(n,`flags.${u}.showName}`)!==void 0;"ownership"in n&&(t=!0),t&&N()}r(B,"onActorUpdate");function re({entries:e,choices:n,defaultData:t={}}){Array.isArray(n)&&(n=n.reduce((o,a)=>(o[a]={},o),{}));for(let o in n){let a=n[o],c=a.name??(typeof t.name=="function"?t.name(o):t.name)??"",s=a.icon??(typeof t.icon=="function"?t.icon(o):t.icon)??"";if(!$(s).length){let i=$("");i.addClass(s),s=i[0].outerHTML}e.unshift({name:c,icon:s,callback:i=>{a.callback?a.callback(i):t.callback&&t.callback(i,o)},condition:i=>a.condition?.(i)??t.condition?.(i,o)??!0})}}r(re,"addSelectContextEntry");var b=class extends FormApplication{static get defaultOptions(){return mergeObject(super.defaultOptions,{id:"anonymous-names-menu",title:g("templates.names.title"),template:O("names.html"),width:400})}getData(n){let t=g("unknown"),o=E(),a=game.system.documentTypes.Actor.map(c=>({type:c,value:(o[c]??"").trim(),placeholder:H(t,c)}));return{...super.getData(n),types:a,i18n:D("templates.names")}}activateListeners(n){super.activateListeners(n),n.find("[data-action=cancel]").on("click",()=>this.close())}async _updateObject(n,t){R("names",t)}};r(b,"AnonymousNamesMenu");function V({message:e,$html:n,isAnonymous:t,actor:o}){if(t&&e.rolls.length&&m("criticals")){let a=game.i18n.localize("DND5E.CriticalHit"),c=game.i18n.localize("DND5E.PowerfulCritical"),s=new RegExp(` (\\(([\\w ]*)?(?:${a}|${c})([\\w ]*)?\\))$`,"igm"),i=n.find("header .flavor-text");game.user.isGM&&k(i,s,' $1',!0),k(i,s,"",!0)}}r(V,"dnd5ParseChat");function q(e){h({name:"pf2e.traits",type:String,default:"never",config:!0,choices:{never:p("pf2e.traits.choices.never"),rolls:p("pf2e.traits.choices.rolls"),always:p("pf2e.traits.choices.always")}})}r(q,"pf2eInitHook");function W(e){e&&oe()}r(W,"pf2eReadyHook");function oe(){let e="";if(game.settings.settings.has("pf2e.metagame.tokenSetsNameVisibility")?e="metagame.tokenSetsNameVisibility":game.settings.settings.has("pf2e.metagame_tokenSetsNameVisibility")&&(e="metagame_tokenSetsNameVisibility"),!e||!game.settings.get("pf2e",e))return;let n=C().title,t=game.i18n.localize("PF2E.SETTINGS.Metagame.TokenSetsNameVisibility.Name");game.settings.set("pf2e",e,!1),T("pf2e.disabled",{module:n,setting:t},!0)}r(oe,"disableSettings");function X({message:e,isAnonymous:n,$html:t}){let o=game.user.isGM,a=e.target?.actor,c=m("criticals"),s=m("rolls");if(a&&!a.hasPlayerOwner&&!f(a)){let i=t.find('.flavor-text .target-dc [data-whose="target"]');if(i.length){let l=i.first();o?l.attr("data-visibility","gm"):l.text(g("pf2e.target",{name:d(a)}))}}if(!o&&n){let i=m("pf2e.traits");if(e.rolls.length)if(s){let l=t.find(".flavor-text hr + .tags");l.length&&(l.prev("hr").remove(),l.remove()),c&&t.find(".message-content .dice-roll .dice-result .dice-total").css("color","var(--color-text-dark-primary)"),i!=="never"&&t.find(".flavor-text .tags").remove()}else i==="always"&&t.find(".flavor-text .tags").first().remove();else i==="always"&&t.find(".message-content section.tags").remove()}if(n&&e.rolls.length&&s&&c){let i=game.i18n.localize("PF2E.Check.Result.Degree.Attack.criticalSuccess"),l=game.i18n.localize("PF2E.Check.Result.Degree.Attack.success"),x=new RegExp(`(\\((${i}|${l})\\))`,"gmi"),v=o?'$1':"",w=t.find("header .flavor-text");k(w,x,v,!0)}}r(X,"pf2eParseChat");var ae=/\(dc \d+\)/gim;function J({message:e,isAnonymous:n,$html:t}){if(game.user.isGM)return;if(n&&m("rolls")){let i=t.find(".dice-tooltip");i.empty(),i.css("padding-top",0),m("criticals")&&t.find(".dice-total").removeClass("critical fumble");let l=t.find(".phase-saving-throws .phase-heading");l.text(l.text().replace(ae,""))}let o=t.find(".phase-attack .token-info .token-name"),a=e.getFlag("wire","activation.attack.targetActorUuid");if(o.length&&a)try{let i=fromUuidSync(a)?.actor;i&&!i.hasPlayerOwner&&!f(i)&&o.text(d(i))}catch(i){console.error(i)}let c=t.find(".phase-saving-throws .saving-throw-target:has(.target-name)"),s=e.getFlag("wire","activation.targetUuids");if(c.length&&s?.length)try{for(let i of s){let l=fromUuidSync(i)?.actor;l&&!l.hasPlayerOwner&&!f(l)&&c.filter(`[data-actor-id="${i}"]`).find(".target-name").text(d(l))}}catch(i){console.error(i)}}r(J,"wireParseChat");var A=L(),z=L(),S=L();function Q(){switch(game.system.id){case"pf2e":A.add(q),z.add(W),S.add(X);break;case"dnd5e":S.add(V);break}game.modules.get("wire")?.active&&S.add(J)}r(Q,"thirdPartyInitialization");function L(){let e=[],n=r(function(...t){e.forEach(o=>o(...t))},"f");return n.add=t=>e.push(t),n}r(L,"createThirdPartyListener");function Y(e,n){if(e.blind)return;let t=game.user.isGM,o=e.speaker,a=ChatMessage.getSpeakerActor(o),c=!a||f(a),s=!!a&&!a.hasPlayerOwner;if(a&&!c&&ie(e,a,n),!t&&s){if(e.rolls.length&&m("rolls")){let i=n.find(".message-content .dice-roll .dice-result");i.find(".dice-formula, .dice-tooltip").remove(),m("criticals")&&i.find(".dice-total").removeClass("critical fumble")}m("footer")&&n.find(".message-content footer.card-footer").remove(),m("cardContent")&&n.find(".message-content .card-content").remove()}S({message:e,actor:a,$html:n,playersCanSee:c,isAnonymous:s})}r(Y,"renderChatMessage");function ie(e,n,t){let o=e.speaker,a=new Set;if(o.alias&&a.add(o.alias),n.name&&a.add(n.name),o.token&&o.scene){let w=game.scenes.get(o.scene)?.tokens.get(o.token);w?.name&&a.add(w.name)}if(!a.size)return;let s=Array.from(a).map(v=>RegExp.escape(v)).join("|"),i=new RegExp(`\\b(${s})\\b`,"gmi"),l=d(n),x=game.user.isGM?`$1`:l;k(t,i,x)}r(ie,"changeNames");function Z(e,n){let t=e.object.actor;if(!t||t.hasPlayerOwner)return;let o=se(t);o.addEventListener("click",()=>y(t)),n.find(".col.right").append(o)}r(Z,"renderTokenHUD");function se(e){let n=document.createElement("template"),t=f(e);return n.innerHTML=`
-
`,n.content.firstChild}r(fe,"createToggle");function V(e,n){n?me(e):ge(e)}r(V,"changeDisplayName");function me(e){let n=e.displayName;if(K(n)||!f("token"))return;let t=n;t===CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER?t=CONST.TOKEN_DISPLAY_MODES.HOVER:t===CONST.TOKEN_DISPLAY_MODES.OWNER&&(t=CONST.TOKEN_DISPLAY_MODES.ALWAYS),e.update({displayName:t})}r(me,"showTokenName");function ge(e){let n=e.displayName;if(ue(n))return;let t=q(n);e.update({displayName:t})}r(ge,"hideTokenName");function ue(e){return!K(e)}r(ue,"isHidding");function K(e){return e===CONST.TOKEN_DISPLAY_MODES.HOVER||e===CONST.TOKEN_DISPLAY_MODES.ALWAYS}r(K,"isShowing");function q(e){return e===CONST.TOKEN_DISPLAY_MODES.HOVER?CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER:e===CONST.TOKEN_DISPLAY_MODES.ALWAYS?CONST.TOKEN_DISPLAY_MODES.OWNER:e}r(q,"swapToHide");function m(e){return e instanceof Combatant&&e.actor&&(e=e.actor),e instanceof Actor&&e.hasPlayerOwner?!0:!!z(e,"showName")}r(m,"playersSeeName");async function y(e){let n=!m(e);e instanceof Actor||!e.actor?await C(e,"showName",n):await C(e.actor,"showName",n),canvas.tokens.hud?.rendered&&canvas.tokens.hud.render();let t=e instanceof Actor?e:e.actor;return t&&E(t,n),n}r(y,"toggleSeeName");function d(e){let n=g("unknown"),t=e instanceof Actor?e.type:e.actor?.type;return t?(A()[t]??"").trim()||M(n,t):n}r(d,"getName");function b(){ui.combat.render()}r(b,"refresh");function A(){return f("names")}r(A,"getSavedNames");function M(e,n){return`${e} ${F(n)}`}r(M,"formatUnknown");function X(e,n){de({entries:n,defaultData:{name:t=>g(`context.${t}`),icon:"fa-solid fa-signature",callback:t=>{let o=t.attr("data-document-id"),a=game.actors.get(o);a&&y(a)},condition:(t,o)=>{let a=t.attr("data-document-id"),c=game.actors.get(a);return!!c&&!c.hasPlayerOwner&&(o==="show"?!m(c):m(c))}},choices:["show","hide"]})}r(X,"getActorDirectoryEntryContext");function J(e,n){let t=getProperty(n,`flags.${u}.showName}`)!==void 0;"ownership"in n&&(E(e,e.hasPlayerOwner),t=!0),t&&b()}r(J,"onActorUpdate");function de({entries:e,choices:n,defaultData:t={}}){Array.isArray(n)&&(n=n.reduce((o,a)=>(o[a]={},o),{}));for(let o in n){let a=n[o],c=a.name??(typeof t.name=="function"?t.name(o):t.name)??"",s=a.icon??(typeof t.icon=="function"?t.icon(o):t.icon)??"";if(!$(s).length){let i=$("");i.addClass(s),s=i[0].outerHTML}e.unshift({name:c,icon:s,callback:i=>{a.callback?a.callback(i):t.callback&&t.callback(i,o)},condition:i=>a.condition?.(i)??t.condition?.(i,o)??!0})}}r(de,"addSelectContextEntry");var x=class extends FormApplication{static get defaultOptions(){return mergeObject(super.defaultOptions,{id:"anonymous-names-menu",title:g("templates.names.title"),template:_("names.html"),width:400})}getData(n){let t=g("unknown"),o=A(),a=game.system.documentTypes.Actor.map(c=>({type:c,value:(o[c]??"").trim(),placeholder:M(t,c)}));return{...super.getData(n),types:a,i18n:R("templates.names")}}activateListeners(n){super.activateListeners(n),n.find("[data-action=cancel]").on("click",()=>this.close())}async _updateObject(n,t){G("names",t)}};r(x,"AnonymousNamesMenu");function Q({message:e,$html:n,isAnonymous:t,actor:o}){if(t&&e.rolls.length&&f("criticals")){let a=game.i18n.localize("DND5E.CriticalHit"),c=game.i18n.localize("DND5E.PowerfulCritical"),s=new RegExp(` (\\(([\\w ]*)?(?:${a}|${c})([\\w ]*)?\\))$`,"igm"),i=n.find("header .flavor-text");game.user.isGM&&S(i,s,' $1',!0),S(i,s,"",!0)}}r(Q,"dnd5ParseChat");function Z(e){h({name:"pf2e.traits",type:String,default:"never",config:!0,choices:{never:p("pf2e.traits.choices.never"),rolls:p("pf2e.traits.choices.rolls"),always:p("pf2e.traits.choices.always")}})}r(Z,"pf2eInitHook");function ee(e){e&&pe()}r(ee,"pf2eReadyHook");function pe(){let e="";if(game.settings.settings.has("pf2e.metagame.tokenSetsNameVisibility")?e="metagame.tokenSetsNameVisibility":game.settings.settings.has("pf2e.metagame_tokenSetsNameVisibility")&&(e="metagame_tokenSetsNameVisibility"),!e||!game.settings.get("pf2e",e))return;let n=O().title,t=game.i18n.localize("PF2E.SETTINGS.Metagame.TokenSetsNameVisibility.Name");game.settings.set("pf2e",e,!1),P("pf2e.disabled",{module:n,setting:t},!0)}r(pe,"disableSettings");function te({message:e,isAnonymous:n,$html:t}){let o=game.user.isGM,a=e.target?.actor,c=f("criticals"),s=f("rolls");if(a&&!a.hasPlayerOwner&&!m(a)){let i=t.find('.flavor-text .target-dc [data-whose="target"]');if(i.length){let l=i.first();o?l.attr("data-visibility","gm"):l.text(g("pf2e.target",{name:d(a)}))}}if(!o&&n){let i=f("pf2e.traits");if(e.rolls.length)if(s){let l=t.find(".flavor-text hr + .tags");l.length&&(l.prev("hr").remove(),l.remove()),c&&t.find(".message-content .dice-roll .dice-result .dice-total").css("color","var(--color-text-dark-primary)"),i!=="never"&&t.find(".flavor-text .tags").remove()}else i==="always"&&t.find(".flavor-text .tags").first().remove();else i==="always"&&t.find(".message-content section.tags").remove()}if(n&&e.rolls.length&&s&&c){let i=game.i18n.localize("PF2E.Check.Result.Degree.Attack.criticalSuccess"),l=game.i18n.localize("PF2E.Check.Result.Degree.Attack.success"),k=new RegExp(`(\\((${i}|${l})\\))`,"gmi"),w=o?'$1':"",T=t.find("header .flavor-text");S(T,k,w,!0)}}r(te,"pf2eParseChat");var he=/\(dc \d+\)/gim;function ne({message:e,isAnonymous:n,$html:t}){if(game.user.isGM)return;if(n&&f("rolls")){let i=t.find(".dice-tooltip");i.empty(),i.css("padding-top",0),f("criticals")&&t.find(".dice-total").removeClass("critical fumble");let l=t.find(".phase-saving-throws .phase-heading");l.text(l.text().replace(he,""))}let o=t.find(".phase-attack .token-info .token-name"),a=e.getFlag("wire","activation.attack.targetActorUuid");if(o.length&&a)try{let i=fromUuidSync(a)?.actor;i&&!i.hasPlayerOwner&&!m(i)&&o.text(d(i))}catch(i){console.error(i)}let c=t.find(".phase-saving-throws .saving-throw-target:has(.target-name)"),s=e.getFlag("wire","activation.targetUuids");if(c.length&&s?.length)try{for(let i of s){let l=fromUuidSync(i)?.actor;l&&!l.hasPlayerOwner&&!m(l)&&c.filter(`[data-actor-id="${i}"]`).find(".target-name").text(d(l))}}catch(i){console.error(i)}}r(ne,"wireParseChat");var D=L(),H=L(),N=L();function re(){switch(game.system.id){case"pf2e":D.add(Z),H.add(ee),N.add(te);break;case"dnd5e":N.add(Q);break}game.modules.get("wire")?.active&&N.add(ne)}r(re,"thirdPartyInitialization");function L(){let e=[],n=r(function(...t){e.forEach(o=>o(...t))},"f");return n.add=t=>e.push(t),n}r(L,"createThirdPartyListener");function oe(e,n){if(e.blind)return;let t=game.user.isGM,o=e.speaker,a=ChatMessage.getSpeakerActor(o),c=!a||m(a),s=!!a&&!a.hasPlayerOwner;if(a&&!c&&ye(e,a,n),!t&&s){if(e.rolls.length&&f("rolls")){let i=n.find(".message-content .dice-roll .dice-result");i.find(".dice-formula, .dice-tooltip").remove(),f("criticals")&&i.find(".dice-total").removeClass("critical fumble")}f("footer")&&n.find(".message-content footer.card-footer").remove(),f("cardContent")&&n.find(".message-content .card-content").remove()}N({message:e,actor:a,$html:n,playersCanSee:c,isAnonymous:s})}r(oe,"renderChatMessage");function ye(e,n,t){let o=e.speaker,a=new Set;if(o.alias&&a.add(o.alias),n.name&&a.add(n.name),o.token&&o.scene){let T=game.scenes.get(o.scene)?.tokens.get(o.token);T?.name&&a.add(T.name)}if(!a.size)return;let s=Array.from(a).map(w=>RegExp.escape(w)).join("|"),i=new RegExp(`\\b(${s})\\b`,"gmi"),l=d(n),k=game.user.isGM?`$1`:l;S(t,i,k)}r(ye,"changeNames");function ae(e,n){let t=ui.combat.viewed?.combatants;!t||!t.size||n.find("#combat-tracker .combatant").each(function(){let o=this.dataset.combatantId,a=t.get(o);if(!a||!a.actor||a.actor.hasPlayerOwner)return;let c=m(a);if(game.user.isGM){let s=this.querySelector(".combatant-controls"),i=s.querySelector('.combatant-control[data-control="toggleHidden"]'),l=ke(c);l.addEventListener("click",k=>Se(k,a)),i?i.after(l):s.appendChild(l)}else if(!c){let s=this.querySelector("h4");s.textContent=d(a)}})}r(ae,"renderCombatTracker");function Se(e,n){e.preventDefault(),e.stopPropagation(),e.shiftKey&&n.actor&&n.actor.isToken&&game.combat?.scene?U(n).forEach(y):y(n)}r(Se,"toggleCombatantName");function ke(e){let n=document.createElement("template"),t=e?"context.hide":"context.show";return n.innerHTML=``,n.content.firstChild}r(se,"createToggle");function K(e,n){let t=ui.combat.viewed?.combatants;!t||!t.size||n.find("#combat-tracker .combatant").each(function(){let o=this.dataset.combatantId,a=t.get(o);if(!a||!a.actor||a.actor.hasPlayerOwner)return;let c=f(a);if(game.user.isGM){let s=this.querySelector(".combatant-controls"),i=s.querySelector('.combatant-control[data-control="toggleHidden"]'),l=le(c);l.addEventListener("click",x=>ce(x,a)),i?i.after(l):s.appendChild(l)}else if(!c){let s=this.querySelector("h4");s.textContent=d(a)}})}r(K,"renderCombatTracker");function ce(e,n){e.preventDefault(),e.stopPropagation(),e.shiftKey&&n.actor&&n.actor.isToken&&game.combat?.scene?G(n).forEach(y):y(n)}r(ce,"toggleCombatantName");function le(e){let n=document.createElement("template"),t=e?"context.hide":"context.show";return n.innerHTML=` -`,n.content.firstChild}r(ke,"createToggle");Hooks.once("init",()=>{h({name:"version",type:String,default:""}),h({name:"names",type:Object,default:{},onChange:b}),h({name:"token",type:Boolean,default:!0,config:!0}),h({name:"rolls",type:Boolean,default:!0,config:!0}),h({name:"criticals",type:Boolean,default:!0,config:!0}),h({name:"cardContent",type:Boolean,default:!1,config:!0}),h({name:"footer",type:Boolean,default:!1,config:!0}),j({name:"namesMenu",type:x}),O().api={playersSeeName:m,toggleSeeName:y,getName:d};let e=I();e&&(Hooks.on("getActorDirectoryEntryContext",X),Hooks.on("renderTokenHUD",W)),re(),D(e)});Hooks.once("ready",()=>{H(game.user.isGM)});Hooks.on("renderCombatTracker",ae);Hooks.on("renderChatMessage",oe);Hooks.on("preCreateToken",B);Hooks.on("updateActor",J);})(); +`,n.content.firstChild}r(le,"createToggle");Hooks.once("init",()=>{h({name:"version",type:String,default:""}),h({name:"names",type:Object,default:{},onChange:N}),h({name:"token",type:Boolean,default:!0,config:!0}),h({name:"rolls",type:Boolean,default:!0,config:!0}),h({name:"criticals",type:Boolean,default:!0,config:!0}),h({name:"cardContent",type:Boolean,default:!1,config:!0}),h({name:"footer",type:Boolean,default:!1,config:!0}),j({name:"namesMenu",type:b}),C().api={playersSeeName:f,toggleSeeName:y,getName:d};let e=U();e&&(Hooks.on("getActorDirectoryEntryContext",_),Hooks.on("renderTokenHUD",Z)),Q(),A(e)});Hooks.once("ready",()=>{z(game.user.isGM)});Hooks.on("renderCombatTracker",K);Hooks.on("renderChatMessage",Y);Hooks.on("updateActor",B);})(); //# sourceMappingURL=main.js.map diff --git a/scripts/main.js.map b/scripts/main.js.map index a510557..5ab55b2 100644 --- a/scripts/main.js.map +++ b/scripts/main.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../src/module.js", "../src/token.js", "../src/api.js", "../src/actor.js", "../src/apps/names.js", "../src/third/dnd5e.js", "../src/third/pf2e.js", "../src/third/wire.js", "../src/third.js", "../src/chat.js", "../src/tracker.js", "../src/main.js"], - "sourcesContent": ["export const MODULE_ID = 'anonymous'\r\n\r\nexport function templatePath(...path) {\r\n path = path.filter(x => typeof x === 'string')\r\n return `modules/${MODULE_ID}/templates/${path.join('/')}`\r\n}\r\n\r\nexport function isGM() {\r\n const data = game.data\r\n const user = data.users.find(x => x._id === data.userId)\r\n return !!user && user.role >= CONST.USER_ROLES.GAMEMASTER\r\n}\r\n\r\nexport function getFlag(doc, key, fallback) {\r\n return doc.getFlag(MODULE_ID, key) ?? fallback\r\n}\r\n\r\nexport function setFlag(doc, key, value) {\r\n return doc.setFlag(MODULE_ID, key, value)\r\n}\r\n\r\nexport function localize(...args) {\r\n let [key, data] = args\r\n key = `${MODULE_ID}.${key}`\r\n if (data) return game.i18n.format(key, data)\r\n return game.i18n.localize(key)\r\n}\r\n\r\nexport function subLocalize(subKey) {\r\n const fn = (...args) => localize(`${subKey}.${args[0]}`, args[1])\r\n\r\n Object.defineProperties(fn, {\r\n warn: {\r\n value: (...args) => warn(`${subKey}.${args[0]}`, args[1], args[2]),\r\n enumerable: false,\r\n configurable: false,\r\n },\r\n info: {\r\n value: (...args) => info(`${subKey}.${args[0]}`, args[1], args[2]),\r\n enumerable: false,\r\n configurable: false,\r\n },\r\n error: {\r\n value: (...args) => error(`${subKey}.${args[0]}`, args[1], args[2]),\r\n enumerable: false,\r\n configurable: false,\r\n },\r\n has: {\r\n value: key => hasLocalization(`${subKey}.${key}`),\r\n enumerable: false,\r\n configurable: false,\r\n },\r\n path: {\r\n value: key => localizePath(`${subKey}.${key}`),\r\n enumerable: false,\r\n configurable: false,\r\n },\r\n template: {\r\n value: (key, { hash }) => fn(key, hash),\r\n enumerable: false,\r\n configurable: false,\r\n },\r\n })\r\n\r\n return fn\r\n}\r\n\r\nexport function getSameCombatants(combatant) {\r\n return combatant.combat.turns.filter(x => x.actorId === combatant.actorId)\r\n}\r\n\r\nexport function getSetting(key) {\r\n return game.settings.get(MODULE_ID, key)\r\n}\r\n\r\nexport function setSetting(key, value) {\r\n return game.settings.set(MODULE_ID, key, value)\r\n}\r\n\r\nexport function getActorSceneTokens(scene, actor, linkedOnly = false) {\r\n return scene.tokens.filter(token => token.actorId === actor.id && (!linkedOnly || token.actorLink))\r\n}\r\n\r\nexport function getActorTokens(actor, linkedOnly = false) {\r\n return game.scenes.map(scene => getActorSceneTokens(scene, actor, linkedOnly)).flat()\r\n}\r\n\r\nexport function capitalize(str) {\r\n if (!str) return ''\r\n return str[0].toUpperCase() + str.slice(1)\r\n}\r\n\r\nexport function registerSetting(options) {\r\n const name = options.name\r\n options.scope = options.scope ?? 'world'\r\n options.config = options.config ?? false\r\n if (options.config) {\r\n options.name = getSettingLocalizationPath(name, 'name')\r\n options.hint = getSettingLocalizationPath(name, 'hint')\r\n }\r\n if (Array.isArray(options.choices)) {\r\n options.choices = options.choices.reduce((choices, choice) => {\r\n choices[choice] = getSettingLocalizationPath(name, 'choices', choice)\r\n return choices\r\n }, {})\r\n }\r\n game.settings.register(MODULE_ID, name, options)\r\n}\r\n\r\nexport function registerSettingMenu(options) {\r\n const name = options.name\r\n options.name = getSettingLocalizationPath('menus', name, 'name')\r\n options.label = getSettingLocalizationPath('menus', name, 'label')\r\n options.hint = getSettingLocalizationPath('menus', name, 'hint')\r\n options.restricted = options.restricted ?? true\r\n options.icon = options.icon ?? 'fas fa-cogs'\r\n game.settings.registerMenu(MODULE_ID, name, options)\r\n}\r\n\r\nexport function getSettingLocalizationPath(...path) {\r\n return `${MODULE_ID}.settings.${path.join('.')}`\r\n}\r\n\r\nexport function getCurrentModule() {\r\n return game.modules.get(MODULE_ID)\r\n}\r\n\r\nfunction notify(str, arg1, arg2, arg3) {\r\n const type = typeof arg1 === 'string' ? arg1 : 'info'\r\n const data = typeof arg1 === 'object' ? arg1 : typeof arg2 === 'object' ? arg2 : undefined\r\n const permanent = typeof arg1 === 'boolean' ? arg1 : typeof arg2 === 'boolean' ? arg2 : arg3 ?? false\r\n\r\n ui.notifications.notify(localize(str, data), type, { permanent })\r\n}\r\n\r\nexport function warn(...args) {\r\n const [str, arg1, arg2] = args\r\n notify(str, 'warning', arg1, arg2)\r\n}\r\n\r\nexport function info(...args) {\r\n const [str, arg1, arg2] = args\r\n notify(str, 'info', arg1, arg2)\r\n}\r\n\r\nexport function error(...args) {\r\n const [str, arg1, arg2] = args\r\n notify(str, 'error', arg1, arg2)\r\n}\r\n\r\nexport function replaceHTMLText(html, regexp, replacement, addSelf = false) {\r\n let nodes = html.find('*')\r\n if (addSelf) nodes = nodes.addBack()\r\n nodes.contents().each((_, el) => {\r\n if (el.nodeType === Node.TEXT_NODE && el.textContent?.trim()) {\r\n $(el).replaceWith(el.textContent.replace(regexp, replacement))\r\n }\r\n })\r\n}\r\n", "import { playersSeeName, toggleSeeName } from './api'\r\nimport { getActorTokens, getSetting, localize } from './module'\r\n\r\nexport function updateActorTokens(actor, showName) {\r\n if (actor.token) changeDisplayName(actor.token, showName)\r\n else getActorTokens(actor, true).forEach(x => changeDisplayName(x, showName))\r\n}\r\n\r\nexport function renderTokenHUD(hud, html) {\r\n const actor = hud.object.actor\r\n if (!actor || actor.hasPlayerOwner) return\r\n\r\n const toggle = createToggle(actor)\r\n toggle.addEventListener('click', () => toggleSeeName(actor))\r\n html.find('.col.right').append(toggle)\r\n}\r\n\r\nexport function preCreateToken(token) {\r\n if (token.actor?.hasPlayerOwner) return\r\n const displayName = token.displayName\r\n const swap = swapToHide(displayName)\r\n if (swap !== displayName) token._source.displayName = swap\r\n}\r\n\r\nfunction createToggle(actor) {\r\n const tmp = document.createElement('template')\r\n const toggled = playersSeeName(actor)\r\n\r\n tmp.innerHTML = `
\r\n \r\n
`\r\n\r\n return tmp.content.firstChild\r\n}\r\n\r\nfunction changeDisplayName(token, showName) {\r\n if (showName) showTokenName(token)\r\n else hideTokenName(token)\r\n}\r\n\r\nfunction showTokenName(token) {\r\n const displayName = token.displayName\r\n if (isShowing(displayName) || !getSetting('token')) return\r\n\r\n let swap = displayName\r\n if (swap === CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER) swap = CONST.TOKEN_DISPLAY_MODES.HOVER\r\n else if (swap === CONST.TOKEN_DISPLAY_MODES.OWNER) swap = CONST.TOKEN_DISPLAY_MODES.ALWAYS\r\n\r\n token.update({ displayName: swap })\r\n}\r\n\r\nfunction hideTokenName(token) {\r\n const displayName = token.displayName\r\n if (isHidding(displayName)) return\r\n const swap = swapToHide(displayName)\r\n token.update({ displayName: swap })\r\n}\r\n\r\nfunction isHidding(displayName) {\r\n return !isShowing(displayName)\r\n}\r\n\r\nfunction isShowing(displayName) {\r\n return displayName === CONST.TOKEN_DISPLAY_MODES.HOVER || displayName === CONST.TOKEN_DISPLAY_MODES.ALWAYS\r\n}\r\n\r\nfunction swapToHide(displayName) {\r\n if (displayName === CONST.TOKEN_DISPLAY_MODES.HOVER) return CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER\r\n if (displayName === CONST.TOKEN_DISPLAY_MODES.ALWAYS) return CONST.TOKEN_DISPLAY_MODES.OWNER\r\n return displayName\r\n}\r\n", "import { capitalize, getFlag, getSetting, localize, setFlag } from './module'\r\nimport { updateActorTokens } from './token'\r\n\r\nexport function playersSeeName(doc) {\r\n if (doc instanceof Combatant && doc.actor) doc = doc.actor\r\n if (doc instanceof Actor && doc.hasPlayerOwner) return true\r\n return !!getFlag(doc, 'showName')\r\n}\r\n\r\nexport async function toggleSeeName(doc) {\r\n const showName = !playersSeeName(doc)\r\n\r\n if (doc instanceof Actor || !doc.actor) await setFlag(doc, 'showName', showName)\r\n else await setFlag(doc.actor, 'showName', showName)\r\n\r\n if (canvas.tokens.hud?.rendered) canvas.tokens.hud.render()\r\n\r\n const actor = doc instanceof Actor ? doc : doc.actor\r\n if (actor) updateActorTokens(actor, showName)\r\n\r\n return showName\r\n}\r\n\r\nexport function getName(doc) {\r\n const unknown = localize('unknown')\r\n const type = doc instanceof Actor ? doc.type : doc.actor?.type\r\n if (!type) return unknown\r\n\r\n const saved = (getSavedNames()[type] ?? '').trim()\r\n return saved || formatUnknown(unknown, type)\r\n}\r\n\r\nexport function refresh() {\r\n ui.combat.render()\r\n}\r\n\r\nexport function getSavedNames() {\r\n return getSetting('names')\r\n}\r\n\r\nexport function formatUnknown(unknown, type) {\r\n return `${unknown} ${capitalize(type)}`\r\n}\r\n", "import { playersSeeName, refresh, toggleSeeName } from './api'\r\nimport { MODULE_ID, localize } from './module'\r\nimport { updateActorTokens } from './token'\r\n\r\nexport function getActorDirectoryEntryContext(html, entries) {\r\n addSelectContextEntry({\r\n entries,\r\n defaultData: {\r\n name: choice => localize(`context.${choice}`),\r\n icon: 'fa-solid fa-signature',\r\n callback: $li => {\r\n const id = $li.attr('data-document-id')\r\n const actor = game.actors.get(id)\r\n if (actor) toggleSeeName(actor)\r\n },\r\n condition: ($li, choice) => {\r\n const id = $li.attr('data-document-id')\r\n const actor = game.actors.get(id)\r\n return !!actor && !actor.hasPlayerOwner && (choice === 'show' ? !playersSeeName(actor) : playersSeeName(actor))\r\n },\r\n },\r\n choices: ['show', 'hide'],\r\n })\r\n}\r\n\r\nexport function onActorUpdate(actor, data) {\r\n let needsRefresh = getProperty(data, `flags.${MODULE_ID}.showName}`) !== undefined\r\n\r\n if ('ownership' in data) {\r\n updateActorTokens(actor, actor.hasPlayerOwner)\r\n needsRefresh = true\r\n }\r\n\r\n if (needsRefresh) refresh()\r\n}\r\n\r\nfunction addSelectContextEntry({ entries, choices, defaultData = {} }) {\r\n if (Array.isArray(choices)) {\r\n choices = choices.reduce((acc, curr) => {\r\n acc[curr] = {}\r\n return acc\r\n }, {})\r\n }\r\n\r\n for (const key in choices) {\r\n const choice = choices[key]\r\n const name = choice.name ?? (typeof defaultData.name === 'function' ? defaultData.name(key) : defaultData.name) ?? ''\r\n\r\n let icon = choice.icon ?? (typeof defaultData.icon === 'function' ? defaultData.icon(key) : defaultData.icon) ?? ''\r\n if (!$(icon).length) {\r\n const $icon = $('')\r\n $icon.addClass(icon)\r\n icon = $icon[0].outerHTML\r\n }\r\n\r\n entries.unshift({\r\n name,\r\n icon,\r\n callback: $li => {\r\n if (choice.callback) choice.callback($li)\r\n else if (defaultData.callback) defaultData.callback($li, key)\r\n },\r\n condition: $li => choice.condition?.($li) ?? defaultData.condition?.($li, key) ?? true,\r\n })\r\n }\r\n}\r\n", "import { formatUnknown, getSavedNames } from '../api'\r\nimport { localize, setSetting, subLocalize, templatePath } from '../module'\r\n\r\nexport class AnonymousNamesMenu extends FormApplication {\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'anonymous-names-menu',\r\n title: localize('templates.names.title'),\r\n template: templatePath('names.html'),\r\n width: 400,\r\n })\r\n }\r\n\r\n getData(options) {\r\n const unknown = localize('unknown')\r\n const saved = getSavedNames()\r\n const types = game.system.documentTypes.Actor.map(x => ({\r\n type: x,\r\n value: (saved[x] ?? '').trim(),\r\n placeholder: formatUnknown(unknown, x),\r\n }))\r\n return {\r\n ...super.getData(options),\r\n types,\r\n i18n: subLocalize('templates.names'),\r\n }\r\n }\r\n\r\n activateListeners(html) {\r\n super.activateListeners(html)\r\n html.find('[data-action=cancel]').on('click', () => this.close())\r\n }\r\n\r\n async _updateObject(event, formData) {\r\n setSetting('names', formData)\r\n }\r\n}\r\n", "import { getSetting, replaceHTMLText } from '../module'\r\n\r\nexport function dnd5ParseChat({ message, $html, isAnonymous, actor }) {\r\n if (!isAnonymous) return\r\n\r\n if (message.rolls.length && getSetting('criticals')) {\r\n const critical = game.i18n.localize('DND5E.CriticalHit')\r\n const powerful = game.i18n.localize('DND5E.PowerfulCritical')\r\n const regexp = new RegExp(` (\\\\(([\\\\w ]*)?(?:${critical}|${powerful})([\\\\w ]*)?\\\\))$`, 'igm')\r\n const $flavor = $html.find('header .flavor-text')\r\n if (game.user.isGM) replaceHTMLText($flavor, regexp, ' $1', true)\r\n replaceHTMLText($flavor, regexp, '', true)\r\n }\r\n}\r\n", "import { getName, playersSeeName } from '../api'\r\nimport {\r\n getCurrentModule,\r\n getSetting,\r\n getSettingLocalizationPath,\r\n localize,\r\n registerSetting,\r\n replaceHTMLText,\r\n warn,\r\n} from '../module'\r\n\r\nexport function pf2eInitHook(isGM) {\r\n registerSetting({\r\n name: 'pf2e.traits',\r\n type: String,\r\n default: 'never',\r\n config: true,\r\n choices: {\r\n never: getSettingLocalizationPath('pf2e.traits.choices.never'),\r\n rolls: getSettingLocalizationPath('pf2e.traits.choices.rolls'),\r\n always: getSettingLocalizationPath('pf2e.traits.choices.always'),\r\n },\r\n })\r\n}\r\n\r\nexport function pf2eReadyHook(isGM) {\r\n if (isGM) disableSettings()\r\n}\r\n\r\nfunction disableSettings() {\r\n let key = ''\r\n if (game.settings.settings.has('pf2e.metagame.tokenSetsNameVisibility')) key = 'metagame.tokenSetsNameVisibility'\r\n else if (game.settings.settings.has('pf2e.metagame_tokenSetsNameVisibility')) key = 'metagame_tokenSetsNameVisibility'\r\n if (!key || !game.settings.get('pf2e', key)) return\r\n\r\n const module = getCurrentModule().title\r\n const setting = game.i18n.localize('PF2E.SETTINGS.Metagame.TokenSetsNameVisibility.Name')\r\n\r\n game.settings.set('pf2e', key, false)\r\n warn('pf2e.disabled', { module, setting }, true)\r\n}\r\n\r\nexport function pf2eParseChat({ message, isAnonymous, $html }) {\r\n const isGM = game.user.isGM\r\n const target = message.target?.actor\r\n const criticals = getSetting('criticals')\r\n const rolls = getSetting('rolls')\r\n\r\n if (target && !target.hasPlayerOwner && !playersSeeName(target)) {\r\n const $targets = $html.find('.flavor-text .target-dc [data-whose=\"target\"]')\r\n if ($targets.length) {\r\n const $target = $targets.first()\r\n if (isGM) $target.attr('data-visibility', 'gm')\r\n else $target.text(localize('pf2e.target', { name: getName(target) }))\r\n }\r\n }\r\n\r\n if (!isGM && isAnonymous) {\r\n const traits = getSetting('pf2e.traits')\r\n\r\n if (message.rolls.length) {\r\n if (rolls) {\r\n const $tags = $html.find('.flavor-text hr + .tags')\r\n\r\n if ($tags.length) {\r\n $tags.prev('hr').remove()\r\n $tags.remove()\r\n }\r\n\r\n if (criticals) {\r\n $html\r\n .find('.message-content .dice-roll .dice-result .dice-total')\r\n .css('color', 'var(--color-text-dark-primary)')\r\n }\r\n\r\n if (traits !== 'never') {\r\n $html.find('.flavor-text .tags').remove()\r\n }\r\n } else if (traits === 'always') {\r\n $html.find('.flavor-text .tags').first().remove()\r\n }\r\n } else if (traits === 'always') {\r\n $html.find('.message-content section.tags').remove()\r\n }\r\n }\r\n\r\n if (isAnonymous && message.rolls.length && rolls && criticals) {\r\n const critical = game.i18n.localize('PF2E.Check.Result.Degree.Attack.criticalSuccess')\r\n const hit = game.i18n.localize('PF2E.Check.Result.Degree.Attack.success')\r\n const regex = new RegExp(`(\\\\((${critical}|${hit})\\\\))`, 'gmi')\r\n const str = isGM ? '$1' : ''\r\n const flavor = $html.find('header .flavor-text')\r\n replaceHTMLText(flavor, regex, str, true)\r\n }\r\n}\r\n", "import { getName, playersSeeName } from '../api'\r\nimport { getSetting } from '../module'\r\n\r\nconst SAVE = /\\(dc \\d+\\)/gim\r\n\r\nexport function wireParseChat({ message, isAnonymous, $html }) {\r\n if (game.user.isGM) return\r\n\r\n if (isAnonymous) {\r\n if (getSetting('rolls')) {\r\n const $tooltips = $html.find('.dice-tooltip')\r\n $tooltips.empty()\r\n $tooltips.css('padding-top', 0)\r\n\r\n if (getSetting('criticals')) {\r\n $html.find('.dice-total').removeClass('critical fumble')\r\n }\r\n\r\n const $save = $html.find('.phase-saving-throws .phase-heading')\r\n $save.text($save.text().replace(SAVE, ''))\r\n }\r\n }\r\n\r\n // target\r\n\r\n const $target = $html.find('.phase-attack .token-info .token-name')\r\n const targetUUID = message.getFlag('wire', 'activation.attack.targetActorUuid')\r\n if ($target.length && targetUUID) {\r\n try {\r\n const target = fromUuidSync(targetUUID)?.actor\r\n if (target && !target.hasPlayerOwner && !playersSeeName(target)) {\r\n $target.text(getName(target))\r\n }\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n }\r\n\r\n const $targets = $html.find('.phase-saving-throws .saving-throw-target:has(.target-name)')\r\n const targetsUUID = message.getFlag('wire', 'activation.targetUuids')\r\n if ($targets.length && targetsUUID?.length) {\r\n try {\r\n for (const uuid of targetsUUID) {\r\n const target = fromUuidSync(uuid)?.actor\r\n if (target && !target.hasPlayerOwner && !playersSeeName(target)) {\r\n $targets.filter(`[data-actor-id=\"${uuid}\"]`).find('.target-name').text(getName(target))\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n }\r\n}\r\n", "import { dnd5ParseChat } from './third/dnd5e'\r\nimport { pf2eInitHook, pf2eParseChat, pf2eReadyHook } from './third/pf2e'\r\nimport { wireParseChat } from './third/wire'\r\n\r\nexport const thirdPartyInitHooks = createThirdPartyListener()\r\nexport const thirdPartyReadyHooks = createThirdPartyListener()\r\nexport const thirdPartyChatParse = createThirdPartyListener()\r\n\r\nexport function thirdPartyInitialization() {\r\n switch (game.system.id) {\r\n case 'pf2e':\r\n thirdPartyInitHooks.add(pf2eInitHook)\r\n thirdPartyReadyHooks.add(pf2eReadyHook)\r\n thirdPartyChatParse.add(pf2eParseChat)\r\n break\r\n case 'dnd5e':\r\n thirdPartyChatParse.add(dnd5ParseChat)\r\n break\r\n }\r\n\r\n if (game.modules.get('wire')?.active) {\r\n thirdPartyChatParse.add(wireParseChat)\r\n }\r\n}\r\n\r\nfunction createThirdPartyListener() {\r\n const a = []\r\n const f = function (...args) {\r\n a.forEach(x => x(...args))\r\n }\r\n f.add = fn => a.push(fn)\r\n return f\r\n}\r\n", "import { getName, playersSeeName } from './api'\r\nimport { getSetting, replaceHTMLText } from './module'\r\nimport { thirdPartyChatParse } from './third'\r\n\r\nexport function renderChatMessage(message, html) {\r\n if (message.blind) return\r\n\r\n const isGM = game.user.isGM\r\n const speaker = message.speaker\r\n const actor = ChatMessage.getSpeakerActor(speaker)\r\n const playersCanSee = !actor || playersSeeName(actor)\r\n const isAnonymous = !!actor && !actor.hasPlayerOwner\r\n\r\n if (actor && !playersCanSee) changeNames(message, actor, html)\r\n\r\n if (!isGM && isAnonymous) {\r\n if (message.rolls.length && getSetting('rolls')) {\r\n const $result = html.find('.message-content .dice-roll .dice-result')\r\n $result.find('.dice-formula, .dice-tooltip').remove()\r\n if (getSetting('criticals')) $result.find('.dice-total').removeClass('critical fumble')\r\n }\r\n if (getSetting('footer')) html.find('.message-content footer.card-footer').remove()\r\n if (getSetting('cardContent')) html.find('.message-content .card-content').remove()\r\n }\r\n\r\n thirdPartyChatParse({ message, actor, $html: html, playersCanSee, isAnonymous })\r\n}\r\n\r\nfunction changeNames(message, actor, html) {\r\n const speaker = message.speaker\r\n const names = new Set()\r\n\r\n if (speaker.alias) names.add(speaker.alias)\r\n if (actor.name) names.add(actor.name)\r\n\r\n if (speaker.token && speaker.scene) {\r\n const scene = game.scenes.get(speaker.scene)\r\n const token = scene?.tokens.get(speaker.token)\r\n if (token?.name) names.add(token.name)\r\n }\r\n\r\n if (!names.size) return\r\n\r\n const escaped = Array.from(names).map(x => RegExp.escape(x))\r\n const joined = escaped.join('|')\r\n const regexp = new RegExp(`\\\\b(${joined})\\\\b`, 'gmi')\r\n const renamed = getName(actor)\r\n const replacement = game.user.isGM ? `$1` : renamed\r\n\r\n replaceHTMLText(html, regexp, replacement)\r\n}\r\n", "import { getName, playersSeeName, toggleSeeName } from './api'\r\nimport { getSameCombatants, localize } from './module'\r\n\r\nexport function renderCombatTracker(tracker, html) {\r\n const combatants = ui.combat.viewed?.combatants\r\n if (!combatants || !combatants.size) return\r\n\r\n html.find('#combat-tracker .combatant').each(function () {\r\n const id = this.dataset.combatantId\r\n const combatant = combatants.get(id)\r\n if (!combatant || !combatant.actor || combatant.actor.hasPlayerOwner) return\r\n\r\n const showName = playersSeeName(combatant)\r\n\r\n if (game.user.isGM) {\r\n const controls = this.querySelector('.combatant-controls')\r\n const hidden = controls.querySelector('.combatant-control[data-control=\"toggleHidden\"]')\r\n const toggle = createToggle(showName)\r\n\r\n toggle.addEventListener('click', event => toggleCombatantName(event, combatant))\r\n\r\n if (hidden) hidden.after(toggle)\r\n else controls.appendChild(toggle)\r\n } else if (!showName) {\r\n const h4 = this.querySelector('h4')\r\n h4.textContent = getName(combatant)\r\n }\r\n })\r\n}\r\n\r\nfunction toggleCombatantName(event, combatant) {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n\r\n if (event.shiftKey && combatant.actor && combatant.actor.isToken && game.combat?.scene) {\r\n getSameCombatants(combatant).forEach(toggleSeeName)\r\n } else {\r\n toggleSeeName(combatant)\r\n }\r\n}\r\n\r\nfunction createToggle(active) {\r\n const tmp = document.createElement('template')\r\n const tooltip = active ? 'context.hide' : 'context.show'\r\n\r\n tmp.innerHTML = `\r\n \r\n`\r\n\r\n return tmp.content.firstChild\r\n}\r\n", "import { getActorDirectoryEntryContext, onActorUpdate } from './actor'\r\nimport { getName, playersSeeName, refresh, toggleSeeName } from './api'\r\nimport { AnonymousNamesMenu } from './apps/names'\r\nimport { renderChatMessage } from './chat'\r\nimport { getCurrentModule, isGM, registerSetting, registerSettingMenu } from './module'\r\nimport { thirdPartyInitHooks, thirdPartyInitialization, thirdPartyReadyHooks } from './third'\r\nimport { preCreateToken, renderTokenHUD } from './token'\r\nimport { renderCombatTracker } from './tracker'\r\n\r\nHooks.once('init', () => {\r\n registerSetting({\r\n name: 'version',\r\n type: String,\r\n default: '',\r\n })\r\n\r\n registerSetting({\r\n name: 'names',\r\n type: Object,\r\n default: {},\r\n onChange: refresh,\r\n })\r\n\r\n registerSetting({\r\n name: 'token',\r\n type: Boolean,\r\n default: true,\r\n config: true,\r\n })\r\n\r\n registerSetting({\r\n name: 'rolls',\r\n type: Boolean,\r\n default: true,\r\n config: true,\r\n })\r\n\r\n registerSetting({\r\n name: 'criticals',\r\n type: Boolean,\r\n default: true,\r\n config: true,\r\n })\r\n\r\n registerSetting({\r\n name: 'cardContent',\r\n type: Boolean,\r\n default: false,\r\n config: true,\r\n })\r\n\r\n registerSetting({\r\n name: 'footer',\r\n type: Boolean,\r\n default: false,\r\n config: true,\r\n })\r\n\r\n registerSettingMenu({\r\n name: 'namesMenu',\r\n type: AnonymousNamesMenu,\r\n })\r\n\r\n getCurrentModule().api = {\r\n playersSeeName,\r\n toggleSeeName,\r\n getName,\r\n }\r\n\r\n const gm = isGM()\r\n\r\n if (gm) {\r\n Hooks.on('getActorDirectoryEntryContext', getActorDirectoryEntryContext)\r\n Hooks.on('renderTokenHUD', renderTokenHUD)\r\n }\r\n\r\n thirdPartyInitialization()\r\n thirdPartyInitHooks(gm)\r\n})\r\n\r\nHooks.once('ready', () => {\r\n thirdPartyReadyHooks(game.user.isGM)\r\n})\r\n\r\nHooks.on('renderCombatTracker', renderCombatTracker)\r\nHooks.on('renderChatMessage', renderChatMessage)\r\nHooks.on('preCreateToken', preCreateToken)\r\nHooks.on('updateActor', onActorUpdate)\r\n"], - "mappings": "uFAAO,IAAMA,EAAY,YAElB,SAASC,KAAgBC,EAAM,CAClC,OAAAA,EAAOA,EAAK,OAAOC,GAAK,OAAOA,GAAM,QAAQ,EACtC,WAAWH,eAAuBE,EAAK,KAAK,GAAG,GAC1D,CAHgBE,EAAAH,EAAA,gBAKT,SAASI,GAAO,CACnB,IAAMC,EAAO,KAAK,KACZC,EAAOD,EAAK,MAAM,KAAKH,GAAKA,EAAE,MAAQG,EAAK,MAAM,EACvD,MAAO,CAAC,CAACC,GAAQA,EAAK,MAAQ,MAAM,WAAW,UACnD,CAJgBH,EAAAC,EAAA,QAMT,SAASG,EAAQC,EAAKC,EAAKC,EAAU,CACxC,OAAOF,EAAI,QAAQT,EAAWU,CAAG,GAAKC,CAC1C,CAFgBP,EAAAI,EAAA,WAIT,SAASI,EAAQH,EAAKC,EAAKG,EAAO,CACrC,OAAOJ,EAAI,QAAQT,EAAWU,EAAKG,CAAK,CAC5C,CAFgBT,EAAAQ,EAAA,WAIT,SAASE,KAAYC,EAAM,CAC9B,GAAI,CAACL,EAAKJ,CAAI,EAAIS,EAElB,OADAL,EAAM,GAAGV,KAAaU,IAClBJ,EAAa,KAAK,KAAK,OAAOI,EAAKJ,CAAI,EACpC,KAAK,KAAK,SAASI,CAAG,CACjC,CALgBN,EAAAU,EAAA,YAOT,SAASE,EAAYC,EAAQ,CAChC,IAAMC,EAAKd,EAAA,IAAIW,IAASD,EAAS,GAAGG,KAAUF,EAAK,CAAC,IAAKA,EAAK,CAAC,CAAC,EAArD,MAEX,cAAO,iBAAiBG,EAAI,CACxB,KAAM,CACF,MAAO,IAAIH,IAASI,E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,KAAM,QACN,KAAM,QACN,QAAS,GACT,OAAQ,EACZ,CAAC,EAEDA,EAAgB,CACZ,KAAM,YACN,KAAM,QACN,QAAS,GACT,OAAQ,EACZ,CAAC,EAEDA,EAAgB,CACZ,KAAM,cACN,KAAM,QACN,QAAS,GACT,OAAQ,EACZ,CAAC,EAEDA,EAAgB,CACZ,KAAM,SACN,KAAM,QACN,QAAS,GACT,OAAQ,EACZ,CAAC,EAEDE,EAAoB,CAChB,KAAM,YACN,KAAMC,CACV,CAAC,EAEDC,EAAiB,EAAE,IAAM,CACrB,eAAAC,EACA,cAAAC,EACA,QAAAC,CACJ,EAEA,IAAMC,EAAKC,EAAK,EAEZD,IACA,MAAM,GAAG,gCAAiCE,CAA6B,EACvE,MAAM,GAAG,iBAAkBC,CAAc,GAG7CC,GAAyB,EACzBC,EAAoBL,CAAE,CAC1B,CAAC,EAED,MAAM,KAAK,QAAS,IAAM,CACtBM,EAAqB,KAAK,KAAK,IAAI,CACvC,CAAC,EAED,MAAM,GAAG,sBAAuBC,EAAmB,EACnD,MAAM,GAAG,oBAAqBC,EAAiB,EAC/C,MAAM,GAAG,iBAAkBC,CAAc,EACzC,MAAM,GAAG,cAAeC,CAAa", - "names": ["MODULE_ID", "templatePath", "path", "x", "__name", "isGM", "data", "user", "getFlag", "doc", "key", "fallback", "setFlag", "value", "localize", "args", "subLocalize", "subKey", "fn", "warn", "info", "error", "hash", "getSameCombatants", "combatant", "getSetting", "setSetting", "getActorSceneTokens", "scene", "actor", "linkedOnly", "token", "getActorTokens", "capitalize", "str", "registerSetting", "options", "name", "getSettingLocalizationPath", "choices", "choice", "registerSettingMenu", "getCurrentModule", "notify", "arg1", "arg2", "arg3", "type", "permanent", "replaceHTMLText", "html", "regexp", "replacement", "addSelf", "nodes", "_", "el", "updateActorTokens", "actor", "showName", "changeDisplayName", "getActorTokens", "x", "__name", "renderTokenHUD", "hud", "html", "toggle", "createToggle", "toggleSeeName", "preCreateToken", "token", "displayName", "swap", "swapToHide", "tmp", "toggled", "playersSeeName", "localize", "showTokenName", "hideTokenName", "isShowing", "getSetting", "isHidding", "playersSeeName", "doc", "getFlag", "__name", "toggleSeeName", "showName", "setFlag", "actor", "updateActorTokens", "getName", "unknown", "localize", "type", "getSavedNames", "formatUnknown", "refresh", "getSetting", "capitalize", "getActorDirectoryEntryContext", "html", "entries", "addSelectContextEntry", "choice", "localize", "$li", "id", "actor", "toggleSeeName", "playersSeeName", "__name", "onActorUpdate", "data", "needsRefresh", "MODULE_ID", "updateActorTokens", "refresh", "choices", "defaultData", "acc", "curr", "key", "name", "icon", "$icon", "AnonymousNamesMenu", "localize", "templatePath", "options", "unknown", "saved", "getSavedNames", "types", "x", "formatUnknown", "subLocalize", "html", "event", "formData", "setSetting", "__name", "dnd5ParseChat", "message", "$html", "isAnonymous", "actor", "getSetting", "critical", "powerful", "regexp", "$flavor", "replaceHTMLText", "__name", "pf2eInitHook", "isGM", "registerSetting", "getSettingLocalizationPath", "__name", "pf2eReadyHook", "disableSettings", "key", "module", "getCurrentModule", "setting", "warn", "pf2eParseChat", "message", "isAnonymous", "$html", "target", "criticals", "getSetting", "rolls", "playersSeeName", "$targets", "$target", "localize", "getName", "traits", "$tags", "critical", "hit", "regex", "str", "flavor", "replaceHTMLText", "SAVE", "wireParseChat", "message", "isAnonymous", "$html", "getSetting", "$tooltips", "$save", "$target", "targetUUID", "target", "playersSeeName", "getName", "error", "$targets", "targetsUUID", "uuid", "__name", "thirdPartyInitHooks", "createThirdPartyListener", "thirdPartyReadyHooks", "thirdPartyChatParse", "thirdPartyInitialization", "pf2eInitHook", "pf2eReadyHook", "pf2eParseChat", "dnd5ParseChat", "wireParseChat", "__name", "a", "f", "args", "x", "fn", "renderChatMessage", "message", "html", "isGM", "speaker", "actor", "playersCanSee", "playersSeeName", "isAnonymous", "changeNames", "getSetting", "$result", "thirdPartyChatParse", "__name", "names", "token", "joined", "x", "regexp", "renamed", "getName", "replacement", "replaceHTMLText", "renderCombatTracker", "tracker", "html", "combatants", "id", "combatant", "showName", "playersSeeName", "controls", "hidden", "toggle", "createToggle", "event", "toggleCombatantName", "h4", "getName", "__name", "getSameCombatants", "toggleSeeName", "active", "tmp", "tooltip", "localize", "registerSetting", "refresh", "registerSettingMenu", "AnonymousNamesMenu", "getCurrentModule", "playersSeeName", "toggleSeeName", "getName", "gm", "isGM", "getActorDirectoryEntryContext", "renderTokenHUD", "thirdPartyInitialization", "thirdPartyInitHooks", "thirdPartyReadyHooks", "renderCombatTracker", "renderChatMessage", "preCreateToken", "onActorUpdate"] + "sources": ["../src/module.js", "../src/api.js", "../src/actor.js", "../src/apps/names.js", "../src/third/dnd5e.js", "../src/third/pf2e.js", "../src/third/wire.js", "../src/third.js", "../src/chat.js", "../src/token.js", "../src/tracker.js", "../src/main.js"], + "sourcesContent": ["export const MODULE_ID = 'anonymous'\n\nexport function templatePath(...path) {\n path = path.filter(x => typeof x === 'string')\n return `modules/${MODULE_ID}/templates/${path.join('/')}`\n}\n\nexport function isGM() {\n const data = game.data\n const user = data.users.find(x => x._id === data.userId)\n return !!user && user.role >= CONST.USER_ROLES.GAMEMASTER\n}\n\nexport function getFlag(doc, key, fallback) {\n return doc.getFlag(MODULE_ID, key) ?? fallback\n}\n\nexport function setFlag(doc, key, value) {\n return doc.setFlag(MODULE_ID, key, value)\n}\n\nexport function localize(...args) {\n let [key, data] = args\n key = `${MODULE_ID}.${key}`\n if (data) return game.i18n.format(key, data)\n return game.i18n.localize(key)\n}\n\nexport function subLocalize(subKey) {\n const fn = (...args) => localize(`${subKey}.${args[0]}`, args[1])\n\n Object.defineProperties(fn, {\n warn: {\n value: (...args) => warn(`${subKey}.${args[0]}`, args[1], args[2]),\n enumerable: false,\n configurable: false,\n },\n info: {\n value: (...args) => info(`${subKey}.${args[0]}`, args[1], args[2]),\n enumerable: false,\n configurable: false,\n },\n error: {\n value: (...args) => error(`${subKey}.${args[0]}`, args[1], args[2]),\n enumerable: false,\n configurable: false,\n },\n has: {\n value: key => hasLocalization(`${subKey}.${key}`),\n enumerable: false,\n configurable: false,\n },\n path: {\n value: key => localizePath(`${subKey}.${key}`),\n enumerable: false,\n configurable: false,\n },\n template: {\n value: (key, { hash }) => fn(key, hash),\n enumerable: false,\n configurable: false,\n },\n })\n\n return fn\n}\n\nexport function getSameCombatants(combatant) {\n return combatant.combat.turns.filter(x => x.actorId === combatant.actorId)\n}\n\nexport function getSetting(key) {\n return game.settings.get(MODULE_ID, key)\n}\n\nexport function setSetting(key, value) {\n return game.settings.set(MODULE_ID, key, value)\n}\n\nexport function getActorSceneTokens(scene, actor, linkedOnly = false) {\n return scene.tokens.filter(token => token.actorId === actor.id && (!linkedOnly || token.actorLink))\n}\n\nexport function getActorTokens(actor, linkedOnly = false) {\n return game.scenes.map(scene => getActorSceneTokens(scene, actor, linkedOnly)).flat()\n}\n\nexport function capitalize(str) {\n if (!str) return ''\n return str[0].toUpperCase() + str.slice(1)\n}\n\nexport function registerSetting(options) {\n const name = options.name\n options.scope = options.scope ?? 'world'\n options.config = options.config ?? false\n if (options.config) {\n options.name = getSettingLocalizationPath(name, 'name')\n options.hint = getSettingLocalizationPath(name, 'hint')\n }\n if (Array.isArray(options.choices)) {\n options.choices = options.choices.reduce((choices, choice) => {\n choices[choice] = getSettingLocalizationPath(name, 'choices', choice)\n return choices\n }, {})\n }\n game.settings.register(MODULE_ID, name, options)\n}\n\nexport function registerSettingMenu(options) {\n const name = options.name\n options.name = getSettingLocalizationPath('menus', name, 'name')\n options.label = getSettingLocalizationPath('menus', name, 'label')\n options.hint = getSettingLocalizationPath('menus', name, 'hint')\n options.restricted = options.restricted ?? true\n options.icon = options.icon ?? 'fas fa-cogs'\n game.settings.registerMenu(MODULE_ID, name, options)\n}\n\nexport function getSettingLocalizationPath(...path) {\n return `${MODULE_ID}.settings.${path.join('.')}`\n}\n\nexport function getCurrentModule() {\n return game.modules.get(MODULE_ID)\n}\n\nfunction notify(str, arg1, arg2, arg3) {\n const type = typeof arg1 === 'string' ? arg1 : 'info'\n const data = typeof arg1 === 'object' ? arg1 : typeof arg2 === 'object' ? arg2 : undefined\n const permanent = typeof arg1 === 'boolean' ? arg1 : typeof arg2 === 'boolean' ? arg2 : arg3 ?? false\n\n ui.notifications.notify(localize(str, data), type, { permanent })\n}\n\nexport function warn(...args) {\n const [str, arg1, arg2] = args\n notify(str, 'warning', arg1, arg2)\n}\n\nexport function info(...args) {\n const [str, arg1, arg2] = args\n notify(str, 'info', arg1, arg2)\n}\n\nexport function error(...args) {\n const [str, arg1, arg2] = args\n notify(str, 'error', arg1, arg2)\n}\n\nexport function replaceHTMLText(html, regexp, replacement, addSelf = false) {\n let nodes = html.find('*')\n if (addSelf) nodes = nodes.addBack()\n nodes.contents().each((_, el) => {\n if (el.nodeType === Node.TEXT_NODE && el.textContent?.trim()) {\n $(el).replaceWith(el.textContent.replace(regexp, replacement))\n }\n })\n}\n", "import { capitalize, getFlag, getSetting, localize, setFlag } from './module'\n\nexport function playersSeeName(doc) {\n if (doc instanceof Combatant && doc.actor) doc = doc.actor\n if (doc instanceof Actor && doc.hasPlayerOwner) return true\n return !!getFlag(doc, 'showName')\n}\n\nexport async function toggleSeeName(doc) {\n const showName = !playersSeeName(doc)\n\n if (doc instanceof Actor || !doc.actor) await setFlag(doc, 'showName', showName)\n else await setFlag(doc.actor, 'showName', showName)\n\n if (canvas.tokens.hud?.rendered) canvas.tokens.hud.render()\n\n const actor = doc instanceof Actor ? doc : doc.actor\n\n return showName\n}\n\nexport function getName(doc) {\n const unknown = localize('unknown')\n const type = doc instanceof Actor ? doc.type : doc.actor?.type\n if (!type) return unknown\n\n const saved = (getSavedNames()[type] ?? '').trim()\n return saved || formatUnknown(unknown, type)\n}\n\nexport function refresh() {\n ui.combat.render()\n}\n\nexport function getSavedNames() {\n return getSetting('names')\n}\n\nexport function formatUnknown(unknown, type) {\n return `${unknown} ${capitalize(type)}`\n}\n", "import { playersSeeName, refresh, toggleSeeName } from './api'\nimport { MODULE_ID, localize } from './module'\n\nexport function getActorDirectoryEntryContext(html, entries) {\n addSelectContextEntry({\n entries,\n defaultData: {\n name: choice => localize(`context.${choice}`),\n icon: 'fa-solid fa-signature',\n callback: $li => {\n const id = $li.attr('data-document-id')\n const actor = game.actors.get(id)\n if (actor) toggleSeeName(actor)\n },\n condition: ($li, choice) => {\n const id = $li.attr('data-document-id')\n const actor = game.actors.get(id)\n return !!actor && !actor.hasPlayerOwner && (choice === 'show' ? !playersSeeName(actor) : playersSeeName(actor))\n },\n },\n choices: ['show', 'hide'],\n })\n}\n\nexport function onActorUpdate(actor, data) {\n let needsRefresh = getProperty(data, `flags.${MODULE_ID}.showName}`) !== undefined\n\n if ('ownership' in data) {\n needsRefresh = true\n }\n\n if (needsRefresh) refresh()\n}\n\nfunction addSelectContextEntry({ entries, choices, defaultData = {} }) {\n if (Array.isArray(choices)) {\n choices = choices.reduce((acc, curr) => {\n acc[curr] = {}\n return acc\n }, {})\n }\n\n for (const key in choices) {\n const choice = choices[key]\n const name = choice.name ?? (typeof defaultData.name === 'function' ? defaultData.name(key) : defaultData.name) ?? ''\n\n let icon = choice.icon ?? (typeof defaultData.icon === 'function' ? defaultData.icon(key) : defaultData.icon) ?? ''\n if (!$(icon).length) {\n const $icon = $('')\n $icon.addClass(icon)\n icon = $icon[0].outerHTML\n }\n\n entries.unshift({\n name,\n icon,\n callback: $li => {\n if (choice.callback) choice.callback($li)\n else if (defaultData.callback) defaultData.callback($li, key)\n },\n condition: $li => choice.condition?.($li) ?? defaultData.condition?.($li, key) ?? true,\n })\n }\n}\n", "import { formatUnknown, getSavedNames } from '../api'\nimport { localize, setSetting, subLocalize, templatePath } from '../module'\n\nexport class AnonymousNamesMenu extends FormApplication {\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: 'anonymous-names-menu',\n title: localize('templates.names.title'),\n template: templatePath('names.html'),\n width: 400,\n })\n }\n\n getData(options) {\n const unknown = localize('unknown')\n const saved = getSavedNames()\n const types = game.system.documentTypes.Actor.map(x => ({\n type: x,\n value: (saved[x] ?? '').trim(),\n placeholder: formatUnknown(unknown, x),\n }))\n return {\n ...super.getData(options),\n types,\n i18n: subLocalize('templates.names'),\n }\n }\n\n activateListeners(html) {\n super.activateListeners(html)\n html.find('[data-action=cancel]').on('click', () => this.close())\n }\n\n async _updateObject(event, formData) {\n setSetting('names', formData)\n }\n}\n", "import { getSetting, replaceHTMLText } from '../module'\n\nexport function dnd5ParseChat({ message, $html, isAnonymous, actor }) {\n if (!isAnonymous) return\n\n if (message.rolls.length && getSetting('criticals')) {\n const critical = game.i18n.localize('DND5E.CriticalHit')\n const powerful = game.i18n.localize('DND5E.PowerfulCritical')\n const regexp = new RegExp(` (\\\\(([\\\\w ]*)?(?:${critical}|${powerful})([\\\\w ]*)?\\\\))$`, 'igm')\n const $flavor = $html.find('header .flavor-text')\n if (game.user.isGM) replaceHTMLText($flavor, regexp, ' $1', true)\n replaceHTMLText($flavor, regexp, '', true)\n }\n}\n", "import { getName, playersSeeName } from '../api'\nimport {\n getCurrentModule,\n getSetting,\n getSettingLocalizationPath,\n localize,\n registerSetting,\n replaceHTMLText,\n warn,\n} from '../module'\n\nexport function pf2eInitHook(isGM) {\n registerSetting({\n name: 'pf2e.traits',\n type: String,\n default: 'never',\n config: true,\n choices: {\n never: getSettingLocalizationPath('pf2e.traits.choices.never'),\n rolls: getSettingLocalizationPath('pf2e.traits.choices.rolls'),\n always: getSettingLocalizationPath('pf2e.traits.choices.always'),\n },\n })\n}\n\nexport function pf2eReadyHook(isGM) {\n if (isGM) disableSettings()\n}\n\nfunction disableSettings() {\n let key = ''\n if (game.settings.settings.has('pf2e.metagame.tokenSetsNameVisibility')) key = 'metagame.tokenSetsNameVisibility'\n else if (game.settings.settings.has('pf2e.metagame_tokenSetsNameVisibility')) key = 'metagame_tokenSetsNameVisibility'\n if (!key || !game.settings.get('pf2e', key)) return\n\n const module = getCurrentModule().title\n const setting = game.i18n.localize('PF2E.SETTINGS.Metagame.TokenSetsNameVisibility.Name')\n\n game.settings.set('pf2e', key, false)\n warn('pf2e.disabled', { module, setting }, true)\n}\n\nexport function pf2eParseChat({ message, isAnonymous, $html }) {\n const isGM = game.user.isGM\n const target = message.target?.actor\n const criticals = getSetting('criticals')\n const rolls = getSetting('rolls')\n\n if (target && !target.hasPlayerOwner && !playersSeeName(target)) {\n const $targets = $html.find('.flavor-text .target-dc [data-whose=\"target\"]')\n if ($targets.length) {\n const $target = $targets.first()\n if (isGM) $target.attr('data-visibility', 'gm')\n else $target.text(localize('pf2e.target', { name: getName(target) }))\n }\n }\n\n if (!isGM && isAnonymous) {\n const traits = getSetting('pf2e.traits')\n\n if (message.rolls.length) {\n if (rolls) {\n const $tags = $html.find('.flavor-text hr + .tags')\n\n if ($tags.length) {\n $tags.prev('hr').remove()\n $tags.remove()\n }\n\n if (criticals) {\n $html\n .find('.message-content .dice-roll .dice-result .dice-total')\n .css('color', 'var(--color-text-dark-primary)')\n }\n\n if (traits !== 'never') {\n $html.find('.flavor-text .tags').remove()\n }\n } else if (traits === 'always') {\n $html.find('.flavor-text .tags').first().remove()\n }\n } else if (traits === 'always') {\n $html.find('.message-content section.tags').remove()\n }\n }\n\n if (isAnonymous && message.rolls.length && rolls && criticals) {\n const critical = game.i18n.localize('PF2E.Check.Result.Degree.Attack.criticalSuccess')\n const hit = game.i18n.localize('PF2E.Check.Result.Degree.Attack.success')\n const regex = new RegExp(`(\\\\((${critical}|${hit})\\\\))`, 'gmi')\n const str = isGM ? '$1' : ''\n const flavor = $html.find('header .flavor-text')\n replaceHTMLText(flavor, regex, str, true)\n }\n}\n", "import { getName, playersSeeName } from '../api'\nimport { getSetting } from '../module'\n\nconst SAVE = /\\(dc \\d+\\)/gim\n\nexport function wireParseChat({ message, isAnonymous, $html }) {\n if (game.user.isGM) return\n\n if (isAnonymous) {\n if (getSetting('rolls')) {\n const $tooltips = $html.find('.dice-tooltip')\n $tooltips.empty()\n $tooltips.css('padding-top', 0)\n\n if (getSetting('criticals')) {\n $html.find('.dice-total').removeClass('critical fumble')\n }\n\n const $save = $html.find('.phase-saving-throws .phase-heading')\n $save.text($save.text().replace(SAVE, ''))\n }\n }\n\n // target\n\n const $target = $html.find('.phase-attack .token-info .token-name')\n const targetUUID = message.getFlag('wire', 'activation.attack.targetActorUuid')\n if ($target.length && targetUUID) {\n try {\n const target = fromUuidSync(targetUUID)?.actor\n if (target && !target.hasPlayerOwner && !playersSeeName(target)) {\n $target.text(getName(target))\n }\n } catch (error) {\n console.error(error)\n }\n }\n\n const $targets = $html.find('.phase-saving-throws .saving-throw-target:has(.target-name)')\n const targetsUUID = message.getFlag('wire', 'activation.targetUuids')\n if ($targets.length && targetsUUID?.length) {\n try {\n for (const uuid of targetsUUID) {\n const target = fromUuidSync(uuid)?.actor\n if (target && !target.hasPlayerOwner && !playersSeeName(target)) {\n $targets.filter(`[data-actor-id=\"${uuid}\"]`).find('.target-name').text(getName(target))\n }\n }\n } catch (error) {\n console.error(error)\n }\n }\n}\n", "import { dnd5ParseChat } from './third/dnd5e'\nimport { pf2eInitHook, pf2eParseChat, pf2eReadyHook } from './third/pf2e'\nimport { wireParseChat } from './third/wire'\n\nexport const thirdPartyInitHooks = createThirdPartyListener()\nexport const thirdPartyReadyHooks = createThirdPartyListener()\nexport const thirdPartyChatParse = createThirdPartyListener()\n\nexport function thirdPartyInitialization() {\n switch (game.system.id) {\n case 'pf2e':\n thirdPartyInitHooks.add(pf2eInitHook)\n thirdPartyReadyHooks.add(pf2eReadyHook)\n thirdPartyChatParse.add(pf2eParseChat)\n break\n case 'dnd5e':\n thirdPartyChatParse.add(dnd5ParseChat)\n break\n }\n\n if (game.modules.get('wire')?.active) {\n thirdPartyChatParse.add(wireParseChat)\n }\n}\n\nfunction createThirdPartyListener() {\n const a = []\n const f = function (...args) {\n a.forEach(x => x(...args))\n }\n f.add = fn => a.push(fn)\n return f\n}\n", "import { getName, playersSeeName } from './api'\nimport { getSetting, replaceHTMLText } from './module'\nimport { thirdPartyChatParse } from './third'\n\nexport function renderChatMessage(message, html) {\n if (message.blind) return\n\n const isGM = game.user.isGM\n const speaker = message.speaker\n const actor = ChatMessage.getSpeakerActor(speaker)\n const playersCanSee = !actor || playersSeeName(actor)\n const isAnonymous = !!actor && !actor.hasPlayerOwner\n\n if (actor && !playersCanSee) changeNames(message, actor, html)\n\n if (!isGM && isAnonymous) {\n if (message.rolls.length && getSetting('rolls')) {\n const $result = html.find('.message-content .dice-roll .dice-result')\n $result.find('.dice-formula, .dice-tooltip').remove()\n if (getSetting('criticals')) $result.find('.dice-total').removeClass('critical fumble')\n }\n if (getSetting('footer')) html.find('.message-content footer.card-footer').remove()\n if (getSetting('cardContent')) html.find('.message-content .card-content').remove()\n }\n\n thirdPartyChatParse({ message, actor, $html: html, playersCanSee, isAnonymous })\n}\n\nfunction changeNames(message, actor, html) {\n const speaker = message.speaker\n const names = new Set()\n\n if (speaker.alias) names.add(speaker.alias)\n if (actor.name) names.add(actor.name)\n\n if (speaker.token && speaker.scene) {\n const scene = game.scenes.get(speaker.scene)\n const token = scene?.tokens.get(speaker.token)\n if (token?.name) names.add(token.name)\n }\n\n if (!names.size) return\n\n const escaped = Array.from(names).map(x => RegExp.escape(x))\n const joined = escaped.join('|')\n const regexp = new RegExp(`\\\\b(${joined})\\\\b`, 'gmi')\n const renamed = getName(actor)\n const replacement = game.user.isGM ? `$1` : renamed\n\n replaceHTMLText(html, regexp, replacement)\n}\n", "import { playersSeeName, toggleSeeName } from './api'\nimport { getActorTokens, localize } from './module'\n\nexport function renderTokenHUD(hud, html) {\n const actor = hud.object.actor\n if (!actor || actor.hasPlayerOwner) return\n\n const toggle = createToggle(actor)\n toggle.addEventListener('click', () => toggleSeeName(actor))\n html.find('.col.right').append(toggle)\n}\n\nfunction createToggle(actor) {\n const tmp = document.createElement('template')\n const toggled = playersSeeName(actor)\n\n tmp.innerHTML = `
\n \n
`\n\n return tmp.content.firstChild\n}\n", "import { getName, playersSeeName, toggleSeeName } from './api'\nimport { getSameCombatants, localize } from './module'\n\nexport function renderCombatTracker(tracker, html) {\n const combatants = ui.combat.viewed?.combatants\n if (!combatants || !combatants.size) return\n\n html.find('#combat-tracker .combatant').each(function () {\n const id = this.dataset.combatantId\n const combatant = combatants.get(id)\n if (!combatant || !combatant.actor || combatant.actor.hasPlayerOwner) return\n\n const showName = playersSeeName(combatant)\n\n if (game.user.isGM) {\n const controls = this.querySelector('.combatant-controls')\n const hidden = controls.querySelector('.combatant-control[data-control=\"toggleHidden\"]')\n const toggle = createToggle(showName)\n\n toggle.addEventListener('click', event => toggleCombatantName(event, combatant))\n\n if (hidden) hidden.after(toggle)\n else controls.appendChild(toggle)\n } else if (!showName) {\n const h4 = this.querySelector('h4')\n h4.textContent = getName(combatant)\n }\n })\n}\n\nfunction toggleCombatantName(event, combatant) {\n event.preventDefault()\n event.stopPropagation()\n\n if (event.shiftKey && combatant.actor && combatant.actor.isToken && game.combat?.scene) {\n getSameCombatants(combatant).forEach(toggleSeeName)\n } else {\n toggleSeeName(combatant)\n }\n}\n\nfunction createToggle(active) {\n const tmp = document.createElement('template')\n const tooltip = active ? 'context.hide' : 'context.show'\n\n tmp.innerHTML = `\n \n`\n\n return tmp.content.firstChild\n}\n", "import { getActorDirectoryEntryContext, onActorUpdate } from './actor'\nimport { getName, playersSeeName, refresh, toggleSeeName } from './api'\nimport { AnonymousNamesMenu } from './apps/names'\nimport { renderChatMessage } from './chat'\nimport { getCurrentModule, isGM, registerSetting, registerSettingMenu } from './module'\nimport { thirdPartyInitHooks, thirdPartyInitialization, thirdPartyReadyHooks } from './third'\nimport { renderTokenHUD } from './token'\nimport { renderCombatTracker } from './tracker'\n\nHooks.once('init', () => {\n registerSetting({\n name: 'version',\n type: String,\n default: '',\n })\n\n registerSetting({\n name: 'names',\n type: Object,\n default: {},\n onChange: refresh,\n })\n\n registerSetting({\n name: 'token',\n type: Boolean,\n default: true,\n config: true,\n })\n\n registerSetting({\n name: 'rolls',\n type: Boolean,\n default: true,\n config: true,\n })\n\n registerSetting({\n name: 'criticals',\n type: Boolean,\n default: true,\n config: true,\n })\n\n registerSetting({\n name: 'cardContent',\n type: Boolean,\n default: false,\n config: true,\n })\n\n registerSetting({\n name: 'footer',\n type: Boolean,\n default: false,\n config: true,\n })\n\n registerSettingMenu({\n name: 'namesMenu',\n type: AnonymousNamesMenu,\n })\n\n getCurrentModule().api = {\n playersSeeName,\n toggleSeeName,\n getName,\n }\n\n const gm = isGM()\n\n if (gm) {\n Hooks.on('getActorDirectoryEntryContext', getActorDirectoryEntryContext)\n Hooks.on('renderTokenHUD', renderTokenHUD)\n }\n\n thirdPartyInitialization()\n thirdPartyInitHooks(gm)\n})\n\nHooks.once('ready', () => {\n thirdPartyReadyHooks(game.user.isGM)\n})\n\nHooks.on('renderCombatTracker', renderCombatTracker)\nHooks.on('renderChatMessage', renderChatMessage)\nHooks.on('updateActor', onActorUpdate)\n"], + "mappings": "uFAAO,IAAMA,EAAY,YAElB,SAASC,KAAgBC,EAAM,CAClC,OAAAA,EAAOA,EAAK,OAAOC,GAAK,OAAOA,GAAM,QAAQ,EACtC,WAAWH,eAAuBE,EAAK,KAAK,GAAG,GAC1D,CAHgBE,EAAAH,EAAA,gBAKT,SAASI,GAAO,CACnB,IAAMC,EAAO,KAAK,KACZC,EAAOD,EAAK,MAAM,KAAKH,GAAKA,EAAE,MAAQG,EAAK,MAAM,EACvD,MAAO,CAAC,CAACC,GAAQA,EAAK,MAAQ,MAAM,WAAW,UACnD,CAJgBH,EAAAC,EAAA,QAMT,SAASG,EAAQC,EAAKC,EAAKC,EAAU,CACxC,OAAOF,EAAI,QAAQT,EAAWU,CAAG,GAAKC,CAC1C,CAFgBP,EAAAI,EAAA,WAIT,SAASI,EAAQH,EAAKC,EAAKG,EAAO,CACrC,OAAOJ,EAAI,QAAQT,EAAWU,EAAKG,CAAK,CAC5C,CAFgBT,EAAAQ,EAAA,WAIT,SAASE,KAAYC,EAAM,CAC9B,GAAI,CAACL,EAAKJ,CAAI,EAAIS,EAElB,OADAL,EAAM,GAAGV,KAAaU,IAClBJ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CAAC,EAEDE,EAAoB,CAChB,KAAM,YACN,KAAMC,CACV,CAAC,EAEDC,EAAiB,EAAE,IAAM,CACrB,eAAAC,EACA,cAAAC,EACA,QAAAC,CACJ,EAEA,IAAMC,EAAKC,EAAK,EAEZD,IACA,MAAM,GAAG,gCAAiCE,CAA6B,EACvE,MAAM,GAAG,iBAAkBC,CAAc,GAG7CC,EAAyB,EACzBC,EAAoBL,CAAE,CAC1B,CAAC,EAED,MAAM,KAAK,QAAS,IAAM,CACtBM,EAAqB,KAAK,KAAK,IAAI,CACvC,CAAC,EAED,MAAM,GAAG,sBAAuBC,CAAmB,EACnD,MAAM,GAAG,oBAAqBC,CAAiB,EAC/C,MAAM,GAAG,cAAeC,CAAa", + "names": ["MODULE_ID", "templatePath", "path", "x", "__name", "isGM", "data", "user", "getFlag", "doc", "key", "fallback", "setFlag", "value", "localize", "args", "subLocalize", "subKey", "fn", "warn", "info", "error", "hash", "getSameCombatants", "combatant", "getSetting", "setSetting", "capitalize", "str", "__name", "registerSetting", "options", "name", "getSettingLocalizationPath", "choices", "choice", "MODULE_ID", "registerSettingMenu", "path", "getCurrentModule", "notify", "arg1", "arg2", "arg3", "type", "data", "permanent", "localize", "warn", "args", "info", "error", "replaceHTMLText", "html", "regexp", "replacement", "addSelf", "nodes", "_", "el", "playersSeeName", "doc", "getFlag", "__name", "toggleSeeName", "showName", "setFlag", "actor", "getName", "unknown", "localize", "type", "getSavedNames", "formatUnknown", "refresh", "getSetting", "capitalize", "getActorDirectoryEntryContext", "html", "entries", "addSelectContextEntry", "choice", "localize", "$li", "id", "actor", "toggleSeeName", "playersSeeName", "__name", "onActorUpdate", "data", "needsRefresh", "MODULE_ID", "refresh", "choices", "defaultData", "acc", "curr", "key", "name", "icon", "$icon", "AnonymousNamesMenu", "localize", "templatePath", "options", "unknown", "saved", "getSavedNames", "types", "x", "formatUnknown", "subLocalize", "html", "event", "formData", "setSetting", "__name", "dnd5ParseChat", "message", "$html", "isAnonymous", "actor", "getSetting", "critical", "powerful", "regexp", "$flavor", "replaceHTMLText", "__name", "pf2eInitHook", "isGM", "registerSetting", "getSettingLocalizationPath", "__name", "pf2eReadyHook", "disableSettings", "key", "module", "getCurrentModule", "setting", "warn", "pf2eParseChat", "message", "isAnonymous", "$html", "target", "criticals", "getSetting", "rolls", "playersSeeName", "$targets", "$target", "localize", "getName", "traits", "$tags", "critical", "hit", "regex", "str", "flavor", "replaceHTMLText", "SAVE", "wireParseChat", "message", "isAnonymous", "$html", "getSetting", "$tooltips", "$save", "$target", "targetUUID", "target", "playersSeeName", "getName", "error", "$targets", "targetsUUID", "uuid", "__name", "thirdPartyInitHooks", "createThirdPartyListener", "thirdPartyReadyHooks", "thirdPartyChatParse", "thirdPartyInitialization", "pf2eInitHook", "pf2eReadyHook", "pf2eParseChat", "dnd5ParseChat", "wireParseChat", "__name", "a", "f", "args", "x", "fn", "renderChatMessage", "message", "html", "isGM", "speaker", "actor", "playersCanSee", "playersSeeName", "isAnonymous", "changeNames", "getSetting", "$result", "thirdPartyChatParse", "__name", "names", "token", "joined", "x", "regexp", "renamed", "getName", "replacement", "replaceHTMLText", "renderTokenHUD", "hud", "html", "actor", "toggle", "createToggle", "toggleSeeName", "__name", "tmp", "toggled", "playersSeeName", "localize", "renderCombatTracker", "tracker", "html", "combatants", "id", "combatant", "showName", "playersSeeName", "controls", "hidden", "toggle", "createToggle", "event", "toggleCombatantName", "h4", "getName", "__name", "getSameCombatants", "toggleSeeName", "active", "tmp", "tooltip", "localize", "registerSetting", "refresh", "registerSettingMenu", "AnonymousNamesMenu", "getCurrentModule", "playersSeeName", "toggleSeeName", "getName", "gm", "isGM", "getActorDirectoryEntryContext", "renderTokenHUD", "thirdPartyInitialization", "thirdPartyInitHooks", "thirdPartyReadyHooks", "renderCombatTracker", "renderChatMessage", "onActorUpdate"] } diff --git a/src/actor.js b/src/actor.js index f03efec..e0e8ff6 100644 --- a/src/actor.js +++ b/src/actor.js @@ -1,6 +1,5 @@ import { playersSeeName, refresh, toggleSeeName } from './api' import { MODULE_ID, localize } from './module' -import { updateActorTokens } from './token' export function getActorDirectoryEntryContext(html, entries) { addSelectContextEntry({ @@ -27,7 +26,6 @@ export function onActorUpdate(actor, data) { let needsRefresh = getProperty(data, `flags.${MODULE_ID}.showName}`) !== undefined if ('ownership' in data) { - updateActorTokens(actor, actor.hasPlayerOwner) needsRefresh = true } diff --git a/src/api.js b/src/api.js index 32816dd..3dedf0e 100644 --- a/src/api.js +++ b/src/api.js @@ -1,5 +1,4 @@ import { capitalize, getFlag, getSetting, localize, setFlag } from './module' -import { updateActorTokens } from './token' export function playersSeeName(doc) { if (doc instanceof Combatant && doc.actor) doc = doc.actor @@ -16,7 +15,6 @@ export async function toggleSeeName(doc) { if (canvas.tokens.hud?.rendered) canvas.tokens.hud.render() const actor = doc instanceof Actor ? doc : doc.actor - if (actor) updateActorTokens(actor, showName) return showName } diff --git a/src/main.js b/src/main.js index 76231aa..e6198e4 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import { AnonymousNamesMenu } from './apps/names' import { renderChatMessage } from './chat' import { getCurrentModule, isGM, registerSetting, registerSettingMenu } from './module' import { thirdPartyInitHooks, thirdPartyInitialization, thirdPartyReadyHooks } from './third' -import { preCreateToken, renderTokenHUD } from './token' +import { renderTokenHUD } from './token' import { renderCombatTracker } from './tracker' Hooks.once('init', () => { @@ -84,5 +84,4 @@ Hooks.once('ready', () => { Hooks.on('renderCombatTracker', renderCombatTracker) Hooks.on('renderChatMessage', renderChatMessage) -Hooks.on('preCreateToken', preCreateToken) Hooks.on('updateActor', onActorUpdate) diff --git a/src/token.js b/src/token.js index 099c5b6..98f049e 100644 --- a/src/token.js +++ b/src/token.js @@ -1,10 +1,5 @@ import { playersSeeName, toggleSeeName } from './api' -import { getActorTokens, getSetting, localize } from './module' - -export function updateActorTokens(actor, showName) { - if (actor.token) changeDisplayName(actor.token, showName) - else getActorTokens(actor, true).forEach(x => changeDisplayName(x, showName)) -} +import { getActorTokens, localize } from './module' export function renderTokenHUD(hud, html) { const actor = hud.object.actor @@ -15,13 +10,6 @@ export function renderTokenHUD(hud, html) { html.find('.col.right').append(toggle) } -export function preCreateToken(token) { - if (token.actor?.hasPlayerOwner) return - const displayName = token.displayName - const swap = swapToHide(displayName) - if (swap !== displayName) token._source.displayName = swap -} - function createToggle(actor) { const tmp = document.createElement('template') const toggled = playersSeeName(actor) @@ -32,40 +20,3 @@ function createToggle(actor) { return tmp.content.firstChild } - -function changeDisplayName(token, showName) { - if (showName) showTokenName(token) - else hideTokenName(token) -} - -function showTokenName(token) { - const displayName = token.displayName - if (isShowing(displayName) || !getSetting('token')) return - - let swap = displayName - if (swap === CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER) swap = CONST.TOKEN_DISPLAY_MODES.HOVER - else if (swap === CONST.TOKEN_DISPLAY_MODES.OWNER) swap = CONST.TOKEN_DISPLAY_MODES.ALWAYS - - token.update({ displayName: swap }) -} - -function hideTokenName(token) { - const displayName = token.displayName - if (isHidding(displayName)) return - const swap = swapToHide(displayName) - token.update({ displayName: swap }) -} - -function isHidding(displayName) { - return !isShowing(displayName) -} - -function isShowing(displayName) { - return displayName === CONST.TOKEN_DISPLAY_MODES.HOVER || displayName === CONST.TOKEN_DISPLAY_MODES.ALWAYS -} - -function swapToHide(displayName) { - if (displayName === CONST.TOKEN_DISPLAY_MODES.HOVER) return CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER - if (displayName === CONST.TOKEN_DISPLAY_MODES.ALWAYS) return CONST.TOKEN_DISPLAY_MODES.OWNER - return displayName -}