All user data for FoundryVTT. Includes worlds, systems, modules, and any asset in the "foundryuserdata" directory. Does NOT include the FoundryVTT installation itself.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
4.8 KiB

1 year ago
  1. function drawDefault(token, fillColor, p, aw, h, hh, w, hw, ah) {
  2. token.target.beginFill(fillColor, 1.0)
  3. .lineStyle(1, 0x000000)
  4. .drawPolygon([-p, hh, -p - aw, hh - ah, -p - aw, hh + ah])
  5. .drawPolygon([w + p, hh, w + p + aw, hh - ah, w + p + aw, hh + ah])
  6. .drawPolygon([hw, -p, hw - ah, -p - aw, hw + ah, -p - aw])
  7. .drawPolygon([hw, h + p, hw - ah, h + p + aw, hw + ah, h + p + aw]);
  8. }
  9. function drawCrossHairs1(token, fillColor, p, aw, h, hh, w, hw, ah) {
  10. let borderColor = 0x000000;
  11. let rw = 10; // rect width
  12. let rh = 30; // rect length
  13. let r = hh; // radius
  14. let topX = hw - rw / 2;
  15. let topY = 0 - rh / 2;
  16. let rightX = w - rh / 2;
  17. let rightY = hh - rw / 2;
  18. let botX = hw - rw / 2;
  19. let botY = h - rh / 2;
  20. let leftX = 0 - rh / 2;
  21. let leftY = hh - rw / 2;
  22. token.target
  23. .beginFill(borderColor, 0).lineStyle(10, borderColor).drawCircle(hw, hh, r).endFill()
  24. .beginFill(fillColor, 0).lineStyle(6, fillColor).drawCircle(hw, hh, r).endFill()
  25. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(topX, topY, rw, rh).endFill() // top bar
  26. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(rightX, rightY, rh, rw).endFill() // right bar
  27. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(botX, botY, rw, rh).endFill() // bottom bar
  28. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(leftX, leftY, rh, rw).endFill(); // tleft bar
  29. }
  30. function drawCrossHairs2(token, fillColor, p, aw, h, hh, w, hw, ah) {
  31. let borderColor = 0x000000;
  32. let rw = 10; // rect width
  33. let rh = 50; // rect length
  34. let r = hh; // radius
  35. let topX = hw - rw / 2;
  36. let topY = 0 - rh / 2;
  37. let rightX = w - rh / 2;
  38. let rightY = hh - rw / 2;
  39. let botX = hw - rw / 2;
  40. let botY = h - rh / 2;
  41. let leftX = 0 - rh / 2;
  42. let leftY = hh - rw / 2;
  43. token.target
  44. .beginFill(borderColor, 1).lineStyle(8, borderColor).drawCircle(hw, hh, 2).endFill()
  45. .beginFill(fillColor, 1).lineStyle(6, fillColor).drawCircle(hw, hh, 2).endFill()
  46. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(topX, topY, rw, rh).endFill() // top bar
  47. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(rightX, rightY, rh, rw).endFill() // right bar
  48. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(botX, botY, rw, rh).endFill() // bottom bar
  49. .beginFill(fillColor).lineStyle(2, borderColor).drawRect(leftX, leftY, rh, rw).endFill(); // tleft bar
  50. }
  51. function drawBullsEye1(token, fillColor, p, aw, h, hh, w, hw, ah) {
  52. let borderColor = 0x000000;
  53. token.target
  54. .beginFill(borderColor, 0).lineStyle(6, borderColor).drawCircle(hw, hh, hh).endFill()
  55. .beginFill(fillColor, 0).lineStyle(4, fillColor).drawCircle(hw, hh, hh).endFill() // stop here for outer ring
  56. .beginFill(borderColor, 0).lineStyle(6, borderColor).drawCircle(hw, hh, hh - 40).endFill()
  57. .beginFill(fillColor, 0).lineStyle(4, fillColor).drawCircle(hw, hh, hh - 40).endFill();
  58. }
  59. function drawBullsEye2(token, fillColor, p, aw, h, hh, w, hw, ah) {
  60. let borderColor = 0x000000;
  61. token.target
  62. .beginFill(borderColor, 0).lineStyle(6, borderColor).drawCircle(hw, hh, hh).endFill()
  63. .beginFill(fillColor, 0).lineStyle(4, fillColor).drawCircle(hw, hh, hh).endFill() // stop here for outer ring
  64. .beginFill(borderColor, 0).lineStyle(6, borderColor).drawCircle(hw, hh, hh - 20).endFill()
  65. .beginFill(fillColor, 0).lineStyle(4, fillColor).drawCircle(hw, hh, hh - 20).endFill()
  66. .beginFill(fillColor, 1).lineStyle(8, fillColor).drawCircle(hw, hh, 2).endFill();
  67. }
  68. function drawBetterTarget(token, fillColor, p, aw, h, hh, w, hw, ah) {
  69. let size = token.w;
  70. // Constrain dimensions to the shortest axis
  71. if (size > token.h) {
  72. size = token.h;
  73. }
  74. const padding = size / 8;
  75. const stroke = size / 16;
  76. const vmid = token.h / 2;
  77. const hmid = token.w / 2;
  78. const crossLen = (size / 2) - (padding * 1.5);
  79. // TODO: Remove this when core PIXI.js graphics-smooth version >= v0.0.17
  80. const smoothGraphicsHack = 0.999;
  81. token.target
  82. .beginFill(0x000000, 0.0).lineStyle(stroke + 2, 0x000000)
  83. .drawCircle(hmid, vmid, (size / 2) - padding - (stroke / 2))
  84. .endFill()
  85. .beginFill(0x000000, 0.0).lineStyle(stroke, fillColor)
  86. .drawCircle(hmid, vmid, (size / 2) - padding - (stroke / 2))
  87. .endFill()
  88. .beginFill(fillColor, 1.0).lineStyle(1, 0x000000)
  89. .drawRoundedRect(hmid - (stroke / 2), vmid - stroke - (padding / 2) - crossLen, stroke, crossLen, stroke / 2 * smoothGraphicsHack)
  90. .drawRoundedRect(hmid - (stroke / 2), vmid + (padding * 1.5) - stroke, stroke, crossLen, stroke / 2 * smoothGraphicsHack)
  91. .drawRoundedRect(hmid - stroke - (padding / 2) - crossLen, vmid - (stroke / 2), crossLen, stroke, stroke / 2 * smoothGraphicsHack)
  92. .drawRoundedRect(hmid + (padding * 1.5) - stroke, vmid - (stroke / 2), crossLen, stroke, stroke / 2 * smoothGraphicsHack)
  93. .endFill();
  94. }