first commit, long overdue
deez
This commit is contained in:
commit
54b9012a47
79 changed files with 2516 additions and 0 deletions
123
01 - Menus/04 - Modules/modules_skill.gd
Normal file
123
01 - Menus/04 - Modules/modules_skill.gd
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
extends Control
|
||||
|
||||
|
||||
var item # e.g. grondir
|
||||
var category # e.g. character
|
||||
var module # e.g. trait
|
||||
var items # e.g. ["Undergrounder","Tough"]
|
||||
|
||||
var cost:Array = [0,0,0,0]
|
||||
var difficulty:int = 0
|
||||
var action:String = ""
|
||||
var success:String = ""
|
||||
var failure:String = ""
|
||||
var duration:int = 0
|
||||
var ends_on:int = 0
|
||||
var target:Array = []
|
||||
var stat:Array = []
|
||||
var challenge:String = ""
|
||||
|
||||
var config = ConfigFile.new()
|
||||
var item_filter = ""
|
||||
var targets1 = ""
|
||||
|
||||
func _enter_tree() -> void:
|
||||
config = ConfigFile.new()
|
||||
config.load("res://02 - Configurations/" + category + ".ini")
|
||||
#print(str(config.get_value(item,"cost")))
|
||||
cost = config.get_value(item,"cost",[0,0,0,0])
|
||||
difficulty = config.get_value(item,"difficulty",0)
|
||||
action = config.get_value(item,"action","")
|
||||
success = config.get_value(item,"success","")
|
||||
failure = config.get_value(item,"failure","")
|
||||
duration = config.get_value(item,"duration",0)
|
||||
ends_on = config.get_value(item,"ends_on",0)
|
||||
target = config.get_value(item,"target",[""])
|
||||
stat = config.get_value(item,"stat",[""])
|
||||
var j = 0
|
||||
for i in %cost.get_children():
|
||||
i.text = str(cost[j])
|
||||
j = j + 1
|
||||
%difficulty.text = str(difficulty)
|
||||
%action.text = action
|
||||
%success.text = success
|
||||
%failure.text = failure
|
||||
%duration.text = str(duration)
|
||||
%ends_on.select(ends_on)
|
||||
%target.item_count = 0
|
||||
for i in target:
|
||||
%target.add_item(i)
|
||||
config = ConfigFile.new()
|
||||
config.load("res://02 - Configurations/stat.ini")
|
||||
for i in stat:
|
||||
%stat.add_item(i)
|
||||
|
||||
func _on_body_text_changed(new_text: String) -> void:
|
||||
cost[0] = int(new_text)
|
||||
print(str(cost))
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_communication_text_changed(new_text: String) -> void:
|
||||
cost[1] = int(new_text)
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_mind_text_changed(new_text: String) -> void:
|
||||
cost[2] = int(new_text)
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_soul_text_changed(new_text: String) -> void:
|
||||
cost[3] = int(new_text)
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
func save():
|
||||
config = ConfigFile.new()
|
||||
config.load("res://02 - Configurations/" + category + ".ini")
|
||||
config.set_value(item,"cost",cost)
|
||||
config.set_value(item,"difficulty",difficulty)
|
||||
config.set_value(item,"action",action)
|
||||
config.set_value(item,"success",success)
|
||||
config.set_value(item,"failure",failure)
|
||||
config.set_value(item,"duration",duration)
|
||||
config.set_value(item,"ends_on",ends_on)
|
||||
config.set_value(item,"target",target)
|
||||
config.set_value(item,"stat",stat)
|
||||
config.save("res://02 - Configurations/" + category + ".ini")
|
||||
%http.request("https://ttrpg.marty.tf/hi2/",["Content-Type: application/json"],HTTPClient.METHOD_PUT,"hi2")
|
||||
|
||||
|
||||
func _on_difficulty_text_changed(new_text: String) -> void:
|
||||
difficulty = int(new_text)
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_action_text_changed() -> void:
|
||||
action = %action.text
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_success_text_changed() -> void:
|
||||
success = %success.text
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_failure_text_changed() -> void:
|
||||
failure = %failure.text
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_duration_text_changed(new_text) -> void:
|
||||
duration = int(new_text)
|
||||
print(str(duration))
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_ends_on_item_selected(index: int) -> void:
|
||||
ends_on = index
|
||||
get_parent().get_parent().show_save()
|
||||
|
||||
|
||||
func _on_http_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
print(str(response_code))
|
||||
Loading…
Add table
Add a link
Reference in a new issue