Ejemplo n.º 1
0
 public void UpdateCrownsCallback(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode.Value == 1)
     {
         GameEngine.Instance.World.ProfileCrowns        = response.Crowns.Value;
         GameEngine.Instance.World.LastUpdatedCrowns    = DateTime.Now;
         GameEngine.Instance.World.ProfileUserCardPacks = response.UserCardPacks;
     }
 }
Ejemplo n.º 2
0
 private void getRewardcardsCallback(ICardsProvider sender, ICardsResponse response)
 {
     m_lastRewardCardsCall = DateTime.Now;
     foreach (int num in response.Cards.Keys)
     {
         if (!GameEngine.Instance.World.ProfileCards.ContainsKey(num))
         {
             GameEngine.Instance.World.addProfileCard(num, response.Cards[num]);
             GameEngine.Instance.World.ProfileCards[num].rewardcard = true;
             GameEngine.Instance.World.ProfileCards[num].worldID    = RemoteServices.Instance.ProfileWorldID;
         }
     }
     if (response.Cardpoints.HasValue)
     {
         GameEngine.Instance.World.FakeCardPoints = response.Cardpoints.Value;
     }
     ((CustomSelfDrawPanel.ICardsPanel) this.currentPanel).init(this.currentCardSection);
 }
Ejemplo n.º 3
0
 private void cardPlayed(ICardsProvider provider, ICardsResponse response)
 {
     if (!response.SuccessCode.HasValue || (response.SuccessCode.Value != 1))
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_failed");
         MyMessageBox.Show(PlayCardsWindow.translateCardError(response.Message, this.clickedCard.Definition.id), SK.Text("BuyCardsPanel_Cannot_Play_Cards", "Could not play card."));
         try
         {
             GameEngine.Instance.World.addProfileCard(this.clickedCard.UserIDList[0], CardTypes.getStringFromCard(this.clickedCard.Definition.id));
         }
         catch (Exception exception)
         {
             MyMessageBox.Show(exception.Message, SK.Text("BuyCardsPanel_Error_Report", "ERROR: Please report this error message"));
         }
     }
     else
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_success");
         GameEngine.Instance.World.ProfileCardsSet.Remove(this.clickedCard.UserIDList[0]);
         GameEngine.Instance.addRecentCard(this.clickedCard.Definition.id);
         if (this.clickedCard.UserIDList.Count > 0)
         {
             this.clickedCard.UserID = this.clickedCard.UserIDList[0];
         }
         GameEngine.Instance.World.CardPlayed(this.clickedCard.Definition.cardCategory, this.clickedCard.Definition.id, this.selectedVillage);
         if (this.clickedCard.cardCount > 1)
         {
             this.clickedCard.UserIDList.Remove(this.clickedCard.UserID);
             this.clickedCard.UserID = this.clickedCard.UserIDList[0];
             this.clickedCard.cardCount--;
             this.clickedCard.countLabel.Text = this.clickedCard.cardCount.ToString();
         }
         else
         {
             this.clickedCard.setClickDelegate(null);
             CustomSelfDrawPanel.CSDImage control = new CustomSelfDrawPanel.CSDImage {
                 Position = new Point(0, 0),
                 Size = this.clickedCard.bigImage.Size,
                 Image = (Image) GFXLibrary.CardBackBig
             };
             control.setScale(0.25);
             this.clickedCard.CustomTooltipID = 0;
             this.clickedCard.CustomTooltipData = -1;
             this.clickedCard.addControl(control);
         }
     }
     this.Dirty = true;
     base.invalidate();
     this.clickedCard = null;
     this.waitingResponse = false;
 }
 public void veteranLevelUpResponse(IAsyncResult asr)
 {
     XmlRpcAsyncResult result = (XmlRpcAsyncResult) asr;
     CardsProxy clientProtocol = (CardsProxy) result.ClientProtocol;
     clientProtocol.Url = this.EndpointUri;
     try
     {
         XmlRpcRespStruct_Cards cards = clientProtocol.EndgetVeteranLevel(asr);
         this.mResponse = new XmlRpcCardsResponse();
         XmlRpcRespStruct_Cards cards2 = new XmlRpcRespStruct_Cards {
             mVeteranLv1 = cards.mVeteranLv1,
             mVeteranLv2 = cards.mVeteranLv2,
             mVeteranLv3 = cards.mVeteranLv3,
             mVeteranLv4 = cards.mVeteranLv4,
             mVeteranLv5 = cards.mVeteranLv5,
             mVeteranLv6 = cards.mVeteranLv6,
             mVeteranLv7 = cards.mVeteranLv7,
             mVeteranLv8 = cards.mVeteranLv8,
             mVeteranLv9 = cards.mVeteranLv9,
             mVeteranLv10 = cards.mVeteranLv10,
             mVeteranSecondsLeft = cards.mVeteranSecondsLeft,
             mMessage = cards.mMessage,
             mSuccessCode = cards.mSuccessCode,
             mVeteranCurrentLevel = cards.mVeteranCurrentLevel
         };
         this.mResponse.Response = cards2;
     }
     catch (Exception exception)
     {
         this.mResponse = new XmlRpcCardsResponse(exception.Message, 0);
     }
     try
     {
         if (this.FormsControl != null)
         {
             this.FormsControl.Invoke(new CardsEndResponseDelegate(this.CallbackMethod.Invoke), new object[] { this, this.Response });
         }
     }
     catch (Exception exception2)
     {
         string message = exception2.Message;
     }
 }
 public void getFreeCardResponse(IAsyncResult asr)
 {
     XmlRpcAsyncResult result = (XmlRpcAsyncResult) asr;
     CardsProxy clientProtocol = (CardsProxy) result.ClientProtocol;
     clientProtocol.Url = this.EndpointUri;
     try
     {
         XmlRpcRespStruct_Cards cards = clientProtocol.EndgetVeteranLevel(asr);
         this.mResponse = new XmlRpcCardsResponse();
         XmlRpcRespStruct_Cards cards2 = new XmlRpcRespStruct_Cards {
             mVeteranLv1 = cards.mVeteranLv1,
             mVeteranLv2 = cards.mVeteranLv2,
             mVeteranLv3 = cards.mVeteranLv3,
             mVeteranLv4 = cards.mVeteranLv4,
             mVeteranLv5 = cards.mVeteranLv5,
             mVeteranLv6 = cards.mVeteranLv6,
             mVeteranLv7 = cards.mVeteranLv7,
             mVeteranLv8 = cards.mVeteranLv8,
             mVeteranLv9 = cards.mVeteranLv9,
             mVeteranLv10 = cards.mVeteranLv10,
             mVeteranSecondsLeft = cards.mVeteranSecondsLeft,
             mMessage = cards.mMessage,
             mSuccessCode = cards.mSuccessCode,
             mVeteranCurrentLevel = cards.mVeteranCurrentLevel,
             mStrings = cards.mStrings
         };
         this.mResponse.Response = cards2;
     }
     catch (Exception exception)
     {
         this.mResponse = new XmlRpcCardsResponse(exception.Message, 0);
     }
     try
     {
         this.CallbackMethod(this, this.Response);
     }
     catch (Exception exception2)
     {
         string message = exception2.Message;
     }
 }
 private void PlayedToken(ICardsProvider provider, ICardsResponse response)
 {
     this.inSend = false;
     if (response.SuccessCode != 1)
     {
         MyMessageBox.Show(PlayCardsWindow.translateCardError(response.Message, 0), SK.Text("GENERIC_Error", "Error"));
         GameEngine.Instance.World.ProfilePremiumTokens.Add(this.lastToken.UserPremiumTokenID, this.lastToken);
         this.premiumInPlay = false;
         GameEngine.Instance.World.UserCardData.premiumCard = 0;
         GameEngine.Instance.World.UserCardData.premiumCardExpiry = VillageMap.getCurrentServerTime();
         this.UpdatePremiumTokens();
         this.UpdateExpiry();
         if (InterfaceMgr.Instance.getCardWindow() != null)
         {
             CursorManager.SetCursor(CursorManager.CursorType.Default, InterfaceMgr.Instance.getCardWindow());
         }
     }
     else
     {
         GameEngine.Instance.World.CardPlayed(-1, GameEngine.Instance.World.UserCardData.premiumCard, -1);
     }
 }
