New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testclient #390
Merged
Merged
Testclient #390
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
275dffc
first testclient version
turleypol 47e890b
movement tests
turleypol 7172b2a
add new item event
turleypol f8f120a
added openconnection docs
turleypol 63808b6
test if the ci can fail to find python3
turleypol 206a6ea
explicit add python3
turleypol 821c3c5
added multiclient support
turleypol d472926
debug logs
turleypol 76a5aac
more debug
turleypol f728184
id out of sync?
turleypol 8dc5783
cleanup fixed typo
turleypol 5f0807c
transfer client id
turleypol c49ff85
send todos to the correct brain
turleypol 5dfa74f
addee core changes
turleypol File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
find_package(Python3 COMPONENTS Interpreter REQUIRED QUIET) | ||
execute_process( | ||
COMMAND ${Python3_EXECUTABLE} ${testdir}/testclient/pyuo/testclient.py | ||
COMMAND ${pol} | ||
COMMAND_ECHO STDOUT | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | ||
RESULT_VARIABLE res | ||
TIMEOUT 120 | ||
) | ||
if(NOT "${res}" STREQUAL "0") | ||
message(SEND_ERROR "${res}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use uo; | ||
use os; | ||
|
||
var res:=GetGlobalProperty("#clientcon"); | ||
if (res) | ||
var clientcon:=GetProcess(res); | ||
clientcon.sendevent(struct{todo:="exit"}); | ||
sleep(1); | ||
endif | ||
var a:=FindAccount("testclient0"); | ||
if (a) | ||
a.deletecharacter(1); | ||
a.delete(); | ||
endif | ||
a:=FindAccount("testclient1"); | ||
if (a) | ||
a.deletecharacter(1); | ||
a.delete(); | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use os; | ||
use uo; | ||
|
||
program clientconn(con, test) | ||
SetGlobalProperty("#clientcon", getpid()); | ||
while (1) | ||
var ev:=Wait_For_Event(10); | ||
if (!ev) | ||
continue; | ||
endif | ||
if (ev.todo) | ||
var json:=PackJson(ev); | ||
syslog(" to client: "+json,0); | ||
con.transmit(json); | ||
if (ev.todo=="exit") | ||
break; | ||
endif | ||
else | ||
syslog(" from client: "+ev,0); | ||
var e:=UnpackJson(ev.value); | ||
test.sendevent(e); | ||
endif | ||
endwhile | ||
endprogram |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//see pyuo/brain.py method typestr() | ||
const EVT_INIT := "init"; | ||
const EVT_HP_CHANGED := "hp_changed"; | ||
const EVT_MANA_CHANGED := "mana_changed"; | ||
const EVT_STAM_CHANGED := "stam_changed"; | ||
const EVT_SPEECH := "speech"; | ||
const EVT_NOTORIETY := "notoriety"; | ||
const EVT_MOVED := "moved"; | ||
const EVT_NEW_MOBILE := "new_mobile"; | ||
const EVT_NEW_ITEM := "new_item"; | ||
|
||
function waitForClient(id, types) | ||
while (1) | ||
var ev:=Wait_For_Event(5); | ||
if (!ev) | ||
return ret_error("no signal received"); | ||
endif | ||
if (ev.id != id || !(ev.type in types)) | ||
continue; | ||
endif | ||
return ev; | ||
endwhile | ||
endfunction | ||
|
||
function waitForClients(types) | ||
while (1) | ||
var ev:=Wait_For_Event(5); | ||
if (!ev) | ||
return ret_error("no signal received"); | ||
endif | ||
if (!(ev.type in types)) | ||
continue; | ||
endif | ||
return ev; | ||
endwhile | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name TestClient | ||
enabled 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use os; | ||
use uo; | ||
|
||
var a:=FindAccount("testclient0"); | ||
if (!a) | ||
a:=CreateAccount("testclient0","pass",1); | ||
endif | ||
a.addcharacter(0); | ||
|
||
var a2:=FindAccount("testclient1"); | ||
if (!a2) | ||
a2:=CreateAccount("testclient1","pass",1); | ||
endif | ||
a2.addcharacter(0); | ||
return 1; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice find