mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Implemented buying from a vendor. Also fixed opening the spellbook from the last commit. Updated ESS to get backend support for buying items.
This commit is contained in:
parent
f68e3e1054
commit
8648d5556c
2
HEADS
2
HEADS
@ -1 +1 @@
|
||||
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "cf95db4a7571b443ade0b8fa1149354ffd044439"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "6f8e54879bcab6c628c761b545f6df4cd7534a07"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}}
|
||||
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "bbe9df3ad6dc35146e4c985d92e7abe003062083"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "6f8e54879bcab6c628c761b545f6df4cd7534a07"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}}
|
@ -5,7 +5,6 @@
|
||||
[ext_resource path="res://scripts/items/ItemTemplateGD.gd" type="Script" id=3]
|
||||
[ext_resource path="res://modules/entity_classes/naturalist/spells/14_amplify_pain_rank_1.tres" type="Spell" id=4]
|
||||
|
||||
|
||||
[resource]
|
||||
resource_name = "Chest of the Infinite Wisdom"
|
||||
id = 3
|
||||
@ -17,21 +16,4 @@ model_visual = ExtResource( 1 )
|
||||
icon = ExtResource( 2 )
|
||||
use_spell = ExtResource( 4 )
|
||||
text_name = "Chest of the Infinite Wisdom"
|
||||
item_stat_modifier_count = 2
|
||||
Modifiers_0/stat_id = 8
|
||||
Modifiers_0/min_base_mod = 1000.0
|
||||
Modifiers_0/max_base_mod = 0.0
|
||||
Modifiers_0/min_bonus_mod = 1000.0
|
||||
Modifiers_0/max_bonus_mod = 0.0
|
||||
Modifiers_0/min_percent_mod = 0.0
|
||||
Modifiers_0/max_percent_mod = 0.0
|
||||
Modifiers_0/scaling_factor = 1.0
|
||||
Modifiers_1/stat_id = 7
|
||||
Modifiers_1/min_base_mod = 1000.0
|
||||
Modifiers_1/max_base_mod = 0.0
|
||||
Modifiers_1/min_bonus_mod = 1000.0
|
||||
Modifiers_1/max_bonus_mod = 0.0
|
||||
Modifiers_1/min_percent_mod = 0.0
|
||||
Modifiers_1/max_percent_mod = 0.0
|
||||
Modifiers_1/scaling_factor = 1.0
|
||||
script = ExtResource( 3 )
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -37,9 +37,11 @@ var _name_label : Label
|
||||
#var _description_label : RichTextLabel
|
||||
var _item_button : Button
|
||||
var _popup : Popup
|
||||
var _quantity_spinbox : SpinBox
|
||||
|
||||
var _vendor_item_data_entry : VendorItemDataEntry
|
||||
var _player : Entity
|
||||
var _index : int
|
||||
|
||||
func _ready() -> void:
|
||||
_icon = get_node(icon_path) as TextureRect
|
||||
@ -47,10 +49,12 @@ func _ready() -> void:
|
||||
# _description_label = get_node(description_label_path) as RichTextLabel
|
||||
_item_button = get_node(spell_button_path) as Button
|
||||
_popup = get_node(popup_path) as Popup
|
||||
_quantity_spinbox = get_node(quantity_spinbox_path) as SpinBox
|
||||
|
||||
func set_vendor_item(p_player : Entity, p_vide: VendorItemDataEntry) -> void:
|
||||
func set_vendor_item(p_player : Entity, p_vide: VendorItemDataEntry, index : int) -> void:
|
||||
_vendor_item_data_entry = p_vide
|
||||
_player = p_player
|
||||
_index = index
|
||||
|
||||
# _icon.set_spell(_spell)
|
||||
_item_button.set_item(_vendor_item_data_entry)
|
||||
@ -72,6 +76,14 @@ func spell_button_pressed() -> void:
|
||||
pos.x += _item_button.rect_size.x
|
||||
|
||||
_popup.popup(Rect2(pos, _popup.rect_size))
|
||||
|
||||
func buy():
|
||||
if !_player:
|
||||
return
|
||||
|
||||
var count : int = _quantity_spinbox.value
|
||||
|
||||
_player.vendor_item_sbuy(_index, count)
|
||||
|
||||
func update_spell_indicators():
|
||||
pass
|
||||
|
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://ui/windows/SpellDragAndDropSpellBook.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ui/windows/ItemDragAndDropVendor.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ui/windows/ItemContainer.gd" type="Script" id=2]
|
||||
[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=3]
|
||||
[ext_resource path="res://ui/vendor_window/VendorEntryPopup.gd" type="Script" id=4]
|
||||
@ -162,4 +162,4 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
[connection signal="pressed" from="PanelContainer/HBoxContainer/Button" to="." method="spell_button_pressed"]
|
||||
[connection signal="pressed" from="EntryPopup/VBoxContainer/HBoxContainer/Button" to="EntryPopup" method="hide"]
|
||||
[connection signal="pressed" from="EntryPopup/VBoxContainer/Container/VBoxContainer/HBoxContainer/LearnButton" to="." method="learn_spell"]
|
||||
[connection signal="pressed" from="EntryPopup/VBoxContainer/Container/VBoxContainer/HBoxContainer/LearnButton" to="." method="buy"]
|
||||
|
45
game/ui/windows/ItemDragAndDropVendor.gd
Normal file
45
game/ui/windows/ItemDragAndDropVendor.gd
Normal file
@ -0,0 +1,45 @@
|
||||
extends Button
|
||||
|
||||
# Copyright (c) 2019-2020 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
var item : VendorItemDataEntry
|
||||
|
||||
func set_item(p_item):
|
||||
item = p_item
|
||||
|
||||
func get_drag_data(pos):
|
||||
if item == null || item.item:
|
||||
return null
|
||||
|
||||
var tr = TextureRect.new()
|
||||
tr.texture = item.item.icon
|
||||
tr.expand = true
|
||||
|
||||
# tr.rect_size = rect_size
|
||||
tr.rect_size = Vector2(45, 45)
|
||||
set_drag_preview(tr)
|
||||
|
||||
var esd = ESDragAndDrop.new()
|
||||
|
||||
esd.type = ESDragAndDrop.ES_DRAG_AND_DROP_TYPE_ITEM
|
||||
esd.item_path = item.item.resource_path
|
||||
|
||||
return esd
|
@ -20,17 +20,17 @@ extends Button
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
var item : VendorItemDataEntry
|
||||
var spell
|
||||
|
||||
func set_item(p_item):
|
||||
item = p_item
|
||||
func set_spell(p_spell):
|
||||
spell = p_spell
|
||||
|
||||
func get_drag_data(pos):
|
||||
if item == null || item.item:
|
||||
if spell == null:
|
||||
return null
|
||||
|
||||
var tr = TextureRect.new()
|
||||
tr.texture = item.item.icon
|
||||
tr.texture = spell.icon
|
||||
tr.expand = true
|
||||
|
||||
# tr.rect_size = rect_size
|
||||
@ -39,7 +39,7 @@ func get_drag_data(pos):
|
||||
|
||||
var esd = ESDragAndDrop.new()
|
||||
|
||||
esd.type = ESDragAndDrop.ES_DRAG_AND_DROP_TYPE_ITEM
|
||||
esd.item_path = item.item.resource_path
|
||||
esd.type = ESDragAndDrop.ES_DRAG_AND_DROP_TYPE_SPELL
|
||||
esd.item_path = spell.resource_path
|
||||
|
||||
return esd
|
||||
|
@ -94,7 +94,7 @@ func refresh_entries() -> void:
|
||||
var spindex : int = i + (_page * len(_item_entries))
|
||||
|
||||
if spindex >= _vendor_item_data.get_num_vendor_datas():
|
||||
_item_entries[n].set_vendor_item(_player, null)
|
||||
_item_entries[n].set_vendor_item(_player, null, 0)
|
||||
i += 1
|
||||
n += 1
|
||||
continue
|
||||
@ -104,7 +104,7 @@ func refresh_entries() -> void:
|
||||
if !vide:
|
||||
continue
|
||||
|
||||
_item_entries[n].set_vendor_item(_player, vide)
|
||||
_item_entries[n].set_vendor_item(_player, vide, spindex)
|
||||
i += 1
|
||||
n += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user