Date: 2023/09/07 06:48:04 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
chat_formatting:
type: world
debug: true
enabled: true
on player chats flagged:!player.chat.busy:
- determine cancelled passively
################## highlight player names, server locations, links, etc.
# TODO: move this to a task script with data containers
- define linkstart <list[https://|http://|www.|meta.|map.|forum.|login.]>
- define linkend <list[.de|.com|.net|.info|.ly|.be|.fr|.is|.biz|.to|.co|.org|.uk|.at]>
- define locations <list[Orbis|Avarus|Arboretum|Kaos|Orcus|Zeitkapsel|Hortusmanium|Ituria|Moraira|Blackshire]>
- define serverwords <list[Projektantrag|Fachgespräche|Gallerie|Projektwelt|Bauprojekt]>
- define misc <list[Discord|Regeln|Hilfe|Support|Wiki|Guide]>
- define symbols <list[?|,|:|;|!|.]>
- define textrpl <context.message.parse_color>
# loop through each word of the message and highlight links
- foreach <context.message.split> as:arg:
- if <[linkstart].filter_tag[<[arg].starts_with[<[filter_value]>]>].any> || <[linkend].filter_tag[<[arg].ends_with[<[filter_value]>]>].any>:
- define textrpl <[textrpl].replace[<[arg]>].with[<&n><[arg]><&r>]>
# filter out symbols like ?,:,!
- if <[symbols].filter_tag[<[arg].ends_with[<[filter_value]>]>].any>:
- define textrpl <[textrpl].replace[<[arg].to_list.last>].with[<&f><[arg].to_list.last><&r>]>
# highlitght predefined locations
- foreach <[locations]> as:loc:
- define textrpl <[textrpl].replace[<[loc]>].with[<&c><[loc]><&r>]>
# highlight server words
- foreach <[serverwords]> as:words:
- define textrpl <[textrpl].replace[<[words]>].with[<&color[<color[#DBF227]>]><[words]><&r>]>
# higlight player names
- foreach <server.online_players.exclude[<player>].include[<server.offline_players>]> as:player:
- define name <[player].name>
- if <[textrpl].contains_text[<[name]>]>:
- define textrpl <[textrpl].replace[<[name]>].with[<&a><[name]><&r>]>
- if <[player].is_online>:
- playsound <[player]> sound:block_bell_use
# highlight and replace misc words
- foreach <[misc]> as:misc:
- choose <[misc]>:
- case Discord:
- define textrpl <[textrpl].replace_text[<element[Discord]>].with[<&color[<color[#5865F2]>]>Discord<&co> <&n>https://is.gd/cdiscord<&r>]>
- case Regeln rules:
- define textrpl <[textrpl].replace[<element[Regeln]>].with[<element[<&color[<color[#F26800]>]><&n>Regeln].on_click[/regeln].on_hover[Klicken, um Regeln aufzurufen]><&r>]>
- define textrpl <[textrpl].replace[<element[rules]>].with[<element[<&color[<color[#F26800]>]><&n>Regeln].on_click[/regeln].on_hover[Klicken, um Regeln aufzurufen]><&r>]>
- case Hilfe help:
- define textrpl <[textrpl].replace[<element[Hilfe]>].with[<element[<&color[<color[#F26800]>]><&n>Hilfe].on_click[/hilfe].on_hover[Klicken, um Hilfe aufzurufen]><&r>]>
- define textrpl <[textrpl].replace[<element[help]>].with[<element[<&color[<color[#F26800]>]><&n>Hilfe].on_click[/hilfe].on_hover[Klicken, um Hilfe aufzurufen]><&r>]>
- case Support report:
- define textrpl <[textrpl].replace[<element[Support]>].with[<element[<&color[<color[#F26800]>]><&n>Support].on_click[/support].on_hover[Klicken, um Support aufzurufen]><&r>]>
- define textrpl <[textrpl].replace[<element[report]>].with[<element[<&color[<color[#F26800]>]><&n>Support].on_click[/support].on_hover[Klicken, um Support aufzurufen]><&r>]>
################### build the text
- define text "<player.proc[player_name_format]><&f><&co> <[textrpl]>"