Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ jobs:
with:
channel: 'stable'
- run: flutter config --enable-windows-desktop
- run: flutter build windows
- run: flutter build windows --release
working-directory: ./src/icarus_editor
- uses: actions/upload-artifact@v3
with:
name: icarus_editor_windows
path: build/windows/runner/Release/
path: ./src/icarus_editor/build/windows/runner/Release/
build_linux:
runs-on: ubuntu-latest
steps:
Expand All @@ -30,10 +31,11 @@ jobs:
sudo apt-get install -y ninja-build libgtk-3-dev
- run: flutter config --enable-linux-desktop
- run: flutter build linux --release
working-directory: ./src/icarus_editor
- uses: actions/upload-artifact@v3
with:
name: icarus_editor_linux
path: build/linux/x64/release/bundle/
path: ./src/icarus_editor/build/linux/x64/release/bundle/
create_release:
needs: [build_windows, build_linux]
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/UnrealPakTool"]
path = src/UnrealPakTool
url = https://github.com/allcoolthingsatoneplace/UnrealPakTool.git
42 changes: 0 additions & 42 deletions lib/widgets/inventory/inventory_overview.dart

This file was deleted.

16 changes: 16 additions & 0 deletions scripts/Extract-Packs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Add-Type -AssemblyName System.Windows.Forms
$FileBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
$FileBrowser.ShowDialog()
$icarus = $FileBrowser.SelectedPath
$packFile = Join-Path $icarus "Icarus\Content\Data\data.pak"

if (Test-Path -Path $packFile -PathType Leaf) {
..\src\UnrealPakTool\UnrealPak.exe -Filter="*D_ItemsStatic.json" -Extract $packFile ../icarus_editor_core/lib/src/generated
..\src\UnrealPakTool\UnrealPak.exe -Filter="*D_Itemable.json" -Extract $packFile ../icarus_editor_core/lib/src/generated
..\src\UnrealPakTool\UnrealPak.exe -Filter="*D_Durable.json" -Extract $packFile ../icarus_editor_core/lib/src/generated

cd ../src/icarus_editor_core
flutter pub run build_runner build
} else {
Write-Error "Failed to find data.pak file, please select the Icarus root folder"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';

import 'package:icarus_editor/exceptions/icarus_exception.dart';
import 'package:icarus_editor/services/icarus_save.dart';
import 'package:icarus_editor_core/icarus_editor_core.dart';

class IcarusInventory {
final Map inventory;
Expand All @@ -20,20 +21,28 @@ class IcarusInventory {
class IcarusInventoryItem {
final Map item;
late int _durabilityIndex;
ItemStaticEntry? _entry;

IcarusInventoryItem({required this.item}) {
_durabilityIndex = _getDynamicDataIndex('Durability');
if (itemsStatic.containsKey(item['ItemStaticData']['RowName'])) {
_entry = itemsStatic[item['ItemStaticData']['RowName']];
}
}

String get name {
return item['ItemStaticData']['RowName'];
String get displayName {
return _entry?.displayName ?? item['ItemStaticData']['RowName'];
}

set name(String value) {
item['ItemStaticData']['RowName'] = value;
bool get hasDurability => _durabilityIndex != -1;

int get maxDurability {
return _entry?.durability ?? -1;
}

bool get hasDurability => _durabilityIndex != -1;
double get durabilityPercentage {
return (durability / maxDurability) * 100;
}

int get durability {
if (hasDurability == false) {
Expand Down
44 changes: 44 additions & 0 deletions src/icarus_editor/lib/widgets/inventory/inventory_overview.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:icarus_editor/services/icarus_inventory.dart';

class InventoryOverview extends StatefulWidget {
final IcarusInventory inventory;

const InventoryOverview({super.key, required this.inventory});

@override
State<InventoryOverview> createState() => _InventoryOverviewState();
}

class _InventoryOverviewState extends State<InventoryOverview> {
@override
Widget build(BuildContext context) {
var itemsWithDurability = widget.inventory.items
.where((element) => element.hasDurability)
.toList();

return ColoredBox(
color: FluentTheme.of(context).scaffoldBackgroundColor,
child: Center(
child: ListView.builder(
itemCount: itemsWithDurability.length,
itemBuilder: (context, index) {
var item = itemsWithDurability[index];

return ListTile(
trailing: FilledButton(
child: const Text('Repair'),
onPressed: () {
item.durability = item.maxDurability;
setState(() {});
},
),
title: Text(
'${item.displayName} (${item.durabilityPercentage.toStringAsFixed(2)}%)'),
);
},
),
),
);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading