xaroth / libottdadmin2 Goto Github PK
View Code? Open in Web Editor NEWA small library for the Admin Port interface for OpenTTD
License: Other
A small library for the Admin Port interface for OpenTTD
License: Other
The lib seems to throw an exception when receiving a ServerClientInfo packet for the server (Client ID 1). The joindate is not a valid input for gamedate_to_datetime()
Error message: date value out of range
:)
Currently, when receiving a servercmdnames packet, libotttdadmin2 will return the packet as below:
INFO 2013-09-28T17:24:54 supybot soaptest - (<PacketID: 122 :: ServerCmdNames>, {'commands': {0: '\x01', 25441: '\x01', 30018: '\x01', 21093: '\x01', 1: '\x01', 25938: '\x01', 24943: '\x01', 24914: '\x01', 24946: '\x01', 28530: '\x01'}})
INFO 2013-09-28T17:24:54 supybot soaptest - (<PacketID: 122 :: ServerCmdNames>, {'commands': {25964: '\x01G', 24933: '\x01G', 71: '\x01G'}})
Expected output would be a dict with for instance: {'commands': {0:'CmdBuildRailroadTrack', 1:CmdRemoveRailroadTrack}} etc. Below is the raw stream output:
INFO 2013-09-28T21:20:51 supybot soaptest - (122, '\x01\x00\x00CmdBuildRailroadTrack\x00\x01\x01\x00CmdRemoveRailroadTrack\x00\x01\x02\x00CmdBuildSingleRail\x00\x01\x03\x00CmdRemoveSingleRail\x00\x01\x04\x00CmdLandscapeClear\x00\x01\x05\x00CmdBuildBridge\x00\x01\x06\x00CmdBuildRailStation\x00\x01\x07\x00CmdBuildTrainDepot\x00\x01\x08\x00CmdBuildSingleSignal\x00\x01\t\x00CmdRemoveSingleSignal\x00\x01\n\x00CmdTerraformLand\x00\x01\x0b\x00CmdBuildObject\x00\x01\x0c\x00CmdBuildTunnel\x00\x01\r\x00CmdRemoveFromRailStation\x00\x01\x0e\x00CmdConvertRail\x00\x01\x0f\x00CmdBuildRailWaypoint\x00\x01\x10\x00CmdRenameWaypoint\x00\x01\x11\x00CmdRemoveFromRailWaypoint\x00\x01\x12\x00CmdBuildRoadStop\x00\x01\x13\x00CmdRemoveRoadStop\x00\x01\x14\x00CmdBuildLongRoad\x00\x01\x15\x00CmdRemoveLongRoad\x00\x01\x16\x00CmdBuildRoad\x00\x01\x17\x00CmdBuildRoadDepot\x00\x01\x18\x00CmdBuildAirport\x00\x01\x19\x00CmdBuildDock\x00\x01\x1a\x00CmdBuildShipDepot\x00\x01\x1b\x00CmdBuildBuoy\x00\x01\x1c\x00CmdPlantTree\x00\x01\x1d\x00CmdBuildVehicle\x00\x01\x1e\x00CmdSellVehicle\x00\x01\x1f\x00CmdRefitVehicle\x00\x01 \x00CmdSendVehicleToDepot\x00\x01!\x00CmdMoveRailVehicle\x00\x01"\x00CmdForceTrainProceed\x00\x01#\x00CmdReverseTrainDirection\x00\x01$\x00CmdClearOrderBackup\x00\x01%\x00CmdModifyOrder\x00\x01&\x00CmdSkipToOrder\x00\x01\'\x00CmdDeleteOrder\x00\x01(\x00CmdInsertOrder\x00\x01)\x00CmdChangeServiceInt\x00\x01*\x00CmdBuildIndustry\x00\x01+\x00CmdSetCompanyManagerFace\x00\x01,\x00CmdSetCompanyColour\x00\x01-\x00CmdIncreaseLoan\x00\x01.\x00CmdDecreaseLoan\x00\x01/\x00CmdWantEnginePreview\x00\x010\x00CmdRenameVehicle\x00\x011\x00CmdRenameEngine\x00\x012\x00CmdRenameCompany\x00\x013\x00CmdRenamePresident\x00\x014\x00CmdRenameStation\x00\x015\x00CmdRenameDepot\x00\x016\x00CmdPlaceSign\x00\x017\x00CmdRenameSign\x00\x018\x00CmdTurnRoadVeh\x00\x019\x00CmdPause\x00\x01:\x00CmdBuyShareInCompany\x00\x01;\x00CmdSellShareInCompany\x00\x01<\x00CmdBuyCompany\x00\x01=\x00CmdFoundTown\x00\x01>\x00CmdRenameTown\x00\x01?\x00CmdDoTownAction\x00\x01@\x00CmdTownCargoGoal\x00\x01A\x00CmdTownGrowthRate\x00\x01B\x00CmdTownSetText\x00\x01C\x00CmdExpandTown\x00\x01D\x00CmdDeleteTown\x00\x01E\x00CmdOrderRefit\x00\x01F\x00CmdCloneOrder\x00\x00')
INFO 2013-09-28T21:20:51 supybot soaptest - (122, '\x01G\x00CmdClearArea\x00\x01H\x00CmdMoneyCheat\x00\x01I\x00CmdChangeBankBalance\x00\x01J\x00CmdBuildCanal\x00\x01K\x00CmdCreateSubsidy\x00\x01L\x00CmdCompanyCtrl\x00\x01M\x00CmdCustomNewsItem\x00\x01N\x00CmdCreateGoal\x00\x01O\x00CmdRemoveGoal\x00\x01P\x00CmdSetGoalText\x00\x01Q\x00CmdSetGoalProgress\x00\x01R\x00CmdSetGoalCompleted\x00\x01S\x00CmdGoalQuestion\x00\x01T\x00CmdGoalQuestionAnswer\x00\x01U\x00CmdCreateStoryPage\x00\x01V\x00CmdCreateStoryPageElement\x00\x01W\x00CmdUpdateStoryPageElement\x00\x01X\x00CmdSetStoryPageTitle\x00\x01Y\x00CmdShowStoryPage\x00\x01Z\x00CmdRemoveStoryPage\x00\x01[\x00CmdLevelLand\x00\x01\\\x00CmdBuildLock\x00\x01]\x00CmdBuildSignalTrack\x00\x01^\x00CmdRemoveSignalTrack\x00\x01_\x00CmdGiveMoney\x00\x01`\x00CmdChangeSetting\x00\x01a\x00CmdChangeCompanySetting\x00\x01b\x00CmdSetAutoReplace\x00\x01c\x00CmdCloneVehicle\x00\x01d\x00CmdStartStopVehicle\x00\x01e\x00CmdMassStartStopVehicle\x00\x01f\x00CmdAutoreplaceVehicle\x00\x01g\x00CmdDepotSellAllVehicles\x00\x01h\x00CmdDepotMassAutoReplace\x00\x01i\x00CmdCreateGroup\x00\x01j\x00CmdDeleteGroup\x00\x01k\x00CmdRenameGroup\x00\x01l\x00CmdAddVehicleGroup\x00\x01m\x00CmdAddSharedVehicleGroup\x00\x01n\x00CmdRemoveAllVehiclesGroup\x00\x01o\x00CmdSetGroupReplaceProtection\x00\x01p\x00CmdMoveOrder\x00\x01q\x00CmdChangeTimetable\x00\x01r\x00CmdSetVehicleOnTime\x00\x01s\x00CmdAutofillTimetable\x00\x01t\x00CmdSetTimetableStart\x00\x01u\x00CmdOpenCloseAirport\x00\x00')
File "/home/bot/bots/bin/plugins/Soap/plugin.py", line 30, in
from libottdadmin2.trackingclient import TrackingAdminClient as AClient
File "/usr/lib/python2.7/site-packages/libottdadmin2/trackingclient.py", line 167, in
class TrackingAdminClient(AdminConnection):
File "/usr/lib/python2.7/site-packages/libottdadmin2/trackingclient.py", line 168, in TrackingAdminClient
_settable_args = AdminConnection._settable_args + ['timeout', 'poll_once']
AttributeError: type object 'AdminConnection' has no attribute '_settable_args'
I get above error when trying
from libottdadmin2.trackingclient import TrackingAdminClient as AClient
class SoapClient(AClient):
Doing:
from libottdadmin2.client import AdminClient as AClient
class SoapClient(AClient):
Works fine, even though AdminClient uses a near-identical line and accepts it.
Reproducability: 100%
Occurs with: Soap and the included bin/openttd-admin.py
When shutting down the game (for instance using 'rcon quit'), the disconnect event seems to fire twice instead of once. This results in the disconnected message being shown twice in the openttd-admin console or (when using soap) the irc channel.
"Income" in companyInfo packet is change in money for the calendar year, ie profit.
Is this raw data straight from the openttd adminport rather than manipulation by libottdadmin?
Is the latest commit working or is it WIP?
See below traceback:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 761, in run
self.__target(_self.__args, *_self.__kwargs)
File "/home/bot/bots/bin/plugins/Soap/plugin.py", line 92, in _pollThread
packet = conn.recv_packet()
File "/usr/lib/python2.7/site-packages/libottdadmin2/adminconnection.py", line 203, in recv_packet
plen = self.recv(self.format_packetlen.size)
error: [Errno 104] Connection reset by peer
I've not been able to reproduce this error, but it happened when the server in question was in the process of crashing. During this the connection seems to have gotten reset at a point where loa doesn't catch it.
Crashing openttd on purpose does not seem to reproduce this, the disconnect event fires as it should.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.