public void doOfferClicked(bool initialClick)
        {
            CustomSelfDrawPanel.UICardOffer parent = (CustomSelfDrawPanel.UICardOffer) base.ClickedControl.Parent;
            if (initialClick && (parent.Offer.CrownCost > GameEngine.Instance.World.ProfileCrowns))
            {
                BuyCrownsPopup popup = new BuyCrownsPopup();
                popup.init(parent.Offer.CrownCost - GameEngine.Instance.World.ProfileCrowns, base.ParentForm);
                popup.Show(base.ParentForm);
            }
            else if (initialClick && Program.mySettings.BuyMultipleCardPacks)
            {
                GameEngine.Instance.playInterfaceSound("BuyCardsPanel_open_offer_open_confirmation");
                base.PanelActive = false;
                this.waitingResponse = false;
                InterfaceMgr.Instance.openConfirmBuyOfferPopup(parent, new ConfirmBuyOfferPanel.CardClickPlayDelegate(this.doOfferClicked));
            }
            else
            {
                if (initialClick)
                {
                    GameEngine.Instance.playInterfaceSound("BuyCardsPanel_open_offer");
                    InterfaceMgr.Instance.BuyOfferMultiple = 0;
                }
                if (parent.Offer.CrownCost > GameEngine.Instance.World.ProfileCrowns)
                {
                    BuyCrownsPopup popup2 = new BuyCrownsPopup();
                    popup2.init(parent.Offer.CrownCost - GameEngine.Instance.World.ProfileCrowns, base.ParentForm);
                    popup2.Show(base.ParentForm);
                }
                else
                {
                    if (InterfaceMgr.Instance.BuyOfferMultiple == 0)
                    {
                        InterfaceMgr.Instance.BuyOfferMultiple = 1;
                    }
                    string iD = string.Empty;
                    switch (parent.Offer.Category)
                    {
                        case "FARMING":
                            iD = "CARD_OFFERS_Food_Pack";
                            break;

                        case "CASTLE":
                            iD = "CARD_OFFERS_Castle_Pack";
                            break;

                        case "DEFENSE":
                        case "DEFENCE":
                            iD = "CARD_OFFERS_Defense_Pack";
                            break;

                        case "RANDOM":
                            iD = "CARD_OFFERS_Random_Pack";
                            break;

                        case "INDUSTRY":
                            iD = "CARD_OFFERS_Industry_Pack";
                            break;

                        case "RESEARCH":
                            iD = "CARD_OFFERS_Industry_Pack";
                            break;

                        case "ARMY":
                            iD = "CARD_OFFERS_Army_Pack";
                            break;

                        case "SUPERFARMING":
                            iD = "CARD_OFFERS_Super_Food_Pack";
                            break;

                        case "SUPERDEFENSE":
                        case "SUPERDEFENCE":
                            iD = "CARD_OFFERS_Super_Defense_Pack";
                            break;

                        case "SUPERRANDOM":
                            iD = "CARD_OFFERS_Super_Random_Pack";
                            break;

                        case "SUPERINDUSTRY":
                            iD = "CARD_OFFERS_Super_Industry_Pack";
                            break;

                        case "SUPERARMY":
                            iD = "CARD_OFFERS_Super_Army_Pack";
                            break;

                        case "ULTIMATEFARMING":
                            iD = "CARD_OFFERS_Ultimate_Food_Pack";
                            break;

                        case "ULTIMATEDEFENSE":
                        case "ULTIMATEDEFENCE":
                            iD = "CARD_OFFERS_Ultimate_Defense_Pack";
                            break;

                        case "ULTIMATERANDOM":
                            iD = "CARD_OFFERS_Ultimate_Random_Pack";
                            break;

                        case "ULTIMATEINDUSTRY":
                            iD = "CARD_OFFERS_Ultimate_Industry_Pack";
                            break;

                        case "ULTIMATEARMY":
                            iD = "CARD_OFFERS_Ultimate_Army_Pack";
                            break;

                        case "PLATINUM":
                            iD = "CARD_OFFERS_Platinum_Pack";
                            break;
                    }
                    string str2 = SK.Text(iD);
                    string[] strArray = new string[] { InterfaceMgr.Instance.BuyOfferMultiple.ToString(), " x ", str2, Environment.NewLine, SK.Text("BuyCardsPanel_Crowns_Cost", "Crowns Cost"), " : ", (parent.Offer.CrownCost * InterfaceMgr.Instance.BuyOfferMultiple).ToString() };
                    if (MyMessageBox.Show(string.Concat(strArray), SK.Text("BuyCardsPanel_Confirm_Purchase", "Confirm Purchase"), MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        this.lastoffer = parent;
                        XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath);
                        XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), parent.Offer.ID.ToString());
                        if (InterfaceMgr.Instance.BuyOfferMultiple > 1)
                        {
                            req.Multiple = new int?(InterfaceMgr.Instance.BuyOfferMultiple);
                        }
                        provider.buyCardOffer(req, new CardsEndResponseDelegate(this.OfferBought), this);
                        WorldMap world = GameEngine.Instance.World;
                        world.ProfileCrowns -= parent.Offer.CrownCost * InterfaceMgr.Instance.BuyOfferMultiple;
                        this.labelTitle.Text = SK.Text("BuyCardsPanel_Buy_and_Open_Packs", "Buy and Open Card Packs: Crowns in your treasury") + " : " + GameEngine.Instance.World.ProfileCrowns.ToString();
                    }
                }
            }
        }
 private void ClickedOffer()
 {
     int num = 30;
     if (base.ClickedControl.Data == 0x1010)
     {
         num = 30;
     }
     else if (base.ClickedControl.Data == 0x1012)
     {
         num = 100;
     }
     if (GameEngine.Instance.World.ProfileCrowns < num)
     {
         BuyCrownsPopup popup = new BuyCrownsPopup();
         popup.init(num - GameEngine.Instance.World.ProfileCrowns, base.ParentForm);
         popup.Show(base.ParentForm);
     }
     else if (!this.buying)
     {
         this.buying = true;
         string txtMessage = "";
         if (base.ClickedControl.Data == 0x1010)
         {
             this.crowns = 30;
             txtMessage = SK.Text("PremiumCardsPanel_7Day_Premium", "Buy one 7-Day Premium Token for 30 Crowns?  To activate the Premium Token you must click on it to set it into play on the game world.") + Environment.NewLine;
         }
         else if (base.ClickedControl.Data == 0x1012)
         {
             this.crowns = 100;
             txtMessage = SK.Text("PremiumCardsPanel_30Day_Premium", "Buy one 30-Day Premium Token for 100 Crowns?  To activate the Premium Token you must click on it to set it into play on the game world.") + Environment.NewLine;
         }
         this.buytype = base.ClickedControl.Data;
         if (MyMessageBox.Show(txtMessage, SK.Text("BuyCardsPanel_Confirm_Purchase", "Confirm Purchase"), MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath);
             XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""));
             if (base.ClickedControl.Data == 0x1010)
             {
                 req.PackID = "2";
             }
             else if (base.ClickedControl.Data == 0x1012)
             {
                 req.PackID = "6";
             }
             provider.buyPremium(req, new CardsEndResponseDelegate(this.BoughtOffer), this);
             WorldMap world = GameEngine.Instance.World;
             world.ProfileCrowns -= this.crowns;
             this.labelTitle.Text = SK.Text("PremiumCardsPanel_Buy_and_Open_Packs", "Buy and Play Premium Tokens: Crowns in your treasury") + " : " + GameEngine.Instance.World.ProfileCrowns.ToString();
         }
         else
         {
             this.buying = false;
         }
     }
 }