Skip to content
This repository has been archived by the owner on Feb 24, 2025. It is now read-only.

Commit

Permalink
Enabled Vendor Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
alex193a committed Jan 28, 2016
1 parent ecaaad4 commit 37c864a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 26 deletions.
46 changes: 26 additions & 20 deletions SOSSE/ItemEditingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private void LoadItemData()
storageItems = displayItem(storageDataGridView, storageItemOffset, maxContainerItem);
materialItems = displayItem(materialDataGridView, materialItemOffset, maxContainerItem);
wardrobeItems = displayItem(wardrobeDataGridView, wardrobeItemOffset, maxContainerItem);

DataLoaded = true;
}

Expand All @@ -313,7 +313,7 @@ private Item[] displayItem(DataGridView dataGridView, int offset, int count)
localOffset += 12;
}
Array.Sort<Item>(items, (x, y) => x.CompareTo(y));

dataGridView.Rows.Add(count);
for (int i = 0; i < count; i++)
{
Expand All @@ -339,20 +339,20 @@ private Item[] displayItem(DataGridView dataGridView, int offset, int count)
{
dataGridView.Rows[i].Cells[1].Value = StarQualityList[12];
dataGridView.Rows[i].Cells[1].ReadOnly = true;
dataGridView.Rows[i].Cells[1].Style = MainForm.GrayCellStyle;
dataGridView.Rows[i].Cells[1].Style.BackColor = Color.LightGray;
dataGridView.Rows[i].Cells[2].ReadOnly = true;
dataGridView.Rows[i].Cells[2].Style = MainForm.GrayCellStyle;
dataGridView.Rows[i].Cells[2].Style.BackColor = Color.LightGray;
}
dataGridView.Rows[i].Cells[2].Value = items[i].Quality;
dataGridView.Rows[i].Cells[3].Value = items[i].Quantity;
if (items[i].Index == 0xFFFF || Item.BaseQuality[items[i].Index] == -1)
{
dataGridView.Rows[i].Cells[1].ReadOnly = true;
dataGridView.Rows[i].Cells[1].Style = MainForm.GrayCellStyle;
dataGridView.Rows[i].Cells[1].Style.BackColor = Color.LightGray;
dataGridView.Rows[i].Cells[2].ReadOnly = true;
dataGridView.Rows[i].Cells[2].Style = MainForm.GrayCellStyle;
dataGridView.Rows[i].Cells[2].Style.BackColor = Color.LightGray;
dataGridView.Rows[i].Cells[3].ReadOnly = true;
dataGridView.Rows[i].Cells[3].Style = MainForm.GrayCellStyle;
dataGridView.Rows[i].Cells[3].Style.BackColor = Color.LightGray;
}
}
return items;
Expand All @@ -362,7 +362,7 @@ private Item[] displayItem(DataGridView dataGridView, int offset, int count)
private void dataGridView_CellClick(DataGridView dataGridView, DataGridViewCellEventArgs e)
{
if ((e.ColumnIndex != 0) && (e.ColumnIndex != 1)) return;
ComboBox cb = (ComboBox)dataGridView.EditingControl;
ComboBox cb = (ComboBox) dataGridView.EditingControl;
if (cb != null) cb.DroppedDown = true;
}

Expand Down Expand Up @@ -471,39 +471,42 @@ private int dataGridView_CellValueChanged(DataGridView dataGridView, DataGridVie
dataGridView.Rows[e.RowIndex].Cells[1].Value =
StarQualityList[0];
dataGridView.Rows[e.RowIndex].Cells[1].ReadOnly = true;
dataGridView.Rows[e.RowIndex].Cells[1].Style = MainForm.GrayCellStyle;
dataGridView.Rows[e.RowIndex].Cells[1].Style.BackColor =
Color.LightGray;
dataGridView.Rows[e.RowIndex].Cells[2].Value = -1;
dataGridView.Rows[e.RowIndex].Cells[2].ReadOnly = true;
dataGridView.Rows[e.RowIndex].Cells[2].Style = MainForm.GrayCellStyle;
dataGridView.Rows[e.RowIndex].Cells[2].Style.BackColor =
Color.LightGray;
if (itemIndex == -1)
dataGridView.Rows[e.RowIndex].Cells[3].Value = 0;
else
dataGridView.Rows[e.RowIndex].Cells[3].Value = 1;
dataGridView.Rows[e.RowIndex].Cells[3].ReadOnly = true;
dataGridView.Rows[e.RowIndex].Cells[3].Style = MainForm.GrayCellStyle;
dataGridView.Rows[e.RowIndex].Cells[3].Style.BackColor =
Color.LightGray;
}
else
{
dataGridView.Rows[e.RowIndex].Cells[1].Value =
StarQualityList[(Item.BaseQuality[itemIndex] - 1) / 30 + 1];
dataGridView.Rows[e.RowIndex].Cells[1].ReadOnly = false;
dataGridView.Rows[e.RowIndex].Cells[1].Style =
dataGridView.DefaultCellStyle;
dataGridView.Rows[e.RowIndex].Cells[1].Style.BackColor =
dataGridView.DefaultCellStyle.BackColor;
dataGridView.Rows[e.RowIndex].Cells[2].Value =
Item.BaseQuality[itemIndex];
dataGridView.Rows[e.RowIndex].Cells[2].ReadOnly = false;
dataGridView.Rows[e.RowIndex].Cells[2].Style =
dataGridView.DefaultCellStyle;
dataGridView.Rows[e.RowIndex].Cells[2].Style.BackColor =
dataGridView.DefaultCellStyle.BackColor;
dataGridView.Rows[e.RowIndex].Cells[3].Value = 1;
dataGridView.Rows[e.RowIndex].Cells[3].ReadOnly = false;
dataGridView.Rows[e.RowIndex].Cells[3].Style =
dataGridView.DefaultCellStyle;
dataGridView.Rows[e.RowIndex].Cells[3].Style.BackColor =
dataGridView.DefaultCellStyle.BackColor;
}
return itemIndex;
}
return -2;
}

private void bagDataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (!DataLoaded) return;
Expand Down Expand Up @@ -744,7 +747,10 @@ private void saveItems(DataGridView dataGridView, int offset, int count, Item[]
Array.Copy(itemBytes, 0, MainForm.SaveData, offset, 12 * count);
}

private void saveAllItems()
/// <summary>
/// Save item changes to save data
/// </summary>
public void SaveItems()
{
if (IsModified)
{
Expand Down Expand Up @@ -860,7 +866,7 @@ private void maxQualityButton_Click(object sender, EventArgs e)

private void ItemEditingForm_FormClosing(object sender, FormClosingEventArgs e)
{
saveAllItems();
this.Hide();
e.Cancel = true;
}
}
Expand Down
16 changes: 15 additions & 1 deletion SOSSE/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void enableButtons()
animalButton.Enabled = false;
patternButton.Enabled = false;
recipeButton.Enabled = false;
vendorButton.Enabled = false;
vendorButton.Enabled = true;
npcButton.Enabled = false;
generalButton.Enabled = true;
eventButton.Enabled = false;
Expand Down Expand Up @@ -112,6 +112,20 @@ private void openButton_Click(object sender, EventArgs e)
MessageBox.Show("Invalid save file", "Error");
return;
}

//only for testing
/*
using (FileStream fs = new FileStream("dec3.bin", FileMode.Create, FileAccess.Write))
{
using (BinaryWriter bw = new BinaryWriter(fs))
{
bw.Write(decompressed);
}
}
*/


}
}

Expand Down
2 changes: 1 addition & 1 deletion SOSSE/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.4")]
[assembly: AssemblyVersion("1.7.6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 2 additions & 2 deletions SOSSE/SOSSE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<ApplicationVersion>1.7.6.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down Expand Up @@ -234,7 +234,7 @@
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
<ProductName>Microsoft .NET Framework 4 %28x86 e x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
Expand Down
4 changes: 2 additions & 2 deletions SOSSE/VendorEditingForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace SOSSE
{
public partial class VendorEditingForm : Form
{
private int vendorOffset = 0x448E8;
private int[] vendorFlagOffset = { 0x1294, 0x1660, 0x16C4 };
private int vendorOffset = 0x44E28;
private int[] vendorFlagOffset = { 0x12EC, 0x16B8, 0x171C };
private int currentCountry;
private ulong currentMoney;
private uint currentItemQuantity;
Expand Down

0 comments on commit 37c864a

Please sign in to comment.