public static XmlRpcCardsResponse GiveCardExample(string userguid, int kingdomsworldID, string commaSeparatedCardStrings) { XmlRpcCardsRequest req = new XmlRpcCardsRequest { UserGUID = userguid, WorldID = kingdomsworldID.ToString(), CardString = commaSeparatedCardStrings }; return XmlRpcCardsProvider.CreateForEndpoint("http", "174.129.182.8", "8080", "secureservices/cards.php").giveCards(req, null, null, 0x7530); }
public static XmlRpcCardsResponse GiveCardExample(string userguid, int kingdomsworldID, string commaSeparatedCardStrings) { XmlRpcCardsRequest req = new XmlRpcCardsRequest { UserGUID = userguid, WorldID = kingdomsworldID.ToString(), CardString = commaSeparatedCardStrings }; return(XmlRpcCardsProvider.CreateForEndpoint("http", "174.129.182.8", "8080", "secureservices/cards.php").giveCards(req, null, null, 0x7530)); }
public void buyPremium(ICardsRequest req, CardsEndResponseDelegate callbackHandler, Control ctrl) { this.FormsControl = ctrl; this.CallbackMethod = callbackHandler; this.mRequest = (XmlRpcCardsRequest)req; CardsProxy proxy = XmlRpcProxyGen.Create <CardsProxy>(); proxy.Url = this.EndpointUri; proxy.BeginbuyPremium(this.mRequest.Request, new AsyncCallback(this.BuyPremiumResponse), null); }
public XmlRpcCardsResponse playPremium(ICardsRequest req, int timeout) { this.mRequest = (XmlRpcCardsRequest)req; CardsProxy proxy = XmlRpcProxyGen.Create <CardsProxy>(); proxy.Url = this.EndpointUri; proxy.Timeout = timeout; XmlRpcRespStruct_Cards cards = proxy.playPremium(this.mRequest.Request); try { this.mResponse = new XmlRpcCardsResponse(cards.mMessage, cards.mSuccessCode); } catch (Exception exception) { this.mResponse = new XmlRpcCardsResponse(exception.Message, 0); } return(this.mResponse); }
public XmlRpcCardsResponse setVeteranData(ICardsRequest req, CardsEndResponseDelegate callbackHandler, Control ctrl, int timeout) { this.FormsControl = ctrl; this.CallbackMethod = callbackHandler; this.mRequest = (XmlRpcCardsRequest)req; CardsProxy proxy = XmlRpcProxyGen.Create <CardsProxy>(); proxy.Url = this.EndpointUri; proxy.Timeout = timeout; XmlRpcRespStruct_Cards cards = proxy.setVeteranData(this.mRequest.Request); try { this.mResponse = new XmlRpcCardsResponse(cards.mMessage, cards.mSuccessCode); } catch (Exception exception) { this.mResponse = new XmlRpcCardsResponse(exception.Message, 0); } return(this.mResponse); }
private void BuyPackAfterConfirmation() { try { CustomSelfDrawPanel.UICardOffer lastoffer = this.lastoffer; XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), lastoffer.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 -= 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(); this.confirmBuyCardPopUp.Close(); } catch (Exception exception) { UniversalDebugLog.Log("Exception " + exception.ToString()); } }
private bool doExtendedMultiOpen() { string category = GameEngine.Instance.World.ProfileCardOffers[this.extendedPackClicked.PackIDs[0]].Category; foreach (CardTypes.UserCardPack pack in GameEngine.Instance.World.ProfileUserCardPacks.Values) { if ((GameEngine.Instance.World.ProfileCardOffers[pack.PackID].Category == category) && (pack.Count > 0)) { this.openedPackID = pack.PackID; XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); int num = GameEngine.Instance.World.getRank() + 1; XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), num.ToString(), pack.PackID.ToString(), RemoteServices.Instance.ProfileWorldID.ToString()) { Multiple = new int?(this.extendedMultiOpenLeft) }; if (pack.Count < this.extendedMultiOpenLeft) { this.extendedMultiOpen = true; this.extendedMultiOpenLeft -= pack.Count; req.Multiple = new int?(pack.Count); this.extendedMultiOpened = pack.Count; } else { this.extendedMultiOpened = this.extendedMultiOpenLeft; this.extendedMultiOpen = false; this.extendedPackClicked = null; } provider.openCardPack(req, new CardsEndResponseDelegate(this.PackOpened), this); return true; } } return false; }
public XmlRpcCardsResponse setVeteranData(ICardsRequest req, CardsEndResponseDelegate callbackHandler, Control ctrl, int timeout) { this.FormsControl = ctrl; this.CallbackMethod = callbackHandler; this.mRequest = (XmlRpcCardsRequest) req; CardsProxy proxy = XmlRpcProxyGen.Create<CardsProxy>(); proxy.Url = this.EndpointUri; proxy.Timeout = timeout; XmlRpcRespStruct_Cards cards = proxy.setVeteranData(this.mRequest.Request); try { this.mResponse = new XmlRpcCardsResponse(cards.mMessage, cards.mSuccessCode); } catch (Exception exception) { this.mResponse = new XmlRpcCardsResponse(exception.Message, 0); } return this.mResponse; }
public void veteranLevelUp(ICardsRequest req, CardsEndResponseDelegate callbackHandler, Control ctrl) { this.FormsControl = ctrl; this.CallbackMethod = callbackHandler; this.mRequest = (XmlRpcCardsRequest) req; CardsProxy proxy = XmlRpcProxyGen.Create<CardsProxy>(); proxy.Url = this.EndpointUri; proxy.BeginveteranLevelUp(this.mRequest.Request, new AsyncCallback(this.veteranLevelUpResponse), null); }
public void UpdateRewardCards() { ICardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); ICardsRequest req = new XmlRpcCardsRequest { UserGUID = RemoteServices.Instance.UserGuid.ToString("N"), WorldID = RemoteServices.Instance.ProfileWorldID.ToString() }; ((XmlRpcCardsProvider) provider).getRewardCards(req, new CardsEndResponseDelegate(this.getRewardcardsCallback), this); }
public XmlRpcCardsResponse playPremium(ICardsRequest req, int timeout) { this.mRequest = (XmlRpcCardsRequest) req; CardsProxy proxy = XmlRpcProxyGen.Create<CardsProxy>(); proxy.Url = this.EndpointUri; proxy.Timeout = timeout; XmlRpcRespStruct_Cards cards = proxy.playPremium(this.mRequest.Request); try { this.mResponse = new XmlRpcCardsResponse(cards.mMessage, cards.mSuccessCode); } catch (Exception exception) { this.mResponse = new XmlRpcCardsResponse(exception.Message, 0); } return this.mResponse; }
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; } } }
private void ClickedToken() { if (!this.inSend) { int data = base.ClickedControl.Data; int type = GameEngine.Instance.World.ProfilePremiumTokens[data].Type; DateTime time = VillageMap.getCurrentServerTime(); if (this.premiumInPlay) { this.currentExpirySeconds = GameEngine.Instance.World.UserCardData.premiumCardExpiry.Subtract(VillageMap.getCurrentServerTime()).TotalSeconds; time = time.AddSeconds(this.currentExpirySeconds); if ((GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1011) && (GameEngine.Instance.World.UserCardData.premiumCard == 0x1011)) { MyMessageBox.Show(SK.Text("PremiumCardsPanel_Already_In_Play_2_2", "You cannot extend a 2 day Premium Token using another 2 day Premium Token."), SK.Text("GENERIC_Error", "Error")); return; } if (MyMessageBox.Show(SK.Text("PremiumCardsPanel_ExtendToken", "You currently have a Premium Token in play, do you wish to extend this by playing another Token?"), SK.Text("PremiumCardsPanel_ExtendWarning", "Extend Premium Token"), MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } type = 0x1014; } else { string str = ""; switch (GameEngine.Instance.World.ProfilePremiumTokens[data].Type) { case 0x1010: str = SK.Text("PremiumCardsPanel_7day", "7 Day Premium Token"); break; case 0x1011: str = SK.Text("TOOLTIPS_QUEST_REWARD_PREMIUM_CARD", "2 Day Premium Token"); break; case 0x1012: str = SK.Text("PremiumCardsPanel_30day", "30 Day Premium Token"); break; } if (MyMessageBox.Show(str + Environment.NewLine + Environment.NewLine + SK.Text("PremiumCardsPanel_PlayToken", "You are about to play this Premium Token. This Premium Token will only affect the current game world.") + Environment.NewLine + Environment.NewLine + SK.Text("PremiumCardsPanel_PlayToken2", "Are you sure you wish to play this Token?"), SK.Text("PremiumCardsPanel_PlayToken_Header", "Play Premium Token"), MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } } this.lastToken = GameEngine.Instance.World.ProfilePremiumTokens[data]; XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", "")) { WorldID = RemoteServices.Instance.ProfileWorldID.ToString(), UserCardID = data.ToString() }; if (this.lastToken.Type == 0x1010) { req.CardString = "CARDTYPE_PREMIUM"; } if (this.lastToken.Type == 0x1011) { req.CardString = "CARDTYPE_PREMIUM2"; } if (this.lastToken.Type == 0x1012) { req.CardString = "CARDTYPE_PREMIUM30"; } if (InterfaceMgr.Instance.getCardWindow() != null) { CursorManager.SetCursor(CursorManager.CursorType.WaitCursor, InterfaceMgr.Instance.getCardWindow()); } this.inSend = true; provider.playPremium(req, new CardsEndResponseDelegate(this.PlayedToken), this); this.premiumInPlay = true; this.currentExpirySeconds = 604800.0; if (GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1010) { GameEngine.Instance.World.UserCardData.premiumCardExpiry = time.AddDays(7.0); } if (GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1012) { GameEngine.Instance.World.UserCardData.premiumCardExpiry = time.AddDays(30.0); } if (GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1011) { GameEngine.Instance.World.UserCardData.premiumCardExpiry = time.AddDays(2.0); } GameEngine.Instance.World.UserCardData.premiumCard = type; GameEngine.Instance.World.ProfilePremiumTokens.Remove(data); this.UpdatePremiumTokens(); this.UpdateExpiry(); } }
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 ExtendOrPlayPremiumToken() { try { int data = base.ClickedControl.Data; int num2 = 0x1014; DateTime time = VillageMap.getCurrentServerTime(); this.currentExpirySeconds = GameEngine.Instance.World.UserCardData.premiumCardExpiry.Subtract(VillageMap.getCurrentServerTime()).TotalSeconds; time = time.AddSeconds(this.currentExpirySeconds); this.lastToken = GameEngine.Instance.World.ProfilePremiumTokens[data]; XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", "")) { WorldID = RemoteServices.Instance.ProfileWorldID.ToString(), UserCardID = data.ToString() }; if (this.lastToken.Type == 0x1010) { req.CardString = "CARDTYPE_PREMIUM"; } if (this.lastToken.Type == 0x1011) { req.CardString = "CARDTYPE_PREMIUM2"; } if (this.lastToken.Type == 0x1012) { req.CardString = "CARDTYPE_PREMIUM30"; } if (InterfaceMgr.Instance.getCardWindow() != null) { CursorManager.SetCursor(CursorManager.CursorType.WaitCursor, InterfaceMgr.Instance.getCardWindow()); } this.inSend = true; provider.playPremium(req, new CardsEndResponseDelegate(this.PlayedToken), this); this.premiumInPlay = true; this.currentExpirySeconds = 604800.0; if (GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1010) { GameEngine.Instance.World.UserCardData.premiumCardExpiry = time.AddDays(7.0); } if (GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1012) { GameEngine.Instance.World.UserCardData.premiumCardExpiry = time.AddDays(30.0); } if (GameEngine.Instance.World.ProfilePremiumTokens[data].Type == 0x1011) { GameEngine.Instance.World.UserCardData.premiumCardExpiry = time.AddDays(2.0); } GameEngine.Instance.World.UserCardData.premiumCard = num2; GameEngine.Instance.World.ProfilePremiumTokens.Remove(data); this.UpdatePremiumTokens(); this.UpdateExpiry(); } catch (Exception exception) { UniversalDebugLog.Log(exception.ToString()); } }
public void cancelVacationMode() { XmlRpcCardsRequest req = new XmlRpcCardsRequest { UserGUID = RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), SessionGUID = RemoteServices.Instance.SessionGuid.ToString().Replace("-", "") }; XmlRpcCardsResponse response = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressLogin, URLs.ProfileServerPort, "/services/cardserver.php").cancelVacation(req, null, null, 0x7530); if (response.SuccessCode.HasValue && (response.SuccessCode == 1)) { InterfaceMgr.Instance.closeVacationCancelPopupWindow(); } }
private void ClickBuyMultiple() { if (!this.cashingIn && !this.buyingCard) { XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); XmlRpcCardsRequest req = new XmlRpcCardsRequest { UserGUID = RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), WorldID = RemoteServices.Instance.ProfileWorldID.ToString(), CardString = "" }; if (GameEngine.Instance.World.getTutorialStage() == 0x66) { req.CardPoints = 1; } this.newcardcost = 0; for (int i = 0; i < this.ShoppingCart.Count; i++) { req.CardString = req.CardString + this.ShoppingCart[i].Definition.name; this.newcardcost += this.ShoppingCart[i].Definition.cardPoints; if (i < (this.ShoppingCart.Count - 1)) { req.CardString = req.CardString + ","; } } this.newcardnames = req.CardString; provider.buyMultipleCards(req, new CardsEndResponseDelegate(this.MultipleCallback), this); this.buyingCard = true; this.cardsButtons.Available = false; } }
private void CashClick() { if (!this.cashingIn && !this.buyingCard) { XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); XmlRpcCardsRequest req = new XmlRpcCardsRequest { UserGUID = RemoteServices.Instance.UserGuid.ToString().Replace("-", "") }; string str = ""; this.NumCardsCachingIn = 0; foreach (CustomSelfDrawPanel.UICard card in this.SetCards) { if (card.Visible) { if (str.Length > 0) { str = str + ","; } str = str + card.UserID.ToString(); this.NumCardsCachingIn++; } } req.CardString = str; provider.cashInCards(req, new CardsEndResponseDelegate(this.CashClickCallback), this); for (int i = 0; i < this.SlotAnims.Length; i++) { this.SlotAnims[i].Visible = true; this.SlotAnims[i].Playing = !this.fastCashIn; } this.SlotHolder.Visible = true; this.cashingIn = true; this.lastCashResponse = null; this.cardsButtons.Available = false; this.spinspeed = 0x40; this.spinstart = DateTime.Now; if (!this.fastCashIn && !this.playingSpinSound) { this.playingSpinSound = true; GameEngine.Instance.playInterfaceSound("CardSpinners_spin"); for (int j = 0; j < 5; j++) { this.spinSoundStopPlayed[j] = false; } this.spinSoundSoundID = 1; } this.mainBackgroundImage.invalidate(); this.DynamicLabel.Visible = false; } }
public void doOpenPack(bool initialClick) { if (!this.openingPack) { bool flag = false; CustomSelfDrawPanel.UICardPack clickedControl = (CustomSelfDrawPanel.UICardPack) base.ClickedControl; if (initialClick && Program.mySettings.OpenMultipleCardPacks) { GameEngine.Instance.playInterfaceSound("BuyCardsPanel_open_pack_open_confirmation"); base.PanelActive = false; this.waitingResponse = false; InterfaceMgr.Instance.openConfirmOpenPackPopup(clickedControl, new ConfirmOpenPackPanel.CardClickPlayDelegate(this.doOpenPack)); } else { if (initialClick) { GameEngine.Instance.playInterfaceSound("BuyCardsPanel_open_pack"); InterfaceMgr.Instance.OpenPackMultiple = 0; } this.openingPack = true; this.extendedMultiOpen = false; this.extendedMultiOpenLeft = 0; this.extendedMultiOpened = 0; foreach (CardTypes.UserCardPack pack2 in GameEngine.Instance.World.ProfileUserCardPacks.Values) { if ((pack2.PackID == clickedControl.PackIDs[0]) && (pack2.Count > 0)) { this.openedPackID = pack2.PackID; this.lastpack = clickedControl; XmlRpcCardsProvider provider = XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath); int num = GameEngine.Instance.World.getRank() + 1; XmlRpcCardsRequest req = new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), num.ToString(), pack2.PackID.ToString(), RemoteServices.Instance.ProfileWorldID.ToString()) { Multiple = new int?(InterfaceMgr.Instance.OpenPackMultiple) }; if ((InterfaceMgr.Instance.OpenPackMultiple > 0) && (pack2.Count < InterfaceMgr.Instance.OpenPackMultiple)) { this.extendedMultiOpen = true; this.extendedMultiOpenLeft = InterfaceMgr.Instance.OpenPackMultiple - pack2.Count; this.extendedPackClicked = clickedControl; req.Multiple = new int?(pack2.Count); this.extendedMultiOpened = pack2.Count; } provider.openCardPack(req, new CardsEndResponseDelegate(this.PackOpened), this); flag = true; break; } } if (!flag) { MyMessageBox.Show(SK.Text("BuyCardsPanel_No_More_Available", "You have no more packs of that type available."), SK.Text("GENERIC_Error", "Error")); this.openingPack = false; } } } }
private void BoughtTokenPopUp() { try { 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(); } catch (Exception exception) { UniversalDebugLog.Log(exception.ToString()); } this.buyTokenPopUp.Close(); }