Skip to content

Instantly share code, notes, and snippets.

@lofcz
Created January 4, 2021 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lofcz/cb6b816405eeffbdd9a7b939d64b6916 to your computer and use it in GitHub Desktop.
Save lofcz/cb6b816405eeffbdd9a7b939d64b6916 to your computer and use it in GitHub Desktop.
{
data: {
durability: 10,
trickleAmount: 10,
trickleDelayS: 1800, // 30 minut
lastUseDateTime: 0,
lastUseDateTimeAsStr: "",
catchTimer: 0,
catchTimerAsStr: "",
usedAtLeastOnce: 0
},
options: [
{
name: "Aktivovat",
actions: [
{
conditionsAll: [
{
left: "{{now}}",
right: "{lastUseDateTime} + {trickleDelayS}",
compare: "<",
evalLeft: true,
evalRight: true
}
],
actions: [
{
type: A_VARIABLE,
variable: "catchTimerAsStr",
value: "{catchTimer} - {{now}} + {lastUseDateTime}",
eval: true,
format: STRING_FORMAT_DT_HH_MM_SS
},
{
type: A_NOTIFICATION,
notification: N_ERROR,
text: "Tento předmět půjde použít až za {catchTimerAsStr}"
}
],
post: {
exit: true
}
},
{
actions: [
{
type: A_VARIABLE,
variable: "lastUseDateTime",
value: "{{now}}",
operation: "=",
eval: true
},
{
type: A_VARIABLE,
variable: "lastUseDateTimeAsStr",
value: "{{now}}",
operation: "=",
eval: true,
format: STRING_FORMAT_DT_DD_MM_YYYY_HH_MM
},
{
type: A_VARIABLE,
variable: "usedAtLeastOnce",
value: 1,
operation: "="
},
{
type: A_KERNEL,
kernel: K_PLAYER_SET_ENERGY,
operation: "+=",
value: "trickleAmount",
},
{
type: A_NOTIFICATION,
notification: N_INFO,
text: "Získal jsi 10 energie"
},
{
type: A_VARIABLE,
variable: "catchTimer",
operation: "=",
value: "{lastUseDateTime} + {trickleDelayS} - {{now}}",
eval: true
},
{
type: A_VARIABLE,
variable: "durability",
value: 1,
operation: "-="
},
{
type: A_KERNEL,
kernel: K_REFRESH_INVENTORY
}
]
},
{
conditionsAll: [
{
left: "durability",
right: 0,
compare: "<="
}
],
actions: [
{
type: A_KERNEL,
kernel: K_DELETE_SELF
},
{
type: A_KERNEL,
kernel: K_REFRESH_INVENTORY
},
{
type: A_KERNEL,
kernel: K_REFRESH_INVENTORY
}
]
}
]
}
],
render: [
{
type: UI_LINE,
text: "Po použití okamžitě obnoví {trickleAmount} energie. Použij aktivací z kontextové nabídky.",
style: {
color: "yellow"
}
},
{
type: UI_LINE,
text: "Lze použít ještě <b>{durability}</b>x, jednou za 30 minut.",
style: {
color: "darkgray",
italics: true
}
},
{
type: UI_LINE,
textConditions: [
{
conditionsAll: [
{
left: "usedAtLeastOnce",
right: 0,
compare: ">"
}
],
text: "<i style='color: darkgray'>Naposledy použito {lastUseDateTimeAsStr}.</i>"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment