private void menu1Callback(int id)
        {
            string str;

            GameEngine.Instance.playInterfaceSound("WorldMapScreen_menu_item_selected");
            this.fixCommandSent = false;
            switch (id)
            {
            case 0x5207:
                castleCopyMode = true;
                return;

            case 0x5208:
            case 0x19c9:
            case 0x44f:
            case 0x450:
            case 0x451:
            case 0x452:
            case 0x453:
            case 0x454:
            case 0x259:
            case 0x25a:
            case 0xde:
            case 3:
            case 4:
            case 6:
            case 7:
            case 8:
            case 10:
            case 0x68:
            case 0x6a:
            case 110:
            case 0x6f:
            case 0x71:
            case 0x72:
            case 0x73:
            case 0x74:
            case 0x75:
            case 0x76:
            case 0x77:
            case 120:
                return;

            case 0x5209:
            {
                string fileName = (URLs.AccountInfoURL + "?u=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&s=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "")) + "&lang=" + Program.mySettings.LanguageIdent.ToLower();
                try
                {
                    Process.Start(fileName);
                }
                catch (Exception)
                {
                    MyMessageBox.Show(SK.Text("ERROR_Browser1", "Stronghold Kingdoms encountered an error when trying to open your system's Default Web Browser. Please check that your web browser is working correctly and there are no unresponsive copies showing in task manager->Processes and then try again.") + Environment.NewLine + Environment.NewLine + SK.Text("ERROR_Browser2", "If this problem persists, please contact support."), SK.Text("ERROR_Browser3", "Error opening Web Browser"));
                }
                return;
            }

            case 0x520a:
            {
                string str4 = (URLs.InviteAFriendURL + "?u=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&s=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "")) + "&lang=" + Program.mySettings.LanguageIdent.ToLower();
                try
                {
                    Process.Start(str4);
                }
                catch (Exception)
                {
                    MyMessageBox.Show(SK.Text("ERROR_Browser1", "Stronghold Kingdoms encountered an error when trying to open your system's Default Web Browser. Please check that your web browser is working correctly and there are no unresponsive copies showing in task manager->Processes and then try again.") + Environment.NewLine + Environment.NewLine + SK.Text("ERROR_Browser2", "If this problem persists, please contact support."), SK.Text("ERROR_Browser3", "Error opening Web Browser"));
                }
                return;
            }

            case 0x520b:
            {
                string str5 = (URLs.AccountInfoURL + "?section=codes&u=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&s=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "")) + "&lang=" + Program.mySettings.LanguageIdent.ToLower();
                try
                {
                    Process.Start(str5);
                }
                catch (Exception)
                {
                    MyMessageBox.Show(SK.Text("ERROR_Browser1", "Stronghold Kingdoms encountered an error when trying to open your system's Default Web Browser. Please check that your web browser is working correctly and there are no unresponsive copies showing in task manager->Processes and then try again.") + Environment.NewLine + Environment.NewLine + SK.Text("ERROR_Browser2", "If this problem persists, please contact support."), SK.Text("ERROR_Browser3", "Error opening Web Browser"));
                }
                return;
            }

            case 0x5211:
                CreateVacationWindow.showVacationMode();
                return;

            case 0x2a2f:
                try
                {
                    string str2 = "http://login.strongholdkingdoms.com/support/?u=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&s=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "") + "&lang=" + Program.mySettings.languageIdent;
                    new Process {
                        StartInfo = { FileName = str2 }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x23f2:
                this.nextPlaybackCountries = false;
                if (!GameEngine.Instance.World.gotPlaybackData())
                {
                    this.retrieveGameStats();
                    return;
                }
                GameEngine.Instance.World.playbackProvinces();
                return;

            case 0x23f3:
                GameEngine.Instance.World.stopPlayback();
                return;

            case 0x4b1:
                PostTutorialWindow.CreatePostTutorialWindow(false);
                return;

            case 0x8ab:
            {
                if (!GameEngine.Instance.World.MapEditing)
                {
                    GameEngine.Instance.World.MapEditing = true;
                    return;
                }
                int villageID = GameEngine.Instance.World.lastClickedVillage();
                if (GameEngine.Instance.World.isCountyCapital(villageID) && !GameEngine.Instance.World.isVillageVisible(villageID))
                {
                    RemoteServices.Instance.CompleteVillageCastle(villageID, 0x15);
                }
                GameEngine.Instance.World.MapEditing = false;
                return;
            }

            case 0x44d:
                InterfaceMgr.Instance.getMainTabBar().selectDummyTab(2);
                GameEngine.Instance.InitCastleAttackSetup();
                return;

            case 0x44e:
                GameEngine.Instance.SkipVillageTab();
                InterfaceMgr.Instance.getMainTabBar().changeTab(1);
                InterfaceMgr.Instance.getVillageTabBar().changeTab(1);
                CastleMap.CreateMode = true;
                return;

            case 0x455:
                GameEngine.Instance.playInterfaceSound("Options_resume_tutorial");
                GameEngine.Instance.World.resumeTutorial();
                return;

            case 0x456:
            case 0x457:
            case 0x458:
            case 0x459:
            case 0x45a:
            case 0x45b:
            case 0x45c:
            case 0x45d:
            case 0x45e:
            case 0x45f:
                CastleMap.FakeKeep = (id - 0x456) + 1;
                return;

            case 0x460:
            case 0x461:
            case 0x462:
            case 0x463:
                CastleMap.FakeDefensiveMode = id - 0x460;
                return;

            case 0x3e9:
                InterfaceMgr.Instance.ParentForm.Close();
                return;

            case 0xe7:
                GameEngine.Instance.World.DrawDebugNames        = !GameEngine.Instance.World.DrawDebugNames;
                GameEngine.Instance.World.DrawDebugVillageNames = false;
                return;

            case 0xe8:
                GameEngine.Instance.World.DrawDebugVillageNames = !GameEngine.Instance.World.DrawDebugVillageNames;
                GameEngine.Instance.World.DrawDebugNames        = false;
                return;

            case 300:
                InterfaceMgr.Instance.getMainTabBar().selectDummyTab(60);
                return;

            case 0xdd:
                this.createIngameMessage();
                return;

            case 0xdf:
                this.clearIngameMessage();
                return;

            case 0xd1:
            {
                MessageBoxButtons yesNo = MessageBoxButtons.YesNo;
                if (MyMessageBox.Show("This call is not entirely 'game friendly'. Only use sparingly and at quiet game times and make sure no one else is using them same function!", "Admin Warning!", yesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2, 0) == DialogResult.Yes)
                {
                    this.fixCommandSent = true;
                    RemoteServices.Instance.set_CompleteVillageCastle_UserCallBack(new RemoteServices.CompleteVillageCastle_UserCallBack(this.CompleteVillageCastleCallBack));
                    RemoteServices.Instance.CompleteVillageCastle(InterfaceMgr.Instance.getSelectedMenuVillage(), 15);
                }
                return;
            }

            case 0x97:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.TermsAndConditions }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x98:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.PrivacyPolicy }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0xc9:
                AdminInfoPopup.showAdminEdit();
                return;

            case 0xca:
                this.nextPlaybackCountries = true;
                if (!GameEngine.Instance.World.gotPlaybackData())
                {
                    this.retrieveGameStats();
                    return;
                }
                GameEngine.Instance.World.playbackCountries();
                return;

            case 0xcb:
                this.retrieveGameInfo();
                return;

            case 1:
                GameEngine.Instance.playInterfaceSound("Options_open");
                OptionsPopup.openSettings();
                return;

            case 2:
                InterfaceMgr.Instance.openLogoutWindow(true);
                return;

            case 5:
                InterfaceMgr.Instance.getMainTabBar().selectDummyTab(10);
                return;

            case 9:
            {
                if (!RemoteServices.Instance.Admin || !GameEngine.Instance.World.DrawDebugVillageNames)
                {
                    int ownSelectedVillage = InterfaceMgr.Instance.OwnSelectedVillage;
                    if (((ownSelectedVillage >= 0) && !GameEngine.Instance.World.isCapital(ownSelectedVillage)) && GameEngine.Instance.World.isUserVillage(ownSelectedVillage))
                    {
                        RenameVillagePopup popup2 = new RenameVillagePopup();
                        popup2.setVillageID(ownSelectedVillage, GameEngine.Instance.World.getVillageNameOnly(ownSelectedVillage));
                        popup2.Show(InterfaceMgr.Instance.ParentForm);
                        return;
                    }
                    MyMessageBox.Show(SK.Text("MENU_Cannot_Rename", "You cannot rename this village."), SK.Text("MENU_Rename_Error", "Rename Error"));
                    return;
                }
                int selectedVillage      = InterfaceMgr.Instance.SelectedVillage;
                RenameVillagePopup popup = new RenameVillagePopup();
                popup.setVillageID(selectedVillage, GameEngine.Instance.World.getVillageNameOnly(selectedVillage));
                popup.Show(InterfaceMgr.Instance.ParentForm);
                return;
            }

            case 11:
            {
                int num3 = InterfaceMgr.Instance.OwnSelectedVillage;
                if (((num3 < 0) || GameEngine.Instance.World.isCapital(num3)) || !GameEngine.Instance.World.isUserVillage(num3))
                {
                    MyMessageBox.Show(SK.Text("MENU_Cannot_Abandon", "You cannot abandon this village."), SK.Text("GENERIC_Error", "Error"));
                    return;
                }
                GameEngine.Instance.villageToAbandon = num3;
                return;
            }

            case 12:
            {
                int num4 = InterfaceMgr.Instance.OwnSelectedVillage;
                if (((num4 < 0) || GameEngine.Instance.World.isCapital(num4)) || !GameEngine.Instance.World.isUserVillage(num4))
                {
                    return;
                }
                InterfaceMgr.Instance.changeTab(1);
                VillageMap map = GameEngine.Instance.getVillage(num4);
                if ((map == null) || (map.m_nextMapTypeChange <= VillageMap.getCurrentServerTime()))
                {
                    InterfaceMgr.Instance.openBuyVillageWindow(num4, false);
                    return;
                }
                TimeSpan span = (TimeSpan)(map.m_nextMapTypeChange - VillageMap.getCurrentServerTime());
                str = "";
                if (span.Days <= 0)
                {
                    str = string.Format("{0:D1} " + SK.Text("MENU_hours_short", "hrs") + ", {1:D2} " + SK.Text("MENU_minutes_short", "mins"), span.Hours, span.Minutes);
                    break;
                }
                str = string.Format("{0:D2} " + SK.Text("MENU_days", "days") + ", {1:D2} " + SK.Text("MENU_hours_short", "hrs") + ", {2:D2} " + SK.Text("MENU_minutes_short", "mins"), span.Days, span.Hours, span.Minutes);
                break;
            }

            case 0x65:
                new Process {
                    StartInfo = { FileName = "readme.txt" }
                }.Start();
                return;

            case 0x66:
            {
                AboutPopup popup3 = new AboutPopup();
                popup3.init();
                popup3.Show();
                return;
            }

            case 0x67:
                AdminInfoPopup.showMessage();
                return;

            case 0x69:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.FireflyHomepage }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x6b:
                try
                {
                    new Process {
                        StartInfo = { FileName = "http://login.strongholdkingdoms.com/forum/?u=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&s=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "") + "&lang=" + Program.mySettings.languageIdent }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x6c:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.WikiPage }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x6d:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.IPSharingPage }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x70:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.TechnicalFAQPage }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            case 0x79:
                try
                {
                    new Process {
                        StartInfo = { FileName = URLs.WikiPage }
                    }.Start();
                }
                catch (Exception)
                {
                }
                return;

            default:
                return;
            }
            MyMessageBox.Show(SK.Text("MENU_Cannot_Change_Type", "You cannot change this Village's Type for") + " : " + str, SK.Text("MENU_Change_Type_Error", "Change Village Type Error"));
        }
Example #2
0
 public void fireURLError()
 {
     MyMessageBox.Show("Stronghold Kingdoms encountered an error when trying to " + Environment.NewLine + "open your system's Default Web Browser. Please check that " + Environment.NewLine + "your web browser is working correctly and there are no unresponsive " + Environment.NewLine + "copies showing in task manager->Processes and then try again." + Environment.NewLine + "If this problem persists, please contact support.", "Error opening Web Browser");
 }
 private void viewCastleCallback(ViewCastle_ReturnType returnData)
 {
     if (returnData.Success && ((returnData.castleMapSnapshot != null) || (returnData.castleTroopsSnapshot != null)))
     {
         base.m_parent.closeControl(true);
         InterfaceMgr.Instance.getMainTabBar().selectDummyTab(6);
         InterfaceMgr.Instance.reactiveMainWindow();
         int villageID = -1;
         int campMode  = 0;
         if (base.m_returnData != null)
         {
             if (base.m_returnData.reportType == 0x1a)
             {
                 campMode  = 1;
                 villageID = -2;
             }
             else if (base.m_returnData.reportType == 0x1b)
             {
                 campMode  = 2;
                 villageID = -3;
             }
             else if ((base.m_returnData.reportType == 0x15) && (base.m_returnData.otherUser.Length == 0))
             {
                 villageID = -4;
             }
             else if (base.m_returnData.reportType == 0x36)
             {
                 campMode  = 0;
                 villageID = -5;
             }
             else if (base.m_returnData.reportType == 0x37)
             {
                 campMode  = 0;
                 villageID = -6;
             }
             else if (base.m_returnData.reportType == 0x38)
             {
                 campMode  = 0;
                 villageID = -7;
             }
             else if (base.m_returnData.reportType == 0x39)
             {
                 campMode  = 0;
                 villageID = -8;
             }
             else if (base.m_returnData.reportType == 0x79)
             {
                 campMode  = 0;
                 villageID = -9;
             }
             else if (base.m_returnData.reportType == 0x7a)
             {
                 campMode  = 0;
                 villageID = -10;
             }
             else if (base.m_returnData.reportType == 0x7e)
             {
                 campMode  = 0;
                 villageID = -11;
             }
             else
             {
                 villageID = returnData.villageID;
             }
         }
         GameEngine.Instance.InitCastleView(returnData.castleMapSnapshot, returnData.castleTroopsSnapshot, returnData.keepLevel, campMode, returnData.defencesLevel, villageID, returnData.landType);
         InterfaceMgr.Instance.castleBattleTimes(returnData.lastCastleTime, returnData.lastTroopTime);
     }
     else
     {
         MyMessageBox.Show(SK.Text("ReportsPanel_No_Longer_Valid", "The target for this scout report is no longer valid."), SK.Text("ReportsPanel_Scout_Report", "Scout Report"));
     }
 }
Example #4
0
        private void iconClicked()
        {
            if (base.ClickedControl != null)
            {
                switch (base.ClickedControl.Data)
                {
                case 0:
                    InterfaceMgr.Instance.getMainTabBar().changeTab(3);
                    PostTutorialWindow.close();
                    return;

                case 1:
                    InterfaceMgr.Instance.getMainTabBar().changeTab(4);
                    PostTutorialWindow.close();
                    return;

                case 2:
                    InterfaceMgr.Instance.getMainTabBar().changeTab(4);
                    PostTutorialWindow.close();
                    return;

                case 3:
                    InterfaceMgr.Instance.getMainTabBar().changeTab(5);
                    PostTutorialWindow.close();
                    return;

                case 4:
                    InterfaceMgr.Instance.getMainTabBar().changeTab(7);
                    PostTutorialWindow.close();
                    return;

                case 5:
                    Process.Start(URLs.shieldDesignerURL + "?UserGUID=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&SessionGUID=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "") + "&lang=" + Program.mySettings.LanguageIdent.ToLower());
                    return;

                case 6:
                    InterfaceMgr.Instance.getMainTabBar().selectDummyTab(10);
                    PostTutorialWindow.close();
                    return;

                case 7:
                {
                    string fileName = (URLs.InviteAFriendURL + "?u=" + RemoteServices.Instance.UserGuid.ToString().Replace("-", "") + "&s=" + RemoteServices.Instance.SessionGuid.ToString().Replace("-", "")) + "&lang=" + Program.mySettings.LanguageIdent.ToLower();
                    try
                    {
                        Process.Start(fileName);
                    }
                    catch (Exception)
                    {
                        MyMessageBox.Show(SK.Text("ERROR_Browser1", "Stronghold Kingdoms encountered an error when trying to open your system's Default Web Browser. Please check that your web browser is working correctly and there are no unresponsive copies showing in task manager->Processes and then try again.") + Environment.NewLine + Environment.NewLine + SK.Text("ERROR_Browser2", "If this problem persists, please contact support."), SK.Text("ERROR_Browser3", "Error opening Web Browser"));
                    }
                    return;
                }

                case 8:
                    InterfaceMgr.Instance.getMainTabBar().changeTab(2);
                    PostTutorialWindow.close();
                    return;

                case 9:
                    if (!InterfaceMgr.Instance.isMailDocked())
                    {
                        if (InterfaceMgr.Instance.mailScreenNeedsOpening())
                        {
                            InterfaceMgr.Instance.initMailSubTab(0);
                        }
                        else
                        {
                            InterfaceMgr.Instance.mailScreenRePop();
                        }
                        break;
                    }
                    InterfaceMgr.Instance.getMainTabBar().selectDummyTab(0x15);
                    break;

                default:
                    return;
                }
                PostTutorialWindow.close();
            }
        }
Example #5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     this.saveName = this.txtSaveName.Text;
     if ((this.saveName != "") && (!this.lstStored.Items.Contains(this.saveName) || (MyMessageBox.Show(SK.Text("Formations_Overwrite", "That name is already in use. Do you want to replace the existing formation?"), SK.Text("Formations_Overwrite_Title", "Name Already in Use"), MessageBoxButtons.YesNo) != DialogResult.No)))
     {
         this.saveFormation();
         if (!this.lstStored.Items.Contains(this.saveName))
         {
             this.lstStored.Items.Add(this.saveName);
         }
         this.saveNames();
     }
 }
        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;
        }
Example #7
0
 public void confirmAvailableSpace()
 {
     if (!this.m_awaitingResponse)
     {
         if (!this.m_AppleChecked && (this.m_questDef.reward_apples > 0))
         {
             this.m_buildingType = 0x12;
             this.checkResource();
         }
         else if (!this.m_WoodChecked && (this.m_questDef.reward_wood > 0))
         {
             this.m_buildingType = 6;
             this.checkResource();
         }
         else if (!this.m_StoneChecked && (this.m_questDef.reward_stone > 0))
         {
             this.m_buildingType = 7;
             this.checkResource();
         }
         else if (((this.m_AppleAvailable && this.m_WoodAvailable) && this.m_StoneAvailable) || (MyMessageBox.Show(SK.Text("Quest_Reward_Insufficient_Space", "You do not have enough room to store all of the reward at this village. Are you sure you want to send the reward to this village?"), SK.Text("Quest_Reward_Insufficient_Space_header", "Insufficient Space"), MessageBoxButtons.YesNo) != DialogResult.No))
         {
             this.CompleteQuest();
         }
     }
 }
Example #8
0
 public void sendScoutsCallback(SendScouts_ReturnType returnData)
 {
     CursorManager.SetCursor(CursorManager.CursorType.Default, base.ParentForm);
     this.inLaunch = false;
     if (!returnData.Success && (returnData.m_errorCode == ErrorCodes.ErrorCode.ATTACKING_VILLAGE_INTERDICT_PROTECTED))
     {
         MessageBoxButtons yesNo = MessageBoxButtons.YesNo;
         if (MyMessageBox.Show(SK.Text("GameEngine_Currently_Interdited", "You are currently Interdiction protected") + "\n" + SK.Text("GameEngine_CancelProtection", "Do you wish to cancel this protection?"), SK.Text("GENERIC_Protected", "You Are Protected"), yesNo) == DialogResult.Yes)
         {
             RemoteServices.Instance.set_CancelInterdiction_UserCallBack(new RemoteServices.CancelInterdiction_UserCallBack(this.cancelInterdictionCallback));
             RemoteServices.Instance.CancelInterdiction(-returnData.sourceVillage);
         }
         else
         {
             if (returnData.numScoutsNotTaken > 0)
             {
                 VillageMap map = GameEngine.Instance.getVillage(returnData.sourceVillage);
                 if (map != null)
                 {
                     map.addTroops(0, 0, 0, 0, 0, returnData.numScoutsNotTaken);
                 }
             }
             InterfaceMgr.Instance.closeScoutPopupWindow();
             InterfaceMgr.Instance.getMainTabBar().changeTab(9);
             InterfaceMgr.Instance.getMainTabBar().changeTab(0);
         }
     }
     else
     {
         this.closeButton.Enabled = true;
         if (returnData.Success)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             InterfaceMgr.Instance.displaySelectedVillagePanel(this.m_ownVillage, false, false, false, false);
             InterfaceMgr.Instance.closeScoutPopupWindow();
             if (returnData.cardData != null)
             {
                 GameEngine.Instance.World.UserCardData = returnData.cardData;
             }
             AttackTargetsPanel.addRecent(returnData.targetVillage);
         }
         if (returnData.numScoutsNotTaken > 0)
         {
             VillageMap map2 = GameEngine.Instance.getVillage(returnData.sourceVillage);
             if (map2 != null)
             {
                 map2.addTroops(0, 0, 0, 0, 0, returnData.numScoutsNotTaken);
             }
             if (!returnData.Success)
             {
                 this.launchButton.Enabled = false;
             }
         }
         if (returnData.Success)
         {
             InterfaceMgr.Instance.displaySelectedVillagePanel(this.m_selectedVillage, false, true, false, false);
             InterfaceMgr.Instance.closeScoutPopupWindow();
         }
     }
 }
 public static DialogResult Show(string txtMessage)
 {
     newMessageBox = new MyMessageBox();
     buttons = MessageBoxButtons.OK;
     defaultButton = MessageBoxDefaultButton.Button1;
     newMessageBox.lblMessage.Text = txtMessage;
     Graphics graphics = newMessageBox.lblMessage.CreateGraphics();
     Size size = graphics.MeasureString(txtMessage, newMessageBox.lblMessage.Font, 0x14f).ToSize();
     graphics.Dispose();
     int height = size.Height;
     if (height < 50)
     {
         height = 50;
     }
     newMessageBox.lblMessage.Size = new Size(0x14f, height);
     newMessageBox.panel1.Size = newMessageBox.lblMessage.Size;
     newMessageBox.Size = new Size(newMessageBox.Size.Width, (height + 0x8e) - 0x3a);
     bool flag = false;
     Form activeForm = Form.ActiveForm;
     if (forcedForm != null)
     {
         activeForm = forcedForm;
         flag = true;
         newMessageBox.StartPosition = FormStartPosition.CenterParent;
     }
     else if (((activeForm != null) && (activeForm.ProductName == newMessageBox.ProductName)) && (activeForm.WindowState == FormWindowState.Normal))
     {
         flag = true;
     }
     if (flag)
     {
         newMessageBox.ShowDialog(activeForm);
     }
     else
     {
         newMessageBox.ShowDialog();
     }
     newMessageBox.Dispose();
     forcedForm = null;
     if ((activeForm != null) && flag)
     {
         bool topMost = activeForm.TopMost;
         activeForm.TopMost = false;
         activeForm.TopMost = true;
         activeForm.Focus();
         activeForm.BringToFront();
         activeForm.Focus();
         activeForm.TopMost = topMost;
     }
     return result;
 }
 public static DialogResult Show(string txtMessage, string txtTitle, MessageBoxButtons buts, MessageBoxIcon x1, MessageBoxDefaultButton defaultBut, int x2)
 {
     newMessageBox = new MyMessageBox();
     buttons = buts;
     defaultButton = defaultBut;
     newMessageBox.lblTitle.Text = txtTitle;
     newMessageBox.lblMessage.Text = txtMessage;
     Graphics graphics = newMessageBox.lblMessage.CreateGraphics();
     Size size = graphics.MeasureString(txtMessage, newMessageBox.lblMessage.Font, 0x14f).ToSize();
     graphics.Dispose();
     int height = size.Height;
     if (height < 50)
     {
         height = 50;
     }
     newMessageBox.lblMessage.Size = new Size(0x14f, height + 20);
     newMessageBox.panel1.Size = newMessageBox.lblMessage.Size;
     newMessageBox.Size = new Size(newMessageBox.Size.Width, (height + 0x8e) - 0x3a);
     bool flag = false;
     Form activeForm = Form.ActiveForm;
     if (((activeForm != null) && (activeForm.ProductName == newMessageBox.ProductName)) && (activeForm.WindowState == FormWindowState.Normal))
     {
         flag = true;
     }
     if (flag)
     {
         newMessageBox.ShowDialog(activeForm);
     }
     else
     {
         newMessageBox.ShowDialog();
     }
     newMessageBox.Dispose();
     if ((activeForm != null) && flag)
     {
         bool topMost = activeForm.TopMost;
         activeForm.TopMost = false;
         activeForm.TopMost = true;
         activeForm.Focus();
         activeForm.BringToFront();
         activeForm.Focus();
         activeForm.TopMost = topMost;
     }
     return result;
 }