Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
version 0.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
p4535992 committed Jun 3, 2022
1 parent 5589f66 commit 23021a4
Show file tree
Hide file tree
Showing 10 changed files with 387 additions and 303 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.6.7

- Add a checr on the flags property on the updateToken
- Checker more faster when using the draw handler
- Update API and tutorial documentation little

### 0.6.6

- Bug fix (again): [[BUG] Conditional Visibility spam upon Refresh](https://github.com/p4535992/conditional-visibility/issues/38)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "conditional-visibility",
"title": "Conditional Visibility",
"description": "Hide tokens from some players, but not others, based on the senses the players have. Uses unknown, newspaper, and foggy icons made by <a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>, from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>. Moon icon made by <a href=\"https://www.flaticon.com/authors/iconixar\" title=\"iconixar\">iconixar</a> from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>",
"version": "0.6.6",
"version": "0.6.7",
"scripts": {
"package": "gulp package",
"build": "gulp build && gulp link",
Expand Down
6 changes: 3 additions & 3 deletions src/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "conditional-visibility",
"title": "Conditional Visibility",
"description": "Hide tokens from some players, but not others, based on the senses the players have. Uses unknown, newspaper, and foggy icons made by <a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>, from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>. Moon icon made by <a href=\"https://www.flaticon.com/authors/iconixar\" title=\"iconixar\">iconixar</a> from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>",
"version": "0.6.6",
"version": "0.6.7",
"author": "Greg Ludington, p4535992, Szefo09, Teshynil",
"authors": [
{ "name": "Greg Ludington" },
Expand Down Expand Up @@ -78,8 +78,8 @@
"url": "https://github.com/p4535992/conditional-visibility",
"manifest": "https://github.com/p4535992/conditional-visibility/releases/latest/download/module.json",
"download": "https://github.com/p4535992/conditional-visibility/releases/latest/download/module.zip",
"readme": "https://github.com/p4535992/conditional-visibility/blob/v0.6.6/README.md",
"changelog": "https://github.com/p4535992/conditional-visibility/blob/v0.6.6/changelog.md",
"readme": "https://github.com/p4535992/conditional-visibility/blob/v0.6.7/README.md",
"changelog": "https://github.com/p4535992/conditional-visibility/blob/v0.6.7/changelog.md",
"bugs": "https://github.com/p4535992/conditional-visibility/issues",
"allowBugReporter": true,
"dependencies": [
Expand Down
41 changes: 37 additions & 4 deletions src/module/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
AtcvEffectConditionFlags,
AtcvEffectSenseFlags,
ConditionalVisibilityFlags,
CVResultData,
CVSkillData,
SenseData,
} from './conditional-visibility-models';
Expand Down Expand Up @@ -1246,7 +1247,7 @@ const API = {
throw error('renderAutoSkillsDialogCVArr | inAttributes must be of type array');
}
const [sourceTokenId, enabledSkill, isSense, valSkillRoll] = inAttributes;
const tokens = <Token[]>canvas.tokens?.placeables;
const tokens = <Token[]>canvas.tokens?.placeables || [];
const sourceToken = <Token>tokens.find((token) => {
return isStringEquals(token.name, i18n(sourceTokenId)) || isStringEquals(token.id, sourceTokenId);
});
Expand All @@ -1257,8 +1258,40 @@ const API = {
renderAutoSkillsDialog(sourceToken, enabledSkill, isSense, valSkillRoll);
},

canSee(sourceToken: Token, targetToken: Token): boolean {
return <boolean>shouldIncludeVisionV2(sourceToken, targetToken);
canSee(sourceTokenIdOrName: string, targetTokenIdOrName: string): boolean {
const tokens = <Token[]>canvas.tokens?.placeables || [];
const sourceToken = <Token>tokens.find((token) => {
return isStringEquals(token.name, i18n(targetTokenIdOrName)) || isStringEquals(token.id, targetTokenIdOrName);
});
const targetToken = <Token>tokens.find((token) => {
return isStringEquals(token.name, i18n(sourceTokenIdOrName)) || isStringEquals(token.id, sourceTokenIdOrName);
});
if (!sourceToken) {
warn(`No token found with reference '${sourceTokenIdOrName}'`, true);
}
if (!targetToken) {
warn(`No token found with reference '${targetTokenIdOrName}'`, true);
}
const cvResultData = shouldIncludeVisionV2(sourceToken, targetToken);
return cvResultData.canSee;
},

canSeeWithData(sourceTokenIdOrName: string, targetTokenIdOrName: string): CVResultData {
const tokens = <Token[]>canvas.tokens?.placeables || [];
const sourceToken = <Token>tokens.find((token) => {
return isStringEquals(token.name, i18n(targetTokenIdOrName)) || isStringEquals(token.id, targetTokenIdOrName);
});
const targetToken = <Token>tokens.find((token) => {
return isStringEquals(token.name, i18n(sourceTokenIdOrName)) || isStringEquals(token.id, sourceTokenIdOrName);
});
if (!sourceToken) {
warn(`No token found with reference '${sourceTokenIdOrName}'`, true);
}
if (!targetToken) {
warn(`No token found with reference '${targetTokenIdOrName}'`, true);
}
const cvResultData = shouldIncludeVisionV2(sourceToken, targetToken);
return cvResultData;
},

async cleanUpToken(tokenId: string) {
Expand Down Expand Up @@ -1341,7 +1374,7 @@ const API = {
}
},

weakMap: new Map<String, boolean>(),
// weakMap: new Map<String, boolean>(),
};

export default API;
12 changes: 7 additions & 5 deletions src/module/conditional-visibility-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class AtcvEffect {
// res.visionType = isSense ? 'sense' : 'condition';
// }
// if(!res.visionIsDisabled){
// res.visionIsDisabled = Stirng(IsDisabled) === 'true' ? true : false;
// res.visionIsDisabled = String(IsDisabled) === 'true' ? true : false;
// }
if (!res.visionBlinded) {
res.visionBlinded = senseData.conditionBlinded;
Expand Down Expand Up @@ -778,8 +778,10 @@ export class VisionCapabilities {
}
}

export class CheckerDebugData {
atcvSourceEffect: AtcvEffect;
atcvTargetEffect: AtcvEffect | string;
checkerResult: boolean;
export class CVResultData {
sourceTokenId:string;
targetTokenId:string;
sourceVisionsLevels: AtcvEffect[];
targetVisionsLevels: AtcvEffect[];
canSee: boolean;
}
Loading

0 comments on commit 23021a4

Please sign in to comment.