Skip to content

Commit

Permalink
fix: read notes
Browse files Browse the repository at this point in the history
- several tweaks to forms
- gearhandler set selector is typeable again
- new poh decoration enum to be used soon
  • Loading branch information
Torwent committed Nov 29, 2024
1 parent 94a9d9d commit 8d8fcf7
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 105 deletions.
32 changes: 16 additions & 16 deletions optional/handlers/alchhandler.simba
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
tmp := TButton(sender).getCaption();
TButton(sender).setCaption('Loading...');

itemList := TScriptForm.Form.GetChild('item_list_listbox');
alchList := TScriptForm.Form.GetChild('alch_list_listbox');
itemList := Self.Form.GetChild('item_list_listbox');
alchList := Self.Form.GetChild('alch_list_listbox');

i := itemList.getItemIndex();
if i = -1 then
Expand All @@ -497,8 +497,8 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
begin
tmp := TButton(sender).getCaption();
TButton(sender).setCaption('Loading...');
itemList := TScriptForm.Form.GetChild('item_list_listbox');
alchList := TScriptForm.Form.GetChild('alch_list_listbox');
itemList := Self.Form.GetChild('item_list_listbox');
alchList := Self.Form.GetChild('alch_list_listbox');

i := itemList.getItemIndex();
if i = -1 then
Expand Down Expand Up @@ -541,8 +541,8 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
tmp := TButton(sender).getCaption();
TButton(sender).setCaption('Loading...');

itemList := TScriptForm.Form.GetChild('item_list_listbox');
alchList := TScriptForm.Form.GetChild('alch_list_listbox');
itemList := Self.Form.GetChild('item_list_listbox');
alchList := Self.Form.GetChild('alch_list_listbox');

i := alchList.getItemIndex();
if i = -1 then
Expand All @@ -567,8 +567,8 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
tmp := TButton(sender).getCaption();
TButton(sender).setCaption('Loading...');

itemList := TScriptForm.Form.GetChild('item_list_listbox');
alchList := TScriptForm.Form.GetChild('alch_list_listbox');
itemList := Self.Form.GetChild('item_list_listbox');
alchList := Self.Form.GetChild('alch_list_listbox');

i := alchList.getItemIndex();
if i = -1 then
Expand Down Expand Up @@ -606,19 +606,19 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
var
btn: TButton;
begin
btn := TScriptForm.Form.GetChild('add_alch_button');
btn := Self.Form.GetChild('add_alch_button');
btn.setEnabled(True);
btn := TScriptForm.Form.GetChild('add_both_alch_button');
btn := Self.Form.GetChild('add_both_alch_button');
btn.setEnabled(True);
end;

procedure TScriptForm._OnAlchListSelected({$H-}sender: TObject);{$H+}
var
btn: TButton;
begin
btn := TScriptForm.Form.GetChild('remove_alch_button');
btn := Self.Form.GetChild('remove_alch_button');
btn.setEnabled(True);
btn := TScriptForm.Form.GetChild('remove_both_alch_button');
btn := Self.Form.GetChild('remove_both_alch_button');
btn.setEnabled(True);
end;

Expand All @@ -632,8 +632,8 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
tmp := TButton(sender).getCaption();
TButton(sender).setCaption('Loading...');

itemList := TScriptForm.Form.GetChild('item_list_listbox');
alchList := TScriptForm.Form.GetChild('alch_list_listbox');
itemList := Self.Form.GetChild('item_list_listbox');
alchList := Self.Form.GetChild('alch_list_listbox');

alchList.Clear();
alchList._ReWriteAlchConfig();
Expand All @@ -658,7 +658,7 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
var
list: TListBox;
begin
list := TScriptForm.Form.GetChild('item_list_listbox');
list := Self.Form.GetChild('item_list_listbox');
if not TEdit(sender).IsEmpty() then
if list.Search(TEdit(sender).getText()) > -1 then
Self._OnItemListSelected(list);
Expand All @@ -668,7 +668,7 @@ function TScriptForm.CreateAlchemyPanel(): TTabSheet;
var
list: TListBox;
begin
list := TScriptForm.Form.GetChild('alch_list_listbox');
list := Self.Form.GetChild('alch_list_listbox');
if not TEdit(sender).IsEmpty() then
if list.Search(TEdit(sender).getText()) > -1 then
Self._OnItemListSelected(list);
Expand Down
13 changes: 1 addition & 12 deletions optional/handlers/gearhandler.simba
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ begin
SetTop(TControl.AdjustToDPI(5));
SetLeft(TControl.AdjustToDPI(20));
SetWidth(TControl.AdjustToDPI(284));
SetStyle(TComboBoxStyle.csDropDown);
ComboBox.setOnChange(@Self._OnGearSelectorChange);
end;

Expand Down Expand Up @@ -756,7 +757,6 @@ begin
SetLeft((Self.Size.X div 2) + TControl.AdjustToDPI(90));
SetName('head_slot');
SetCaption('Head');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.HEAD);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -770,7 +770,6 @@ begin
SetWidth(w);
SetName('secondary_ammo_slot');
SetCaption('Secondary ammo');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.SECONDARY_AMMO);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -784,7 +783,6 @@ begin
SetLeft(head.GetLeft() - TControl.AdjustToDPI(20) - w);
SetName('cape_slot');
SetCaption('Cape');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.CAPE);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -798,7 +796,6 @@ begin
SetWidth(w);
SetName('neck_slot');
SetCaption('Neck');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.NECK);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -812,7 +809,6 @@ begin
SetWidth(w);
SetName('ammo_slot');
SetCaption('Ammo');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.AMMO);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -826,7 +822,6 @@ begin
SetLeft(head.GetLeft() - TControl.AdjustToDPI(20) - w);
SetName('weapon_slot');
SetCaption('Weapon');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.WEAPON);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -840,7 +835,6 @@ begin
SetWidth(w);
SetName('body_slot');
SetCaption('Body');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.BODY);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -854,7 +848,6 @@ begin
SetWidth(w);
SetName('shield_slot');
SetCaption('Shield');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.SHIELD);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -868,7 +861,6 @@ begin
SetLeft(head.GetLeft());
SetName('legs_slot');
SetCaption('Legs');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.LEGS);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -882,7 +874,6 @@ begin
SetLeft(head.GetLeft() - TControl.AdjustToDPI(20) - w);
SetName('hands_slot');
SetCaption('Hands');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.HANDS);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -896,7 +887,6 @@ begin
SetWidth(w);
SetName('feet_slot');
SetCaption('Feet');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.FEET);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand All @@ -910,7 +900,6 @@ begin
SetWidth(w);
SetName('ring_slot');
SetCaption('Ring');
SetStyle(TComboBoxStyle.csDropDownList);
_RefreshList(ComboBox, ERSEquipmentSlot.RING);
SetItemIndex(0);
ComboBox.setOnChange(@Self._OnGearChange);
Expand Down
4 changes: 4 additions & 0 deletions optional/handlers/pohmap.simba
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ ERSHouseRoom = (
STUDY_PARLOUR, KITCHEN_BEDROOM, ACHIEVEMENT_GALLERY, QUEST_NEXUS, COMBAT,
COSTUME, ALTAR, PORTAL, WORKSHOP
);

ERSHouseDecoration = (
WOOD, STONE, WHITE_STONE, FREMENNIK_WOOD, TROPICAL_WOOD, FANCY_STONE, DEATHLY, TWISTED, HOSIDIUS, WINTER
);
{$SCOPEDENUMS OFF}

(*
Expand Down
14 changes: 7 additions & 7 deletions osr/interfaces/gametabs/inventory.simba
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,17 @@ begin
end;


function TRSInventory.FindAllItems(Items: TRSItemArray; out Slots: TIntegerArray): Boolean;
function TRSInventory.FindAllItems(items: TRSItemArray; out Slots: TIntegerArray): Boolean;
var
Item: TRSItem;
item: TRSItem;
begin
for Item in Items do
for item in items do
begin
if not Self.FindItem(Item, Slots) then
if not Self.FindItem(item, slots) then
Exit(False);
Slots := [];
slots := [];
end;

Result := True;
end;

Expand All @@ -94,8 +95,7 @@ function TRSInventory.SetSelectedItem(item: TRSItem): Boolean;
var
slot: Int32;
begin
if Inventory.FindItem(item, slot) then
Result := Self.SetSelectedSlot(slot);
Result := Inventory.FindItem(item, slot) and Self.SetSelectedSlot(slot);
end;

function TRSInventory.Use(slot: Int32; item: TRSItem): Boolean; overload;
Expand Down
2 changes: 0 additions & 2 deletions templates/form_example.simba
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ begin
SetTop(TControl.AdjustToDPI(190));
end;

Self.CreateVersionPanel(tab);

Self.CreateAntibanManager();
Self.CreateBankSettings();
Self.CreateWaspLibSettings();
Expand Down
1 change: 1 addition & 0 deletions utils/forms/formutils.simba
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ procedure TSimbaImageBox.Create(owner: TControl);
begin
Self.Init(owner);
Self.SetParent(owner);
Self.SetAlign(TAlign.alClient);
end;

procedure TSimbaImageBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
Expand Down
Loading

0 comments on commit 8d8fcf7

Please sign in to comment.