コード例 #1
0
        /*private void additemtolist(Card c, string from, int gold, bool wts, string wholemsg)
{
if (wts)
{
this.addingcards.Add(new Auction(from, DateTime.Now, Auction.OfferType.SELL, c, wholemsg, gold));
}
else
{

this.addingcards.Add(new Auction(from, DateTime.Now, Auction.OfferType.BUY, c, wholemsg, gold));
}

}*/

        private static void GetAuctionsFromShortIntoList(string shortList, string from, Auction.OfferType offerType, List<Auction> outList)
        {
            string[] words = shortList.Split(';');
            for (int i = 0; i < words.Length; i++)
            {
                if (words[i] == "" || words[i] == " ") break;
                string price;
                string ids;
                if (words[i].Contains(' '))
                {
                    price = words[i].Split(' ')[1];
                    if (price == "") { price = "0"; }
                    ids = words[i].Split(' ')[0];
                }

                else
                {
                    price = "0";
                    ids = words[i];
                }

                string[] ideen = ids.Split(','); //When string does not contain a , the whole string is the first element of the returned array.
                foreach (string idd in ideen)
                {
                    int id = Convert.ToInt32(idd);
                    CardType type = CardTypeManager.getInstance().get(id);
                    Card card = new Card(id, type, true);
                    outList.Add(new Auction(from, DateTime.Now, offerType, card, "(Network Auction)", Convert.ToInt32(price)));
                }

            }
        }
コード例 #2
0
 public bool isFilteredByAmountFilter(Auction a)
 {
     //if (!helpf.cardIDToNumberOwned.ContainsKey(a.card.getType())) Console.WriteLine("#key is not in " + a.card.getName());
     int anz = helpf.cardIDToNumberOwned[a.card.getType()];
     if (amountFilter == 1 && anz == 0 ) return true;
     if (amountFilter == 2 && anz <= 3) return true;
     if (amountFilter == 3 && anz >= 3) return true;
     if (amountFilter == 4 && anz >= 1) return true;
     if (amountFilter == 26)
     {
         if(helpf.cardIDToNumberOwnedTiered[a.card.getType()] <= 27) return true;
     }
     if (amountFilter == 27)
     {
         if (helpf.cardIDToNumberOwnedTiered[a.card.getType()] >= 27) return true;
     }
     return false;
 }
コード例 #3
0
        public void TestSpamFilterDisabled()
        {
            SpamFilter sf = new SpamFilter(); //No SpamTime set => Show everything
            DateTime time1 = new DateTime(2013, 1, 1, 0, 0, 0);
            CardType cType = new CardType();
            cType.id = 1;
            Auction aBob1 = new Auction("bob", time1, Auction.OfferType.BUY, new Card(1, cType, true),"");
            Auction aAlice1 = new Auction("alice", new DateTime(2013, 1, 1, 0, 0, 15), Auction.OfferType.BUY, new Card(1, cType, true),"");

            DateTime time2 = new DateTime(2013, 1, 1, 0, 0, 30);
            Auction aBob2 = new Auction("bob", time2, Auction.OfferType.BUY, new Card(1, cType, true),"");
            sf.addAuction(aBob1);
            sf.addAuction(aAlice1);
            sf.addAuction(aBob2);
            Assert.IsFalse(sf.isFilteredBySpamFilter(aBob1));
            Assert.IsFalse(sf.isFilteredBySpamFilter(aAlice1));
            Assert.IsFalse(sf.isFilteredBySpamFilter(aBob2));
        }
コード例 #4
0
        public void TestSpamFilterBlock()
        {
            SpamFilter sf = new SpamFilter();
            sf.setSpamTime(new TimeSpan(0, 1, 0));
            DateTime time1 = new DateTime(2013, 1, 1, 0, 0, 0);
            CardType cType = new CardType();
            cType.id = 1;
            Auction aBob1 = new Auction("bob", time1, Auction.OfferType.BUY, new Card(1, cType, true),"");
            Auction aAlice1 = new Auction("alice", new DateTime(2013, 1, 1, 0, 0, 15), Auction.OfferType.BUY, new Card(1, cType, true),"");

            DateTime time2 = new DateTime(2013, 1, 1, 0, 0, 30);
            Auction aBob2 = new Auction("bob", time2, Auction.OfferType.BUY, new Card(1, cType, true),"");
            sf.addAuction(aBob1);
            sf.addAuction(aAlice1);
            sf.addAuction(aBob2);
            Assert.IsFalse(sf.isFilteredBySpamFilter(aBob1)); //Block the newer message and show the older one
            Assert.IsFalse(sf.isFilteredBySpamFilter(aAlice1));
            Assert.IsTrue(sf.isFilteredBySpamFilter(aBob2));
        }
コード例 #5
0
        public bool isFilteredByAmountFilter(Auction a)
        {
            //if (!helpf.cardIDToNumberOwned.ContainsKey(a.card.getType())) Console.WriteLine("#key is not in " + a.card.getName());
            int anz = helpf.cardIDToNumberOwned[a.card.getType()];

            if (amountFilter == 1 && anz == 0)
            {
                return(true);
            }
            if (amountFilter == 2 && anz <= 3)
            {
                return(true);
            }
            if (amountFilter == 3 && anz >= 3)
            {
                return(true);
            }
            if (amountFilter == 4 && anz >= 1)
            {
                return(true);
            }
            if (amountFilter == 26)
            {
                if (helpf.cardIDToNumberOwnedTiered[a.card.getType()] <= 27)
                {
                    return(true);
                }
            }
            if (amountFilter == 27)
            {
                if (helpf.cardIDToNumberOwnedTiered[a.card.getType()] >= 27)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #6
0
ファイル: Auction.cs プロジェクト: dga711/auction.mod
 public static int CompareSellerName(Auction a1, Auction a2)
 {
     return(a1.seller.CompareTo(a2.seller));
 }
コード例 #7
0
        private void drawAHandSearch()
        {
            
            bool clickableItems = false;
            // have to draw textfield in front of scrollbar or otherwise you lose focus in textfield (lol)
            if (helpf.inauchouse)
            {

                
                GUI.color = Color.white;

                // draw filter menue
                GUI.skin = helpf.cardListPopupSkin;
                GUI.Box(recto.filtermenurect, string.Empty);
                // wts filter menue
                GUI.skin = helpf.cardListPopupBigLabelSkin;
                GUI.Label(recto.sbarlabelrect, "Scroll:");
                GUI.skin = helpf.cardListPopupSkin;
                GUI.Box(recto.sbrect, string.Empty);
                string selfcopy = srchsvr.wtssearchstring;
                GUI.SetNextControlName("dbSearchfield");
                srchsvr.wtssearchstring = GUI.TextField(recto.sbrect, srchsvr.wtssearchstring, helpf.chatLogStyle);
                recto.drawsearchpulldown();// draw here to be the pull down menue the first clicked object


                GUI.contentColor = Color.white;
                GUI.color = Color.white;
                if (!srchsvr.growthbool) { GUI.color = dblack; }
                bool growthclick = GUI.Button(recto.sbgrect, growthres);
                GUI.color = Color.white;
                if (!srchsvr.orderbool) { GUI.color = dblack; }
                bool orderclick = GUI.Button(recto.sborect, orderres);
                GUI.color = Color.white;
                if (!srchsvr.energybool) { GUI.color = dblack; }
                bool energyclick = GUI.Button(recto.sberect, energyres);
                GUI.color = Color.white;
                if (!srchsvr.decaybool) { GUI.color = dblack; }
                bool decayclick = GUI.Button(recto.sbdrect, decayres);


                GUI.contentColor = Color.gray;
                GUI.color = Color.white;
                if (!srchsvr.commonbool) { GUI.color = dblack; }
                bool commonclick = GUI.Button(recto.sbcommonrect, "C");
                GUI.color = Color.white;
                if (!srchsvr.uncommonbool) { GUI.color = dblack; }
                GUI.contentColor = Color.white;
                bool uncommonclick = GUI.Button(recto.sbuncommonrect, "U");
                GUI.color = Color.white;
                if (!srchsvr.rarebool) { GUI.color = dblack; }
                GUI.contentColor = Color.yellow;
                bool rareclick = GUI.Button(recto.sbrarerect, "R");
                GUI.color = Color.white;
                if (!srchsvr.twentysevenbool) { GUI.color = dblack; }
                //if (!p1mt3bool) { GUI.color = dblack; }
                bool mt27click;
                if (helpf.wtsmenue)
                {
                    mt27click = GUI.Button(recto.sbtwentysevenrect, "<27"); // >3 bei wtsmenue=false
                }
                else { mt27click = GUI.Button(recto.sbtwentysevenrect, ">27"); }
                bool mt3click;
                bool mt0click = false;
                GUI.color = Color.white;
                if (!srchsvr.threebool) { GUI.color = dblack; }
                if (helpf.wtsmenue)
                {
                    mt3click = GUI.Button(recto.sbthreerect, "<3"); // >3 bei wtsmenue=false
                }
                else { mt3click = GUI.Button(recto.sbthreerect, ">3"); }
                GUI.color = Color.white;
                if (!srchsvr.onebool) { GUI.color = dblack; }
                if (!helpf.wtsmenue) { mt0click = GUI.Button(recto.sbonerect, ">0"); }
                else
                {
                    if(helpf.playerStoreMenu)mt0click = GUI.Button(recto.sbonerect, "<1");
                }
                GUI.color = Color.white;
                GUI.contentColor = Color.white;

                // draw seller filter
                GUI.skin = helpf.cardListPopupBigLabelSkin;
                if (helpf.wtsmenue)
                {
                    GUI.Label(recto.sbsellerlabelrect, "ignore Seller:");
                }
                else { GUI.Label(recto.sbsellerlabelrect, "ignore Buyer:"); }

                GUI.skin = helpf.cardListPopupSkin;
                GUI.Box(recto.sbsellerrect, string.Empty);
                string sellercopy = srchsvr.sellersearchstring;
                GUI.SetNextControlName("sellerframe");
                srchsvr.sellersearchstring = GUI.TextField(recto.sbsellerrect, srchsvr.sellersearchstring, helpf.chatLogStyle);

                // draw price filter


                GUI.skin = helpf.cardListPopupBigLabelSkin;
                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                GUI.Label(recto.sbpricelabelrect, "<= Price <=");
                GUI.skin.label.alignment = TextAnchor.MiddleLeft;


                GUI.skin = helpf.cardListPopupSkin;
                GUI.Box(recto.sbpricerect, string.Empty);
                GUI.Box(recto.sbpricerect2, string.Empty);
                string pricecopy = srchsvr.pricesearchstring;
                string pricecopy2 = srchsvr.pricesearchstring2;
                srchsvr.pricesearchstring = Regex.Replace(GUI.TextField(recto.sbpricerect, srchsvr.pricesearchstring, helpf.chatLogStyle), @"[^0-9]", "");
                srchsvr.pricesearchstring2 = Regex.Replace(GUI.TextField(recto.sbpricerect2, srchsvr.pricesearchstring2, helpf.chatLogStyle), @"[^0-9]", "");
                GUI.color = Color.white;

                // draw time filter
                if (!helpf.playerStoreMenu)
                {
                    GUI.skin = helpf.cardListPopupBigLabelSkin;
                    GUI.Label(recto.sbtimelabel, "not older than");
                    GUI.skin = helpf.cardListPopupSkin;
                    GUI.Box(recto.sbtimerect, string.Empty);
                    string timecopy = srchsvr.timesearchstring;
                    srchsvr.timesearchstring = Regex.Replace(GUI.TextField(recto.sbtimerect, srchsvr.timesearchstring, 2, helpf.chatLogStyle), @"[^0-9]", "");
                    if (srchsvr.timesearchstring != "" && Convert.ToInt32(srchsvr.timesearchstring) > helpf.deleteTime) { srchsvr.timesearchstring = ((int)helpf.deleteTime).ToString(); }
                    GUI.color = Color.white;
                }


                bool tpfgen = GUI.Button(recto.sbtpfgen, "");
                if (srchsvr.takepriceformgenarator)
                {
                    GUI.DrawTexture(recto.sbtpfgen, ResourceManager.LoadTexture("Arena/scroll_browser_button_cb_checked"));
                }
                else
                {
                    GUI.DrawTexture(recto.sbtpfgen, ResourceManager.LoadTexture("Arena/scroll_browser_button_cb"));
                }
                GUI.skin = helpf.cardListPopupBigLabelSkin;
                if (helpf.wtsmenue)
                {
                    GUI.Label(recto.sbtpfgenlabel, "Price <= wtb-generator");
                }
                else { GUI.Label(recto.sbtpfgenlabel, "Price >= wts-generator"); }


                // only scrolls with price
                bool owp = false;
                if (!helpf.playerStoreMenu)
                {
                    owp = GUI.Button(recto.sbonlywithpricebox, "");
                    if (srchsvr.ignore0)
                    {
                        GUI.DrawTexture(recto.sbonlywithpricebox, ResourceManager.LoadTexture("Arena/scroll_browser_button_cb_checked"));
                    }
                    else
                    {
                        GUI.DrawTexture(recto.sbonlywithpricebox, ResourceManager.LoadTexture("Arena/scroll_browser_button_cb"));
                    }
                    GUI.skin = helpf.cardListPopupBigLabelSkin;
                    GUI.Label(recto.sbonlywithpricelabelbox, "only Scrolls with Price");
                }
                GUI.skin = helpf.cardListPopupSkin;

                GUI.contentColor = Color.red;
                bool closeclick = GUI.Button(recto.sbclearrect, "X");
                GUI.contentColor = Color.white;

                if (this.helpf.playerStoreMenu)
                {
                    if (!this.gglthngs.workthreadready) GUI.contentColor = this.dblack;
                    if (GUI.Button(recto.updateGoogleThings, "Update"))
                    {
                        if (this.gglthngs.workthreadready) new Thread(new ThreadStart(this.gglthngs.workthread)).Start();
                    }
                    GUI.contentColor = Color.white;
                }
                

                if (growthclick) { srchsvr.growthbool = !srchsvr.growthbool; };
                if (orderclick) { srchsvr.orderbool = !srchsvr.orderbool; }
                if (energyclick) { srchsvr.energybool = !srchsvr.energybool; };
                if (decayclick) { srchsvr.decaybool = !srchsvr.decaybool; }
                if (commonclick) { srchsvr.commonbool = !srchsvr.commonbool; };
                if (uncommonclick) { srchsvr.uncommonbool = !srchsvr.uncommonbool; }
                if (rareclick) { srchsvr.rarebool = !srchsvr.rarebool; };
                if (mt27click) { srchsvr.twentysevenbool = !srchsvr.twentysevenbool; }
                if (mt3click) { srchsvr.threebool = !srchsvr.threebool; }
                if (mt0click) { srchsvr.onebool = !srchsvr.onebool; }
                if (owp) { srchsvr.ignore0 = !srchsvr.ignore0; }
                if (tpfgen) { srchsvr.takepriceformgenarator = !srchsvr.takepriceformgenarator; }
                if (closeclick)
                {
                    srchsvr.resetsearchsettings();
                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.resetFilters();
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.resetFilters();
                    }
                    else
                    {
                        ah.buyOfferFilter.resetFilters();
                    }

                }

                if (helpf.wtsmenue)
                {
                    if (helpf.playerStoreMenu) srchsvr.savesettings(2, true); 
                    else srchsvr.savesettings(0, true); 
                } 
                else { srchsvr.savesettings(0, false); }

                //set filters
                if (tpfgen)
                {
                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setTakeWTB(srchsvr.takepriceformgenarator);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setTakeWTB(srchsvr.takepriceformgenarator);
                    }
                    else
                    {
                        ah.buyOfferFilter.setTakeWTS(srchsvr.takepriceformgenarator);
                    } 
                }
                if (selfcopy != srchsvr.wtssearchstring)
                {
                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setCardFilter(srchsvr.wtssearchstring);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setCardFilter(srchsvr.wtssearchstring);
                    }
                    else
                    {
                        ah.buyOfferFilter.setCardFilter(srchsvr.wtssearchstring);
                    }

                }
                if (owp)
                {
                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setDontShowNoPrice(srchsvr.ignore0);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setDontShowNoPrice(srchsvr.ignore0);
                    }
                    else
                    {
                        ah.buyOfferFilter.setDontShowNoPrice(srchsvr.ignore0);
                    }
                }
                if (mt3click || mt0click || mt27click)
                {
                    int filter = 0;
                    
                    if (helpf.wtsmenue)
                    {
                        if (srchsvr.twentysevenbool) filter = 27;//(onebool < threebool)
                        if (srchsvr.threebool) filter = 3;
                        if (helpf.playerStoreMenu && srchsvr.onebool) filter = 4;
                        ah.sellOfferFilter.setAmountFilter(filter);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setAmountFilter(filter);
                    }
                    else
                    {
                        if (srchsvr.onebool) filter = 1;
                        if (srchsvr.threebool) filter = 2;//(onebool < threebool)
                        if (srchsvr.twentysevenbool) filter = 26;//(onebool < threebool)
                        ah.buyOfferFilter.setAmountFilter(filter);
                    }
                }

                if (sellercopy != srchsvr.sellersearchstring)
                {

                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setIgnoredSellers(srchsvr.sellersearchstring);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setIgnoredSellers(srchsvr.sellersearchstring);
                    }
                    else
                    {
                        ah.buyOfferFilter.setIgnoredSellers(srchsvr.sellersearchstring);
                    }


                }
                if (pricecopy != srchsvr.pricesearchstring)
                {
                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setPriceLowerBound(srchsvr.pricesearchstring);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setPriceLowerBound(srchsvr.pricesearchstring);
                    }
                    else
                    {
                        ah.buyOfferFilter.setPriceLowerBound(srchsvr.pricesearchstring);
                    }
                }
                if (pricecopy2 != srchsvr.pricesearchstring2)
                {

                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setPriceUpperBound(srchsvr.pricesearchstring2);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setPriceUpperBound(srchsvr.pricesearchstring2);
                    }
                    else
                    {
                        ah.buyOfferFilter.setPriceUpperBound(srchsvr.pricesearchstring2);
                    }
                }


                if (growthclick || orderclick || energyclick || decayclick)
                {
                    string[] res = { "", "", "", "" };
                    if (srchsvr.decaybool) { res[0] = "decay"; };
                    if (srchsvr.energybool) { res[1] = "energy"; };
                    if (srchsvr.growthbool) { res[2] = "growth"; };
                    if (srchsvr.orderbool) { res[3] = "order"; };


                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setResourceFilter(res);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setResourceFilter(res);
                    }
                    else
                    {
                        ah.buyOfferFilter.setResourceFilter(res);
                    }


                }
                if (commonclick || uncommonclick || rareclick)
                {
                    if (helpf.wtsmenue)
                    {
                        ah.sellOfferFilter.setRarityFilter(srchsvr.commonbool, srchsvr.uncommonbool, srchsvr.rarebool);
                        if (helpf.playerStoreMenu) ps.sellOfferFilter.setRarityFilter(srchsvr.commonbool, srchsvr.uncommonbool, srchsvr.rarebool);
                    }
                    else
                    {
                        ah.buyOfferFilter.setRarityFilter(srchsvr.commonbool, srchsvr.uncommonbool, srchsvr.rarebool);
                    }

                }


                if (recto._showSearchDropdown) recto.OnGUI_drawSearchPulldown(recto.sbrect);// draw pulldown again (for overlay)
            }
            // Draw Auctionhouse here:
            if (helpf.inauchouse)
            {
                bool deleteOldEntrys = false;
                //Console.WriteLine(GUI.GetNameOfFocusedControl());
                GUI.depth = 15;
                this.opacity = 1f;
                GUI.skin = helpf.cardListPopupSkin;
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, this.opacity);

                GUI.Box(recto.position, string.Empty);
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, this.opacity * 0.3f);
                GUI.Box(recto.position2, string.Empty);
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, this.opacity);



                // draw sort buttons:###############################################
                Vector2 vec11 = GUI.skin.button.CalcSize(new GUIContent("Scroll"));

                if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX, recto.screenRect.yMin - 4, vec11.x, 20), "Scroll"))
                {
                    if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }// this will toggle the reverse mode
                    if (srchsvr.sortmode == 1) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                    srchsvr.sortmode = 1;

                    bool res = false;
                    if ((!(this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0) && srchsvr.reverse) || (this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0 && !srchsvr.reverse)) { res = true; }
                    
                    if (helpf.wtsmenue)
                    {
                        ah.setSellSortMode((!res)? AuctionHouse.SortMode.CARD : AuctionHouse.SortMode.CARD_REVERSE);
                        if (helpf.playerStoreMenu) ps.setSellSortMode((!res)? AuctionHouse.SortMode.CARD : AuctionHouse.SortMode.CARD_REVERSE);
                    }
                    else
                    {
                        ah.setBuySortMode((!res)? AuctionHouse.SortMode.CARD : AuctionHouse.SortMode.CARD_REVERSE);
                    }

                    //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);

                }
                float datelength = GUI.skin.button.CalcSize(new GUIContent("Date")).x;
                float datebeginn = 0;
                if (helpf.wtsmenue)
                {
                    vec11 = GUI.skin.button.CalcSize(new GUIContent("Seller"));

                    if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX + recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + recto.costIconWidth + (recto.labelsWidth - vec11.x) / 2f - datelength / 2f - 2f, recto.screenRect.yMin - 4f, vec11.x, 20f), "Seller"))
                    {
                        if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                        if (srchsvr.sortmode == 3) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                        srchsvr.sortmode = 3;

                        bool res = false;
                        if ((!(this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0) && srchsvr.reverse) || (this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0 && !srchsvr.reverse)) { res = true; }
                    
                        ah.setSellSortMode((!res)? AuctionHouse.SortMode.SELLER : AuctionHouse.SortMode.SELLER_REVERSE);
                        if (helpf.playerStoreMenu) ps.setSellSortMode((!res)? AuctionHouse.SortMode.SELLER : AuctionHouse.SortMode.SELLER_REVERSE);
                        //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                    }
                }
                else
                {
                    vec11 = GUI.skin.button.CalcSize(new GUIContent("Buyer"));
                    if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX + recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + recto.costIconWidth + (recto.labelsWidth - vec11.x) / 2f - datelength / 2f - 2f, recto.screenRect.yMin - 4f, vec11.x, 20f), "Buyer"))
                    {
                        if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                        if (srchsvr.sortmode == 3) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                        srchsvr.sortmode = 3;
                        bool res = false;
                        if ((!(this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0) && srchsvr.reverse) || (this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0 && !srchsvr.reverse)) { res = true; }

                        ah.setBuySortMode((!res) ? AuctionHouse.SortMode.SELLER : AuctionHouse.SortMode.SELLER_REVERSE);
                        //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                    }
                }
                datebeginn = recto.innerRect.xMin + recto.labelX + recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + recto.costIconWidth + (recto.labelsWidth - vec11.x) / 2 - datelength / 2 - 2 + vec11.x;
                vec11 = GUI.skin.button.CalcSize(new GUIContent("Price"));
                if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX + 2f * recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + 2 * recto.costIconWidth + recto.labelsWidth / 4f - vec11.x / 2, recto.screenRect.yMin - 4, vec11.x, 20), "Price"))
                {
                    if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                    if (srchsvr.sortmode == 2) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                    srchsvr.sortmode = 2;

                    bool res = false;
                    if ((!(this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0) && srchsvr.reverse) || (this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0 && !srchsvr.reverse)) { res = true; }
                    
                    if (helpf.wtsmenue)
                    {
                        ah.setSellSortMode((!res) ? AuctionHouse.SortMode.PRICE : AuctionHouse.SortMode.PRICE_REVERSE);
                        if (helpf.playerStoreMenu) ps.setSellSortMode((!res) ? AuctionHouse.SortMode.PRICE : AuctionHouse.SortMode.PRICE_REVERSE);
                    }
                    else
                    {
                        ah.setBuySortMode((!res) ? AuctionHouse.SortMode.PRICE : AuctionHouse.SortMode.PRICE_REVERSE);
                    }

                    //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                }
                vec11 = GUI.skin.button.CalcSize(new GUIContent("Date"));
                //if (GUI.Button(new Rect(this.innerRect.x + offX , this.screenRect.yMin - 4, vec11.x * 2, 20), "Date"))
                if (GUI.Button(new Rect(datebeginn + 4, recto.screenRect.yMin - 4, vec11.x, 20), "Date"))
                {
                    if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                    if (srchsvr.sortmode == 0) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                    srchsvr.sortmode = 0;

                    bool res = false;
                    if (srchsvr.reverse) { res = true; }
                    
                    if (helpf.wtsmenue)
                    {
                        ah.setSellSortMode((!res) ? AuctionHouse.SortMode.TIME : AuctionHouse.SortMode.TIME_REVERSE);
                        if (helpf.playerStoreMenu) ps.setSellSortMode((!res) ? AuctionHouse.SortMode.TIME : AuctionHouse.SortMode.TIME_REVERSE);
                    }
                    else
                    {
                        ah.setBuySortMode((!res) ? AuctionHouse.SortMode.TIME : AuctionHouse.SortMode.TIME_REVERSE);
                    }
                    //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                }



                int num = 0;
                Card card = null;

                // set drawn cards
                if (helpf.playerStoreMenu)
                {
                    this.ahlist = ps.getSellOffers();
                }
                else
                {

                    if (helpf.wtsmenue) this.ahlist = ah.getSellOffers();
                    else this.ahlist = ah.getBuyOffers();
                }
                

                DateTime currenttime = DateTime.Now;
                // draw auctimes################################################
                //timefilter: 
                int time = 0;
                bool usetimefilter = false;
                float anzcards = anzcards = (float)this.ahlist.Count();
                if (srchsvr.timesearchstring != "")//doesnt show "old" offers filtered by time-filter
                {
                    time = Convert.ToInt32(srchsvr.timesearchstring);
                    currenttime = DateTime.Now.AddMinutes(-1 * time); usetimefilter = true;
                    anzcards = (float)this.ahlist.Count(delegate(Auction p1) { return (p1.time).CompareTo(currenttime) >= 0; });
                }

                GUI.skin = helpf.cardListPopupSkin;
                if (helpf.wtsmenue)
                {
                    this.scrollPos = GUI.BeginScrollView(recto.position3, this.scrollPos, new Rect(0f, 0f, recto.innerRect.width - 20f, recto.fieldHeight * anzcards));
                }
                else
                {
                    this.scrollPos2 = GUI.BeginScrollView(recto.position3, this.scrollPos2, new Rect(0f, 0f, recto.innerRect.width - 20f, recto.fieldHeight * anzcards));
                }

                //this.scrollPos = GUI.BeginScrollView(recto.position3, this.scrollPos, new Rect(0f, 0f, recto.innerRect.width - 20f, recto.fieldHeight * anzcards));
                
                //if ((!(this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0) && srchsvr.reverse) || (this.helpf.playerStoreMenu && this.srchsvr.sortmode == 0 && !srchsvr.reverse)) { this.ahlist.Reverse(); }

                GUI.skin = helpf.cardListPopupBigLabelSkin;


                float testy = this.scrollPos.y;
                if (!helpf.wtsmenue) testy = this.scrollPos2.y;
                foreach (Auction current in this.ahlist)
                {
                    if (usetimefilter && (current.time).CompareTo(currenttime) < 0) { continue; }
                    if (!current.card.tradable)
                    {
                        GUI.color = new Color(1f, 1f, 1f, 0.5f);
                    }
                    GUI.skin = helpf.cardListPopupGradientSkin;
                    //draw boxes
                    Rect position7 = recto.position7(num);
                    if (position7.yMax < testy || position7.y > testy + recto.position3.height)
                    {
                        num++;
                        GUI.color = Color.white;
                    }
                    else
                    {
                        if (clickableItems)
                        {
                            if (GUI.Button(position7, string.Empty))
                            {
                                //this.callback.ItemClicked(this, current);
                            }
                        }
                        else
                        {
                            GUI.Box(position7, string.Empty);
                        }
                        string name = current.card.getName();

                        string txt = helpf.cardIDtoimageid(current.card.getType()).ToString();
                        Texture texture = App.AssetLoader.LoadTexture2D(txt);//current.getCardImage())
                        if (sttngs.shownumberscrolls) name = "(" + helpf.cardIDToNumberOwned[current.card.getType()] + ") " + name;
                        GUI.skin = helpf.cardListPopupBigLabelSkin;
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        Vector2 vector = GUI.skin.label.CalcSize(new GUIContent(name));
                        // draw text
                        Rect position8 = recto.position8(num);
                        GUI.Label(position8, (vector.x >= position8.width) ? (name.Substring(0, Mathf.Min(name.Length, recto.maxCharsName)) + "...") : name);
                        GUI.skin = helpf.cardListPopupSkin;
                        string text = current.card.getPieceKind().ToString();
                        string str = text.Substring(0, 1) + text.Substring(1).ToLower();
                        string text2 = string.Empty;
                        int num2 = recto.maxCharsRK;
                        if (current.card.level > 0)
                        {
                            string text3 = text2;
                            text2 = string.Concat(new object[] { text3, "<color=#ddbb44>Tier ", current.card.level + 1, "</color>, " });
                            num2 += "<color=#rrggbb></color>".Length;
                        }
                        text2 = text2 + current.card.getRarityString() + ", " + str;
                        Vector2 vector2 = GUI.skin.label.CalcSize(new GUIContent(text2));

                        Rect position9 = recto.position9(num);
                        GUI.Label(position9, (vector2.x >= position9.width) ? (text2.Substring(0, Mathf.Min(text2.Length, num2)) + "...") : text2);
                        Rect restyperect = recto.restyperect(num);
                        //draw resource type
                        this.RenderCost(restyperect, current.card);
                        //draw seller name

                        string sellername = current.seller;
                        GUI.skin = helpf.cardListPopupBigLabelSkin;

                        vector = GUI.skin.label.CalcSize(new GUIContent(sellername));
                        //(this.fieldHeight-this.cardListPopupBigLabelSkin.label.fontSize)/2f
                        //Rect position11 = new Rect(restyperect.xMax + 2f, (float)num * this.fieldHeight, this.labelsWidth, this.fieldHeight);
                        Rect position11 = new Rect(restyperect.xMax + 2f, position8.yMin, recto.labelsWidth, recto.cardHeight);
                        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                        GUI.Label(position11, (vector.x >= position11.width) ? (sellername.Substring(0, Mathf.Min(sellername.Length, recto.maxCharsName)) + "...") : sellername);
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        //draw timestamp
                        GUI.skin = helpf.cardListPopupSkin;
                        DateTime temptime = DateTime.Now;
                        TimeSpan ts = temptime.Subtract(current.time);
                        if (this.helpf.playerStoreMenu)
                        {
                            /*
                            if (current.message.Split(';')[0] == "sold")
                            { sellername = "sold"; }
                            else
                            {
                                ts = (current.time).Subtract(temptime);
                                if (ts.TotalHours >= 1.0)
                                {
                                    sellername = ((int)ts.TotalHours+1) + " hours left";
                                }
                                else
                                {

                                    if (ts.TotalMinutes >= 1.0)
                                    {
                                        sellername = (ts.Minutes+1) + " min left";

                                    }
                                    else
                                    {
                                        sellername = "ends in a minute";
                                        if (ts.Seconds <= 40) { sellername = "ends in 40 seconds"; }
                                        if (ts.Seconds <= 20) { sellername = "ends in 20 seconds"; }
                                        if (ts.Seconds <= 10) { sellername = "ends in 10 seconds"; }
                                        if (ts.Seconds <= 5) { sellername = "ends in 5 seconds"; }
                                        if (ts.Seconds <= 0) { sellername = "ended"; }
                                        if (ts.TotalSeconds <= 0 && current.message.Split(';')[4] != App.MyProfile.ProfileInfo.id.ToString()) deleteOldEntrys = true;
                                    }
                                }
                            }*/

                        }
                        else
                        {
                            if (ts.TotalMinutes >= 1.0)
                            {
                                sellername = "" + ts.Minutes + " minutes ago";
                                if (ts.TotalMinutes >= helpf.deleteTime) deleteOldEntrys = true;
                            }
                            else
                            {
                                //sellername = "" + ts.Seconds + " seconds ago"; // to mutch changing numbers XD
                                if (ts.Seconds >= 40) { sellername = "40 seconds ago"; }
                                else if (ts.Seconds >= 20) { sellername = "20 seconds ago"; }
                                else if (ts.Seconds >= 10) { sellername = "10 seconds ago"; }
                                else if (ts.Seconds >= 5) { sellername = "5 seconds ago"; }
                                else sellername = "seconds ago";
                            }
                        }
                        


                        Rect position13 = new Rect(restyperect.xMax + 2f, position9.y, recto.labelsWidth, recto.fieldHeight);
                        GUI.skin.label.alignment = TextAnchor.UpperCenter;
                        GUI.Label(position13, sellername);
                        GUI.skin.label.alignment = TextAnchor.UpperLeft;
                        //testonly
                        //    restyperect = new Rect(position11.xMax , (float)num * this.fieldHeight + (this.fieldHeight - this.costIconHeight) / 2f, this.costIconWidth, this.costIconHeight);
                        //       draw resource type
                        //     this.RenderCost(restyperect, current);

                        //draw gold cost
                        float nextx = position11.xMax + recto.costIconWidth;
                        string gold = current.price + "g";
                        if (current.price == 0) gold = "?";
                        GUI.skin = helpf.cardListPopupBigLabelSkin;
                        //(this.fieldHeight-this.cardListPopupBigLabelSkin.label.fontSize)/2f

                        //Rect position12 = new Rect(nextx + 2f, position8.yMin, recto.goldlength, recto.cardHeight);
                        Rect position12 = new Rect(nextx + 2f, position8.yMin, recto.labelsWidth / 2f, recto.cardHeight);
                        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                        GUI.Label(position12, gold);
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;

                        // draw suggested price
                        //int index = Array.FindIndex(helpf.cardids, element => element == current.card.getType());
                        int index = helpf.cardidToArrayIndex(current.card.getType());
                        string suggeprice = "";
                        
                        if (index >= 0)
                        {
                            int p1 = 0, p2 = 0;
                            if (helpf.wtsmenue)
                            {
								p1 = prcs.getPrice(index, sttngs.wtsAHpriceType);
                                suggeprice = ((sttngs.wtsAHpriceType == ScrollsPostPriceType.BLACKMARKET)? "BM: " : "SG: ") + p1;
                            }
                            else
                            {
								p1 = prcs.getPrice(index, sttngs.wtbAHpriceType);
                                suggeprice = ((sttngs.wtbAHpriceType == ScrollsPostPriceType.BLACKMARKET) ? "BM: " : "SG: ") + p1;
                            }
                            
                            if (sttngs.showsugrange)
                            {
                                if (helpf.wtsmenue)
                                {
									p2 = prcs.getPrice(index, sttngs.wtsAHpriceType2);
                                }
                                else
                                {
									p2 = prcs.getPrice(index, sttngs.wtbAHpriceType2);
                                    
                                }
                                if (p1 != p2) suggeprice = "SG: " + Math.Min(p1, p2) + "-" + Math.Max(p1, p2);
                            }
                            
                        }
                        GUI.skin = helpf.cardListPopupSkin;
                        Rect position14 = new Rect(nextx + 2f, position9.y, recto.labelsWidth / 2f, recto.fieldHeight);
                        GUI.skin.label.alignment = TextAnchor.UpperCenter;
                        GUI.Label(position14, suggeprice);
                        GUI.skin.label.alignment = TextAnchor.UpperLeft;



                        GUI.skin = helpf.cardListPopupLeftButtonSkin;
                        if (!this.selectable)
                        {
                            GUI.enabled = false;
                        }
                        if (GUI.Button(recto.position10(num), string.Empty) && current.card.tradable)
                        {
                            card = current.card;
                            App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_button_click");
                        }
                        if (!this.selectable)
                        {
                            GUI.enabled = true;
                        }
                        //draw picture
                        if (texture != null)
                        {
                            GUI.DrawTexture(new Rect(4f, (float)num * recto.fieldHeight + (recto.fieldHeight - recto.cardHeight) * 0.43f, recto.cardWidth, recto.cardHeight), texture);
                        }
                        // draw buy/sell button
                        GUI.skin = helpf.cardListPopupGradientSkin;
                        if (helpf.wtsmenue)
                        {
                            if (!helpf.showtradedialog)
                            {
                                if (current.seller == App.MyProfile.ProfileInfo.name || current.price > App.MyProfile.ProfileData.gold || gglthngs.clickedItemBuyID != -1)
                                {
                                    GUI.color = dblack;
                                }
                                if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                {

                                    // start trading with seller
                                    if (current.seller != App.MyProfile.ProfileInfo.name && current.price <= App.MyProfile.ProfileData.gold)
                                    {
                                        if (!this.helpf.playerStoreMenu)
                                        {
                                            helpf.showtradedialog = true;
                                        }
                                        tradeitem = current;

                                        if (this.helpf.playerStoreMenu && gglthngs.clickedItemBuyID == -1)
                                        {
                                            helpf.showtradedialog = true;
                                            gglthngs.clickedItemLevel = -1;
                                            gglthngs.clickedItemForSales = -1;
                                            gglthngs.clickedItemPrice = -1;
                                            gglthngs.clickedItemBuyID = -2;
                                            gglthngs.clickedItemtypeid = -1;
                                            gglthngs.clickedItemPriceFromOfferMessage = current.price;
                                            App.Communicator.sendRequest(new MarketplaceOffersSearchViewMessage(current.card.getType()));
                                        }
                                    }
                                }
                            }
                            else
                            {
                                GUI.Box(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "");
                            }
                            
                            GUI.skin = helpf.cardListPopupBigLabelSkin;
                            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                            GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "Buy");
                            GUI.color = Color.white;

                        }
                        else
                        {
                            if (!helpf.showtradedialog)
                            {
                                if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                {

                                    // start trading with seller
                                    if (current.seller != App.MyProfile.ProfileInfo.name)
                                    {
                                        helpf.showtradedialog = true;
                                        tradeitem = current;
                                    }
                                }
                            }
                            else { GUI.Box(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""); }
                            GUI.skin = helpf.cardListPopupBigLabelSkin;
                            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                            GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "Sell");
                        }
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        if (!current.card.tradable)
                        {
                            GUI.color = Color.white;
                        }
                        num++;
                    }
                }

                GUI.EndScrollView();

                // delete old entrys
                

                GUI.color = Color.white;
                // show clicked card
                if (card != null)
                {
                    //this.callback.ItemButtonClicked(this, card);
                    string clink = card.getName().ToLower();
                    //int arrindex = Array.FindIndex(helpf.cardnames, element => element.Equals(clink));
                    int arrindex= helpf.cardnameToArrayIndex(clink);
                    if (arrindex >= 0)
                    {

                        crdvwr.createcard(arrindex, helpf.cardids[arrindex]);
                    }

                }

                drawButtonsBelow();

                GUI.skin.button.normal.textColor = Color.white;
                GUI.skin.button.hover.textColor = Color.white;


                GUI.color = Color.white;

                

                if (helpf.playerStoreMenu)
                {
                    if (deleteOldEntrys)
                    {
                        //ps.removeOldEntrys();
                    }
                }
                else
                {
                    if (deleteOldEntrys)
                    {
                        ah.removeOldEntrys();
                    }
                }


                if (helpf.showtradedialog) { this.starttrading(tradeitem.seller, tradeitem.card.getName(), tradeitem.price, helpf.wtsmenue, tradeitem.message, tradeitem.card.getType(),tradeitem.card.level); }






            }
            GUI.color = Color.white;
            GUI.contentColor = Color.white;
        }
