Макросы Фаундри

Открыть актора

// Replace <id> with the actual ID of the character
const id = "<id>";
// Get the actor object from the ID
const actor = game.actors.get(id);
// Check if the actor exists
if (actor) {
  // Open the character sheet
  actor.sheet.render(true);
} else {
  // Display an error message
  ui.notifications.error("No actor found with ID " + id);
}

Свет

const TORCH_ICON = 'icons/sundries/lights/torch-brown-lit.webp'
const torchAnimation = {
    "intensity": 1,
    "speed": 1,
    "type": "torch"
}

const mundaneLight = {
    "alpha": 0.1,
    "angle": 360,
    "animation": torchAnimation,
    "color": "#d98e26",
    "luminosity": 0.5
}

const magicLight = {
    "alpha": 0.1,
    "angle": 360,
    "animation": {"type": "none"},
    "color": "#a6bbdd",
    "luminosity": 0.5
}

async function tokenUpdate(lightData) {
  if (canvas.tokens.controlled.length === 0){
    return ui.notifications.error("No token is selected!")
  }
  const tokens = canvas.tokens.controlled.map(token => {
      return {
          _id: token.id,
          light: {...lightData}
      }
  })
  await canvas.scene.updateEmbeddedDocuments('Token', tokens)
  const turnedOn = lightData?.animation?.type === 'torch'
  const turnedOff = !turnedOn && token.data.effects.includes(TORCH_ICON)
  for (const token of canvas.tokens.controlled) {
    if (turnedOn || turnedOff)
      await token.toggleEffect(TORCH_ICON, { active: true, overlay: false })
    if (turnedOff)
      await token.toggleEffect(TORCH_ICON, { active: false, overlay: false })
  }
}

const dialogOptions = {
    id: "lightPickerSelector",
    width: 320
}

const content = `
<style>
  #lightPickerSelector .dialog-button { margin: auto; min-width: 200px; }
  #lightPickerSelector .light { min-width: 200px; }
  #lightPickerSelector .lightHeightened { min-width: 75px; }
</style>
Pick the light source the selected token is holding.
`

let dialogEditor = new Dialog({
  title: "Token Light Picker",
  content: content,
  buttons: {
    none: {
      icon: "<i class='fas fa-eye'></i>",
      label: "None",
      callback: () => {
        tokenUpdate({"bright": 0, "dim": 0, "angle": 360,});
        dialogEditor.render(true)
      }
    },
    torch: {
      icon: "<i class='fas fa-fire'></i>",
      label: "Torch",
      callback: () => {
        tokenUpdate({...mundaneLight, "bright": 20, "dim": 40})
        dialogEditor.render(true)
      }
    },
    light: {
      icon: "<i class='fas fa-magic'></i>",
      label: "Light cantrip (Level 1 to 3)",
      callback: () => {
        tokenUpdate({...magicLight, "bright": 20, "dim": 40})
        dialogEditor.render(true)
      }
    },
    lightHeightened: {
      icon: "<i class='fas fa-magic'></i>",
      label: "(Level 4+)",
      callback: () => {
        tokenUpdate({...magicLight, "bright": 60, "dim": 120})
        dialogEditor.render(true)
      }
    },
    candle: {
      icon: "<i class='fas fa-burn'></i>",
      label: "Candle",
      callback: () => {
        tokenUpdate({...mundaneLight, "bright": 0, "dim": 10})
        dialogEditor.render(true)
      }
    },
    bullseye: {
      icon: "<i class='fas fa-bullseye'></i>",
      label: "Bullseye Lantern",
      callback: () => {
        tokenUpdate({...mundaneLight, "bright": 60, "dim": 120, "angle": 45})
        dialogEditor.render(true)
      }
    },
    hooded: {
      icon: "<i class='fas fa-traffic-light'></i>",
      label: "Hooded Lantern",
      callback: () => {
        tokenUpdate({...mundaneLight, "bright": 30, "dim": 60})
        dialogEditor.render(true)
      }
    },
    darkness: {
      icon: "<i class='fas fa-eye-slash'></i>",
      label: "Darkness spell",
      callback: () => {
        tokenUpdate({...magicLight, "bright": 15, "dim": 0, "luminosity": -0.5})
        dialogEditor.render(true)
      }
    },
    close: {
      icon: "<i class='fas fa-times'></i>",
      label: "Close"
    },
  },
  default: "close",
  close: () => {}
}, dialogOptions)

