Пример #1
0
 private void CompleteVillageCastleCallBack(CompleteVillageCastle_ReturnType returnData)
 {
     if (returnData.Success && (returnData.cardData >= 0))
     {
         GameEngine.Instance.World.addProfileCard(returnData.cardData, CardTypes.getStringFromCard(0xc08));
     }
     if (returnData.Success && this.fixCommandSent)
     {
         MyMessageBox.Show("Armies : " + returnData.armies.ToString() + Environment.NewLine + "Monks : " + returnData.monks.ToString() + Environment.NewLine + "Traders : " + returnData.traders.ToString() + Environment.NewLine + "Cards : " + returnData.cards.ToString() + Environment.NewLine, "Fixes");
     }
     this.fixCommandSent = false;
 }
Пример #2
0
        public void CompleteQuestCallback(CompleteQuest_ReturnType returnData)
        {
            if (returnData.Success)
            {
                GameEngine.Instance.World.setTutorialInfo(returnData.m_tutorialInfo);
                this.completedActiveQuests = returnData.m_preCompletedQuests;
                if (GameEngine.Instance.GameDisplayMode == GameEngine.GameDisplays.DISPLAY_QUESTS)
                {
                    this.rebuild();
                }
                if (returnData.questCompleted >= 0)
                {
                    List <Quests.QuestReward> list = Quests.getQuestRewards(returnData.questCompleted, false, null);
                    foreach (Quests.QuestReward reward in list)
                    {
                        List <int>             list2;
                        CardTypes.PremiumToken token;
                        switch (reward.type)
                        {
                        case 0x4e20:
                        {
                            list2 = GameEngine.Instance.World.getUserVillageIDList();
                            if (list2.Count == 1)
                            {
                                break;
                            }
                            GameEngine.Instance.flushVillages();
                            if (GameEngine.Instance.GameDisplayMode == GameEngine.GameDisplays.DISPLAY_VILLAGE)
                            {
                                GameEngine.Instance.downloadCurrentVillage();
                            }
                            continue;
                        }

                        case 0x4e21:
                        {
                            GameEngine.Instance.World.addGold((double)reward.amount);
                            continue;
                        }

                        case 0x4e22:
                        {
                            GameEngine.Instance.World.addHonour((double)reward.amount);
                            continue;
                        }

                        case 0x4e23:
                        {
                            GameEngine.Instance.World.addResearchPoints(reward.amount);
                            continue;
                        }

                        case 0x4e24:
                        {
                            if (returnData.cardAdded >= 0)
                            {
                                if (reward.data == 0x1011)
                                {
                                    goto Label_01D0;
                                }
                                GameEngine.Instance.World.addProfileCard(returnData.cardAdded, CardTypes.getStringFromCard(reward.data));
                            }
                            continue;
                        }

                        case 0x4e25:
                        {
                            continue;
                        }

                        case 0x4e26:
                        {
                            WorldMap world = GameEngine.Instance.World;
                            world.FakeCardPoints += reward.amount;
                            continue;
                        }

                        default:
                        {
                            continue;
                        }
                        }
                        if (list2.Count == 1)
                        {
                            VillageMap map = GameEngine.Instance.getVillage(list2[0]);
                            if (map != null)
                            {
                                map.addResources(reward.data, reward.amount);
                            }
                        }
                        continue;
Label_01D0:
                        token                    = new CardTypes.PremiumToken();
                        token.Reward             = 1;
                        token.UserPremiumTokenID = returnData.cardAdded;
                        token.WorldID            = RemoteServices.Instance.ProfileWorldID;
                        token.Type               = 0x1011;
                        bool flag = false;
                        if (GameEngine.Instance.World.UserCardData.premiumCard <= 0)
                        {
                            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 = returnData.cardAdded.ToString()
                            };
                            if (token.Type == 0x1010)
                            {
                                req.CardString = "CARDTYPE_PREMIUM";
                            }
                            if (token.Type == 0x1011)
                            {
                                req.CardString = "CARDTYPE_PREMIUM2";
                            }
                            if (token.Type == 0x1012)
                            {
                                req.CardString = "CARDTYPE_PREMIUM30";
                            }
                            XmlRpcCardsResponse response = provider.playPremium(req, 0x1770);
                            if (response.SuccessCode != 1)
                            {
                                flag = true;
                                MyMessageBox.Show(response.Message, "Error playing premium");
                            }
                            else
                            {
                                GameEngine.Instance.World.CardPlayed(-1, token.Type, -1);
                            }
                        }
                        else
                        {
                            flag = true;
                        }
                        if (flag)
                        {
                            GameEngine.Instance.World.ProfilePremiumTokens.Add(returnData.cardAdded, token);
                        }
                    }
                    bool flag2 = false;
                    foreach (Quests.QuestReward reward2 in list)
                    {
                        if ((reward2.type == 0x4e24) || (reward2.type == 0x4e26))
                        {
                            flag2 = true;
                        }
                    }
                    if (flag2)
                    {
                        PlayCardsWindow.resetRewardCardTimer();
                    }
                }
            }
            this.inCompleteQuest = false;
        }