public void Do() { //Console.WriteLine("Output: \"" + client.ToString() + "\" doing..."); bool found = false; foreach (var converter in HelperHandler.clist) { if (converter.input.ID == outputitem) { found = true; int give = (CalcGive(converter, client.CountItem(converter.input.ID))) - 1; if (give > 0) { //Console.WriteLine("\t Converter: \"" + converter.client.ToString() + "\" is succeptible!"); //give the maximum amount I can give: PZItem giveitem = new PZItem(converter.input.ID, give); Console.WriteLine("(output)" + client + " give " + giveitem + " to (converter)" + converter.client); HelperHandler.GiveItem(client, converter.client, giveitem); } continue; //since I've given my max } } if (!found) { // Console.WriteLine("Did not find any succeptible converters, jumping to storage"); //straight to store foreach (var storage in HelperHandler.slist) { if (storage.inputitem == outputitem) { int give = (SCalcGive(storage, client.CountItem(storage.inputitem))) - 1; if (give > 0) { PZItem giveitem = new PZItem(storage.inputitem, give); Console.WriteLine("(output)" + client + " give " + giveitem + " to (storage)" + storage.client); //Console.WriteLine("\t Storage: \"" + storage.client.ToString() + "\" is succeptible!"); HelperHandler.GiveItem(client, storage.client, giveitem); } continue; } } } }
public void Do() { // Console.WriteLine("Converter: \"" + client.ToString() + "\" doing..."); int myinno = client.CountItem(input.ID); if (myinno >= input.amount) { Console.WriteLine("(converter)" + client + " conversion process started"); //we've got enough input! #region SetTrade client.tradequeue.Clear(); client.tradequeue.Add(new PZTrade() { selling = new PZItem[] { input }.ToList(), buying = new PZItem[] { output }.ToList(), name = client.ToString() }); client.enabled = true; client.spamenabled = true; client.index = 0; #endregion } bool found = false; foreach (var converter in HelperHandler.clist) { if (converter.input.ID == this.output.ID) { found = true; int give = (CalcGive(converter, client.CountItem(converter.input.ID))); if (give > 0) { PZItem giveitem = new PZItem(converter.input.ID, give); Console.WriteLine("(converter)" + client.ToString() + " give " + giveitem + " to (converter)" + converter.client); HelperHandler.GiveItem(client, converter.client, giveitem); } continue; //since I've given my max } } if (!found) { #region Store int myoutno = client.CountItem(output.ID); if (myoutno >= output.amount) { foreach (var storage in HelperHandler.slist) { if (storage.inputitem == output.ID) { int give = SCalcGive(storage, client.CountItem(storage.inputitem)); if (give > 0) { PZItem giveitem = new PZItem(storage.inputitem, give); Console.WriteLine("(converter)" + client + " give " + giveitem + " to (storage)" + storage.client); //give max amount I can give HelperHandler.GiveItem(client, storage.client, giveitem); } continue; } } } #endregion } }
private void button1_Click(object sender, EventArgs e) { HelperHandler.GiveItem(client, (PZClient)comboBox1.SelectedItem, new PZItem(ids[listBox1.SelectedIndex], (int)numericUpDown1.Value)); this.Close(); }