コード例 #8
0
ファイル: PlayerStore.cs プロジェクト: noHero123/auction.mod
 public void delOffer(Auction a)
 {
     this.addAuctionList.Remove(a);
     createCardsFilter.filtersChanged = true;
     if (addAuctionList.Count == 0) helpf.addmode = false;
 }
コード例 #9
0
 public bool isFilteredByRareFilter(Auction a)
 {
     return(!rareFilter[a.card.getRarity()]);
 }
コード例 #10
0
 public bool isFilteredByResourceFilter(Auction a)
 {
     return !resourceFilter.Contains(a.card.getResourceString().ToLower());
 }
コード例 #11
0
ファイル: GeneratorUI.cs プロジェクト: noHero123/auction.mod
        private void generatewtxmsg(List <Auction> liste)
        {
            string         msg      = "";
            string         shortmsg = "";
            List <Auction> postlist = new List <Auction>();

            for (int i = 0; i < liste.Count; i++)
            {
                if (helpf.wtsmenue)
                {
                    if (prcs.wtspricelist1[liste[i].card.getType()] != "")
                    {
                        string price = prcs.wtspricelist1[liste[i].card.getType()];
                        //ai.priceinint = ;
                        Auction ai = new Auction("", DateTime.Now, Auction.OfferType.SELL, liste[i].card, "", Convert.ToInt32(price));
                        postlist.Add(ai);
                        //msg = msg + liste[i].card.getName() + " " + this.wtspricelist1[liste[i].card.getName().ToLower()] + ";";
                        //shortmsg = shortmsg + liste[i].card.getType() + " " + this.wtspricelist1[liste[i].card.getName().ToLower()] + ";";
                    }
                }
                else
                {
                    if (prcs.wtbpricelist1[liste[i].card.getType()] != "")
                    {
                        string  price = prcs.wtbpricelist1[liste[i].card.getType()];
                        Auction ai    = new Auction("", DateTime.Now, Auction.OfferType.SELL, liste[i].card, "", Convert.ToInt32(price));
                        postlist.Add(ai);
                        //msg = msg + liste[i].card.getName() + " " + this.wtbpricelist1[liste[i].card.getName().ToLower()] + ";";
                        //shortmsg = shortmsg + liste[i].card.getType() + " " + this.wtbpricelist1[liste[i].card.getName().ToLower()] + ";";
                    }
                }
            }

            postlist.Sort(delegate(Auction p1, Auction p2) { return((p1.price).CompareTo(p2.price)); });
            postlist.Reverse();
            Dictionary <string, string> shortlist = new Dictionary <string, string>();

            int  priceToAdd            = -1; // = -1 if no price have to be added, otherwise this has to be added to the message
            bool messageWouldBeTooLong = false;

            for (int i = 0; i < postlist.Count; i++)
            {
                Auction ai = postlist[i];

                if (msg.Length + ai.card.getName().Length + 1 + ai.price.ToString().Length > 506)// check if the element and the price still fits in the chat-message
                {
                    if (priceToAdd > 0)
                    {
                        msg      = msg.Substring(0, msg.Length - 2) + " " + ai.price + "g;";
                        shortmsg = shortmsg.Substring(0, shortmsg.Length - 1) + " " + ai.price + ";";
                    }
                    if (priceToAdd == 0)
                    {
                        msg      = msg.Substring(0, msg.Length - 2) + ";";
                        shortmsg = shortmsg.Substring(0, shortmsg.Length - 1) + ";";
                    }
                    messageWouldBeTooLong = true;
                    break;
                }

                if (i < postlist.Count - 1 && postlist[i + 1].price == ai.price)
                {
                    msg        = msg + ai.card.getName() + ", ";
                    shortmsg   = shortmsg + ai.card.getType() + ",";
                    priceToAdd = ai.price;
                }
                else
                {
                    priceToAdd = -1;

                    if (ai.price == 0)
                    {
                        msg      = msg + ai.card.getName() + ";";
                        shortmsg = shortmsg + ai.card.getType() + ";";
                    }
                    else
                    {
                        msg      = msg + ai.card.getName() + " " + ai.price + "g, ";
                        shortmsg = shortmsg + ai.card.getType() + " " + ai.price + ";";
                    }
                }
            }

            if (msg != "")
            {
                if (helpf.wtsmenue)
                {
                    msg = "WTS " + msg; shortmsg = "aucs " + shortmsg;
                }
                else
                {
                    msg = "WTB " + msg; shortmsg = "aucb " + shortmsg;
                }
                if (msg.EndsWith(" "))
                {
                    msg = msg.Remove(msg.Length - 2);
                }
                else
                {
                    msg = msg.Remove(msg.Length - 1);
                }
                shortmsg = shortmsg.Remove(shortmsg.Length - 1);
            }
            if (messageWouldBeTooLong)
            {
                App.Popups.ShowOk(this, "msgToLongMessage", "Message too Long", "Your generated message is too long.\r\nThe message was shortened.", "OK");
            }
            if (msg.Length < 512)
            {
                systemCopyBufferProperty.SetValue(null, msg, null);
            }
            if (msg.Length >= 512)
            {
                msg = "msg too long";
            }                                                // message cant be to long anymore :D
            //if (shortmsg.Length >= 512) { shortmsg = ""; msg = msg + ", networkmsg too"; }
            if (helpf.wtsmenue)
            {
                srchsvr.generatedwtsmessage = msg; srchsvr.shortgeneratedwtsmessage = shortmsg;
            }
            else
            {
                srchsvr.generatedwtbmessage = msg; srchsvr.shortgeneratedwtbmessage = shortmsg;
            }
            //Console.WriteLine(msg);
            //Console.WriteLine(shortmsg);
            srchsvr.sellersearchstring = msg;
            srchsvr.pricesearchstring  = shortmsg;
        }
