Skip to content

Commit

Permalink
add README
Browse files Browse the repository at this point in the history
  • Loading branch information
koiNoCirculation committed Jul 28, 2024
1 parent 1a31643 commit 5db51f9
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 7 deletions.
Binary file added 61abcf499684b5da450be7fe32a58936.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# GTNH 赛博尼哥监控手机端
目前本APP专供GTNH,版本2.6.0,包括BoxPluxPlus和Twisted Space Technology。
当GTNH进入无聊的挂机大后期的时候,你是否曾有过这种想法?
"啊,要是能用网页或者手机监控服务器里面干活的电子倪哥,看他们闲了就多下几单让他们干活".
本APP将提供该能力。
使用该APP需要让服主在服务器安装![倪哥监控器](https://github.com/koiNoCirculation/AEMobile)mod.
![尼哥方块](screenshot-block.png)
在ME控制器放下该方块后,会在聊天栏发送你的访问密码。
![放在ME控制器边上](screenshot-me.png)
![](password.png)
APP启动界面,输入服务器地址(不带端口)和你的密码,可以点击测试连接来验证是否正确。
![](start.png)
点击获取所有AE网络,然后从下拉菜单中选取你刚才放下的监控器方块坐标(一般只有一个吧,谁会监控子网啊!),之后就可以点击保存设置。
![alt text](mainnet.png)
主网物品,左上角按钮为正序/倒序排序,排序按modid/数量/物品名称顺序,显示可合成/所有物品,功能和AE类似。
排序功能反应比较慢,因为主网物品太多了,可能需要在两个页面间切换来触发控件刷新,以后再想办法优化吧。
链接图标为绿代表和服务器通信成功,红色代表断开,点击该图标可以刷新网络访问。
可合成物品右下角有锤子标记,点进去就可以开始合成计划。
![](bb3c7e9dd01a5f76924e65f363f25568.png)
合成CPU监控
![](61abcf499684b5da450be7fe32a58936.png)
合成计划
![](plan.png)
你可能会发现家里多了很多单元,这不是一个错误。因为GTNH NEI没有提供纹理导出的工具,所以流体只能用单元代替显示了。
24 changes: 17 additions & 7 deletions Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Settings({ route, navigation }) {
Toast.show({content: "请从下拉菜单里面选择一个网络作为你的主网", icon: succIcon()});
}
} catch (e) {
Toast.show({content: "请检查网络连接是否正常" + e, icon: failIcon()});
Toast.show({content: '请检查网络连接是否正常或者地址是否输错', icon: failIcon()});
}
} else {
Toast.show({content: "请先填入服务器IP和密码。进入游戏后在ME控制器旁放置倪哥监控器获得密码。", icon: (failIcon())})
Expand Down Expand Up @@ -138,11 +138,11 @@ export default function Settings({ route, navigation }) {
Toast.show({content: "测试成功", icon: succIcon()})
//alert('测试成功');
} else {
Toast.show({content: '测试失败,请检查地址', icon: failIcon()});
Toast.show({content: '请检查网络连接是否正常或者地址是否输错', icon: failIcon()});
}
}).catch(e => {
console.log(url)
Toast.show({content: '请检查网络连接是否正常', icon: failIcon()});
Toast.show({content: '请检查网络连接是否正常或者地址是否输错', icon: failIcon()});
})
})
}}>测试连接</Button>
Expand All @@ -153,10 +153,20 @@ export default function Settings({ route, navigation }) {

<Button type="primary" onPress={() => {
console.log("press");
SecureStore.setItem('server.ip', ip);
SecureStore.setItem('server.scheme', scheme);
SecureStore.setItem("user.uuid", uuid);
SecureStore.setItem("user.ae_main_net", JSON.stringify(network));
try {
SecureStore.setItem('server.ip', ip);
SecureStore.setItem('server.scheme', scheme);
SecureStore.setItem("user.uuid", uuid);
if(network == null) {
Toast.show({content: '保存失败,请在下拉菜单选择一个有效的主网', icon: failIcon()});
return;
} else {
SecureStore.setItem("user.ae_main_net", JSON.stringify(network));
}
} catch(e) {
Toast.show({content: '保存失败,请在下拉菜单选择一个有效的主网', icon: failIcon()});
return;
}
if(navigation.canGoBack()) {
navigation.goBack();
} else {
Expand Down
Binary file added bb3c7e9dd01a5f76924e65f363f25568.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions buildfluiddb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import sqlite3
import csv
import base64
con = sqlite3.connect('itempanel.db')
cur = con.cursor()
cur.execute("""
create table if not exists item_panel (
id integer primary key,
item_name string,
item_id string,
item_meta string,
has_nbt string,
dname string,
icon string
);
""")
cur.execute("create index idx_item_name on item_panel(item_name);")
cur.execute("create index idx_item_id on item_panel(item_id);")
cur.execute("create index idx_item_dname on item_panel(dname);")
cur.execute("create index idx_item_meta on item_panel(item_meta);")
illegalchars = list(map(lambda x: chr(x), [34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47]))
import os
with open('itempanel.csv','r') as csvf:
reader = csv.DictReader(csvf)
data = []
i = 0
for row in reader:
item_name = row['Item Name']
item_id = row['Item ID']
item_meta = row['Item meta']
has_nbt = row['Has NBT']
dname = row['Display Name']
fname = dname
for ill in illegalchars:
fname = fname.replace(ill, '_')
path = f'itempanel_icons/{fname}.png'
if not os.path.exists(path):
path = f'itempanel_icons/_{fname}_.png'
if os.path.exists(path):
with open(path, 'rb') as icon:
data.append({'id':i, 'item_name': item_name, 'item_id':item_id, 'item_meta':item_meta, 'has_nbt': has_nbt, 'dname': dname, 'icon': base64.b64encode(icon.read())})
else:
print(f'file not found:{fname}')
data.append({'id':i, 'item_name': item_name, 'item_id':item_id, 'item_meta':item_meta, 'has_nbt': has_nbt, 'dname': dname, 'icon': None})
i = i + 1
cur.executemany("insert into item_panel values(:id, :item_name, :item_id, :item_meta, :has_nbt, :dname, :icon)", data)
print(data[0])
con.commit()
cur.close()
con.close()

82 changes: 82 additions & 0 deletions builditemdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import sqlite3
import os
import csv
import base64

illegalChars = [ 34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47 ]
def replaceIllegalChars(s):
for c in illegalChars:
s = s.replace(chr(c), '_')
return s

os.remove("itempanel.db")
db=sqlite3.connect("itempanel.db")
cur = db.cursor()
cur.execute("""
create table if not exists item_panel (
id integer primary key,
item_name string,
item_id string,
item_meta string,
has_nbt string,
dname string,
icon string
);
""")
cur.execute(
"""
create table if not exists fluid_container (
id integer primary key,
fluid_name string,
item string,
meta string,
container_display_name string,
amount integer);
""")
cur.execute("create index idx_item_name on item_panel(item_name)")
cur.execute("create index idx_item_id on item_panel(item_id)")
cur.execute("create index idx_item_meta on item_panel(item_meta)")

with open("itempanel.csv") as csvf:
reader = csv.DictReader(csvf)
data = []
i = 0
for row in reader:
d = {'id':i}
dname = row['Display Name']
d['dname'] = dname
d['item_name'] = row['Item Name']
d['item_id'] = row['Item ID']
d['item_meta'] = row['Item meta']
d['has_nbt'] = row['Has NBT']
filename = replaceIllegalChars(dname) + '.png'
try:
with open('itempanel_icons/' + filename, 'rb') as f:
d['icon'] = base64.b64encode(f.read())
except:
print(d)
print(filename)
i = i + 1
data.append(d)
cur.executemany("insert into item_panel values(:id, :item_name, :item_id, :item_meta, :has_nbt, :dname, :icon)", data)
db.commit()


with open("fluidcontainer.csv") as csvf:
reader = csv.DictReader(csvf)
data = []
i = 0
f = {}
for row in reader:
d = {'id':i}
c = row['Fluid']
if c not in f:
f[c] = [row['Filled Container Display Name'], row['Amount'], row['Filled Container'][2:],row['Filled Container Item']]
elif 'bartworks' in f[c][3] and '胶囊' in f[c][0]:
print(f[c][0])
f[c] = [row['Filled Container Display Name'], row['Amount'], row['Filled Container'][2:],row['Filled Container Item']]
for fluid in f.keys():
data.append({'id':i, 'fluid_name':fluid, 'item':f[fluid][3], 'meta':f[fluid][2].split("@")[1], 'dname':f[fluid][0], 'amount':f[fluid][1]})
i = i +1
cur.executemany("insert into fluid_container values(:id, :fluid_name, :item, :meta, :dname, :amount)", data)
db.commit()
Binary file added mainnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5db51f9

Please sign in to comment.