Exemple #1
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (bitemmed)
     {
         var temp = curbitem;
         buying.Add(curbitem);
         curbitem        = new PZItem();
         curbitem.ID     = temp.ID;
         curbitem.nick   = temp.nick;
         curbitem.amount = temp.amount;
         Upd();
     }
     else
     {
         MessageBox.Show("Please select an item to buy using the \"...\" button");
     }
 }
Exemple #2
0
        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;
                    }
                }
            }
        }
Exemple #3
0
        public static bool[] GetToSel(Client client, PZItem item)
        {
            List <int> indexestosel = new List <int>();

            {
                //search for that item
                int lefttofind = item.amount;
                for (int i = 4; i < client.PlayerData.Slot.Length; i++)
                {
                    if (client.PlayerData.Slot[i] == item.ID && lefttofind > 0)
                    {
                        lefttofind--;
                        indexestosel.Add(i);
                    }
                }
                if (lefttofind > 0)
                {
                    Console.WriteLine("You are missing " + lefttofind + " " + item.ToString());
                }
            }

            //conv to bool format
            bool[] ret = new bool[12];
            for (int i = 4; i != 12; i++)
            {
                if (indexestosel.Contains(i))
                {
                    ret[i] = true;
                }
                else
                {
                    ret[i] = false;
                }
            }
            return(ret);
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex == -1)
            {
                return;
            }
            string          txt    = sects[listBox1.SelectedIndex].Value;
            MatchCollection trades = rgxtrade.Matches(txt);

            foreach (Match tr in trades)
            {
                PZTrade trade = new PZTrade();

                string fsellr = rgxfsell.Match(tr.Value).Value;
                string fsell  = fsellr.Substring(2, fsellr.Length - 4);
                trade.fselling = fsell;

                string          before = rgxbefore.Match(tr.Value).Value;
                MatchCollection items  = rgxitem.Matches(before);
                foreach (Match itemfdgsasdasdash in items)
                {
                    string   item   = itemfdgsasdasdash.Value.Substring(2, itemfdgsasdasdash.Value.Length - 4);
                    string[] s      = item.Split('º');
                    PZItem   pzitem = new PZItem(Int32.Parse(s[2]), Int32.Parse(s[0]), s[1]);
                    trade.selling.Add(pzitem);
                }

                string fbuyr = rgxfbuy.Match(tr.Value).Value;
                string fbuy  = fbuyr.Substring(1, fbuyr.Length - 2);
                trade.fbuying = fbuy;

                string after = rgxafter.Match(tr.Value).Value;
                items = rgxitem.Matches(after);
                foreach (Match itemfdgsasdasdash in items)
                {
                    string   item   = itemfdgsasdasdash.Value.Substring(2, itemfdgsasdasdash.Value.Length - 4);
                    string[] s      = item.Split('º');
                    PZItem   pzitem = new PZItem(Int32.Parse(s[2]), Int32.Parse(s[0]), s[1]);
                    trade.buying.Add(pzitem);
                }

                string inc = rgxincnm.Match(tr.Value).Value;
                if (inc.StartsWith("f"))
                {
                    trade.includename = false;
                }
                else
                {
                    trade.includename = true;
                }

                string fnamer = rgxfname.Match(tr.Value).Value;
                string fname  = fnamer.Substring(2, fnamer.Length - 4);
                trade.fname = fname;

                trade.name = clientname;

                Console.WriteLine(trade.ToString());
                ltrades.Add(trade);
            }
            this.Close();
        }
Exemple #5
0
 public override string ToString()
 {
     return(client.ToString() + " -- outputing " + PZItem.GetNameFromID(outputitem));
 }
Exemple #6
0
        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
            }
        }
Exemple #7
0
 public PZConverter(PZClient c, PZItem i, PZItem o)
 {
     client = c;
     input  = i;
     output = o;
 }