Example #1
0
        public void AutoLoot()
        {
            // TODO: fix crash
#if DEBUG
            Log("Trying to loot card");
#endif
            while (true)
            {
                if (autoLoot)
                {
                    //Log(GameEngine.Instance.World.FreeCardInfo.timeUntilNextFreeCard().TotalMilliseconds.ToString());
                    //if (GameEngine.Instance.World.FreeCardInfo.timeUntilNextFreeCard().TotalMilliseconds < 1000.0)
                    if (((GameEngine.Instance.World.FreeCardInfo.timeUntilNextFreeCard().TotalSeconds <= 0.0) &&
                         GameEngine.Instance.World.FreeCardInfo.VeteranStages[0]) &&
                        (GameEngine.Instance.World.FreeCardInfo.CurrentVeteranLevel > 0))
                    {
                        // GameEngine.Instance.World.FreeCardInfo.
                        XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath).getFreeCard(new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", "")), new CardsEndResponseDelegate(FreeCardsPanel.revealCardCallback), this);
                        //InterfaceMgr.Instance.openFreeCardsPopup().freeCardsPanel.revealCard();
                        //InterfaceMgr.Instance.getFreeCardsPopup().freeCardsPanel.revealCard();
                        Log("Card looted at: " + DateTime.Now.ToString("HH:mm:ss"));
                    }
                }
                //InterfaceMgr.Instance.getFreeCardsPopup().freeCardsPanel.Show();
                //InterfaceMgr.Instance.getFreeCardsPopup().freeCardsPanel.revealCard();

                Thread.Sleep(500);
            }
        }
Example #2
0
        public void AutoLoot()
        {
            Log("Поток автолута создан!");

            while (true)
            {
                try
                {
                    // Если лутаем и время пришло
                    if (GameEngine.Instance.World.isDownloadComplete() && IsAutoLoot && GameEngine.Instance.World.FreeCardInfo.timeUntilNextFreeCard().TotalSeconds <= 0)
                    {
                        // Грязный хак. Новая карта не будет показана пока игра не будет перезапущена - каллбека то нету
                        XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath).getFreeCard(new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", "")), null, null);

                        // Wrong next time cause info about it not loaded. Cause callback is broken
                        // Не верное следующее время лута, т.к. новое не загружено - каллбека нет.
                        // Фактически одноразовый автолут, лол
                        Log("Карта полутана! Следующая через " + GameEngine.Instance.World.FreeCardInfo.timeUntilNextFreeCard());
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("\n======| EX INFO |======");
                    Console.WriteLine(ex);
                    Console.WriteLine("======| ======= |======\n");
                }

                Thread.Sleep(60 * 1000); // 60 sec
            }
        }
Example #3
0
        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);
        }
Example #4
0
 public void UpdateCrowns()
 {
     XmlRpcCardsProvider.CreateForEndpoint(URLs.ProfileProtocol, URLs.ProfileServerAddressCards, URLs.ProfileServerPort, URLs.ProfileCardPath).getCrowns(new XmlRpcCardsRequest(RemoteServices.Instance.UserGuid.ToString().Replace("-", "")), new CardsEndResponseDelegate(this.UpdateCrownsCallback), this);
 }
        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;
        }