Ejemplo n.º 7
0
 public void OfferBought(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode == 1)
     {
         if (GameEngine.Instance.World.ProfileUserCardPacks.ContainsKey(this.lastoffer.Offer.ID))
         {
             if (InterfaceMgr.Instance.BuyOfferMultiple < 1)
             {
                 CardTypes.UserCardPack local1 = GameEngine.Instance.World.ProfileUserCardPacks[this.lastoffer.Offer.ID];
                 local1.Count++;
             }
             else
             {
                 CardTypes.UserCardPack local2 = GameEngine.Instance.World.ProfileUserCardPacks[this.lastoffer.Offer.ID];
                 local2.Count += InterfaceMgr.Instance.BuyOfferMultiple;
             }
         }
         else
         {
             CardTypes.UserCardPack pack = new CardTypes.UserCardPack {
                 Count = InterfaceMgr.Instance.BuyOfferMultiple,
                 PackID = this.lastoffer.Offer.ID
             };
             GameEngine.Instance.World.ProfileUserCardPacks.Add(this.lastoffer.Offer.ID, pack);
         }
         this.UpdatePacks();
     }
     else
     {
         WorldMap world = GameEngine.Instance.World;
         world.ProfileCrowns += this.lastoffer.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();
         MyMessageBox.Show(response.Message, SK.Text("GENERIC_Error", "Error"));
     }
 }
Ejemplo n.º 8
0
        private void getVeteranLevelCallback(ICardsProvider provider, ICardsResponse response)
        {
            if (response.SuccessCode.Value == 1)
            {
                int? nullable3;
                int? nullable5;
                int? nullable7;
                int? nullable9;
                int? nullable11;
                int? nullable13;
                int? nullable15;
                int? nullable17;
                int? nullable19;
                int? nullable21;
                bool[] flagArray2 = new bool[10];

                nullable3 = null;
                nullable5 = null;
                nullable7 = null;
                nullable9 = null;
                nullable11 = null;
                nullable13 = null;
                nullable15 = null;
                nullable17 = null;
                nullable19 = null;
                nullable21 = null;
                if (((XmlRpcCardsResponse) response).VeteranLevel1.HasValue)
                {
                    nullable3 = ((XmlRpcCardsResponse) response).VeteranLevel1;
                }
                flagArray2[0] = (nullable3.GetValueOrDefault() == 1) && nullable3.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel2.HasValue)
                {
                    nullable5 = ((XmlRpcCardsResponse) response).VeteranLevel2;
                }
                flagArray2[1] = (nullable5.GetValueOrDefault() == 1) && nullable5.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel3.HasValue)
                {
                    nullable7 = ((XmlRpcCardsResponse) response).VeteranLevel3;
                }
                flagArray2[2] = (nullable7.GetValueOrDefault() == 1) && nullable7.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel4.HasValue)
                {
                    nullable9 = ((XmlRpcCardsResponse) response).VeteranLevel4;
                }
                flagArray2[3] = (nullable9.GetValueOrDefault() == 1) && nullable9.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel5.HasValue)
                {
                    nullable11 = ((XmlRpcCardsResponse) response).VeteranLevel5;
                }
                flagArray2[4] = (nullable11.GetValueOrDefault() == 1) && nullable11.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel6.HasValue)
                {
                    nullable13 = ((XmlRpcCardsResponse) response).VeteranLevel6;
                }
                flagArray2[5] = (nullable13.GetValueOrDefault() == 1) && nullable13.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel7.HasValue)
                {
                    nullable15 = ((XmlRpcCardsResponse) response).VeteranLevel7;
                }
                flagArray2[6] = (nullable15.GetValueOrDefault() == 1) && nullable15.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel8.HasValue)
                {
                    nullable17 = ((XmlRpcCardsResponse) response).VeteranLevel8;
                }
                flagArray2[7] = (nullable17.GetValueOrDefault() == 1) && nullable17.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel9.HasValue)
                {
                    nullable19 = ((XmlRpcCardsResponse) response).VeteranLevel9;
                }
                flagArray2[8] = (nullable19.GetValueOrDefault() == 1) && nullable19.HasValue;
                if (((XmlRpcCardsResponse) response).VeteranLevel10.HasValue)
                {
                    nullable21 = ((XmlRpcCardsResponse) response).VeteranLevel10;
                }
                flagArray2[9] = (nullable21.GetValueOrDefault() == 1) && nullable21.HasValue;
                bool[] stages = flagArray2;
                GameEngine.Instance.World.importFreeCardData(((XmlRpcCardsResponse) response).VeteranCurrentLevel.Value, stages, DateTime.Now.AddSeconds((double) ((XmlRpcCardsResponse) response).VeteranSecondsLeft.Value), DateTime.Now);
            }
            this.init(false);
        }
Ejemplo n.º 9
0
 public void UpdateCrownsCallback(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode.Value == 1)
     {
         GameEngine.Instance.World.ProfileCrowns = response.Crowns.Value;
         GameEngine.Instance.World.LastUpdatedCrowns = DateTime.Now;
         GameEngine.Instance.World.ProfileUserCardPacks = response.UserCardPacks;
     }
 }
Ejemplo n.º 10
0
 public void GetCrownsCallback(ICardsProvider provider, ICardsResponse response)
 {
 }
Ejemplo n.º 11
0
 public void CardPlayed(ICardsProvider provider, ICardsResponse response)
 {
     if (!response.SuccessCode.HasValue || (response.SuccessCode.Value != 1))
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_failed");
         MyMessageBox.Show(PlayCardsWindow.translateCardError(response.Message, this.lastRequestCard.Definition.id), SK.Text("BuyCardsPanel_Cannot_Play_Cards", "Could not play card."));
         try
         {
             GameEngine.Instance.World.addProfileCard(this.lastRequestUserID, CardTypes.getStringFromCard(this.lastRequestCard.Definition.id));
             this.GetCardsAvailable(true);
             int height = this.RefreshCards(this.AvailablePanelContent, this.UICardList, 500);
             this.AvailablePanelContent.Size = new Size(this.AvailablePanel.Width, height);
             this.UpdateScrollbar(this.scrollbarAvailable, this.AvailablePanelContent);
         }
         catch (Exception exception)
         {
             MyMessageBox.Show(exception.Message, SK.Text("BuyCardsPanel_Error_Report", "ERROR: Please report this error message"));
         }
         if (InterfaceMgr.Instance.getCardWindow() != null)
         {
             CursorManager.SetCursor(CursorManager.CursorType.Default, InterfaceMgr.Instance.getCardWindow());
         }
     }
     else
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_success");
         GameEngine.Instance.World.ProfileCardsSet.Remove(this.lastRequestUserID);
         GameEngine.Instance.addRecentCard(this.lastRequestCard.Definition.id);
         if (this.lastRequestCard.UserIDList.Count > 0)
         {
             this.lastRequestCard.UserID = this.lastRequestCard.UserIDList[0];
         }
         if (CardTypes.getBasicUniqueCardType(this.lastRequestCard.Definition.id) != -1)
         {
             disableCardsInPlay(CardTypes.getBasicUniqueCardType(this.lastRequestCard.Definition.id), this.UICardList);
             this.AvailablePanelContent.invalidate();
         }
         GameEngine.Instance.World.CardPlayed(this.lastRequestCard.Definition.cardCategory, this.lastRequestCard.Definition.id, this.selectedVillage);
         StatTrackingClient.Instance().ActivateTrigger(15, this.usingRecentFilter);
         StatTrackingClient.Instance().ActivateTrigger(0x11, (((PlayCardsWindow) base.ParentForm).getNameSearchText().Length <= 0) ? ((object) 0) : ((object) this.clearSearchButton.Visible));
         StatTrackingClient.Instance().ActivateTrigger(6, this.lastRequestCard.Definition.id);
         if ((GameEngine.Instance.World.getTutorialStage() == 8) || (GameEngine.Instance.World.getTutorialStage() == 12))
         {
             InterfaceMgr.Instance.closePlayCardsWindow();
             InterfaceMgr.Instance.ParentForm.TopMost = true;
             InterfaceMgr.Instance.ParentForm.TopMost = false;
         }
     }
     this.waitingResponse = false;
     if (this.usingRecentFilter)
     {
         this.labelTitle.Text = SK.Text("CardPanel_Recent", "Recently Played") + " : " + GameEngine.Instance.World.countCardsInCategory(0x100000).ToString();
     }
     else
     {
         this.labelTitle.Text = this.sectionName + " : " + GameEngine.Instance.World.ProfileCardsSearch.Count.ToString();
     }
 }
