Skip to content

Commit

Permalink
New "Sell with fee" Setting
Browse files Browse the repository at this point in the history
+ Stop buying Feature (minimum funds limit)
+ Sorting Inventory list by clicking column headers.
  • Loading branch information
Maxx53 committed Jun 9, 2014
1 parent 86d2e6a commit 988573d
Show file tree
Hide file tree
Showing 10 changed files with 1,419 additions and 1,699 deletions.
14 changes: 7 additions & 7 deletions scr/SCMBot/Main.Designer.cs

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

123 changes: 114 additions & 9 deletions scr/SCMBot/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public partial class Main : Form
private Size lastFrmSize;
private Point lastFrmPos;
private bool ResComboClicked = false;
private bool sortDirect = true;

public static int walletVal = 0;
public static int stopfundsVal = 0;

public Main()
{
Expand Down Expand Up @@ -192,6 +196,11 @@ private void LoadSettings(bool loadtabs)
settingsForm.ignoreBox.Checked = settings.ignoreWarn;
settingsForm.actualBox.Checked = settings.loadActual;

settingsForm.stopFundsBox.Text = MainScanItem.LogItem.DoFracture(settings.StopFunds.ToString());
stopfundsVal = settings.StopFunds;

settingsForm.FeeCheckBox.Checked = settings.withFee;

settingsForm.playSndCheckBox.Checked = settings.playSnd;

settingsForm.resDelayBox.Text = settings.resellDelay.ToString();
Expand Down Expand Up @@ -302,6 +311,11 @@ private void SaveSettings(bool savetabs)
settings.InvType = comboBox3.SelectedIndex;
settings.LastCurr = steam_srch.currencies.Current;

settings.StopFunds = Convert.ToInt32(SteamSite.GetSweetPrice(settingsForm.stopFundsBox.Text));
stopfundsVal = settings.StopFunds;

settings.withFee = settingsForm.FeeCheckBox.Checked;

settings.Language = settingsForm.intLangComboBox.SelectedItem.ToString();

settings.formParams = new MainFormParams(lastFrmSize, lastFrmPos, this.WindowState,
Expand Down Expand Up @@ -342,7 +356,9 @@ private void LoadTabs(saveTabLst lst)
scanListView.Items.Add(lstItem);
var scanItem = new MainScanItem(ourItem, steam_srch.cookieCont, new eventDelegate(Event_Message), settings.LastCurr, settings.ignoreWarn, settings.resellDelay);

if (isScanValid(ourItem, true))


if (isScanValid(ourItem, true))
{
ourItem.StatId = status.Ready;
setStatImg(i, ourItem.StatId, scanListView);
Expand Down Expand Up @@ -446,6 +462,7 @@ public void GetAccInfo(StrParam mess)
{
StartLoadImgTread(mess.P3, pictureBox2);
label5.Text = mess.P2;
walletVal = Convert.ToInt32(SteamSite.GetSweetPrice(mess.P2));
label10.Text = mess.P1;
ProgressBar1.Visible = false;
SetButton(loginButton, Strings.Logout, 2);
Expand All @@ -472,11 +489,12 @@ private void UpdateScanCurrs()

private void AddToScanLog(string message, int scanId, byte color, bool addcurr, bool ismain)
{
if (ismain)
if (ismain)
{
cutLog(scanItems[scanId].LogCont, settings.logCount);
scanItems[scanId].LogCont.Add(new MainScanItem.LogItem(color, message, DateTime.Now, addcurr, steam_srch.currencies.GetName()));
ScrollLbox(scanId, scanListView, true);

}
else
{
Expand Down Expand Up @@ -1216,14 +1234,23 @@ private void SellButton_Click(object sender, EventArgs e)
{
var ouritem = filteredInvList[InventoryList.CheckedItems[i].Index];
if ((ouritem.Marketable) && (ouritem.Price != "0"))
steam_srch.toSellList.Add(new SteamSite.ItemToSell(ouritem.AssetId, ouritem.Price));
{
string truePrice = ouritem.Price;

if (settings.withFee)
truePrice = CalcWithFee(truePrice);

steam_srch.toSellList.Add(new SteamSite.ItemToSell(ouritem.AssetId, truePrice));
}
}

steam_srch.sellDelay = Convert.ToInt32(sellDelayBox.Text);
steam_srch.ItemSell();

}



private void InventoryList_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
{
if (e.ColumnIndex == 0)
Expand All @@ -1235,8 +1262,55 @@ private void InventoryList_ColumnWidthChanging(object sender, ColumnWidthChangin

private void InventoryList_ColumnClick(object sender, ColumnClickEventArgs e)
{
//itemComparer.ColumnIndex = e.Column;
//((ListView)sender).Sort();
if (steam_srch.Logged && steam_srch.inventList.Count != 0 && e.Column != 0)
{
filteredInvList.Clear();

//Sorry for copypaste

if (sortDirect)
{
switch (e.Column)
{
case 1:

filteredInvList = steam_srch.inventList.OrderBy(foo => foo.Type).ToList();
break;

case 2:
filteredInvList = steam_srch.inventList.OrderBy(foo => foo.Name).ToList();
break;

case 3:
filteredInvList = steam_srch.inventList.OrderBy(foo => foo.Price).ToList();
break;
}
}
else
{
switch (e.Column)
{
case 1:

filteredInvList = steam_srch.inventList.OrderByDescending(foo => foo.Type).ToList();
break;

case 2:
filteredInvList = steam_srch.inventList.OrderByDescending(foo => foo.Name).ToList();
break;

case 3:
filteredInvList = steam_srch.inventList.OrderByDescending(foo => foo.Price).ToList();
break;
}

}


FillInventoryList();
sortDirect = !sortDirect;
}

}


Expand Down Expand Up @@ -1391,6 +1465,11 @@ private void button2_Click(object sender, EventArgs e)
}
}






private void setButtText(status stat)
{
switch (stat)
Expand Down Expand Up @@ -1710,10 +1789,7 @@ private void stopScan(bool all)
var steamItem = ourItem.Steam;
var paramItem = steamItem.scanInput;

if (!steamItem.scaninProg)
continue;

if (paramItem.StatId == status.InProcess)
if (steamItem.scaninProg)
{
steamItem.CancelScan();
paramItem.StatId = status.Ready;
Expand Down Expand Up @@ -2594,5 +2670,34 @@ private void usingProxyStatusToolStripMenuItem_Click(object sender, EventArgs e)
proxyStatForm.Show();
}


//Not Used Yet!
private void scanListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
saveTabLst lst = new saveTabLst();
SaveTabs(lst);

scanItems.Clear();
scanListView.Items.Clear();

switch (e.Column)
{
case 0:
lst.Sort(delegate(saveTab p1, saveTab p2) { return p1.StatId.CompareTo(p2.StatId); });
break;

case 1:
lst.Sort(delegate(saveTab p1, saveTab p2){return p1.Name.CompareTo(p2.Name);});
break;

case 2:
lst.Sort(delegate(saveTab p1, saveTab p2) { return p1.Price.CompareTo(p2.Price); });
break;
}

LoadTabs(lst);

}

}
}
Loading

0 comments on commit 988573d

Please sign in to comment.