Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
Import v7 source
Browse files Browse the repository at this point in the history
  • Loading branch information
Deflaktor committed Apr 7, 2020
1 parent 08ca466 commit ac11d11
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 96 deletions.
7 changes: 3 additions & 4 deletions Editor/AboutBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

Expand All @@ -19,10 +18,10 @@ public AboutBox()
//this.labelCopyright.Text = AssemblyCopyright;
//this.labelCompanyName.Text = AssemblyCompany;
//this.textBoxDescription.Text = AssemblyDescription;
this.labelVersion.Text = "Version 2.1";
this.labelCopyright.Text = "© 2012, 2013 STJrInuyasha / Raspberryfloof";
this.labelVersion.Text = "Version 7";
this.labelCopyright.Text = "© 2012, 2013, 2019";
this.labelCompanyName.Text = "";
this.textBoxDescription.Text = "Based on the Fortune Street Wii Board Editor begun by Xanares, Amazing Ampharos, and zerozerozerozer.\r\n\r\nFortune Street is ™ and © Nintendo, ARMOR PROJECT, and SQUARE ENIX.";
this.textBoxDescription.Text = "Based on the Fortune Street Wii Board Editor begun by Xanares, Amazing Ampharos, and zerozerozerozer.\r\nFurther work done by STJrInuyasha, Raspberryfloof, Deflaktor.\r\n\r\nFortune Street is ™ and © Nintendo, ARMOR PROJECT, and SQUARE ENIX.";
}

#region Assembly Attribute Accessors
Expand Down
2 changes: 1 addition & 1 deletion Editor/Converters/ComboBoxConverter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using FSEditor.FSData;
using System.Linq;

namespace Editor
{
Expand Down
2 changes: 0 additions & 2 deletions Editor/Converters/DistrictConverter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using FSEditor.FSData;

namespace Editor
{
Expand Down
1 change: 0 additions & 1 deletion Editor/Converters/NullToFalseConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

Expand Down
1 change: 0 additions & 1 deletion Editor/Converters/OffsetConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

Expand Down
1 change: 0 additions & 1 deletion Editor/Converters/SquareConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using FSEditor.FSData;
Expand Down
1 change: 0 additions & 1 deletion Editor/HelpWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
Expand Down
20 changes: 16 additions & 4 deletions Editor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,26 @@
<HeaderedContentControl Header="District / Destination Square ID" Margin="0,2,0,0">
<TextBox Text="{Binding DistrictDestinationId}"/>
</HeaderedContentControl>
<HeaderedContentControl Header="Shop Model" Margin="0,2,0,0">
<ComboBox Name="ShopComboBox" SelectedItem="{Binding ShopModelId, Converter={StaticResource ShopComboBoxConverter}, Mode=TwoWay}"/>
</HeaderedContentControl>
<HeaderedContentControl Header="Initial Value" Margin="0,2,0,0">
<TextBox Text="{Binding Value}"/>
<TextBox Name="Value" Text="{Binding Value}" TextChanged="calculatePrice"/>
</HeaderedContentControl>
<HeaderedContentControl Header="Initial Shop Payment Price" Margin="0,2,0,0">
<TextBox Text="{Binding Price}"/>
<TextBox Name="Price" Text="{Binding Price}" TextChanged="calculatePrice"/>
</HeaderedContentControl>
<HeaderedContentControl Header="Shop Model" Margin="0,2,0,0">
<ComboBox Name="ShopComboBox" SelectedItem="{Binding ShopModelId, Converter={StaticResource ShopComboBoxConverter}, Mode=TwoWay}"/>
<HeaderedContentControl Header="Yield" Margin="0,2,0,0">
<TextBox Name="PriceRatio" IsReadOnly="True" Background="#FFF0F0F0" BorderBrush="#FFD9D9D9"/>
</HeaderedContentControl>
<HeaderedContentControl Header="Unknown1" Margin="0,2,0,0">
<TextBox Text="{Binding Unknown1}"/>
</HeaderedContentControl>
<HeaderedContentControl Header="One-Way Lift" Margin="0,2,0,0">
<TextBox Text="{Binding OneWayLift}"/>
</HeaderedContentControl>
<HeaderedContentControl Header="Unknown3" Margin="0,2,0,0">
<TextBox Text="{Binding Unknown3}"/>
</HeaderedContentControl>
</StackPanel>

Expand Down
25 changes: 24 additions & 1 deletion Editor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -14,6 +13,7 @@
using Microsoft.Win32;
using FSEditor.FSData;
using System.IO;
using System.Linq;

namespace Editor
{
Expand Down Expand Up @@ -66,6 +66,8 @@ public partial class MainWindow : Window
{SquareType.LiftMagmaliceSquareStart, "Lift / Magmalice Start"},
{SquareType.MagmaliceSquare, "Magmalice"},
{SquareType.LiftSquareEnd, "Lift End"},

{SquareType.unknown0x2E, "Unknown 0x2E"},
};
public static readonly Dictionary<Byte, String> ShopTypeList = new Dictionary<Byte, String>()
{
Expand Down Expand Up @@ -474,6 +476,15 @@ private void Verify_Click(object sender, RoutedEventArgs e)
if (board.BoardData.Squares.Count(t => t.SquareType == SquareType.Bank) != 1)
warnsb.AppendFormat("W{0}: There should be exactly one Bank.\n", ++warnings);

if (board.BoardData.Squares.Count(t => t.SquareType == SquareType.BoonSquare) == 0)
warnsb.AppendFormat("W{0}: There should be at least one Boon square, or venture card 125 may cause a crash.\n", ++warnings);

if (board.BoardData.Squares.Count(t => t.SquareType == SquareType.TakeABreakSquare) == 0)
warnsb.AppendFormat("W{0}: There should be at least one Take-A-Break square, or various venture cards may cause a crash.\n", ++warnings);

if (board.BoardData.Squares.Count(t => t.SquareType == SquareType.ArcadeSquare) == 0)
warnsb.AppendFormat("W{0}: There should be at least one ArcadeSquare square, or various venture cards may cause a crash.\n", ++warnings);

if (board.BoardData.Squares.Count > 0 && board.BoardData.Squares[0].SquareType != SquareType.Bank)
warnsb.AppendFormat("W{0}: The starting square (ID 0) should be a Bank.\n", ++warnings);

Expand Down Expand Up @@ -818,5 +829,17 @@ private static Brush CanvasGrid(Rect bounds, Size tileSize)

return axesGrid;
}

private void calculatePrice(object sender, TextChangedEventArgs e)
{
PriceRatio.Text = "";
int value = 0, price = 0;
Int32.TryParse(Value.Text, out value);
Int32.TryParse(Price.Text, out price);
if (value != 0) {
double yield = (double)price / (double)value;
PriceRatio.Text = yield.ToString("0.00");
}
}
}
}
134 changes: 63 additions & 71 deletions Editor/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 34 additions & 8 deletions Lib/FSData/SquareData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class SquareData : INotifyPropertyChanged

public const int Size = 0x20;

private Boolean initialized = false;
// ----------------------------------------------------------------------------------------------------
/// <summary>
/// Gets or sets the Square ID.
Expand Down Expand Up @@ -103,9 +104,9 @@ public Byte DistrictDestinationId
private Byte _DistrictDestinationId;

/// <summary>
///
/// If 1, the lift platform will not deactivate
/// </summary>
public Byte Unknown2 { get; set; }
public Byte OneWayLift { get; set; }

/// <summary>
/// Gets or sets the value of the unowned/vacant property.
Expand All @@ -120,6 +121,13 @@ public UInt16 Value
set
{
_Value = value;

if(initialized) {
double yield = -0.15 * Math.Pow(0.2, 0.005 * value) + 0.2;
int price = (int)Math.Round(value * yield - 0.2);
Price = (ushort)price;
}

RaisePropertyChanged("Value");
}
}
Expand Down Expand Up @@ -151,9 +159,23 @@ public UInt16 Price
/// <summary>
/// Gets or sets the Shop Model ID.
/// </summary>
public Byte ShopModelId { get; set; }
// ----------------------------------------------------------------------------------------------------
#endregion
public Byte ShopModelId {
get
{
return _ShopModelId;
}
set
{
_ShopModelId = value;
if(initialized) {
Value = (ushort) (value * 10);
RaisePropertyChanged("ShopModelId");
}
}
}
private Byte _ShopModelId;
// ----------------------------------------------------------------------------------------------------
#endregion

#region Loading & Writing Methods
public static SquareData LoadDefault(Byte squareId)
Expand Down Expand Up @@ -193,6 +215,7 @@ public static SquareData LoadDefault(Byte squareId)
};

newSquare.Waypoints = new WaypointData[] { newSquare.Waypoint1, newSquare.Waypoint2, newSquare.Waypoint3, newSquare.Waypoint4, };
newSquare.initialized = true;
return newSquare;
}

Expand Down Expand Up @@ -223,7 +246,7 @@ public static SquareData LoadFromStream(EndianBinaryReader stream, Byte squareId
// Read District ID / Destination ID
data.DistrictDestinationId = stream.ReadByte();

data.Unknown2 = stream.ReadByte();
data.OneWayLift = stream.ReadByte();

// Read Property Value
data.Value = stream.ReadUInt16();
Expand All @@ -236,7 +259,10 @@ public static SquareData LoadFromStream(EndianBinaryReader stream, Byte squareId

// Read Shop Model ID
data.ShopModelId = stream.ReadByte();
return data;

data.initialized = true;

return data;
}

public void WriteToStream(EndianBinaryWriter stream)
Expand All @@ -254,7 +280,7 @@ public void WriteToStream(EndianBinaryWriter stream)

stream.Write(DistrictDestinationId);

stream.Write(Unknown2);
stream.Write(OneWayLift);

stream.Write(Value);

Expand Down
Loading

0 comments on commit ac11d11

Please sign in to comment.