Ejemplo n.º 12
0
 private void MultipleCallback(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode == 1)
     {
         string str = response.Strings.TrimEnd(",".ToCharArray());
         string[] strArray = this.newcardnames.Split(",".ToCharArray());
         string[] strArray2 = str.Split(",".ToCharArray());
         for (int i = 0; i < strArray.Length; i++)
         {
             int key = Convert.ToInt32(strArray2[(strArray.Length - 1) - i].Trim());
             GameEngine.Instance.World.ProfileCards.Add(key, CardTypes.getCardDefinitionFromString(strArray[i].Trim()));
             if (GameEngine.Instance.World.ProfileCards[key].id == 0xc29)
             {
                 GameEngine.Instance.World.handleQuestObjectiveHappening(0x2717);
             }
         }
         if (GameEngine.Instance.World.getTutorialStage() == 0x66)
         {
             GameEngine.Instance.World.FakeCardPoints = 0;
         }
         else
         {
             WorldMap world = GameEngine.Instance.World;
             world.ProfileCardpoints -= this.newcardcost;
         }
         this.labelTitle.Text = SK.Text("ManageCandsPanel_Get_New_Cards_Points", "Get New Cards: Current Card Points");
         this.addPointsData();
         if (GameEngine.Instance.World.FakeCardPoints > 0)
         {
             this.labelTitlePoints.Text = this.labelTitlePoints.Text + " (+" + GameEngine.Instance.World.FakeCardPoints.ToString() + ")";
         }
         if (GameEngine.Instance.World.getTutorialStage() == 0x66)
         {
             this.closeClick();
         }
         if ((strArray2.Length == 1) && this.buyAndPlayCheckBox.Checked)
         {
             int userID = Convert.ToInt32(strArray2[0].Trim());
             this.autoPlayCard(userID, CardTypes.getCardDefinitionFromString(strArray[0].Trim()), true, false);
         }
     }
     else
     {
         MyMessageBox.Show(response.Message, SK.Text("GENERIC_Error", "Error"));
     }
     this.cardsButtons.Available = true;
     this.buyingCard = false;
     GameEngine.Instance.World.ShoppingCartCards.Clear();
     this.RefreshCart();
     this.LabelClickToRemove.Text = "";
 }
Ejemplo n.º 13
0
 private void CashClickCallback(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode == 1)
     {
         StatTrackingClient.Instance().ActivateTrigger(0x13, null);
         foreach (int num in GameEngine.Instance.World.ProfileCardsSet)
         {
             GameEngine.Instance.World.ProfileCards.Remove(num);
         }
         GameEngine.Instance.World.ProfileCardsSet.Clear();
         this.fastCashInCheckBox.Enabled = true;
         this.lastCashResponse = (XmlRpcCardsResponse) response;
         WorldMap world = GameEngine.Instance.World;
         world.ProfileCardpoints += response.Newpoints.Value;
     }
     else
     {
         MyMessageBox.Show(response.Message, SK.Text("GENERIC_Error", "Error"));
         this.GetCardsAvailable(true);
         int height = this.RefreshCards(this.AvailablePanelContent, this.UICardList, 500);
         this.AvailablePanelContent.Size = new Size(this.AvailablePanel.Width, height);
         this.UpdateScrollbar(this.scrollbarAvailable, this.AvailablePanelContent);
         this.cashingIn = false;
         this.cardsButtons.Available = true;
         this.InitEmptyCards();
         this.RefreshSet();
         this.InitSpinners();
     }
 }
Ejemplo n.º 14
0
 private void CardPlayed(ICardsProvider provider, ICardsResponse response)
 {
     if (!response.SuccessCode.HasValue || (response.SuccessCode.Value != 1))
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_failed");
         MyMessageBox.Show(PlayCardsWindow.translateCardError(response.Message, this.autoCardDef.id), SK.Text("BuyCardsPanel_Cannot_Play_Cards", "Could not play card."));
         try
         {
             GameEngine.Instance.World.addProfileCard(this.autoCardUserID, CardTypes.getStringFromCard(this.autoCardDef.id));
         }
         catch (Exception exception)
         {
             MyMessageBox.Show(exception.Message, SK.Text("BuyCardsPanel_Error_Report", "ERROR: Please report this error message"));
         }
         if (InterfaceMgr.Instance.getCardWindow() != null)
         {
             CursorManager.SetCursor(CursorManager.CursorType.Default, InterfaceMgr.Instance.getCardWindow());
         }
         StatTrackingClient.Instance().ActivateTrigger(0x10, false);
     }
     else
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_success");
         GameEngine.Instance.World.ProfileCardsSet.Remove(this.autoCardUserID);
         GameEngine.Instance.World.CardPlayed(this.autoCardDef.cardCategory, this.autoCardDef.id, this.autoCardVillageID);
         GameEngine.Instance.addRecentCard(this.autoCardDef.id);
         StatTrackingClient.Instance().ActivateTrigger(6, this.autoCardDef.id);
     }
     this.waitingResponse = false;
 }
Ejemplo n.º 15
0
        public static void revealCardCallback(ICardsProvider provider, ICardsResponse response)
        {
            if (response.SuccessCode.Value == 1)
            {
                try
                {
                    int? nullable3;
                    int? nullable5;
                    int? nullable7;
                    int? nullable9;
                    int? nullable11;
                    int? nullable13;
                    int? nullable15;
                    int? nullable17;
                    int? nullable19;
                    int? nullable21;
                    if (_lastInstance != null)
                    {
                        try
                        {
                            _lastInstance.Invoke(new CardsEndResponseDelegate(_lastInstance.revealCardCallbackPanel), new object[] { provider, response });
                        }
                        catch (Exception)
                        {
                        }
                        _lastInstance = null;
                    }
                    GFXLibrary.Instance.closeBigCardsLoader();
                    bool[] flagArray2 = new bool[10];

                    nullable3 = null;
                    nullable5 = null;
                    nullable7 = null;
                    nullable9 = null;
                    nullable11 = null;
                    nullable13 = null;
                    nullable15 = null;
                    nullable17 = null;
                    nullable19 = null;
                    nullable21 = null;
                    if (((XmlRpcCardsResponse) response).VeteranLevel1.HasValue)
                    {
                        nullable3 = ((XmlRpcCardsResponse) response).VeteranLevel1;
                    }
                    flagArray2[0] = (nullable3.GetValueOrDefault() == 1) && nullable3.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel2.HasValue)
                    {
                        nullable5 = ((XmlRpcCardsResponse) response).VeteranLevel2;
                    }
                    flagArray2[1] = (nullable5.GetValueOrDefault() == 1) && nullable5.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel3.HasValue)
                    {
                        nullable7 = ((XmlRpcCardsResponse) response).VeteranLevel3;
                    }
                    flagArray2[2] = (nullable7.GetValueOrDefault() == 1) && nullable7.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel4.HasValue)
                    {
                        nullable9 = ((XmlRpcCardsResponse) response).VeteranLevel4;
                    }
                    flagArray2[3] = (nullable9.GetValueOrDefault() == 1) && nullable9.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel5.HasValue)
                    {
                        nullable11 = ((XmlRpcCardsResponse) response).VeteranLevel5;
                    }
                    flagArray2[4] = (nullable11.GetValueOrDefault() == 1) && nullable11.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel6.HasValue)
                    {
                        nullable13 = ((XmlRpcCardsResponse) response).VeteranLevel6;
                    }
                    flagArray2[5] = (nullable13.GetValueOrDefault() == 1) && nullable13.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel7.HasValue)
                    {
                        nullable15 = ((XmlRpcCardsResponse) response).VeteranLevel7;
                    }
                    flagArray2[6] = (nullable15.GetValueOrDefault() == 1) && nullable15.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel8.HasValue)
                    {
                        nullable17 = ((XmlRpcCardsResponse) response).VeteranLevel8;
                    }
                    flagArray2[7] = (nullable17.GetValueOrDefault() == 1) && nullable17.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel9.HasValue)
                    {
                        nullable19 = ((XmlRpcCardsResponse) response).VeteranLevel9;
                    }
                    flagArray2[8] = (nullable19.GetValueOrDefault() == 1) && nullable19.HasValue;
                    if (((XmlRpcCardsResponse) response).VeteranLevel10.HasValue)
                    {
                        nullable21 = ((XmlRpcCardsResponse) response).VeteranLevel10;
                    }
                    flagArray2[9] = (nullable21.GetValueOrDefault() == 1) && nullable21.HasValue;
                    bool[] stages = flagArray2;
                    GameEngine.Instance.World.importFreeCardData(((XmlRpcCardsResponse) response).VeteranCurrentLevel.Value, stages, DateTime.Now.AddSeconds((double) ((XmlRpcCardsResponse) response).VeteranSecondsLeft.Value), DateTime.Now);
                }
                catch (Exception exception)
                {
                    MyMessageBox.Show(exception.Message, SK.Text("GENERIC_Error", "Error"));
                }
            }
            else
            {
                MyMessageBox.Show(response.Message, SK.Text("FreeCardsPanel_Cannot_Free_Card", "Could not get free card."));
            }
        }
Ejemplo n.º 16
0
 private void revealCardCallbackPanel(ICardsProvider provider, ICardsResponse response)
 {
     try
     {
         foreach (string str in response.Strings.Split(";".ToCharArray()))
         {
             string[] strArray2 = str.Split(",".ToCharArray());
             if (strArray2.Length == 2)
             {
                 GameEngine.Instance.World.ProfileCards.Add(Convert.ToInt32(strArray2[0].Trim()), CardTypes.getCardDefinitionFromString(strArray2[1].Trim()));
                 CustomSelfDrawPanel.UICard control = BuyCardsPanel.makeUICard(CardTypes.getCardDefinitionFromString(strArray2[1].Trim()), Convert.ToInt32(strArray2[0].Trim()), GameEngine.Instance.World.getRank() + 1);
                 control.Position = new Point(12, 11);
                 control.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.cardClicked), "FreeCardsPanel_play_card");
                 this.cardBackImage.addControl(control);
                 this.revealButton.Visible = false;
                 base.Invalidate();
             }
         }
         this.revealButton.Enabled = true;
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 17
0
 private void getRewardcardsCallback(ICardsProvider sender, ICardsResponse response)
 {
     m_lastRewardCardsCall = DateTime.Now;
     foreach (int num in response.Cards.Keys)
     {
         if (!GameEngine.Instance.World.ProfileCards.ContainsKey(num))
         {
             GameEngine.Instance.World.addProfileCard(num, response.Cards[num]);
             GameEngine.Instance.World.ProfileCards[num].rewardcard = true;
             GameEngine.Instance.World.ProfileCards[num].worldID = RemoteServices.Instance.ProfileWorldID;
         }
     }
     if (response.Cardpoints.HasValue)
     {
         GameEngine.Instance.World.FakeCardPoints = response.Cardpoints.Value;
     }
     ((CustomSelfDrawPanel.ICardsPanel) this.currentPanel).init(this.currentCardSection);
 }
Ejemplo n.º 18
0
 private void CardPlayed(ICardsProvider provider, ICardsResponse response)
 {
     if (!response.SuccessCode.HasValue || (response.SuccessCode.Value != 1))
     {
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_failed");
         MyMessageBox.Show(PlayCardsWindow.translateCardError(response.Message, this.lastRequestCard.Definition.id), SK.Text("BuyCardsPanel_Cannot_Play_Cards", "Could not play card."));
         try
         {
             GameEngine.Instance.World.addProfileCard(this.lastRequestCard.UserID, CardTypes.getStringFromCard(this.lastRequestCard.Definition.id));
             this.lastRequestCard.Visible = true;
             this.greyout.invalidate();
         }
         catch (Exception exception)
         {
             MyMessageBox.Show(exception.Message, SK.Text("BuyCardsPanel_Error_Report", "ERROR: Please report this error message"));
         }
         if (InterfaceMgr.Instance.getCardWindow() != null)
         {
             CursorManager.SetCursor(CursorManager.CursorType.Default, InterfaceMgr.Instance.getCardWindow());
         }
     }
     else
     {
         this.greyout.removeControl(this.lastRequestCard);
         GameEngine.Instance.playInterfaceSound("PlayCardsPanel_play_card_success");
         GameEngine.Instance.World.ProfileCardsSet.Remove(this.lastRequestCard.UserID);
         GameEngine.Instance.World.CardPlayed(this.lastRequestCard.Definition.cardCategory, this.lastRequestCard.Definition.id, this.selectedVillage);
         GameEngine.Instance.addRecentCard(this.lastRequestCard.Definition.id);
     }
     this.waitingResponse = false;
 }
Ejemplo n.º 19
0
 public void GetCrownsCallback(ICardsProvider provider, ICardsResponse response)
 {
 }
