Skip to content

Commit 809d8cd

Browse files
ShrBoxOEOTYANDofes
authored
Refactor/adapt to 1.0.0 (#195)
* refactor: adapt to LeviLamina 1.0.0 (WIP) * docs: remove logger.setTitle because it has been deprecated * refactor: ThreadPool -> ThreadPoolExecutor refactor: ServerStatus -> GamingStatus * refactor: refactoring logger * chore: update manifest.json * chore: add missing after build xmake.lua * refactor: annotate some code to pass compilation * ci: automatic rename mod name * fix: fix nodejs engine * refactor: replace some macro with inline * refactor: remove more macro * refactor: clean some code * refactor: remove some annotation * fix: fix ScorePacketInfo * refactor: refactor plugin manager * fix: fix logger while plugin loading * fix: fix debug engine logger * fix: fix form handler * fix: fix TimeTaskSystem.cpp * fix: fix setInterval & setTimeout * docs: add missing picture * refactor: refactoring debug command with new command api * refactor: removing old dynamic command completely --------- Co-authored-by: OEOTYAN <[email protected]> Co-authored-by: Dofes <[email protected]>
1 parent 0b7960d commit 809d8cd

File tree

106 files changed

+2183
-3911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2183
-3911
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ PackConstructorInitializers: CurrentLine
4343
PointerAlignment: Left
4444
TabWidth: 4
4545
UseTab: Never
46-
SortIncludes: CaseSensitive
46+
SortIncludes: Never
4747
IncludeBlocks: Regroup

.github/workflows/build.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
key: xmake-${{ hashFiles('xmake.lua') }}
3434
restore-keys: |
3535
xmake-
36-
36+
3737
- run: |
3838
xmake repo -u
3939
@@ -42,22 +42,11 @@ jobs:
4242
4343
- run: |
4444
xmake -y
45+
sed -i 's/\"name\": \"legacy-script-engine\"/\"name\": \"legacy-script-engine-${{ matrix.backend }}\"/g' bin/legacy-script-engine/manifest.json
46+
mv bin/legacy-script-engine bin/legacy-script-engine-${{ matrix.backend }}
4547
4648
- uses: actions/upload-artifact@v4
4749
with:
4850
name: legacy-script-engine-${{ matrix.backend }}-windows-x64-${{ github.sha }}
4951
path: |
5052
bin/
51-
52-
# clang-format:
53-
# runs-on: windows-latest
54-
# steps:
55-
# - uses: actions/checkout@v4
56-
57-
# - run: |
58-
# choco install llvm -y
59-
60-
# - name: clang-format
61-
# run: |
62-
# Get-ChildItem src/ -Filter *.cpp -Recurse | ForEach-Object { clang-format --dry-run -Werror $_.FullName; if ($LASTEXITCODE -ne 0) { exit 1; } }
63-
# Get-ChildItem src/ -Filter *.h -Recurse | ForEach-Object { clang-format --dry-run -Werror $_.FullName; if ($LASTEXITCODE -ne 0) { exit 1; } }

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
key: xmake-${{ hashFiles('xmake.lua') }}
2626
restore-keys: |
2727
xmake-
28-
28+
2929
- run: |
3030
xmake repo -u
3131
@@ -34,6 +34,8 @@ jobs:
3434
3535
- run: |
3636
xmake -y
37+
sed -i 's/\"name\": \"legacy-script-engine\"/\"name\": \"legacy-script-engine-${{ matrix.backend }}\"/g' bin/legacy-script-engine/manifest.json
38+
mv bin/legacy-script-engine bin/legacy-script-engine-${{ matrix.backend }}
3739
3840
- uses: actions/upload-artifact@v4
3941
with:

docs/apis/ScriptAPI/Logger.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -115,30 +115,7 @@ The result of the log output is:
115115

116116
### Other Settings
117117

118-
In addition, there are other settings to change the format of the output log
119-
120-
#### Set custom log message headers
121-
122-
`logger.setTitle(title)`
123-
124-
- Parameter:
125-
- title : `String`
126-
Set custom headers
127-
- Return value: none
128-
129-
"Header" is the text at the beginning of the log output entry, which is used to visually distinguish the output source of the log.
130-
By default, message headers are empty by default, i.e. output without headers.
131-
132-
For example: set a custom header as `logger.setTitle("LeviLamina")`
133-
Then the following log output will become like:
134-
135-
```log
136-
20:05:26 ERROR [LeviLamina] Fail to transport the player
137-
```
138-
139-
If you want to turn off the header after setting it, do `logger.setTitle("")`
140-
141-
118+
In addition, there are other settings to change the format of the output log
142119

143120
#### Unified modification log output level
144121

docs/apis/ScriptAPI/Logger.zh.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,6 @@
117117

118118
除此之外,还有其他的一些设置项,用来改变输出日志的格式
119119

120-
#### 设置自定义日志消息标头
121-
122-
`logger.setTitle(title)`
123-
124-
- 参数:
125-
- title : `String`
126-
设置的自定义标头
127-
- 返回值:无
128-
129-
「标头」为日志输出条目开头的文字,用来直观地区分日志的输出源。
130-
默认情况下,消息标头默认为空,即输出时没有标头。
131-
132-
例如:设置自定义标头为`logger.setTitle("LeviLamina")`
133-
则在接下来的日志输出将变为形如:
134-
135-
```log
136-
20:05:26 ERROR [LeviLamina] Fail to transport the player
137-
```
138-
139-
如果在设置之后想要关闭标头,请执行`logger.setTitle("")`
140-
141-
142-
143120
#### 统一修改日志输出等级
144121

145122
`logger.setLogLevel(level)`

docs/apis/ScriptAPI/ScriptHelp.md

Lines changed: 52 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# LLSE - Generic Scripting Interface Documentation
22

3-
> Here are some commonly used **auxiliary functions** , such as plugin registration, output information and asynchronous interfaces, etc.
3+
> Here are some commonly used **auxiliary functions** , such as plugin registration, output information and asynchronous
4+
> interfaces, etc.
45
56
They make it easier and more natural for you to develop scripts and avoid a lot of unnecessary details.
67

@@ -10,124 +11,111 @@ The following APIs add necessary auxiliary interfaces to scripts.
1011

1112
### Output Information To The Console
1213

13-
`log(data1,data2,...)`
14+
`log(data1,data2,...)`
1415

1516
- Parameter:.,
16-
- Variable or data to be output
17-
Can be of any type, and the number of parameters can be any number.
17+
- Variable or data to be output
18+
Can be of any type, and the number of parameters can be any number.
1819
- Return value: none
1920

20-
21-
2221
### Output Color Text
2322

2423
This is an upgraded version of the above function; it supports color output.
2524

2625
`colorLog(color,data1,data2,...)`
2726

28-
- Parameter:
29-
- color : `String`
30-
The color output by this line (code example and effect are as follows)
31-
- data... :
32-
Variable or data to be output
33-
Can be of any type, and the number of parameters can be any number.
34-
- Return value: none
35-
36-
#### Show results:
37-
38-
![ColorLogExample](../../../assets/ColorLog.png)
27+
- Parameter:
28+
- color : `String`
29+
The color output by this line (code example and effect are as follows)
30+
- data... :
31+
Variable or data to be output
32+
Can be of any type, and the number of parameters can be any number.
33+
- Return value: none
3934

35+
#### Show results:
4036

37+
![ColorLogExample](../../../img/ColorLog.png)
4138

4239
### Asynchronous Output
4340

44-
This function returns immediately after the output request is sent, avoiding the blocking time caused by synchronous reading and writing.
41+
This function returns immediately after the output request is sent, avoiding the blocking time caused by synchronous
42+
reading and writing.
4543
The bottom layer has lock protection, different `fastLog` There will be no string phenomenon between.
4644

4745
`fastLog(data1,data2,...)`
4846

49-
- Parameter:
50-
- data... :
51-
Variable or data to be output
52-
Can be of any type, and the number of parameters can be any number
53-
- Return value: none
54-
55-
47+
- Parameter:
48+
- data... :
49+
Variable or data to be output
50+
Can be of any type, and the number of parameters can be any number
51+
- Return value: none
5652

57-
### Delay the execution of a function for a period of time
53+
### Delay the execution of a function for a period of time
5854

5955
`setTimeout(func,msec)`
6056

61-
- Parameter:
57+
- Parameter:
6258

63-
- func : `Function`
64-
The function to be executed.
59+
- func : `Function`
60+
The function to be executed.
6561

66-
- msec : `Integer`
67-
Delay execution time (milliseconds)
62+
- msec : `Integer`
63+
Delay execution time (milliseconds)
6864
- Return value: this task id.
6965
- Return value type: `Integer`
70-
- If it returns `Null`, the task failed.
71-
72-
66+
- If it returns `Null`, the task failed.
7367

7468
### Delay the execution of a code segment for a period of time (eval)
7569

7670
`setTimeout(code,msec)`
7771

78-
- Parameter:
72+
- Parameter:
7973

80-
- code : `String`
81-
The code segment to be executed.
74+
- code : `String`
75+
The code segment to be executed.
8276

83-
- msec : `Integer`
84-
Delay execution time (milliseconds)
85-
- Return value: this task id
77+
- msec : `Integer`
78+
Delay execution time (milliseconds)
79+
- Return value: this task id
8680
- Return value type: `Integer`
87-
- If it returns `Null`, the task creation failed.
88-
89-
81+
- If it returns `Null`, the task creation failed.
9082

9183
### Set period execution function
9284

9385
`setInterval(func,msec)`
9486

95-
- Parameter:
96-
- func : `Function`
97-
The function to be executed
87+
- Parameter:
88+
- func : `Function`
89+
The function to be executed
9890

99-
- msec : `Integer`
100-
Execution interval period (ms)
91+
- msec : `Integer`
92+
Execution interval period (ms)
10193
- Return value: this task id
10294
- Return value type: `Integer`
10395

104-
105-
10696
### Set period execution code segment (eval)
10797

10898
`setInterval(code,msec)`
10999

110-
- Parameter:
111-
- code : `String`
112-
The code to be executed.
100+
- Parameter:
101+
- code : `String`
102+
The code to be executed.
113103

114-
- msec : `Integer`
115-
Execution interval period (ms)
116-
- Return value: this task id
104+
- msec : `Integer`
105+
Execution interval period (ms)
106+
- Return value: this task id
117107
- Return value type: `Integer`
118-
- If it returns `Null`, the task creation failed.
119-
120-
108+
- If it returns `Null`, the task creation failed.
121109

122-
### Cancel Delay/Period Execution Item
110+
### Cancel Delay/Period Execution Item
123111

124112
`clearInterval(taskid)`
125113

126-
- Parameter:
127-
- timerid : `Integer`
128-
The task ID returned by the first few functions
114+
- Parameter:
115+
- timerid : `Integer`
116+
The task ID returned by the first few functions
129117
- Return value: whether the cancellation was successful.
130118
- Return value type: `Boolean`
131-
- If it returns `Null`, the cancellation of the task failed.
119+
- If it returns `Null`, the cancellation of the task failed.
132120

133121

0 commit comments

Comments
 (0)