コード例 #12
0
        public static int CompareTimeREV(Auction a1, Auction a2)
        {
            int firstcompare = a1.time.CompareTo(a2.time); //We want the most recent on the flor.

            return((firstcompare != 0) ? firstcompare : CompareCardName(a1, a2));
        }
コード例 #13
0
        public static int ComparePriceREV(Auction a1, Auction a2)
        {
            int firstcompare = -a1.price.CompareTo(a2.price);

            return((firstcompare != 0) ? firstcompare : CompareCardName(a1, a2));
        }
コード例 #14
0
ファイル: Generator.cs プロジェクト: noHero123/auction.mod
        public void setowncards(Message msg)
        {
            List<Card> orgicardsPlayer = new List<Card>();
            this.fullSellOwnList.Clear();
            PlayerStore.Instance.createCardsFilter.filtersChanged = true;
            orgicardsPlayer.AddRange(((LibraryViewMessage)msg).cards);
            List<string> checklist = new List<string>();
            helpf.cardIDToNumberOwned.Clear();
            helpf.cardIDToNumberOwnedTiered.Clear();
            Console.WriteLine("add cards to cardIDToNumberOwned");
            foreach (Auction ai in this.fullBuyOwnList) //fullbuyownlist == all cards in game
            {
                if (!helpf.cardIDToNumberOwned.ContainsKey(ai.card.getType()))
                {
                    helpf.cardIDToNumberOwned.Add(ai.card.getType(), 0);
                    helpf.cardIDToNumberOwnedTiered.Add(ai.card.getType(), 0);
                }
            }

            foreach (Card c in orgicardsPlayer)
            {
                if (c.tradable && c.level==0 && !(checklist.Contains(helpf.cardidsToCardnames[c.getType()]))) // no tier-scrolls
                {
                    Auction ai = new Auction(App.MyProfile.ProfileInfo.name,DateTime.Now,Auction.OfferType.SELL,c,"");
                    this.fullSellOwnList.Add(ai);
                    checklist.Add(helpf.cardidsToCardnames[c.getType()]);
                }


                helpf.cardIDToNumberOwned[c.getType()] = helpf.cardIDToNumberOwned[c.getType()] + 1;

                int tieramount = (int)Math.Pow(3, c.level);
                //Console.WriteLine("#"+ c.getType() + " "+ c.level + " " + tieramount);

                helpf.cardIDToNumberOwnedTiered[c.getType()] = helpf.cardIDToNumberOwnedTiered[c.getType()] + tieramount;
            }

            this.fullSellOwnList.Sort(delegate(Auction p1, Auction p2) { return (p1.card.getName()).CompareTo(p2.card.getName()); });

            //prcs.wtspricelist1.Clear();
            //for (int i = 0; i < fullSellOwnList.Count; i++)
            //{
            //    prcs.wtspricelist1.Add(fullSellOwnList[i].card.getType(), "");
            //}

            this.sellOwnCardsFilter.filtersChanged = true;
            PlayerStore.Instance.createCardsFilter.filtersChanged = true;
            PlayerStore.Instance.sellOfferFilter.filtersChanged = true;

        }
コード例 #15
0
        public static int CompareSellerNameREV(Auction a1, Auction a2)
        {
            int firstcompare = -a1.seller.CompareTo(a2.seller);

            return((firstcompare != 0) ? firstcompare : CompareCardName(a1, a2));
        }
コード例 #16
0
ファイル: Generator.cs プロジェクト: noHero123/auction.mod
        public void setallavailablecards(Message msg)
        {
            // get all available cards, save them!
            helpf.setarrays(msg);

            prcs.resetarrays(helpf.cardids.Length);
            if (helpf.nicks) helpf.readnicksfromfile();
            mssgprsr.searchscrollsnicks.Clear();
            prcs.wtbpricelist1.Clear();
            prcs.wtspricelist1.Clear();
            this.fullBuyOwnList.Clear();
            Console.WriteLine("add cards to fullbuyownList");
            for (int j = 0; j < helpf.cardnames.Length; j++)
            {
                prcs.wtspricelist1.Add(helpf.cardids[j], "");
                prcs.wtbpricelist1.Add(helpf.cardids[j], "");
                CardType type = CardTypeManager.getInstance().get(helpf.cardids[j]);
                Card card = new Card(helpf.cardids[j], type, true);
                //aucitem ai = new aucitem();
                //ai.card = card;
                //ai.price = "";
                //ai.priceinint = helpf.allcardsavailable.Count;
                //ai.seller = "me";
                Auction ai = new Auction(" ", DateTime.Now, Auction.OfferType.BUY, card,"");
                if (App.MyProfile.ProfileInfo.name != null) { ai = new Auction(App.MyProfile.ProfileInfo.name, DateTime.Now, Auction.OfferType.BUY, card,""); }
                this.fullBuyOwnList.Add(ai);
                nickelement nele;
                nele.nick = helpf.cardnames[j];
                nele.cardname = helpf.cardnames[j];
                mssgprsr.searchscrollsnicks.Add(nele);
            };
            mssgprsr.searchscrollsnicks.AddRange(helpf.loadedscrollsnicks);

            this.fullBuyOwnList.Sort(delegate(Auction p1, Auction p2) { return (p1.card.getName()).CompareTo(p2.card.getName()); });
            this.buyOwnCardsFilter.filtersChanged = true;
            try
            {
                prcs.totalpricecheck();//helpf.cardids
            }
            catch { }

            // set cardIDToNumberOwned to zeros, or the mod will crash, if you got an offer, but dont visit the deckbuilder /store etc (where you get your own cards) before
            helpf.cardIDToNumberOwned.Clear();
            Console.WriteLine("zeros cardIDToNumberOwned");
            foreach (Auction ai in this.fullBuyOwnList) //fullbuyownlist == all cards in game
            {
                if (!helpf.cardIDToNumberOwned.ContainsKey(ai.card.getType()))
                {
                    helpf.cardIDToNumberOwned.Add(ai.card.getType(), 0);
                }
            }

        }
コード例 #17
0
ファイル: Auction.cs プロジェクト: noHero123/auction.mod
 public static int ComparePriceREV(Auction a1, Auction a2)
 {
     int firstcompare = -a1.price.CompareTo(a2.price);
     return (firstcompare != 0) ? firstcompare : CompareCardName(a1, a2);
 }
コード例 #18
0
ファイル: PlayerStore.cs プロジェクト: noHero123/auction.mod
 public void addOffer(Auction a)
 {
     this.addAuctionList.Add(a);
     createCardsFilter.filtersChanged = true;
 }
コード例 #19
0
ファイル: Auction.cs プロジェクト: dga711/auction.mod
 public static int ComparePrice(Auction a1, Auction a2)
 {
     return(a1.price.CompareTo(a2.price));
 }
コード例 #20
0
 public void addOffer(Auction a)
 {
     this.addAuctionList.Add(a);
     createCardsFilter.filtersChanged = true;
 }
コード例 #21
0
ファイル: Auction.cs プロジェクト: noHero123/auction.mod
 public static int CompareSellerNameREV(Auction a1, Auction a2)
 {
     int firstcompare = -a1.seller.CompareTo(a2.seller);
     return (firstcompare != 0) ? firstcompare : CompareCardName(a1, a2);
 }
コード例 #22
0
ファイル: AuctionHouse.cs プロジェクト: noHero123/auction.mod
 public void removeMessages(string seller, Auction.OfferType aot, string cname)
 {
     fullSellOfferList.RemoveAll(a => a.seller.Equals(seller)&& a.card.getType() == helpf.cardnamesToID[cname] && a.offer==aot);
     sellOfferListFiltered.RemoveAll(a => a.seller.Equals(seller) && a.card.getType() == helpf.cardnamesToID[cname] && a.offer == aot);
     fullBuyOfferList.RemoveAll(a => a.seller.Equals(seller) && a.card.getType() == helpf.cardnamesToID[cname] && a.offer == aot);
     buyOfferListFiltered.RemoveAll(a => a.seller.Equals(seller) && a.card.getType() == helpf.cardnamesToID[cname] && a.offer == aot);
 }
コード例 #23
0
ファイル: Auction.cs プロジェクト: noHero123/auction.mod
 public static int CompareTimeREV(Auction a1, Auction a2)
 {
     int firstcompare = a1.time.CompareTo(a2.time); //We want the most recent on the flor.
     return (firstcompare != 0) ? firstcompare : CompareCardName(a1, a2);
 }
コード例 #24
0
 public bool isFiltered(Auction a)
 {
     return(isBeyondPriceRange(a) || isFilteredByCardFilter(a) || isIgnoredSellerName(a) || isFilteredByAmountFilter(a) || isFilteredByRareFilter(a) || isFilteredByResourceFilter(a) || isFilteredByTypeCount(a));
 }
コード例 #25
0
        public void handleMessage(Message msg)
        {

            if (msg is MessageMessage)
            {
                MessageMessage omsg = (MessageMessage)msg;
                if (omsg.type == MessageMessage.Type.SOLD_MARKET_SCROLLS)
                {
                    this.needSoldAucs = true;
                    App.Communicator.send(new MarketplaceSoldListViewMessage());
                }
            }

            if (msg is OkMessage)
            {
                OkMessage omsg = (OkMessage)msg;
                if (Helpfunktions.Instance.createAuctionMenu)
                {

                    if (omsg.op == "MarketplaceCreateOffer" && this.sellingCard != null)
                    {
                        Helpfunktions.Instance.cardIDToNumberOwned[this.sellingType]--;
                        Helpfunktions.Instance.cardIDToNumberOwnedTiered[this.sellingType] -= (int)Math.Pow(3, sellingTypeLevel);
                        PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                        PlayerStore.Instance.sellOfferFilter.filtersChanged = true;

                        this.dataOffer = 0;
                        this.sellingCard = null;
                        App.Communicator.send(new MarketplaceOffersViewMessage());
                        //App.Communicator.send(new MarketplaceSoldListViewMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                    }
                    if (omsg.op == "MarketplaceCancelOffer")
                    {
                        Helpfunktions.Instance.cardIDToNumberOwned[this.cancelType]++;
                        Helpfunktions.Instance.cardIDToNumberOwnedTiered[this.cancelType] += (int)Math.Pow(3, cancelTypeLevel);
                        PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                        PlayerStore.Instance.sellOfferFilter.filtersChanged = true;

                        this.dataOffer = 0;
                        App.Communicator.send(new MarketplaceOffersViewMessage());
                        //App.Communicator.send(new MarketplaceSoldListViewMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                    }

                    if (omsg.op == "MarketplaceClaim")
                    {
                        
                        if (transactionBeingClaimed == null) return;
                        if (this.workthreadclaimall)
                        {
                            this.claimeditemstaxes += this.transactionBeingClaimed.fee;
                            this.claimeditemsmoney += this.transactionBeingClaimed.sellPrice;
                            System.Threading.Thread.Sleep(150);
                            this.claimlast();
                            return;
                        }
                        App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_coin_tally_end");
                        CardType cardType = CardTypeManager.getInstance().get(this.transactionBeingClaimed.cardType);
                        this.dataOffer = 0;
                        this.needSoldAucs = true;
                        App.Communicator.send(new MarketplaceOffersViewMessage());
                        App.Communicator.send(new MarketplaceSoldListViewMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                        App.Popups.ShowOk(this, "claimgold", "Gold added", string.Concat(new object[]
							{
								"<color=#bbaa88>Tier ",
								(int)(this.transactionBeingClaimed.level + 1),
								" ",
								cardType.name,
								" sold for ",
								this.transactionBeingClaimed.sellPrice,
								" gold!\nEarned <color=#ffd055>",
								this.transactionBeingClaimed.sellPrice - this.transactionBeingClaimed.fee,
								" gold</color> (the fence collects ",
								this.transactionBeingClaimed.fee,
								").</color>"
							}), "Ok");
                        this.transactionBeingClaimed = null;
                    }
                }

                if (Helpfunktions.Instance.playerStoreMenu)
                {
                    if (omsg.op == "MarketplaceMakeDeal")
                    {
                        App.Communicator.sendRequest(new GetStoreItemsMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                        App.Popups.ShowOk(this, "dealmade", "Purchase complete!", clickedItemName + " has been added to your collection.", "Ok");
                        Helpfunktions.Instance.cardIDToNumberOwned[this.clickedItemtypeid]++;
                        Helpfunktions.Instance.cardIDToNumberOwnedTiered[this.clickedItemtypeid]+=(int)Math.Pow(3, clickedItemLevel);
                        PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                        PlayerStore.Instance.sellOfferFilter.filtersChanged = true;
                        clickedItemBuyID = -1;
                    }
                }

            }

            if (msg is FailMessage)
            {
                FailMessage failMessage = (FailMessage)msg;
                if (failMessage.isType(typeof(MarketplaceMakeDealMessage)))
                {
                    App.Popups.ShowOk(this, "dealNOTmade", "Purchase failed", failMessage.info, "Ok");
                    PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                    PlayerStore.Instance.sellOfferFilter.filtersChanged = true;
                    clickedItemBuyID = -1;
                }

                if (failMessage.isType(typeof(MarketplaceCreateOfferMessage)) && this.sellingCard != null)
                {
                    App.Popups.ShowOk(this, "cantcreate", "Create failed", failMessage.info, "Ok");
                    this.sellingCard = null;
                }

                if (failMessage.isType(typeof(MarketplaceClaimMessage)))
                {
                    if (transactionBeingClaimed == null) return;
                    if (this.workthreadclaimall)
                    {
                        System.Threading.Thread.Sleep(150);
                        this.claimlast();
                        return;
                    }
                    this.dataOffer = 0;
                    this.needSoldAucs = true;
                    App.Communicator.send(new MarketplaceOffersViewMessage());
                    App.Communicator.send(new MarketplaceSoldListViewMessage());
                    App.Communicator.sendRequest(new LibraryViewMessage());
                    transactionBeingClaimed = null;
                }
            }

            if (msg is CheckCardDependenciesMessage && sellingCard !=null )
            {
                CheckCardDependenciesMessage checkCardDependenciesMessage = (CheckCardDependenciesMessage)msg;
                if (checkCardDependenciesMessage.dependencies == null || checkCardDependenciesMessage.dependencies.Length == 0)
                {
                    this.GetCreateOfferInfo();
                }
                else
                {
                    App.Popups.ShowOkCancel(this, "deckinvalidationwarning", "Notice", "Selling this scroll will make the following decks illegal:\n\n" + DeckUtil.GetFormattedDeckNames(checkCardDependenciesMessage.GetDeckNames()), "Ok", "Cancel");
                }
            }

            if (msg is MarketplaceCreateOfferInfoMessage && sellingCard != null)
            {
                MarketplaceCreateOfferInfoMessage marketplaceCreateOfferInfoMessage = (MarketplaceCreateOfferInfoMessage)msg;
                App.Popups.ShowSellCard(this, "sellcard", this.sellingCard, marketplaceCreateOfferInfoMessage.lowestPrice, marketplaceCreateOfferInfoMessage.suggestedPrice, marketplaceCreateOfferInfoMessage.copiesForSale, marketplaceCreateOfferInfoMessage.tax);
            }

            if (msg is MarketplaceOffersSearchViewMessage)
            {
                MarketplaceOffersSearchViewMessage marketplaceOffersViewMessage = (MarketplaceOffersSearchViewMessage)msg;
                clickedItemForSales = marketplaceOffersViewMessage.copiesForSale;
                clickedItemLevel = marketplaceOffersViewMessage.offer.card.level;
                clickedItemPrice = marketplaceOffersViewMessage.offer.price;
                clickedItemBuyID = marketplaceOffersViewMessage.offer.id;
                clickedItemName = marketplaceOffersViewMessage.offer.card.getName();
                clickedItemtypeid = marketplaceOffersViewMessage.offer.card.getType();

            }

            if (msg is MarketplaceOffersViewMessage)
            {
                //if (this.dataisreadyOwnOffers) return;

                MarketplaceOffersViewMessage marketplaceOffersViewMessage = (MarketplaceOffersViewMessage)msg;
                MarketplaceOffer[] offers = marketplaceOffersViewMessage.offers;
                this.pstoreOwnAucs.Clear();
                DateTime tme = DateTime.Now;
                tme = tme.AddMilliseconds(1000);
                for (int i = 0; i < offers.Length; i++)
                {
                    MarketplaceOffer marketplaceOffer = offers[i];
                    Auction a = new Auction(App.MyProfile.ProfileInfo.name, tme, Auction.OfferType.SELL, marketplaceOffer.card, "" + marketplaceOffer.id, marketplaceOffer.price);
                    tme = tme.AddMilliseconds(1);
                    //Console.WriteLine("add owm auction: " + a.card.getName() + " " + a.price);
                    this.pstoreOwnAucs.Add(a);
                }

                this.dataOffer++;
                
                if (this.dataOffer >= 2 || !this.needSoldAucs)
                {
                    this.dataisreadyOwnOffers = true;
                }
                if (this.dataOffer >= 2)
                {
                    this.needSoldAucs = false;
                }
            }

            if (msg is MarketplaceSoldListViewMessage)
            {
                //if (this.dataisreadyOwnOffers) return;

                MarketplaceSoldListViewMessage marketplaceOffersViewMessage = (MarketplaceSoldListViewMessage)msg;
                TransactionInfo[] offers = marketplaceOffersViewMessage.sold;
                this.pstoreSOLDAucs.Clear();
                this.soldScrollTransactions.Clear();
                DateTime tme = DateTime.Now;
                
                for (int i = 0; i < offers.Length; i++)
                {
                    TransactionInfo marketplaceOffer = offers[i];
                    if(!marketplaceOffer.claimed) this.soldScrollTransactions.Add(marketplaceOffer.cardId, marketplaceOffer);
                    CardType type = CardTypeManager.getInstance().get(marketplaceOffer.cardType);
                    Card c = new Card(marketplaceOffer.cardId, type, true);
                    string aucmessage="sold " + marketplaceOffer.fee;
                    if (marketplaceOffer.claimed)
                    {
                        aucmessage += " claimed";
                        continue;
                    }
                    Auction a = new Auction(App.MyProfile.ProfileInfo.name, tme, Auction.OfferType.SELL, c, aucmessage, marketplaceOffer.sellPrice, marketplaceOffer.cardId);
                    tme = tme.AddMilliseconds(1);
                    //Console.WriteLine("add owm auction: " + a.card.getName() + " " + a.price);
                    this.pstoreSOLDAucs.Add(a);
                }
                this.dataOffer++;
                if (this.dataOffer >= 2) this.dataisreadyOwnOffers = true;
                this.needSoldAucs = false;
            }

            if (msg is MarketplaceAvailableOffersListViewMessage)
            {
                Prices.Instance.getBlackmarketPrices(msg as MarketplaceAvailableOffersListViewMessage);
                if (this.dataisready) return;

                MarketplaceAvailableOffersListViewMessage marketplaceAvailableOffersListViewMessage = (MarketplaceAvailableOffersListViewMessage)msg;

                MarketplaceTypeAvailability[] available = marketplaceAvailableOffersListViewMessage.available;
                this.pstoreAucs.Clear();
                DateTime tme = DateTime.Now;
                for (int i = 0; i < available.Length; i++)
                {
                    MarketplaceTypeAvailability mta = available[i];
                    CardType type = CardTypeManager.getInstance().get(mta.type);
                    Card card = new Card(1, type, true);
                    card.level = mta.level;
                    Auction a = new Auction("BlackMarket", tme, Auction.OfferType.SELL, card, "", mta.price);
                    tme = tme.AddMilliseconds(-1);
                    //Console.WriteLine("add auction: " + a.card.getName() + " " + a.price);
                    this.pstoreAucs.Add(a);
                }

                this.dataisready = true;
            }
            return;
        }
コード例 #26
0
ファイル: PlayerStore.cs プロジェクト: noHero123/auction.mod
        private void addOwnAuction(Auction a)
        {
            if (a.offer == Auction.OfferType.SELL)
            {
                fullOWNOfferList.Insert(0, a);

                /*if (!sellOfferFilter.isFiltered(a))
                {
                    sellOfferListFiltered.Insert(0, a);
                    newSellOffers = true;
                }*/
            }
        }
コード例 #27
0
ファイル: AuctionHouse.cs プロジェクト: noHero123/auction.mod
        private void addAuction(Auction a)
        {
            //Console.WriteLine("add auction with time" + a.time.ToLongTimeString() + a.time.Millisecond);
            spamFilter.addAuction(a);
            if (a.offer == Auction.OfferType.BUY)
            {
                fullBuyOfferList.Insert(0, a);

                if (!buyOfferFilter.isFiltered(a) && !this.spamFilter.isFilteredBySpamFilter(a))
                {
                    buyOfferListFiltered.Insert(0, a);
                    newBuyOffers = true;
                }
            }
            else if (a.offer == Auction.OfferType.SELL)
            {
                fullSellOfferList.Insert(0, a);

                if (!sellOfferFilter.isFiltered(a) && !this.spamFilter.isFilteredBySpamFilter(a))
                {
                    sellOfferListFiltered.Insert(0, a);
                    newSellOffers = true;
                }
            }
        }
コード例 #28
0
ファイル: GeneratorUI.cs プロジェクト: noHero123/auction.mod
        private void generatewtxmsg(List<Auction> liste)
        {
            string msg = "";
            string shortmsg = "";
            List<Auction> postlist = new List<Auction>();
            for (int i = 0; i < liste.Count; i++)
            {
                if (helpf.wtsmenue)
                {
                    if (prcs.wtspricelist1[liste[i].card.getType()] != "")
                    {

                        string price = prcs.wtspricelist1[liste[i].card.getType()];
                        //ai.priceinint = ;
                        Auction ai = new Auction("", DateTime.Now, Auction.OfferType.SELL, liste[i].card, "", Convert.ToInt32(price));
                        postlist.Add(ai);
                        //msg = msg + liste[i].card.getName() + " " + this.wtspricelist1[liste[i].card.getName().ToLower()] + ";";
                        //shortmsg = shortmsg + liste[i].card.getType() + " " + this.wtspricelist1[liste[i].card.getName().ToLower()] + ";"; 
                    }
                }
                else
                {
                    if (prcs.wtbpricelist1[liste[i].card.getType()] != "")
                    {
                        string price = prcs.wtbpricelist1[liste[i].card.getType()];
                        Auction ai = new Auction("", DateTime.Now, Auction.OfferType.SELL, liste[i].card, "", Convert.ToInt32(price));
                        postlist.Add(ai);
                        //msg = msg + liste[i].card.getName() + " " + this.wtbpricelist1[liste[i].card.getName().ToLower()] + ";";
                        //shortmsg = shortmsg + liste[i].card.getType() + " " + this.wtbpricelist1[liste[i].card.getName().ToLower()] + ";"; 
                    }
                }
            }

            postlist.Sort(delegate(Auction p1, Auction p2) { return (p1.price).CompareTo(p2.price); });
            postlist.Reverse();
            Dictionary<string, string> shortlist = new Dictionary<string, string>();

            int priceToAdd = -1; // = -1 if no price have to be added, otherwise this has to be added to the message
            bool messageWouldBeTooLong = false;

            for (int i = 0; i < postlist.Count; i++)
            {
                Auction ai = postlist[i];

                if (msg.Length + ai.card.getName().Length + 1 + ai.price.ToString().Length > 506)// check if the element and the price still fits in the chat-message
                {
                    if (priceToAdd > 0)
                    { 
                        msg = msg.Substring(0,msg.Length-2)+ " " + ai.price + "g;";
                        shortmsg = shortmsg.Substring(0, shortmsg.Length - 1) + " " + ai.price + ";";
                    }
                    if (priceToAdd == 0) {
                        msg = msg.Substring(0, msg.Length - 2) + ";";
                        shortmsg = shortmsg.Substring(0, shortmsg.Length - 1) +";";
                    }
                    messageWouldBeTooLong = true;
                    break;
                }

                if (i < postlist.Count - 1 && postlist[i + 1].price == ai.price)
                {
                    msg = msg + ai.card.getName() + ", ";
                    shortmsg = shortmsg + ai.card.getType() + ",";
                    priceToAdd = ai.price;
                }
                else
                {
                    priceToAdd = -1;

                    if (ai.price == 0)
                    {
                        msg = msg + ai.card.getName() + ";";
                        shortmsg = shortmsg + ai.card.getType() + ";";
                    }
                    else
                    {

                        msg = msg + ai.card.getName() + " " + ai.price + "g, ";
                        shortmsg = shortmsg + ai.card.getType() + " " + ai.price + ";";
                    }

                }
            }

            if (msg != "")
            {
                if (helpf.wtsmenue) { msg = "WTS " + msg; shortmsg = "aucs " + shortmsg; } else { msg = "WTB " + msg; shortmsg = "aucb " + shortmsg; }
                if (msg.EndsWith(" ")) { msg = msg.Remove(msg.Length - 2); } else { msg = msg.Remove(msg.Length - 1); }
                shortmsg = shortmsg.Remove(shortmsg.Length - 1);
            }
            if (messageWouldBeTooLong)
            {
                App.Popups.ShowOk(this, "msgToLongMessage", "Message too Long", "Your generated message is too long.\r\nThe message was shortened.", "OK");
            }
            if (msg.Length < 512) systemCopyBufferProperty.SetValue(null, msg, null);
            if (msg.Length >= 512) { msg = "msg too long"; } // message cant be to long anymore :D
            //if (shortmsg.Length >= 512) { shortmsg = ""; msg = msg + ", networkmsg too"; }
            if (helpf.wtsmenue) { srchsvr.generatedwtsmessage = msg; srchsvr.shortgeneratedwtsmessage = shortmsg; } else { srchsvr.generatedwtbmessage = msg; srchsvr.shortgeneratedwtbmessage = shortmsg; }
            //Console.WriteLine(msg);
            //Console.WriteLine(shortmsg);
            srchsvr.sellersearchstring = msg;
            srchsvr.pricesearchstring = shortmsg;
            
            

        }
コード例 #29
0
        public void handleMessage(Message msg)
        {
            if (msg is MessageMessage)
            {
                MessageMessage omsg = (MessageMessage)msg;
                if (omsg.type == MessageMessage.Type.SOLD_MARKET_SCROLLS)
                {
                    this.needSoldAucs = true;
                    App.Communicator.send(new MarketplaceSoldListViewMessage());
                }
            }

            if (msg is OkMessage)
            {
                OkMessage omsg = (OkMessage)msg;
                if (Helpfunktions.Instance.createAuctionMenu)
                {
                    if (omsg.op == "MarketplaceCreateOffer" && this.sellingCard != null)
                    {
                        Helpfunktions.Instance.cardIDToNumberOwned[this.sellingType]--;
                        Helpfunktions.Instance.cardIDToNumberOwnedTiered[this.sellingType] -= (int)Math.Pow(3, sellingTypeLevel);
                        PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                        PlayerStore.Instance.sellOfferFilter.filtersChanged   = true;

                        this.dataOffer   = 0;
                        this.sellingCard = null;
                        App.Communicator.send(new MarketplaceOffersViewMessage());
                        //App.Communicator.send(new MarketplaceSoldListViewMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                    }
                    if (omsg.op == "MarketplaceCancelOffer")
                    {
                        Helpfunktions.Instance.cardIDToNumberOwned[this.cancelType]++;
                        Helpfunktions.Instance.cardIDToNumberOwnedTiered[this.cancelType] += (int)Math.Pow(3, cancelTypeLevel);
                        PlayerStore.Instance.createCardsFilter.filtersChanged              = true;
                        PlayerStore.Instance.sellOfferFilter.filtersChanged = true;

                        this.dataOffer = 0;
                        App.Communicator.send(new MarketplaceOffersViewMessage());
                        //App.Communicator.send(new MarketplaceSoldListViewMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                    }

                    if (omsg.op == "MarketplaceClaim")
                    {
                        if (transactionBeingClaimed == null)
                        {
                            return;
                        }
                        if (this.workthreadclaimall)
                        {
                            this.claimeditemstaxes += this.transactionBeingClaimed.fee;
                            this.claimeditemsmoney += this.transactionBeingClaimed.sellPrice;
                            System.Threading.Thread.Sleep(150);
                            this.claimlast();
                            return;
                        }
                        App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_coin_tally_end");
                        CardType cardType = CardTypeManager.getInstance().get(this.transactionBeingClaimed.cardType);
                        this.dataOffer    = 0;
                        this.needSoldAucs = true;
                        App.Communicator.send(new MarketplaceOffersViewMessage());
                        App.Communicator.send(new MarketplaceSoldListViewMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                        App.Popups.ShowOk(this, "claimgold", "Gold added", string.Concat(new object[]
                        {
                            "<color=#bbaa88>Tier ",
                            (int)(this.transactionBeingClaimed.level + 1),
                            " ",
                            cardType.name,
                            " sold for ",
                            this.transactionBeingClaimed.sellPrice,
                            " gold!\nEarned <color=#ffd055>",
                            this.transactionBeingClaimed.sellPrice - this.transactionBeingClaimed.fee,
                            " gold</color> (the fence collects ",
                            this.transactionBeingClaimed.fee,
                            ").</color>"
                        }), "Ok");
                        this.transactionBeingClaimed = null;
                    }
                }

                if (Helpfunktions.Instance.playerStoreMenu)
                {
                    if (omsg.op == "MarketplaceMakeDeal")
                    {
                        App.Communicator.sendRequest(new GetStoreItemsMessage());
                        App.Communicator.sendRequest(new LibraryViewMessage());
                        App.Popups.ShowOk(this, "dealmade", "Purchase complete!", clickedItemName + " has been added to your collection.", "Ok");
                        Helpfunktions.Instance.cardIDToNumberOwned[this.clickedItemtypeid]++;
                        Helpfunktions.Instance.cardIDToNumberOwnedTiered[this.clickedItemtypeid] += (int)Math.Pow(3, clickedItemLevel);
                        PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                        PlayerStore.Instance.sellOfferFilter.filtersChanged   = true;
                        clickedItemBuyID = -1;
                    }
                }
            }

            if (msg is FailMessage)
            {
                FailMessage failMessage = (FailMessage)msg;
                if (failMessage.isType(typeof(MarketplaceMakeDealMessage)))
                {
                    App.Popups.ShowOk(this, "dealNOTmade", "Purchase failed", failMessage.info, "Ok");
                    PlayerStore.Instance.createCardsFilter.filtersChanged = true;
                    PlayerStore.Instance.sellOfferFilter.filtersChanged   = true;
                    clickedItemBuyID = -1;
                }

                if (failMessage.isType(typeof(MarketplaceCreateOfferMessage)) && this.sellingCard != null)
                {
                    App.Popups.ShowOk(this, "cantcreate", "Create failed", failMessage.info, "Ok");
                    this.sellingCard = null;
                }

                if (failMessage.isType(typeof(MarketplaceClaimMessage)))
                {
                    if (transactionBeingClaimed == null)
                    {
                        return;
                    }
                    if (this.workthreadclaimall)
                    {
                        System.Threading.Thread.Sleep(150);
                        this.claimlast();
                        return;
                    }
                    this.dataOffer    = 0;
                    this.needSoldAucs = true;
                    App.Communicator.send(new MarketplaceOffersViewMessage());
                    App.Communicator.send(new MarketplaceSoldListViewMessage());
                    App.Communicator.sendRequest(new LibraryViewMessage());
                    transactionBeingClaimed = null;
                }
            }

            if (msg is CheckCardDependenciesMessage && sellingCard != null)
            {
                CheckCardDependenciesMessage checkCardDependenciesMessage = (CheckCardDependenciesMessage)msg;
                if (checkCardDependenciesMessage.dependencies == null || checkCardDependenciesMessage.dependencies.Length == 0)
                {
                    this.GetCreateOfferInfo();
                }
                else
                {
                    App.Popups.ShowOkCancel(this, "deckinvalidationwarning", "Notice", "Selling this scroll will make the following decks illegal:\n\n" + DeckUtil.GetFormattedDeckNames(checkCardDependenciesMessage.GetDeckNames()), "Ok", "Cancel");
                }
            }

            if (msg is MarketplaceCreateOfferInfoMessage && sellingCard != null)
            {
                MarketplaceCreateOfferInfoMessage marketplaceCreateOfferInfoMessage = (MarketplaceCreateOfferInfoMessage)msg;
                App.Popups.ShowSellCard(this, "sellcard", this.sellingCard, marketplaceCreateOfferInfoMessage.lowestPrice, marketplaceCreateOfferInfoMessage.suggestedPrice, marketplaceCreateOfferInfoMessage.copiesForSale, marketplaceCreateOfferInfoMessage.tax);
            }

            if (msg is MarketplaceOffersSearchViewMessage)
            {
                MarketplaceOffersSearchViewMessage marketplaceOffersViewMessage = (MarketplaceOffersSearchViewMessage)msg;
                clickedItemForSales = marketplaceOffersViewMessage.copiesForSale;
                clickedItemLevel    = marketplaceOffersViewMessage.offer.card.level;
                clickedItemPrice    = marketplaceOffersViewMessage.offer.price;
                clickedItemBuyID    = marketplaceOffersViewMessage.offer.id;
                clickedItemName     = marketplaceOffersViewMessage.offer.card.getName();
                clickedItemtypeid   = marketplaceOffersViewMessage.offer.card.getType();
            }

            if (msg is MarketplaceOffersViewMessage)
            {
                //if (this.dataisreadyOwnOffers) return;

                MarketplaceOffersViewMessage marketplaceOffersViewMessage = (MarketplaceOffersViewMessage)msg;
                MarketplaceOffer[]           offers = marketplaceOffersViewMessage.offers;
                this.pstoreOwnAucs.Clear();
                DateTime tme = DateTime.Now;
                tme = tme.AddMilliseconds(1000);
                for (int i = 0; i < offers.Length; i++)
                {
                    MarketplaceOffer marketplaceOffer = offers[i];
                    Auction          a = new Auction(App.MyProfile.ProfileInfo.name, tme, Auction.OfferType.SELL, marketplaceOffer.card, "" + marketplaceOffer.id, marketplaceOffer.price);
                    tme = tme.AddMilliseconds(1);
                    //Console.WriteLine("add owm auction: " + a.card.getName() + " " + a.price);
                    this.pstoreOwnAucs.Add(a);
                }

                this.dataOffer++;

                if (this.dataOffer >= 2 || !this.needSoldAucs)
                {
                    this.dataisreadyOwnOffers = true;
                }
                if (this.dataOffer >= 2)
                {
                    this.needSoldAucs = false;
                }
            }

            if (msg is MarketplaceSoldListViewMessage)
            {
                //if (this.dataisreadyOwnOffers) return;

                MarketplaceSoldListViewMessage marketplaceOffersViewMessage = (MarketplaceSoldListViewMessage)msg;
                TransactionInfo[] offers = marketplaceOffersViewMessage.sold;
                this.pstoreSOLDAucs.Clear();
                this.soldScrollTransactions.Clear();
                DateTime tme = DateTime.Now;

                for (int i = 0; i < offers.Length; i++)
                {
                    TransactionInfo marketplaceOffer = offers[i];
                    if (!marketplaceOffer.claimed)
                    {
                        this.soldScrollTransactions.Add(marketplaceOffer.cardId, marketplaceOffer);
                    }
                    CardType type       = CardTypeManager.getInstance().get(marketplaceOffer.cardType);
                    Card     c          = new Card(marketplaceOffer.cardId, type, true);
                    string   aucmessage = "sold " + marketplaceOffer.fee;
                    if (marketplaceOffer.claimed)
                    {
                        aucmessage += " claimed";
                        continue;
                    }
                    Auction a = new Auction(App.MyProfile.ProfileInfo.name, tme, Auction.OfferType.SELL, c, aucmessage, marketplaceOffer.sellPrice, marketplaceOffer.cardId);
                    tme = tme.AddMilliseconds(1);
                    //Console.WriteLine("add owm auction: " + a.card.getName() + " " + a.price);
                    this.pstoreSOLDAucs.Add(a);
                }
                this.dataOffer++;
                if (this.dataOffer >= 2)
                {
                    this.dataisreadyOwnOffers = true;
                }
                this.needSoldAucs = false;
            }

            if (msg is MarketplaceAvailableOffersListViewMessage)
            {
                Prices.Instance.getBlackmarketPrices(msg as MarketplaceAvailableOffersListViewMessage);
                if (this.dataisready)
                {
                    return;
                }

                MarketplaceAvailableOffersListViewMessage marketplaceAvailableOffersListViewMessage = (MarketplaceAvailableOffersListViewMessage)msg;

                MarketplaceTypeAvailability[] available = marketplaceAvailableOffersListViewMessage.available;
                this.pstoreAucs.Clear();
                DateTime tme = DateTime.Now;
                for (int i = 0; i < available.Length; i++)
                {
                    MarketplaceTypeAvailability mta = available[i];
                    CardType type = CardTypeManager.getInstance().get(mta.type);
                    Card     card = new Card(1, type, true);
                    card.level = mta.level;
                    Auction a = new Auction("BlackMarket", tme, Auction.OfferType.SELL, card, "", mta.price);
                    tme = tme.AddMilliseconds(-1);
                    //Console.WriteLine("add auction: " + a.card.getName() + " " + a.price);
                    this.pstoreAucs.Add(a);
                }

                this.dataisready = true;
            }
            return;
        }
コード例 #30
0
        public bool isBeyondPriceRange(Auction a) {
            if (this.dontshowScrollsWithNoPrice && a.price == 0) return true;
            if (a.price == 0) return false;
            if (takeWtbFromGen && prcs.wtbpricelist1[a.card.getType()] != "")
            { if (a.price > Convert.ToInt32(prcs.wtbpricelist1[a.card.getType()])) return true; }

            if (takeWtsFromGen && prcs.wtspricelist1[a.card.getType()] != "")
            { if (a.price < Convert.ToInt32(prcs.wtspricelist1[a.card.getType()])) return true; }

            if (priceLowerBound >= 0 && a.price >0 && priceUpperBound >= 0) {
                return a.price < priceLowerBound || priceUpperBound < a.price;
            } else if (priceLowerBound >= 0 && a.price>0) {
                return a.price < priceLowerBound; //Price is lower than lower Bound
            } else if (priceUpperBound >= 0) {
                return priceUpperBound < a.price; //price is higher than upper bound
            } else {
                return false;
            }
        }
コード例 #31
0
 private bool isIgnoredSellerName(Auction a)
 {
     return(ignoredSellers.Contains(a.seller.ToLower()));
 }
コード例 #32
0
 private bool isIgnoredSellerName(Auction a) {
     return ignoredSellers.Contains (a.seller.ToLower ());
 }
コード例 #33
0
 public bool isFilteredByResourceFilter(Auction a)
 {
     return(!resourceFilter.Contains(a.card.getResourceString().ToLower()));
 }
コード例 #34
0
 public bool isFiltered(Auction a) {
     return isBeyondPriceRange(a) || isFilteredByCardFilter(a) || isIgnoredSellerName(a) || isFilteredByAmountFilter(a) || isFilteredByRareFilter(a) || isFilteredByResourceFilter(a) ||  isFilteredByTypeCount(a);
 }
コード例 #35
0
        public void drawAHlist(bool wtsmenue)
        {
            if (!wtsmenue)
            {
                recto.innerRect.x = recto.innerRect.x + Screen.width * 0.495f;
                recto.innerBGRect.x = recto.innerBGRect.x + Screen.width * 0.495f;
                recto.outerRect.x = recto.outerRect.x + Screen.width * 0.495f;
                recto.screenRect.x = recto.screenRect.x + Screen.width * 0.495f;
                recto.filtermenurect.x = recto.filtermenurect.x + Screen.width * 0.495f;
                recto.calcguirects();
            }

            // Draw Auctionhouse here:
            if (helpf.inauchouse)
            {
                bool deleteOldEntrys = false;
                //Console.WriteLine(GUI.GetNameOfFocusedControl());
                GUI.depth = 15;
                this.opacity = 1f;
                GUI.skin = helpf.cardListPopupSkin;
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, this.opacity);

                GUI.Box(recto.position, string.Empty);
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, this.opacity * 0.3f);
                GUI.Box(recto.position2, string.Empty);
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, this.opacity);

                
                int num = 0;
                Card card = null;

                // set drawn cards
                if (helpf.createAuctionMenu)
                {
                    if (this.helpf.addmode)
                    {
                        this.ahlist = this.ps.getAddOffers();
                    }
                    else
                    {
                        this.ahlist = this.ps.getOwnOffers();
                    }
                }
                else
                {
                        if (wtsmenue) this.ahlist = ah.getSellOffers();
                        else this.ahlist = ah.getBuyOffers();
                }



                // draw sort buttons:###############################################
                if (helpf.bothmenue)
                {
                    Vector2 vec11 = GUI.skin.button.CalcSize(new GUIContent("Scroll"));

                    if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX, recto.screenRect.yMin - 4, vec11.x, 20), "Scroll"))
                    {
                        if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }// this will toggle the reverse mode
                        if (srchsvr.sortmode == 1) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                        srchsvr.sortmode = 1;

                        bool rev = false;
                        if (srchsvr.reverse || (this.helpf.createAuctionMenu && this.helpf.addmode)) { rev = true; }

                        if (helpf.bothmenue)
                        {
                            if (wtsmenue)
                            {
                                ah.setSellSortMode((rev)? AuctionHouse.SortMode.CARD : AuctionHouse.SortMode.CARD_REVERSE);
                            }
                            else
                            {
                                ah.setBuySortMode((rev)? AuctionHouse.SortMode.CARD : AuctionHouse.SortMode.CARD_REVERSE);
                            }
                            if (wtsmenue) { srchsvr.savesettings(0, true); } else { srchsvr.savesettings(0, false); }
                        }
                        //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);

                    }
                    float datelength = GUI.skin.button.CalcSize(new GUIContent("Date")).x;
                    float datebeginn = 0;
                    if (helpf.bothmenue)
                    {
                        if (wtsmenue)
                        {
                            vec11 = GUI.skin.button.CalcSize(new GUIContent("Seller"));

                            if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX + recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + recto.costIconWidth + (recto.labelsWidth - vec11.x) / 2f - datelength / 2f - 2f, recto.screenRect.yMin - 4f, vec11.x, 20f), "Seller"))
                            {
                                if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                                if (srchsvr.sortmode == 3) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                                srchsvr.sortmode = 3;

                                bool rev = false;
                                if (srchsvr.reverse || (this.helpf.createAuctionMenu && this.helpf.addmode)) { rev = true; }

                                if (helpf.bothmenue)
                                {
                                    ah.setSellSortMode((rev)? AuctionHouse.SortMode.SELLER : AuctionHouse.SortMode.SELLER_REVERSE);
                                    //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                                    srchsvr.savesettings(0, true);
                                }
                            }
                        }
                        else
                        {
                            vec11 = GUI.skin.button.CalcSize(new GUIContent("Buyer"));
                            if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX + recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + recto.costIconWidth + (recto.labelsWidth - vec11.x) / 2f - datelength / 2f - 2f, recto.screenRect.yMin - 4f, vec11.x, 20f), "Buyer"))
                            {
                                if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                                if (srchsvr.sortmode == 3) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                                srchsvr.sortmode = 3;

                                bool rev = false;
                                if (srchsvr.reverse || (this.helpf.createAuctionMenu && this.helpf.addmode)) { rev = true; }

                                if (helpf.bothmenue)
                                {
                                    ah.setBuySortMode((rev)? AuctionHouse.SortMode.SELLER : AuctionHouse.SortMode.SELLER_REVERSE);

                                    srchsvr.savesettings(0, false);
                                }
                                //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                            }
                        }
                    }
                    datebeginn = recto.innerRect.xMin + recto.labelX + recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + recto.costIconWidth + (recto.labelsWidth - vec11.x) / 2 - datelength / 2 - 2 + vec11.x;
                    vec11 = GUI.skin.button.CalcSize(new GUIContent("Price"));
                    if (GUI.Button(new Rect(recto.innerRect.xMin + recto.labelX + 2f * recto.labelsWidth + (recto.costIconSize - recto.costIconWidth) / 2f - 5f + 2 * recto.costIconWidth + recto.labelsWidth / 4f - vec11.x / 2, recto.screenRect.yMin - 4, vec11.x, 20), "Price"))
                    {
                        if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                        if (srchsvr.sortmode == 2) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                        srchsvr.sortmode = 2;

                        bool rev = false;
                        if (srchsvr.reverse || (this.helpf.createAuctionMenu && this.helpf.addmode)) { rev = true; }

                        if (helpf.bothmenue)
                        {
                            if (wtsmenue)
                            {
                                ah.setSellSortMode((rev)? AuctionHouse.SortMode.PRICE : AuctionHouse.SortMode.PRICE_REVERSE);
                            }
                            else
                            {
                                ah.setBuySortMode((rev)? AuctionHouse.SortMode.PRICE : AuctionHouse.SortMode.PRICE_REVERSE);
                            }
                            if (wtsmenue) { srchsvr.savesettings(0, true); } else { srchsvr.savesettings(0, false); }
                        }
                        //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                    }
                    vec11 = GUI.skin.button.CalcSize(new GUIContent("Date"));
                    //if (GUI.Button(new Rect(this.innerRect.x + offX , this.screenRect.yMin - 4, vec11.x * 2, 20), "Date"))
                    if (GUI.Button(new Rect(datebeginn + 4, recto.screenRect.yMin - 4, vec11.x, 20), "Date"))
                    {
                        if (srchsvr.reverse == true) { srchsvr.sortmode = -1; }
                        if (srchsvr.sortmode == 0) { srchsvr.reverse = true; } else { srchsvr.reverse = false; };
                        srchsvr.sortmode = 0;

                        bool rev = false;
                        if (srchsvr.reverse || (this.helpf.createAuctionMenu && this.helpf.addmode)) { rev = true; }

                        if (wtsmenue)
                        {
                            ah.setSellSortMode((rev)? AuctionHouse.SortMode.TIME : AuctionHouse.SortMode.TIME_REVERSE);
                        }
                        else
                        {
                            ah.setBuySortMode((rev) ? AuctionHouse.SortMode.TIME : AuctionHouse.SortMode.TIME_REVERSE);
                        }
                        if (wtsmenue) { srchsvr.savesettings(0, true); } else { srchsvr.savesettings(0, false); }
                        //lstfltrs.sortlist(alists.ahlist); lstfltrs.sortlist(alists.ahlistfull);
                    }
                }
                else
                {
                    GUI.skin = helpf.cardListPopupSkin;
                    GUI.Box(new Rect(recto.position.x + recto.position.width * 0.03f, recto.screenRect.yMin - 4, (recto.position.xMax - recto.position.width * 0.03f) - (recto.position.x + recto.position.width * 0.03f), 20), "");
                    GUI.skin = helpf.cardListPopupBigLabelSkin;
                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                    if (this.helpf.addmode)
                    {
                        GUI.Label(new Rect(recto.position.x + recto.position.width * 0.03f, recto.screenRect.yMin - 4, (recto.position.xMax - recto.position.width * 0.03f) - (recto.position.x + recto.position.width * 0.03f), 20), "auctions you want to create");
                    }
                    else
                    {
                        GUI.Label(new Rect(recto.position.x + recto.position.width * 0.03f, recto.screenRect.yMin - 4, (recto.position.xMax - recto.position.width * 0.03f) - (recto.position.x + recto.position.width * 0.03f), 20), "own auctions " + this.gglthngs.pstoreOwnAucs.Count + "/10");
                    }
                    GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                }


                


                DateTime currenttime = DateTime.Now;
                // draw auctimes################################################
                //timefilter: 
                int time = 0;
                bool usetimefilter = false;
                float anzcards  = (float)this.ahlist.Count();
                if (srchsvr.timesearchstring != "")//doesnt show "old" offers filtered by time-filter
                {
                    time = Convert.ToInt32(srchsvr.timesearchstring);
                    currenttime = DateTime.Now.AddMinutes(-1 * time); usetimefilter = true;
                    anzcards = (float)this.ahlist.Count(delegate(Auction p1) { return (p1.time).CompareTo(currenttime) >= 0; });
                }
                
                GUI.skin = helpf.cardListPopupSkin;
                if (wtsmenue)
                {
                    this.scrollPos = GUI.BeginScrollView(recto.position3, this.scrollPos, new Rect(0f, 0f, recto.innerRect.width - 20f, recto.fieldHeight * anzcards));
                }
                else
                {
                    this.scrollPos2 = GUI.BeginScrollView(recto.position3, this.scrollPos2, new Rect(0f, 0f, recto.innerRect.width - 20f, recto.fieldHeight * anzcards));
                }
                //if (srchsvr.reverse || (this.helpf.createAuctionMenu && this.helpf.addmode)) { this.ahlist.Reverse(); }
                GUI.skin = helpf.cardListPopupBigLabelSkin;

                float testy = this.scrollPos.y;
                if (!wtsmenue) testy = this.scrollPos2.y;

                foreach (Auction current in this.ahlist)
                {
                    if (usetimefilter && (current.time).CompareTo(currenttime) < 0) { continue; }
                    if (!current.card.tradable)
                    {
                        GUI.color = new Color(1f, 1f, 1f, 0.5f);
                    }
                    GUI.skin = helpf.cardListPopupGradientSkin;
                    //draw boxes
                    Rect position7 = recto.position7(num);
                    

                    if (position7.yMax < testy || position7.y > testy + recto.position3.height)
                    {
                        num++;
                        GUI.color = Color.white;
                    }
                    else
                    {
                        GUI.Box(position7, string.Empty);

                        string name = current.card.getName();

                        string txt = helpf.cardIDtoimageid(current.card.getType()).ToString();
                        Texture texture = App.AssetLoader.LoadTexture2D(txt);//current.getCardImage())
                        if (sttngs.shownumberscrolls) name = "(" + helpf.cardIDToNumberOwned[current.card.getType()] + ") " + name;
                        GUI.skin = helpf.cardListPopupBigLabelSkin;
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        Vector2 vector = GUI.skin.label.CalcSize(new GUIContent(name));
                        // draw text
                        Rect position8 = recto.position8(num);
                        GUI.Label(position8, (vector.x >= position8.width) ? (name.Substring(0, Mathf.Min(name.Length, recto.maxCharsName)) + "...") : name);
                        GUI.skin = helpf.cardListPopupSkin;
                        string text = current.card.getPieceKind().ToString();
                        string str = text.Substring(0, 1) + text.Substring(1).ToLower();
                        string text2 = string.Empty;
                        int num2 = recto.maxCharsRK;
                        if (current.card.level > 0)
                        {
                            string text3 = text2;
                            text2 = string.Concat(new object[] { text3, "<color=#ddbb44>Tier ", current.card.level + 1, "</color>, " });
                            num2 += "<color=#rrggbb></color>".Length;
                        }
                        text2 = text2 + current.card.getRarityString() + ", " + str;
                        Vector2 vector2 = GUI.skin.label.CalcSize(new GUIContent(text2));

                        Rect position9 = recto.position9(num);
                        GUI.Label(position9, (vector2.x >= position9.width) ? (text2.Substring(0, Mathf.Min(text2.Length, num2)) + "...") : text2);
                        Rect restyperect = recto.restyperect(num);
                        //draw resource type
                        this.RenderCost(restyperect, current.card);
                        //draw seller name

                        string sellername = current.seller;
                        GUI.skin = helpf.cardListPopupBigLabelSkin;

                        vector = GUI.skin.label.CalcSize(new GUIContent(sellername));
                        //(this.fieldHeight-this.cardListPopupBigLabelSkin.label.fontSize)/2f
                        //Rect position11 = new Rect(restyperect.xMax + 2f, (float)num * this.fieldHeight, this.labelsWidth, this.fieldHeight);
                        Rect position11 = new Rect(restyperect.xMax + 2f, position8.yMin, recto.labelsWidth, recto.cardHeight);
                        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                        GUI.Label(position11, (vector.x >= position11.width) ? (sellername.Substring(0, Mathf.Min(sellername.Length, recto.maxCharsName)) + "...") : sellername);
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        //draw timestamp
                        GUI.skin = helpf.cardListPopupSkin;
                        DateTime temptime = DateTime.Now;
                        if (helpf.createAuctionMenu)
                        {
                            if (current.message.StartsWith("sold "))
                            { sellername = "SOLD"; }
                            else
                            {
                                sellername = "unsold";
                            }

                        }
                        else
                        {
                            TimeSpan ts = temptime.Subtract(current.time);
                            if (ts.TotalMinutes >= 1.0)
                            {
                                sellername = "" + ts.Minutes + " minutes ago";
                                if (ts.TotalMinutes >= helpf.deleteTime) deleteOldEntrys = true;
                            }
                            else
                            {
                                //sellername = "" + ts.Seconds + " seconds ago"; // to mutch changing numbers XD
                                if (ts.Seconds >= 40) { sellername = "40 seconds ago"; }
                                else if (ts.Seconds >= 20) { sellername = "20 seconds ago"; }
                                else if (ts.Seconds >= 10) { sellername = "10 seconds ago"; }
                                else if (ts.Seconds >= 5) { sellername = "5 seconds ago"; }
                                else sellername = "seconds ago";
                            }
                        }

                        Rect position13 = new Rect(restyperect.xMax + 2f, position9.y, recto.labelsWidth, recto.fieldHeight);
                        GUI.skin.label.alignment = TextAnchor.UpperCenter;
                        GUI.Label(position13, sellername);
                        GUI.skin.label.alignment = TextAnchor.UpperLeft;
                        //testonly
                        //    restyperect = new Rect(position11.xMax , (float)num * this.fieldHeight + (this.fieldHeight - this.costIconHeight) / 2f, this.costIconWidth, this.costIconHeight);
                        //       draw resource type
                        //     this.RenderCost(restyperect, current);

                        //draw gold cost
                        float nextx = position11.xMax + recto.costIconWidth;
                        string gold = current.price + "g";
                        if (current.price == 0) gold = "?";
                        GUI.skin = helpf.cardListPopupBigLabelSkin;
                        //vector = GUI.skin.label.CalcSize(new GUIContent(gold));
                        //(this.fieldHeight-this.cardListPopupBigLabelSkin.label.fontSize)/2f
                        //Rect position12 = new Rect(position7.xMax-recto.goldlength-2f, position8.yMin, recto.goldlength, recto.cardHeight);
                        Rect position12 = new Rect(nextx + 2f, position8.yMin, recto.labelsWidth / 2f, recto.cardHeight);
                        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                        GUI.Label(position12, gold);
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;

                        // draw suggested price
                        string suggeprice = "";
                        if (helpf.createAuctionMenu && current.message.StartsWith("sold "))
                        {
                            suggeprice += "" + current.message.Split(' ')[1] + "g fee";
                        }
                        else
                        {
                            //int index = Array.FindIndex(helpf.cardids, element => element == current.card.getType());
                            int index = helpf.cardidToArrayIndex(current.card.getType());
                            
                            if (index >= 0)
                            {
                                int p1 = 0, p2 = 0;
                                if (wtsmenue)
                                {
                                    p1 = prcs.getPrice(index, sttngs.wtsAHpriceType);
                                    suggeprice = ((sttngs.wtsAHpriceType == ScrollsPostPriceType.BLACKMARKET) ? "BM: " : "SG: ") + p1;
                                }
                                else
                                {
                                    p1 = prcs.getPrice(index, sttngs.wtbAHpriceType);
                                    suggeprice = ((sttngs.wtbAHpriceType == ScrollsPostPriceType.BLACKMARKET) ? "BM: " : "SG: ") + p1;
                                }

                                if (sttngs.showsugrange)
                                {
                                    if (wtsmenue)
                                    {
                                        p2 = prcs.getPrice(index, sttngs.wtsAHpriceType2);
                                    }
                                    else
                                    {
                                        p2 = prcs.getPrice(index, sttngs.wtbAHpriceType2);

                                    }
                                    if (p1 != p2) suggeprice = "SG: " + Math.Min(p1, p2) + "-" + Math.Max(p1, p2);
                                }

                            }
                        }
                        GUI.skin = helpf.cardListPopupSkin;
                        Rect position14 = new Rect(nextx + 2f, position9.y, recto.labelsWidth / 2f, recto.fieldHeight);
                        GUI.skin.label.alignment = TextAnchor.UpperCenter;
                        GUI.Label(position14, suggeprice);
                        GUI.skin.label.alignment = TextAnchor.UpperLeft;



                        GUI.skin = helpf.cardListPopupLeftButtonSkin;
                        if (!this.selectable)
                        {
                            GUI.enabled = false;
                        }
                        if (GUI.Button(recto.position10(num), string.Empty) && current.card.tradable)
                        {
                            card = current.card;
                            App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_button_click");
                        }
                        if (!this.selectable)
                        {
                            GUI.enabled = true;
                        }
                        //draw picture
                        if (texture != null)
                        {
                            GUI.DrawTexture(new Rect(4f, (float)num * recto.fieldHeight + (recto.fieldHeight - recto.cardHeight) * 0.43f, recto.cardWidth, recto.cardHeight), texture);
                        }
                        // draw buy/sell button
                        GUI.skin = helpf.cardListPopupGradientSkin;
                        if (helpf.createAuctionMenu) // dont need a sell button in own-auctions-menu
                        {
                            if (helpf.addmode)
                            {
                                if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                {
                                    this.ps.delOffer(current);
                                }
                                GUI.skin = helpf.cardListPopupBigLabelSkin;
                                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                                GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "Del");
                            }
                            else
                            {
                                if (current.message.StartsWith("sold "))
                                {
                                    if (current.message.EndsWith(" claimed"))
                                    {
                                        GUI.color = dblack;
                                        if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                        {
                                            
                                        }
                                        GUI.skin = helpf.cardListPopupBigLabelSkin;
                                        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                                        GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "");
                                        GUI.color = Color.white;
                                    }
                                    else
                                    {
                                        if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                        {
                                            GetGoogleThings.Instance.ClaimSalesMoney(current.amountOffered);
                                        }
                                        GUI.skin = helpf.cardListPopupBigLabelSkin;
                                        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                                        GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "g");
                                    }
                                }
                                else
                                {
                                    if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                    {
                                        gglthngs.cancelType = current.card.getType();
                                        gglthngs.cancelTypeLevel = current.card.level;
                                        App.Communicator.sendRequest(new MarketplaceCancelOfferMessage(Convert.ToInt64(current.message)));
                                    }
                                    GUI.skin = helpf.cardListPopupBigLabelSkin;
                                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                                    GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "-");
                                }
                            }
                        }
                        else
                        {
                            if (wtsmenue)
                            {
                                if (!helpf.showtradedialog)
                                {
                                    if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                    {
                                        // start trading with seller
                                        if (current.seller != App.MyProfile.ProfileInfo.name)
                                        {
                                            helpf.showtradedialog = true;
                                            tradeitem = current;
                                            this.bothstarttrading = wtsmenue;
                                        }
                                    }
                                }
                                else { GUI.Box(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""); }
                                GUI.skin = helpf.cardListPopupBigLabelSkin;
                                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                                if (helpf.bothmenue) GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "Buy");

                            }
                            else
                            {
                                if (!helpf.showtradedialog)
                                {
                                    if (GUI.Button(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""))
                                    {
                                        // start trading with seller
                                        if (current.seller != App.MyProfile.ProfileInfo.name)
                                        {
                                            helpf.showtradedialog = true;
                                            tradeitem = current;
                                            this.bothstarttrading = wtsmenue;
                                        }
                                    }
                                }
                                else { GUI.Box(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), ""); }
                                GUI.skin = helpf.cardListPopupBigLabelSkin;
                                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                                GUI.Label(new Rect(position7.xMax + 2, (float)num * recto.fieldHeight, recto.costIconWidth, recto.fieldHeight), "Sell");
                            }
                        }
                        GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                        if (!current.card.tradable)
                        {
                            GUI.color = Color.white;
                        }
                        num++;
                    }
                }

                GUI.EndScrollView();
                
                // delete old entrys
                if (deleteOldEntrys) { ah.removeOldEntrys(); };

                GUI.color = Color.white;
                // show clicked card
                if (card != null)
                {
                    //this.callback.ItemButtonClicked(this, card);
                    string clink = card.getName().ToLower();
                    //int arrindex = Array.FindIndex(helpf.cardnames, element => element.Equals(clink));
                    int arrindex = helpf.cardnameToArrayIndex(clink);
                    if (arrindex >= 0)
                    {

                        crdvwr.createcard(arrindex, helpf.cardids[arrindex]);
                    }

                }
                //wts / wtb menue buttons

                if (wtsmenue)
                {

                    this.drawButtonsBelow();
                    
                }

                if (!wtsmenue && helpf.createAuctionMenu)
                {
                    if (helpf.addmode)
                    {
                        if (GUI.Button(recto.updateGoogleThings, "Clear"))
                        {
                            this.ps.clearAuctions();
                            
                        }

                        if (GUI.Button(recto.getOwnStuffButton, "Create"))
                        {
                            this.helpf.createdAuctionText = "";

                            App.Popups.ShowOkCancel(this, "wantToCreateMultiAuction", "You are sure?", "You really want to create these Auctions?\r\n" + this.helpf.createdAuctionText, "OK", "Cancel");
                        }
                    }
                    else
                    {
                        if (!this.gglthngs.workthreadreadyOwnOffers) GUI.contentColor = this.dblack;
                        if (GUI.Button(recto.updateGoogleThings, "Update"))
                        {
                            //update own offers
                            if (this.gglthngs.workthreadreadyOwnOffers) new Thread(new ThreadStart(this.gglthngs.workthreadOwnOffers)).Start();
                        }
                        GUI.contentColor = Color.white;
                        // draw button for getting cards here!
                        GUI.color = Color.white;
                        if (this.gglthngs.workthreadclaimall) GUI.color = new Color(0.5f, 0.5f, 0.5f, 1f);
                        if (GUI.Button(recto.getOwnStuffButton, "Claim All") )
                        {
                            this.sttngs.tradeCardID = 0;
                            if (this.gglthngs.workthreadclaimall == false) new Thread(new ThreadStart(this.gglthngs.ClaimAllThread)).Start();

                        }
                        GUI.color = Color.white;
                    }
                }

                GUI.color = Color.white;  

            }
            GUI.color = Color.white;
            GUI.contentColor = Color.white;
            if (!wtsmenue)
            {
                recto.innerRect.x = recto.innerRect.x - Screen.width * 0.495f;
                recto.innerBGRect.x = recto.innerBGRect.x - Screen.width * 0.495f;
                recto.outerRect.x = recto.outerRect.x - Screen.width * 0.495f;
                recto.screenRect.x = recto.screenRect.x - Screen.width * 0.495f;
                recto.filtermenurect.x = recto.filtermenurect.x - Screen.width * 0.495f;
                recto.calcguirects();
            }
        }