Ejemplo n.º 20
0
 public void PackOpened(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode.Value != 1)
     {
         MyMessageBox.Show(response.Message, SK.Text("BuyCardsPanel_Could_Not_Open_Pack", "Could not open pack."));
         this.UpdatePacks();
     }
     else
     {
         foreach (CardTypes.UserCardPack pack in GameEngine.Instance.World.ProfileUserCardPacks.Values)
         {
             if (pack.PackID == this.openedPackID)
             {
                 if (this.extendedMultiOpened > 0)
                 {
                     pack.Count -= this.extendedMultiOpened;
                 }
                 else if (InterfaceMgr.Instance.OpenPackMultiple < 1)
                 {
                     pack.Count--;
                 }
                 else
                 {
                     pack.Count -= InterfaceMgr.Instance.OpenPackMultiple;
                 }
                 if ((this.extendedMultiOpen && (this.extendedMultiOpenLeft > 0)) && this.doExtendedMultiOpen())
                 {
                     foreach (string str in response.Strings.Split(";".ToCharArray()))
                     {
                         string[] strArray2 = str.Split(",".ToCharArray());
                         if (strArray2.Length == 2)
                         {
                             GameEngine.Instance.World.ProfileCards.Add(Convert.ToInt32(strArray2[0].Trim()), CardTypes.getCardDefinitionFromString(strArray2[1].Trim()));
                         }
                     }
                     return;
                 }
                 this.UpdatePacks();
                 break;
             }
         }
         try
         {
             this.CloseGrey();
             for (int i = 0; i < 50; i++)
             {
                 if (this.revealCards[i] != null)
                 {
                     this.revealCards[i].clearControls();
                     this.greyout.removeControl(this.revealCards[i]);
                 }
             }
             bool flag = false;
             int index = 0;
             List<CustomSelfDrawPanel.UICard> list = new List<CustomSelfDrawPanel.UICard>();
             string[] strArray3 = response.Strings.Split(";".ToCharArray());
             int length = strArray3.Length;
             int num4 = -10 * ((length / 5) - 1);
             foreach (string str2 in strArray3)
             {
                 string[] strArray4 = str2.Split(",".ToCharArray());
                 if (strArray4.Length == 2)
                 {
                     GameEngine.Instance.World.ProfileCards.Add(Convert.ToInt32(strArray4[0].Trim()), CardTypes.getCardDefinitionFromString(strArray4[1].Trim()));
                     CustomSelfDrawPanel.UICard item = makeUICard(CardTypes.getCardDefinitionFromString(strArray4[1].Trim()), Convert.ToInt32(strArray4[0].Trim()), GameEngine.Instance.World.getRank() + 1);
                     item.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.cardClickPlayTrueFromClickFalseValidate));
                     list.Add(item);
                 }
             }
             list.Sort(CustomSelfDrawPanel.UICard.cardsNameComparer);
             foreach (CustomSelfDrawPanel.UICard card2 in list)
             {
                 this.revealCards[index] = card2;
                 this.revealCards[index].Position = new Point((15 + ((index % 5) * (200 - (length / 5)))) + ((index / 5) * 5), (0x5f + num4) + (20 * (index / 5)));
                 this.greyout.addControl(this.revealCards[index]);
                 switch (this.revealCards[index].Definition.cardGrade)
                 {
                     case 0x200000:
                     case 0x400000:
                     case 0x80000:
                     case 0x100000:
                         flag = true;
                         break;
                 }
                 index++;
             }
             GFXLibrary.Instance.closeBigCardsLoader();
             this.numRevealCards = index;
             if (flag)
             {
                 GameEngine.Instance.playInterfaceSound("BuyCardsPanel_found_rare_card");
             }
             this.OpenGrey();
             this.openingPack = false;
         }
         catch (Exception exception)
         {
             MyMessageBox.Show(exception.Message, SK.Text("GENERIC_Error", "Error"));
         }
     }
     this.openingPack = false;
 }
 private void BoughtOffer(ICardsProvider provider, ICardsResponse response)
 {
     if (response.SuccessCode != 1)
     {
         MyMessageBox.Show(response.Message, SK.Text("BuyCardsPanel_Error_Report", "ERROR: Please report this error message"));
         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
     {
         int result = 0;
         int.TryParse(response.Strings, out result);
         CardTypes.PremiumToken token = new CardTypes.PremiumToken {
             Reward = 0,
             Type = this.buytype,
             UserPremiumTokenID = result,
             WorldID = RemoteServices.Instance.ProfileWorldID
         };
         GameEngine.Instance.World.ProfilePremiumTokens.Add(result, token);
         this.UpdatePremiumTokens();
     }
     this.buying = false;
 }