polserver/testsuite/testclient/pyuo
Fernando Rozenblit 721e4fefe0
Refactor Item states to be explicit instead of implicit (#919)
* extend tests

* more tests for world save

* explicit handle the special layers in wornitem

* add Location variant and relocate() methods

* refactor GottenItem and ensure Chr, not wornitems, is saved

* deflake escript watch test

* dropitem and undo refactoring

* uomod changes

* add more item tests (buy, sell, hair...)

* use location for undoing trade container properly

* rewrite loaddata to use relocate, fixing startup crashes

* do remaining location changes

* fix CI tests

* remove container pointer from item and add wearer() reference

* remove layer writes and explicit intrinsic weapon handling

* add preparing state for fresh items without serial number

* move wornitems to detached state only when it has a serial number

* load corpse items into the correct layer

* do not set a layer on load before the item is equipped

* add more tests to equipped and intrinsic items

* remove layer and substitute with the location()

* add core-changes summary

* mark items as being worn on corpse if they only moved within the corpse

* block Preparing from being reached, just to be sure

* added integrity sweep check

* Reduce direect changes to item location

* Add Item::move_into() and rewrite calling sites

* Fix container slots

* get rid of the slot_index on the item, because Location() already has it

* fix race in test leading to macos issues

* fix dangling pointer

* remove corpse can_equip_list and rely on the GottenItem rules to dress the corpse again

* let item->destroy() detach the item

* make integrity checks fail the tests

* use place_at(item, newpos) for changing item position InWorld

* add boat test for item moved out of boat that should not be visible anymore

* use place_at() in more places

* ensure CreateItemAtLocation really does

* fix Claude instructions

* remove state we didn't need

* fine tuning

* reduce test flakiness
2026-08-10 18:17:53 +00:00
..
pyuo Refactor Item states to be explicit instead of implicit (#919) 2026-08-10 18:17:53 +00:00
.gitignore Testclient (#390) 2021-03-25 19:26:09 +01:00
LICENSE Testclient (#390) 2021-03-25 19:26:09 +01:00
README.md Testclient (#390) 2021-03-25 19:26:09 +01:00
terminal.py made ui version of the testclient work again (#837) 2026-01-02 14:00:46 +01:00
testclient.cfg Testclient (#390) 2021-03-25 19:26:09 +01:00
testclient.py Refactor Item states to be explicit instead of implicit (#919) 2026-08-10 18:17:53 +00:00

Build Status

pyuo

A text-only UO client written in Python Copyright (C) 2015-2016 Gabriele Tozzi

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

System Requirements

  • Python 3.4+

Archive content

Examples:

  • spary.py is a very simple draft of a script using this client
  • terminal.py is curses-based interactive command line client

The library itself is contained in the pyuo folder:

  • brain.py contains the classes useful for writing your scripts
  • client.py contains the client classes

How to use this stuff

Just start terminal.py and play with it or create your own script.

Here is a very minimal draft:

from pyuo import client
from pyuo import brain

class MyBrain(brain.Brain):
    ''' Override the base brain's methods to do your fancy things '''

if __name__ == '__main__':
    # Create a new client
    client = client.Client()
    # Connect to the server, get list of available servers
    servers = cclient.connect(ip_or_host, port, username, password)
    # Select first server, get list of characters
    chars = client.selectServer(servers[0]['idx'])
    # Select first character
    client.selectCharacter(chars[0]['name'], 0)
    # Finally start the main ai loop and enter it
    MyBrain(client)