コード例 #36
0
        private bool isFilteredByCardFilter(Auction a) {
            if (this.everSetCFAmountFiler && cardFilterString.Contains("#:")) return !cardFilterAmountfilter.Contains(a.card.getType());
            return !cardFilter.isIncluded(a.card);

            
        }
コード例 #37
0
ファイル: Auction.cs プロジェクト: dga711/auction.mod
 public static int CompareCardName(Auction a1, Auction a2)
 {
     return(a1.card.getName().CompareTo(a2.card.getName()));
 }
コード例 #38
0
        private bool isFilteredByTypeCount(Auction a)
        {
            
            if (f == null)
            {
                return false;
            }

            return !f(helpf.cardIDToNumberOwned[a.card.typeId]);
        }
コード例 #39
0
ファイル: Auction.cs プロジェクト: dga711/auction.mod
 public static int CompareTime(Auction a1, Auction a2)
 {
     return(-a1.time.CompareTo(a2.time)); //We want the most recent on the top.
 }
コード例 #40
0
 public bool isFilteredByRareFilter(Auction a)
 {
     return !rareFilter[a.card.getRarity()];
 }
コード例 #41
0
        public void setOwnCards(Message msg)
        {//set id-cardid dictionary
            this.cardIDToCardNumber.Clear();
            this.allOwnTradeableAuctions.Clear();
            foreach (Card c in (((LibraryViewMessage)msg).cards))
            {
                if (c.tradable)
                {
                    Auction a = new Auction(App.MyProfile.ProfileInfo.name, DateTime.Now, Auction.OfferType.SELL, c, "");
                    this.allOwnTradeableAuctions.Add(a);
                }

                if (c.tradable && !this.cardIDToCardNumber.ContainsKey(c.typeId))
                {
                    this.cardIDToCardNumber.Add(c.typeId, c.id);
                }
            }

            this.allOwnCards.Clear();
            this.allOwnCards.AddRange(((LibraryViewMessage)msg).cards);

            this.playerstoreAllCardsChanged = true;
            this.auctionHouseAllCardsChanged = true;
            this.generatorAllCardsChanged = true;
            }
コード例 #42
0
ファイル: Auction.cs プロジェクト: noHero123/auction.mod
 public static int CompareCardNameREV(Auction a1, Auction a2)
 {
     return -a1.card.getName().CompareTo(a2.card.getName());
 }