dialogEditor.render(true)

И цзин

hexagrams = [

    {

      "number": "1",

      "symbol": "䷀",

      "name": "Цянь",

      "chinese": "乾 qián",

      "meaning": "Творчество",

      "unicodedec": "19904",

      "unicodehex": "4DC0",

      "englishWiki": 'Hexagram 1 is named 乾 (qián), "Force". Other variations include "the creative", "strong action", "the key", and "god". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is identical.'

    },

    {

      "number": "2",

      "symbol": "䷁",

      "name": "Кунь",

      "chinese": "坤 kūn",

      "meaning": "Исполнение",

      "unicodedec": "19905",

      "unicodehex": "4DC1",

      "englishWiki": 'Hexagram 2 is named 坤 (kūn), "Field". Other variations include "the receptive", "acquiescence", and "the flow". Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is identical.'

    },

    {

      "number": "3",

      "symbol": "䷂",

      "name": "Чжунь",

      "chinese": "屯 zhūn",

      "meaning": "Начальная трудность",

      "unicodedec": "19906",

      "unicodehex": "4DC2",

      "englishWiki": 'Hexagram 3 is named 屯 (zhūn), "Sprouting". Other variations include "difficulty at the beginning", "gathering support", and "hoarding". The meaning of "屯" is collect, store up, stingy, and stationing troops. Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water.'

    },

    {

      "number": "4",

      "symbol": "䷃",

      "name": "Мэн",

      "chinese": "蒙 mēng",

      "meaning": "Недоразвитость",

      "unicodedec": "19907",

      "unicodehex": "4DC3",

      "englishWiki": 'Hexagram 4 is named 蒙 (méng), "Enveloping". Other variations include "youthful folly", "the young shoot", and "discovering". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain.'

    },

    {

      "number": "5",

      "symbol": "䷄",

      "name": "Сюй",

      "chinese": "需 xū",

      "meaning": "Необходимость ждать",

      "unicodedec": "19908",

      "unicodehex": "4DC4",

      "englishWiki": 'Hexagram 5 is named 需 (xū), "Attending". Other variations include "waiting", "moistened", and "arriving". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water.'

    },

    {

      "number": "6",

      "symbol": "䷅",

      "name": "Сун",

      "chinese": "訟 sòng",

      "meaning": "Тяжба",

      "unicodedec": "19909",

      "unicodehex": "4DC5",

      "englishWiki": 'Hexagram 6 is named 訟 (sòng), arguing, dispute, litigation, conflict and "lawsuit". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven.'

    },

    {

      "number": "7",

      "symbol": "䷆",

      "name": "Ши",

      "chinese": "師 shī",

      "meaning": "Войско",

      "unicodedec": "19910",

      "unicodehex": "4DC6",

      "englishWiki": 'Hexagram 7 is named 師 (shī), "Leading". Other variations include "the army" and "the troops". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "8",

      "symbol": "䷇",

      "name": "Би",

      "chinese": "比 bì",

      "meaning": "Сближение",

      "unicodedec": "19911",

      "unicodehex": "4DC7",

      "englishWiki": 'Hexagram 8 is named 比 (bǐ), "Grouping". Other variations include "holding together" and "alliance". Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water. '

    },

    {

      "number": "9",

      "symbol": "䷈",

      "name": "Сяо-чу",

      "chinese": "小畜 xiǎochù",

      "meaning": "Воспитание малым",

      "unicodedec": "19912",

      "unicodehex": "4DC8",

      "englishWiki": 'Hexagram 9 is named 小畜 (xiǎo xù), "Small Accumulating", "domestication" "the taming power of the small", "small harvest", "minor restraint" and "small livestock". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "10",

      "symbol": "䷉",

      "name": "Ли",

      "chinese": "履 lǐ",

      "meaning": "Наступление",

      "unicodedec": "19913",

      "unicodehex": "4DC9",

      "englishWiki": 'Hexagram 10 is named 履 (lǚ), "Treading". Other variations include "treading (conduct)" and "continuing". Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven. '

    },

    {

      "number": "11",

      "symbol": "䷊",

      "name": "Тай",

      "chinese": "泰 tài",

      "meaning": "Расцвет",

      "unicodedec": "19914",

      "unicodehex": "4DCA",

      "englishWiki": 'Hexagram 11 is named 泰 (tài), "Pervading", “smooth going", "peace" and "greatness". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "12",

      "symbol": "䷋",

      "name": "Пи",

      "chinese": "否 pǐ",

      "meaning": "Упадок",

      "unicodedec": "19915",

      "unicodehex": "4DCB",

      "englishWiki": 'Hexagram 12 is named 否 (pǐ), "Obstruction". Other variations include "standstill (stagnation)" and "selfish persons". Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven. '

    },

    {

      "number": "13",

      "symbol": "䷌",

      "name": "Тун-жэнь",

      "chinese": "同人 tóngrén",

      "meaning": "Родня",

      "unicodedec": "19916",

      "unicodehex": "4DCC",

      "englishWiki": 'Hexagram 13 is named 同人 (tóng rén), "Concording People". Other variations include "fellowship with men" and "gathering men". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven. '

    },

    {

      "number": "14",

      "symbol": "䷍",

      "name": "Да-ю",

      "chinese": "大有 dàyǒu",

      "meaning": "Владение многим",

      "unicodedec": "19917",

      "unicodehex": "4DCD",

      "englishWiki": 'Hexagram 14 is named 大有 (dà yǒu), "Great Possessing". Other variations include "possession in great measure" and "the great possession". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire. '

    },

    {

      "number": "15",

      "symbol": "䷎",

      "name": "Цянь",

      "chinese": "謙 qiān",

      "meaning": "Смирение",

      "unicodedec": "19918",

      "unicodehex": "4DCE",

      "englishWiki": 'Hexagram 15 is named 謙 (qiān), "Humbling". Other variations include "modesty". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "16",

      "symbol": "䷏",

      "name": "Юй",

      "chinese": "豫 yù",

      "meaning": "Вольность",

      "unicodedec": "19919",

      "unicodehex": "4DCF",

      "englishWiki": 'Hexagram 16 is named 豫 (yù), "Providing-For". Other variations include "enthusiasm" and "excess". Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "17",

      "symbol": "䷐",

      "name": "Суй",

      "chinese": "隨 suí",

      "meaning": "Последовательность",

      "unicodedec": "19920",

      "unicodehex": "4DD0",

      "englishWiki": 'Hexagram 17 is named 隨 (suí), "Following", "Pursue", "Hunter". Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "18",

      "symbol": "䷑",

      "name": "Гу",

      "chinese": "蠱 gǔ",

      "meaning": "Исправление",

      "unicodedec": "19921",

      "unicodehex": "4DD1",

      "englishWiki": 'Hexagram 18 is named 蠱 (gǔ), "Correcting". Other variations include "work on what has been spoiled (decay)", "decaying" and "branch".[1] Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain. Gu is the name of a venom-based poison traditionally used in Chinese witchcraft. '

    },

    {

      "number": "19",

      "symbol": "䷒",

      "name": "Линь",

      "chinese": "臨 lín",

      "meaning": "Посещение",

      "unicodedec": "19922",

      "unicodehex": "4DD2",

      "englishWiki": 'Hexagram 19 is named 臨 (lín), "Nearing". Other variations include "approach" and "the forest". Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "20",

      "symbol": "䷓",

      "name": "Гуань",

      "chinese": "觀 guān",

      "meaning": "Созерцание",

      "unicodedec": "19923",

      "unicodehex": "4DD3",

      "englishWiki": 'Hexagram 20 is named 觀 (guān), "Viewing". Other variations include "contemplation (view)" and "looking up". Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "21",

      "symbol": "䷔",

      "name": "Ши-хо",

      "chinese": "噬嗑 shì kè",

      "meaning": "Стиснутые зубы",

      "unicodedec": "19924",

      "unicodehex": "4DD4",

      "englishWiki": 'Hexagram 21 is named 噬嗑 (shì kè), "Gnawing Bite". Other variations include "biting through" and "biting and chewing". It may refer to teeth working together to bring coherence.[2] Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire.[3] '

    },

    {

      "number": "22",

      "symbol": "䷕",

      "name": "Би",

      "chinese": "賁 bì",

      "meaning": "Убранство",

      "unicodedec": "19925",

      "unicodehex": "4DD5",

      "englishWiki": 'Hexagram 22 is named 賁 (bì), "Adorning", "bright", "grace", "lush", and "luxuriance". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain.[4] '

    },

    {

      "number": "23",

      "symbol": "䷖",

      "name": "Бо",

      "chinese": "剝 bō",

      "meaning": "Разорение",

      "unicodedec": "19926",

      "unicodehex": "4DD6",

      "englishWiki": 'Hexagram 23 is named 剝 (bō), "Stripping". Other variations include "splitting apart", "flaying", "scalp", and "peel". This may allude to removal of something.[5] Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain. '

    },

    {

      "number": "24",

      "symbol": "䷗",

      "name": "Фу",

      "chinese": "復 fù",

      "meaning": "Возвращение",

      "unicodedec": "19927",

      "unicodehex": "4DD7",

      "englishWiki": 'Hexagram 24 is named 復 (fù), "Returning". Other variations include "return (the turning point)". Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "25",

      "symbol": "䷘",

      "name": "У-ван",

      "chinese": "無妄 wú wàng",

      "meaning": "Беспорочность",

      "unicodedec": "19928",

      "unicodehex": "4DD8",

      "englishWiki": 'Hexagram 25 is named 無妄 (wú wàng), "Without Embroiling". Other variations include "innocence (the unexpected)" and "pestilence". Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven. '

    },

    {

      "number": "26",

      "symbol": "䷙",

      "name": "Да-чу",

      "chinese": "大畜 dà chù",

      "meaning": "Воспитание великим",

      "unicodedec": "19929",

      "unicodehex": "4DD9",

      "englishWiki": 'Hexagram 26 is named 大畜 (dà xù), "Great Accumulating". Other variations include "the taming power of the great", "great storage", and "potential energy". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain. '

    },

    {

      "number": "27",

      "symbol": "䷚",

      "name": "И",

      "chinese": "頤 yí",

      "meaning": "Питание",

      "unicodedec": "19930",

      "unicodehex": "4DDA",

      "englishWiki": 'Hexagram 27 is named 頤 (yí), "Swallowing". Other variations include "the corners of the mouth (providing nourishment)", "jaws" and "comfort/security". Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain. '

    },

    {

      "number": "28",

      "symbol": "䷛",

      "name": "Да-го",

      "chinese": "大過 dà guò",

      "meaning": "Переразвитие великого",

      "unicodedec": "19931",

      "unicodehex": "4DDB",

      "englishWiki": 'Hexagram 28 is named 大過 (dà guò), "Great Exceeding". Other variations include "preponderance of the great", "great surpassing" and "critical mass". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "29",

      "symbol": "䷜",

      "name": "Кань",

      "chinese": "坎 kǎn",

      "meaning": "Повторная опасность",

      "unicodedec": "19932",

      "unicodehex": "4DDC",

      "englishWiki": 'Hexagram 29 is named 坎 (kǎn), "Gorge". Other variations include "the abyss" (in the oceanographic sense) and "repeated entrapment". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is identical. '

    },

    {

      "number": "30",

      "symbol": "䷝",

      "name": "Ли",

      "chinese": "離 lí",

      "meaning": "Сияние",

      "unicodedec": "19933",

      "unicodehex": "4DDD",

      "englishWiki": 'Hexagram 30 is named 離 (lí), "Radiance". Other variations include "the clinging, fire" and "the net". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is identical. The origin of the character has its roots in symbols of long-tailed birds such as the peacock or the legendary phoenix. '

    },

    {

      "number": "31",

      "symbol": "䷞",

      "name": "Сянь",

      "chinese": "咸 xián",

      "meaning": "Взаимодействие",

      "unicodedec": "19934",

      "unicodehex": "4DDE",

      "englishWiki": 'Hexagram 31 is named 咸 (xián), "Conjoining". Other variations include "influence (wooing)", "feelings", "being affected", and "reciprocity". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "32",

      "symbol": "䷟",

      "name": "Хэн",

      "chinese": "恆 héng",

      "meaning": "Постоянство",

      "unicodedec": "19935",

      "unicodehex": "4DDF",

      "englishWiki": 'Hexagram 32 is named 恆 (héng), "Persevering". Other variations include "duration" and "constancy". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "33",

      "symbol": "䷠",

      "name": "Дунь",

      "chinese": "遯 dùn",

      "meaning": "Бегство",

      "unicodedec": "19936",

      "unicodehex": "4DE0",

      "englishWiki": 'Hexagram 33 is named 遯 (dùn), "Retiring". Other variations include "retreat" and "yielding". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven. '

    },

    {

      "number": "34",

      "symbol": "䷡",

      "name": "Да-чжуан",

      "chinese": "大壯 dà zhuàng",

      "meaning": "Великая мощь",

      "unicodedec": "19937",

      "unicodehex": "4DE1",

      "englishWiki": 'Hexagram 34 is named 大壯 (dà zhuàng), "Great Invigorating". Other variations include "the power of the great" and "great maturity". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "35",

      "symbol": "䷢",

      "name": "Цзинь",

      "chinese": "晉 jìn",

      "meaning": "Восход",

      "unicodedec": "19938",

      "unicodehex": "4DE2",

      "englishWiki": 'Hexagram 35 is named 晉 (jìn), "Prospering". Other variations include "progress" and "aquas". Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire. '

    },

    {

      "number": "36",

      "symbol": "䷣",

      "name": "Мин-и",

      "chinese": "明夷 míng yí",

      "meaning": "Поражение света",

      "unicodedec": "19939",

      "unicodehex": "4DE3",

      "englishWiki": 'Hexagram 36 is named 明夷 (míng yí), "Darkening of the Light". Other variations include "brilliance injured" and "intelligence hidden". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "37",

      "symbol": "䷤",

      "name": "Цзя-жэнь",

      "chinese": "家人 jiā rén",

      "meaning": "Домашние",

      "unicodedec": "19940",

      "unicodehex": "4DE4",

      "englishWiki": 'Hexagram 37 is named 家人 (jiā rén), "Dwelling People". Other variations include "the family (the clan)" and "family members". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "38",

      "symbol": "䷥",

      "name": "Куй",

      "chinese": "睽 kuí",

      "meaning": "Разлад",

      "unicodedec": "19941",

      "unicodehex": "4DE5",

      "englishWiki": 'Hexagram 38 is named 睽 (kuí), "Polarising". Other variations include "opposition" and "perversion". The symbol 睽 also means separated, estranged, and stare. Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire. '

    },

    {

      "number": "39",

      "symbol": "䷦",

      "name": "Цзянь",

      "chinese": "蹇 jiǎn",

      "meaning": "Препятствие",

      "unicodedec": "19942",

      "unicodehex": "4DE6",

      "englishWiki": 'Hexagram 39 is named 蹇 (jiǎn), "Limping". Other variations include "obstruction" and "afoot". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water. '

    },

    {

      "number": "40",

      "symbol": "䷧",

      "name": "Цзе",

      "chinese": "解 xiè",

      "meaning": "Разрешение",

      "unicodedec": "19943",

      "unicodehex": "4DE7",

      "englishWiki": 'Hexagram 40 is named 解 (xiè), "Taking-Apart". Other variations include "deliverance" and "untangled". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "41",

      "symbol": "䷨",

      "name": "Сунь",

      "chinese": "損 sǔn",

      "meaning": "Убыли",

      "unicodedec": "19944",

      "unicodehex": "4DE8",

      "englishWiki": 'Hexagram 41 is named 損 (sǔn), "Diminishing", "lose", "reduction", "remove", "damage", "decrease". Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☶ (艮 gèn) bound = (山) mountain. '

    },

    {

      "number": "42",

      "symbol": "䷩",

      "name": "И",

      "chinese": "益 yì",

      "meaning": "Приумножение",

      "unicodedec": "19945",

      "unicodehex": "4DE9",

      "englishWiki": 'Hexagram 42 is named 益 (yì), "Augmenting". Other variations include: increase, beneficial, useful. Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "43",

      "symbol": "䷪",

      "name": "Гуай",

      "chinese": "夬 guài",

      "meaning": "Выход",

      "unicodedec": "19946",

      "unicodehex": "4DEA",

      "englishWiki": 'Hexagram 43 is named 夬 (guài), "Displacement". Other variations include "resoluteness", "parting", and "break-through". Its inner (lower) trigram is ☰ (乾 qián) force = (天) heaven, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "44",

      "symbol": "䷫",

      "name": "Гоу",

      "chinese": "姤 gòu",

      "meaning": "Перечение",

      "unicodedec": "19947",

      "unicodehex": "4DEB",

      "englishWiki": 'Hexagram 44 is named 姤 (gòu), "Coupling". Other variations include "coming to meet" and "meeting". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☰ (乾 qián) force = (天) heaven. '

    },

    {

      "number": "45",

      "symbol": "䷬",

      "name": "Цуй",

      "chinese": "萃 cuì",

      "meaning": "Множество",

      "unicodedec": "19948",

      "unicodehex": "4DEC",

      "englishWiki": 'Hexagram 45 is named 萃 (cuì), "Clustering", "gathering together (massing)" and "finished". Other meanings of the symbol: gather, assemble, collect, dense, thick, and collection. It may mean that it\'s good to get help or advice; for progress it\'s necessary to persevere. The group needs to be sustained. Its inner (lower) trigram is ☷ (坤 kūn) field = (地) earth, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "46",

      "symbol": "䷭",

      "name": "Шэн",

      "chinese": "升 shēng",

      "meaning": "Подъём",

      "unicodedec": "19949",

      "unicodehex": "4DED",

      "englishWiki": 'Hexagram 46 is named 升 (shēng), "Ascending". Other variations include "pushing upward". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☷ (坤 kūn) field = (地) earth. '

    },

    {

      "number": "47",

      "symbol": "䷮",

      "name": "Кунь",

      "chinese": "困 kùn",

      "meaning": "Истощение",

      "unicodedec": "19950",

      "unicodehex": "4DEE",

      "englishWiki": 'Hexagram 47 is named 困 (kùn), "Confining". Other variations include "oppression (exhaustion)" and "entangled". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "48",

      "symbol": "䷯",

      "name": "Цзин",

      "chinese": "井 jǐng",

      "meaning": "Колодец",

      "unicodedec": "19951",

      "unicodehex": "4DEF",

      "englishWiki": 'Hexagram 48 is named 井 (jǐng), "Welling". Other variations include "the well". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water. '

    },

    {

      "number": "49",

      "symbol": "䷰",

      "name": "Гэ",

      "chinese": "革 gé",

      "meaning": "Смена",

      "unicodedec": "19952",

      "unicodehex": "4DF0",

      "englishWiki": 'Hexagram 49 is named 革 (gé), "Skinning". Other variations include "revolution (molting)" and "the bridle". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☱ (兌 duì) open = (澤) swamp. '

    },

    {

      "number": "50",

      "symbol": "䷱",

      "name": "Дин",

      "chinese": "鼎 dǐng",

      "meaning": "Жертвенный треножник",

      "unicodedec": "19953",

      "unicodehex": "4DF1",

      "englishWiki": 'Hexagram 50 is named 鼎 (dǐng), "Holding". Other variations include "the cauldron". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire. '

    },

    {

      "number": "51",

      "symbol": "䷲",

      "name": "Чжэнь",

      "chinese": "震 zhèn",

      "meaning": "Молния",

      "unicodedec": "19954",

      "unicodehex": "4DF2",

      "englishWiki": 'Hexagram 51 is named 震 (zhèn), "Shake","the arousing (shock, thunder)"; "thunder, excite, thrill, convulse, and tremor". The advice is to maintain one\'s concentration ("one did not lose the sacrificial wine in the ladle"). Its inner (lower) trigram is ☳ (震 zhèn) shake = (雷) thunder, and its outer (upper) trigram is identical. '

    },

    {

      "number": "52",

      "symbol": "䷳",

      "name": "Гэнь",

      "chinese": "艮 gèn",

      "meaning": "Сосредоточенность",

      "unicodedec": "19955",

      "unicodehex": "4DF3",

      "englishWiki": 'Hexagram 52 is named 艮 (gèn), "Bound". Other variations include "keeping still, mountain" and "stilling". The symbol also means, "blunt, tough, and chewy like hard leather". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is identical. '

    },

    {

      "number": "53",

      "symbol": "䷴",

      "name": "Цзянь",

      "chinese": "漸 jiàn",

      "meaning": "Течение",

      "unicodedec": "19956",

      "unicodehex": "4DF4",

      "englishWiki": 'Hexagram 53 is named 漸 (jiàn), "Infiltrating". Other variations include "development (gradual progress)" and "advancement". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "54",

      "symbol": "䷵",

      "name": "Гуй-мэй",

      "chinese": "歸妹 guī mèi",

      "meaning": "Невеста",

      "unicodedec": "19957",

      "unicodehex": "4DF5",

      "englishWiki": 'Hexagram 54 is named 歸妹 (guī mèi), "Converting the Maiden". Other variations include "the marrying maiden" and "returning maiden". Marrying younger sister. Not being in a position to make things happen one\'s own way. Trying to anyway will only bring trouble. Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "55",

      "symbol": "䷶",

      "name": "Фэн",

      "chinese": "豐 fēng",

      "meaning": "Изобилие",

      "unicodedec": "19958",

      "unicodehex": "4DF6",

      "englishWiki": 'Hexagram 55 is named 豐 (fēng), "Abounding". Other variations include "abundance" and "fullness". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "56",

      "symbol": "䷷",

      "name": "Люй",

      "chinese": "旅 lǚ",

      "meaning": "Странствие",

      "unicodedec": "19959",

      "unicodehex": "4DF7",

      "englishWiki": 'Hexagram 56 is named 旅 (lǚ), "Sojourning". Other variations include "the wanderer" and "traveling". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire. '

    },

    {

      "number": "57",

      "symbol": "䷸",

      "name": "Сунь",

      "chinese": "巽 xùn",

      "meaning": "Проникновение",

      "unicodedec": "19960",

      "unicodehex": "4DF8",

      "englishWiki": 'Hexagram 57 is named 巽 (xùn), "Ground". Other variations include "the gentle (the penetrating, wind)" and "calculations". Its inner (lower) trigram is ☴ (巽 xùn) ground = (風) wind, and its outer (upper) trigram is identical. '

    },

    {

      "number": "58",

      "symbol": "䷹",

      "name": "Дуй",

      "chinese": "兌 duì",

      "meaning": "Радость",

      "unicodedec": "19961",

      "unicodehex": "4DF9",

      "englishWiki": 'Hexagram 58 is named 兌 (duì), "Open", "exchange" "the joyous, lake" and "usurpation". The symbol "兌" means exchange, add, against, and convert.[6] Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is identical. '

    },

    {

      "number": "59",

      "symbol": "䷺",

      "name": "Хуань",

      "chinese": "渙 huàn",

      "meaning": "Разлив",

      "unicodedec": "19962",

      "unicodehex": "4DFA",

      "englishWiki": 'Hexagram 59 is named 渙 (huàn), "Dispersing". Other variations include "dispersion (dissolution)" and "dispersal". The symbol means dissipate, dissolve, vanish. Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "60",

      "symbol": "䷻",

      "name": "Цзе",

      "chinese": "節 jié",

      "meaning": "Ограничение",

      "unicodedec": "19963",

      "unicodehex": "4DFB",

      "englishWiki": 'Hexagram 60 is named 節 (jié), "Articulating". Other variations include "limitation" and "moderation". Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water. '

    },

    {

      "number": "61",

      "symbol": "䷼",

      "name": "Чжун-фу",

      "chinese": "中孚 zhōng fú",

      "meaning": "Внутренняя правда",

      "unicodedec": "19964",

      "unicodehex": "4DFC",

      "englishWiki": 'Hexagram 61 is named 中孚 (zhōng fú), "Center Returning", "inner trust", "inner truth" and "central return". Its inner (lower) trigram is ☱ (兌 duì) open = (澤) swamp, and its outer (upper) trigram is ☴ (巽 xùn) ground = (風) wind. '

    },

    {

      "number": "62",

      "symbol": "䷽",

      "name": "Сяо-го",

      "chinese": "小過 xiǎo guò",

      "meaning": "Переразвитие малого",

      "unicodedec": "19965",

      "unicodehex": "4DFD",

      "englishWiki": 'Hexagram 62 is named 小過 (xiǎo guò), "Small Exceeding". Other variations include "preponderance of the small" and "small surpassing". Its inner (lower) trigram is ☶ (艮 gèn) bound = (山) mountain, and its outer (upper) trigram is ☳ (震 zhèn) shake = (雷) thunder. '

    },

    {

      "number": "63",

      "symbol": "䷾",

      "name": "Цзи-цзи",

      "chinese": "既濟 jì jì",

      "meaning": "Уже конец",

      "unicodedec": "19966",

      "unicodehex": "4DFE",

      "englishWiki": 'Hexagram 63 is named 既濟 (jì jì), "Already Fording". Other variations include "after completion" and "already completed" or "already done". Its inner (lower) trigram is ☲ (離 lí) radiance = (火) fire, and its outer (upper) trigram is ☵ (坎 kǎn) gorge = (水) water. '

    },

    {

      "number": "64",

      "symbol": "䷿",

      "name": "Вэй-цзи",

      "chinese": "未濟 wèi jì",

      "meaning": "Еще не конец",

      "unicodedec": "19967",

      "unicodehex": "4DFF",

      "englishWiki": 'Hexagram 64 is named 未濟 (wèi jì), "Not Yet Fording". Other variations include "before completion" and "not yet completed". Its inner (lower) trigram is ☵ (坎 kǎn) gorge = (水) water, and its outer (upper) trigram is ☲ (離 lí) radiance = (火) fire. '

    }

  ];

