DiscoveryGC / FLHook

FLHook for Discovery Freelancer
Other
28 stars 33 forks source link

feat(base): outputing chosen base items to JSON #160

Closed dd84ai closed 1 year ago

dd84ai commented 3 years ago

outputting base items to JSON with key shop which players are wishing to show

by default all items are private with /shop public #NumberInShop, item can become public /shop private #NumberInShop, in order to hide item back

Also added for output money which is needed in order to decide if the base is capable to buy things it made public

dd84ai commented 3 years ago

Shouldn't you also be adding this to the list of commands you can't run with viewshop?

Uh, yeah!

dd84ai commented 3 years ago

Made dummy check with trying to load resulting JSON through Python, it still works. silly in game check performed as well

dsyalex commented 1 year ago

Ready for merge once author gives the go-ahead

dd84ai commented 1 year ago

manual CI is running:

dd84ai commented 1 year ago

New CI run: Diff

user@WIN-GHKN5G5H3L9 MINGW64 /c/stats $ python Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

exit()

  • write file test.py
    
    import json

with open("base_status.json") as file: data = file.read()

parsed = json.loads(data) print(parsed)


$ python test.py
{'timestamp': '20230618T201400', 'bases': {'TB1929': {'passwords': ['hastesucks'], 'shop': {'quantity': 100, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Aluminium'}, 'affiliation': 'No Affiliation', 'type': 'legacy', 'solar': 'legacy', 'loadout': 'legacy', 'level': 1, 'money': 999900, 'health': 4.9943, 'defensemode': 1}}}
- shutting down server
- CI has run succesfully ✅ 
dd84ai commented 1 year ago

git checkout . erasing target platform changes

-    <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+    <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>^
dd84ai commented 1 year ago

New Build run:

dd84ai commented 1 year ago

New build run:

dd84ai commented 1 year ago

New CI test run:

Also after reconnect, items dissapear from shop 😢

dd84ai commented 1 year ago

Sold gold and food to base receiving user@WIN-GHKN5G5H3L9 MINGW64 /c/stats $ python test.py {'timestamp': '20230618T222400', 'bases': {'TB1929': {'passwords': ['hastesucks'], 'shop': {'quantity': 123, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Gin'}, 'affiliation': 'No Affiliation', 'type': 'legacy', 'solar': 'legacy', 'loadout': 'legacy', 'level': 1, 'money': 999047, 'health': 4.8233, 'defensemode': 1}}} and broken /base interface 🔴

dd84ai commented 1 year ago

CI rerun adding dsacesrv.dll back to folder, fixed most of issues. Except incorrect JSON is still created. messed up data of all shop items into single dictionary with overriding keys to each other 🔴

dd84ai commented 1 year ago

https://github.com/DiscoveryGC/FLHook/pull/160/commits/98479250ca12407cb78846aa8d799716db9e1344 Fixed bugs image

user@WIN-GHKN5G5H3L9 MINGW64 /c/stats
$ python test.py
{'timestamp': '20230618T232200', 'bases': {'TB1929': {'passwords': ['hastesucks'], 'shop_items': [{'quantity': 60, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Silencer CM Flare'}, {'quantity': 100, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': True, 'item': 'Gadolinium'}, {'quantity': 1, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Coalition Thruster'}, {'quantity': 1, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Adv. Flashpoint Turret'}, {'quantity': 123, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Food Rations'}, {'quantity': 429, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Gold'}, {'quantity': 120, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Nanobots'}, {'quantity': 100, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Aluminium'}, {'quantity': 2, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Light Mining Array'}, {'quantity': 123, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'item': 'Gin'}], 'affiliation': 'No Affiliation', 'type': 'legacy', 'solar': 'legacy', 'loadout': 'legacy', 'level': 1, 'money': 998941, 'health': 4.8113, 'defensemode': 1}}}

State is succesfully changed to Public, saved for server restart (persistent) and succesfully oouputed to json and python is able to parse it correctly

CI passes ✅

dd84ai commented 1 year ago

CI rerun for rebased branch.

dd84ai commented 1 year ago

Manual CI:

dd84ai commented 1 year ago

Manual CI:

$ python test.py
{'timestamp': '20230619T164500', 'bases': {'TB1929': {'passwords': ['hastesucks'], 'shop_items': [{'quantity': 60, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Silencer CM Flare', 'name_id': 501587, 'id': 2211913230, 'nickname': 'ge_s_cm_04_ammo'}, {'quantity': 100, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': True, 'name': 'Gadolinium', 'name_id': 505870, 'id': 2222120073, 'nickname': 'commodity_gadolinium'}, {'quantity': 1, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Coalition Thruster', 'name_id': 520454, 'id': 2394587014, 'nickname': 'dsy_thruster_coal'}, {'quantity': 1, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': True, 'name': 'Adv. Flashpoint Turret', 'name_id': 263498, 'id': 2759792129, 'nickname': 'co_turret01_mark03'}, {'quantity': 123, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Food Rations', 'name_id': 261622, 'id': 2863847232, 'nickname': 'commodity_food'}, {'quantity': 429, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Gold', 'name_id': 261610, 'id': 2866206539, 'nickname': 'commodity_gold'}, {'quantity': 120, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Nanobots', 'name_id': 263746, 'id': 2911012559, 'nickname': 'ge_s_repair_01'}, {'quantity': 100, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Aluminium', 'name_id': 505800, 'id': 2958831363, 'nickname': 'commodity_aluminium'}, {'quantity': 2, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Light Mining Array', 'name_id': 500189, 'id': 3103125006, 'nickname': 'hf_mining_gun'}, {'quantity': 123, 'price': 1, 'min_stock': 100000, 'max_stock': 100000, 'is_public': False, 'name': 'Gin', 'name_id': 505874, 'id': 3207769547, 'nickname': 'commodity_gin'}], 'affiliation': 'No Affiliation', 'type': 'legacy', 'solar': 'legacy', 'loadout': 'legacy', 'level': 1, 'money': 998941, 'health': 4.6325, 'defensemode': 1, 'shieldstate': 0}}}

✅ still green