-
Notifications
You must be signed in to change notification settings - Fork 2
/
core.tin
163 lines (146 loc) · 3.13 KB
/
core.tin
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#LINE quiet {#READ sys.config};
#ALIAS {reloadmodule}
{
#IF {"%1" == "" || "%1" == "all"}
{
#SHOWME \nReloading all modules...;
#LINE quiet {#READ core_module.tin};
#UNVAR autologin;
#UNVAR login_name;
#UNVAR login_password;
#DELAY {0} {#SHOWME Reload complete.\n};
}
{
#CLASS {module_%1} {kill};
#CLASS {module_%1} {open};
#SHOWME \nReloading <169>%1<099>...;
#READ modules/%1.tin;
#CLASS {module_%1} {close};
#DELAY {0} {#SHOWME Reload complete.\n};
};
};
#FUNCTION {is_out_of_date}
{
#INFO system save;
#LOCAL tt_version {$info[SYSTEM][CLIENT_VERSION]};
#UNVAR info;
#REPLACE {tt_version} {.} {};
#REPLACE {tt_version} {b} {};
#IF {$tt_version < 20201}
{
#RETURN 1;
}
{
#RETURN 0;
};
}
#EVENT {PROGRAM START}
{
#IF {@is_out_of_date{}}
{
#SHOWME <001>Your version of Tintin++ is out of date.;
#SHOWME <001>Please upgrade to v2.02.01 or later.;
}
{
#LINE quiet {#READ core_module.tin};
newsess one;
};
};
#ALIAS {newsess %1}
{
#SESSION %1 ${mud_addr} ${mud_port};
};
#EVENT {SESSION CONNECTED}
{
#LINE quiet {#READ core_module.tin};
#IF {"$autologin" == "true"}
{
#ACTION {{^Enter your choice or the name of your character:}}
{
#SEND $login_name;
#SEND $login_password;
#UNVAR autologin;
#UNVAR login_name;
#UNVAR login_password;
#UNACTION {{^Enter your choice or the name of your character:}};
}
{5};
};
#ELSEIF {"$autologin" == "password"}
{
#ACTION {{^Password:}}
{
#SEND $login_password;
#UNACTION {{^Password:}};
}
};
#ELSE
{
#UNVAR autologin;
#UNVAR login_name;
#UNVAR login_password;
};
}
#EVENT {SCREEN RESIZE}
{
@create_layout{};
#IF {@has_module{map}}
{
@on_map_resize{};
};
#IF {@has_module{chat}}
{
@on_chat_resize{};
};
};
#FUNCTION {listen}
{
#ECHO %1 %2;
#IF {"%1" == "" || "%2" == ""}
{
#ECHO {<119>Error subscribing to event. Event name and target function name must be provided.};
}
{
#IF {&{events[%1]}}
{
#LIST events[%1] add %2;
}
{
#LIST events[%1] create %2;
}
}
#RETURN #NOP;
};
#FUNCTION {event}
{
#IF {&{events[%1]}}
{
#FOREACH {$events[%1][%*]} {func}
{
#LINE sub var #LOCAL tmp {@${func}{}};
};
};
#RETURN #NOP;
};
#VAR telnet[iac] \xFF;
#VAR telnet[do] \xFD;
#VAR telnet[sb] \xFA;
#VAR telnet[se] \xF0;
#VAR telnet[gmcp] \xC9;
#EVENT {IAC WILL GMCP}
{
#SEND {$telnet[iac]$telnet[do]$telnet[gmcp]};
#ECHO {<069>GMCP<099> enabled and supported.};
}
#ALIAS {gmcp %1 %*}
{
#SEND $telnet[iac]$telnet[sb]$telnet[gmcp]%1 %2$telnet[iac]$telnet[se];
}
#ALIAS {gmcp %1}
{
#SEND $telnet[iac]$telnet[sb]$telnet[gmcp]%1$telnet[iac]$telnet[se];
}
#EVENT {IAC SB GMCP logging.error IAC SE}
{
#ECHO {<119>%0};
}