// for testing:
// var randomHexagram = hexagrams[Math.floor(Math.random() * hexagrams.length)];

let roll = new Roll("1d64").roll();

roll.then(function(result) {

  hexagram = hexagrams[result.total-1]
  ChatMessage.create({
    user: game.user._id,
    content: `Hexagram ${result.total} ${hexagram.symbol} ${hexagram.name} ${hexagram.chinese} ${hexagram.meaning}<br/><br/>${hexagram.englishWiki}`
  });
});

World size (optimization)

https://www.reddit.com/r/FoundryVTT/comments/zsocbw/foundry_vtt_optimization_guide_part_2_sidebar_and/

Назначить группу

let confirmed = false;
let tintColor = '#ff0000'
  
new Dialog({
  title: "Custom effect",
  content: `
     <form>
      <div class="form-group">
       <label>Effect name:</label>
       <input id="effect-name" name="effect-name" value="Group"></input>
       <input type="color" value="${tintColor}" name="tint-color" style="margin-left: 10px;">
      </div>
     </form>
     `,

  buttons: {
    one: {
      icon: '<i class="fas fa-check"></i>',
      label: "Accept",
      callback: () => confirmed = true
    },
    two: {
      icon: '<i class="fas fa-times"></i>',
      label: "Cancel",
      callback: () => confirmed = false
    }
  },

  default: "Cancel",
  close: html => {
    if (confirmed) {
      let effectName = html.find('[name=effect-name]').val();
      let tintColor = html.find('[name=tint-color]').val();
      const effectIconPath = 'icons/svg/circle.svg';
      let effectMsg = ' has activated ' + effectName + '!';
      let endeffectMsg = ' has deactivated ' + effectName + '!';
      for (const token of canvas.tokens.controlled) {
        let macroActor = token.actor;
        let chatMsg = '';
        let effected = macroActor.effects.find(i => i.name === effectName)
        let effect = {
          changes: [
          ],
          duration: {
            "seconds": 60,
          },
          icon: effectIconPath,
          label: effectName,
          tint: tintColor
        }

        if (macroActor === undefined || macroActor === null) {
          ui.notifications.warn("Please select a token first.");
        }

        else {
          if (effected) {
            macroActor.deleteEmbeddedDocuments("ActiveEffect", [effected.id])
            chatMsg = `${macroActor.name} ${endeffectMsg}`;
          }
          else {
            macroActor.createEmbeddedDocuments("ActiveEffect", [effect])
            chatMsg = `${macroActor.name} ${effectMsg}`;
          }

          if (chatMsg !== '') {
            let chatData = {
              user: game.user._id,
              speaker: ChatMessage.getSpeaker(),
              content: chatMsg
            };
            // ChatMessage.create(chatData, {});
          }
        }
      }
    }
  }

}).render(true);