Implement 40250 classic client port
This commit is contained in:
@@ -27,6 +27,9 @@ class FakeClient extends Node:
|
||||
func cube_make(i) -> bool: calls.append(["cube_make", i]); return true
|
||||
func cube_request_result_list(n) -> bool: calls.append(["cube_rlist", n]); return true
|
||||
func cube_request_materials(a, b) -> bool: calls.append(["cube_mats", a, b]); return true
|
||||
func cube_add_item(a, b) -> bool: calls.append(["cube_add", a, b]); return true
|
||||
func cube_delete_item(a) -> bool: calls.append(["cube_del", a]); return true
|
||||
func cube_close() -> bool: calls.append(["cube_close"]); return true
|
||||
func get_inventory() -> Array: return inventory
|
||||
func open_private_shop(sign, items) -> bool: calls.append(["open_shop", sign, items]); return true
|
||||
func close_private_shop() -> bool: calls.append(["close_shop"]); return true
|
||||
@@ -85,17 +88,43 @@ func _run() -> void:
|
||||
fc.cube = {"open": true, "npc_vnum": 20383, "results": fc.cube["results"], "recipes": [
|
||||
{"result_vnum": 72723, "gold": 120000, "material_groups": [
|
||||
[{"vnum": 125, "count": 1}], [{"vnum": 555, "count": 5}]]}]}
|
||||
fc.inventory = [{"cell": 3, "vnum": 125, "count": 1}, {"cell": 4, "vnum": 555, "count": 5}]
|
||||
(recipe_btns[0] as Button).pressed.emit()
|
||||
await process_frame
|
||||
_ck(_has_call(fc, "cube_mats", func(c): return c[1] == 0), "cube: select → request materials(0)")
|
||||
var gold_lbl := _find(cu._mat, "Label", func(l): return String(l.text).contains("120000"))
|
||||
_ck(gold_lbl != null, "cube: materials panel shows gold 120000")
|
||||
_ck(not cu._make_btn.disabled, "cube: 制作 enabled after select")
|
||||
var bag_btn := _find(cu._mat, "Button", func(b): return String(b.text).begins_with("+ bag[3]"))
|
||||
_ck(bag_btn != null, "cube: inventory item offered for material slot")
|
||||
if bag_btn:
|
||||
bag_btn.pressed.emit()
|
||||
_ck(_has_call(fc, "cube_add", func(c): return c[1] == 0 and c[2] == 3),
|
||||
"cube: inventory item → cube_add_item(slot=0, cell=3)")
|
||||
_ck(int(cu._cube_slots.get(0, -1)) == 3, "cube: local material slot tracks inventory cell")
|
||||
var del_btn := _find(cu._mat, "Button", func(b): return String(b.text) == "삭제")
|
||||
_ck(del_btn != null, "cube: material slot has delete button")
|
||||
if del_btn:
|
||||
del_btn.pressed.emit()
|
||||
_ck(_has_call(fc, "cube_del", func(c): return c[1] == 0), "cube: delete button → cube_delete_item(slot=0)")
|
||||
_ck(cu._make_btn.disabled, "cube: 制作 disabled while required material is missing")
|
||||
# 重新放入两个配方材料后才允许制作。
|
||||
var bag_btn2 := _find(cu._mat, "Button", func(b): return String(b.text).begins_with("+ bag[3]"))
|
||||
if bag_btn2:
|
||||
bag_btn2.pressed.emit()
|
||||
var bag_btn3 := _find(cu._mat, "Button", func(b): return String(b.text).begins_with("+ bag[4]"))
|
||||
if bag_btn3:
|
||||
bag_btn3.pressed.emit()
|
||||
_ck(not cu._make_btn.disabled, "cube: 制作 enabled after all required materials are slotted")
|
||||
cu._make_btn.pressed.emit()
|
||||
_ck(_has_call(fc, "cube_make", func(c): return c[1] == 0), "cube: 制作 → cube_make(0)")
|
||||
fc.cube_result.emit(72723, 1, true)
|
||||
await process_frame
|
||||
_ck(String(cu._status.text).contains("성공") or String(cu._status.text) != "", "cube: result shown")
|
||||
var close_btn := _find(cu._root, "Button", func(b): return String(b.text) == "닫기")
|
||||
_ck(close_btn != null, "cube: close button present")
|
||||
if close_btn:
|
||||
close_btn.pressed.emit()
|
||||
_ck(_has_call(fc, "cube_close", func(_c): return true), "cube: close button → cube_close")
|
||||
fc.cube_closed.emit()
|
||||
await process_frame
|
||||
_ck(not cu.is_open(), "cube: hides on cube_closed")
|
||||
|
||||
Reference in New Issue
Block a user