Пример #1
0
        public void update()
        {
            this.backGround.update();
            bool     visible = this.lblProtectionType.Visible;
            int      num     = 0;
            TimeSpan span    = new TimeSpan();

            if (GameEngine.Instance.World.isVillageInterdictProtected(this.m_selectedVillage))
            {
                DateTime time  = GameEngine.Instance.World.getInterdictTime(this.m_selectedVillage);
                DateTime time2 = VillageMap.getCurrentServerTime();
                span = (TimeSpan)(time - time2);
                num  = 1;
            }
            if (num == 1)
            {
                int    totalSeconds = (int)span.TotalSeconds;
                string str          = VillageMap.createBuildTimeStringFull(totalSeconds);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Interdict", "Interdict");
                this.lblProtectionType.Visible      = true;
            }
            else
            {
                this.lblProtected.TextDiffOnly      = "";
                this.lblProtectionType.TextDiffOnly = "";
                this.lblProtectionType.Visible      = false;
            }
            if (visible != this.lblProtectionType.Visible)
            {
                this.updateSize();
            }
        }
            public bool update(double localTime)
            {
                if (this.btnCancel.Visible)
                {
                    if (this.m_army.localEndTime == 0.0)
                    {
                        return(false);
                    }
                    if ((this.m_army.localStartTime + (GameEngine.Instance.LocalWorldData.AttackCancelDuration * 60)) < localTime)
                    {
                        return(false);
                    }
                }
                else
                {
                    WorldMap.LocalArmyData data = GameEngine.Instance.World.getArmy(this.m_armyID);
                    if ((data == null) || (data.lootType != this.m_origLoot))
                    {
                        return(false);
                    }
                }
                DateTime time     = VillageMap.getCurrentServerTime();
                TimeSpan span     = (TimeSpan)(this.m_arrivalTime - time);
                int      secsLeft = (int)(span.TotalSeconds + 0.5);

                if (secsLeft < 1)
                {
                    secsLeft = 0;
                }
                this.lblArrivalTime.Text = VillageMap.createBuildTimeString(secsLeft);
                return(true);
            }
Пример #3
0
 public static bool isAccountPremium(WorldMap map)
 {
     if (premium)
     {
         return(true);
     }
     return(CardTypes.isPremiumToken(map.UserCardData.premiumCard) && (VillageMap.getCurrentServerTime() < map.UserCardData.premiumCardExpiry));
 }
 private bool isTallTreasureChestPanel(int villageID)
 {
     if ((GameEngine.Instance.World.isSpecial(villageID) && GameEngine.Instance.World.isAttackableSpecial(villageID)) && SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(villageID)))
     {
         TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - GameEngine.Instance.World.getLastTreasureCastleAttackTime());
         int      num2 = WorldMap.TreasureCastle_AttackGap;
         if (span.TotalSeconds < num2)
         {
             return(true);
         }
     }
     return(false);
 }
 public void update()
 {
     if (this.proclamationLabel.Visible)
     {
         TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - this.lastProclamationTime);
         if (span.TotalDays >= 7.0)
         {
             this.proclamationLabel.Visible  = false;
             this.proclamationButton.Enabled = true;
         }
         else
         {
             this.proclamationLabel.Text = SK.Text("Proclamations_time_to_go", "Time before next Proclamation : ") + VillageMap.createBuildTimeString(0x93a80 - ((int)span.TotalSeconds));
         }
     }
 }
 private void updateTreasureCastleTimeout()
 {
     if (GameEngine.Instance.World.isSpecial(this.m_selectedVillage) && GameEngine.Instance.World.isAttackableSpecial(this.m_selectedVillage))
     {
         TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - GameEngine.Instance.World.getLastTreasureCastleAttackTime());
         int      num  = WorldMap.TreasureCastle_AttackGap;
         if (span.TotalSeconds < num)
         {
             this.treasureCastleTimeoutLabel.TextDiffOnly = SK.Text("EmptyVillage_NextAttackAvailable", "Next Attack Available in") + " " + VillageMap.createBuildTimeString(num - ((int)span.TotalSeconds));
         }
         else
         {
             this.treasureCastleTimeoutLabel.TextDiffOnly = "";
             if (this.treasureCastleTimeoutLabel.Visible && !GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage))
             {
                 this.attackButton.Enabled = true;
             }
         }
     }
 }
Пример #7
0
        public void updateResearchTime(ResearchData data)
        {
            int width = -1;

            if ((data != null) && (data.researchingType >= 0))
            {
                DateTime time         = VillageMap.getCurrentServerTime();
                TimeSpan span         = (TimeSpan)(data.research_completionTime - time);
                int      totalSeconds = (int)span.TotalSeconds;
                TimeSpan span2        = data.calcResearchTime(data.research_pointCount - 1, GameEngine.Instance.World.UserCardData, GameEngine.Instance.LocalWorldData);
                if (GameEngine.Instance.LocalWorldData.Alternate_Ruleset == 1)
                {
                    span2 = new TimeSpan(span2.Ticks / 2L);
                }
                int num3 = (int)span2.TotalSeconds;
                if ((num3 == 30) && (GameEngine.Instance.World.getTutorialStage() == 5))
                {
                    num3 = 11;
                }
                this.images[6] = GFXLibrary.tab_3b_normal;
                this.images[7] = GFXLibrary.tab_3b_selected;
                this.tabControl1.addOverlayImages(3, GFXLibrary.tab_3c_normal, GFXLibrary.tab_3c_selected, 0xff);
                width = 3 + ((0x2c * (num3 - totalSeconds)) / num3);
                this.tabControl1.setOverlayWidth(3, width);
                this.refresh = true;
            }
            else
            {
                this.images[6] = GFXLibrary.tab_3_normal;
                this.images[7] = GFXLibrary.tab_3_selected;
                this.tabControl1.addOverlayImages(3, null, null, 0xff);
            }
            this.tabControl1.updateImageArray(this.images);
            if (width != this.lastWidth)
            {
                this.refresh = true;
            }
            this.lastWidth = width;
        }
Пример #8
0
        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"));
        }
        public void update()
        {
            this.backGround.update();
            int[]      numArray  = new int[3];
            TimeSpan[] spanArray = new TimeSpan[3];
            int        numInfos  = this.numInfos;

            this.numInfos = 0;
            int tooltipData = GameEngine.Instance.World.getParishPlagueLevel(this.m_selectedVillage);

            if (tooltipData != this.lastPlague)
            {
                if (tooltipData <= 0)
                {
                    this.backGround.updatePanelType(0x5dc);
                    this.lblPlagueValue.TextDiffOnly = "";
                }
                else if (this.lastPlague <= 0)
                {
                    this.backGround.updatePanelType(0x5e0);
                    this.lblPlagueValue.TextDiffOnly = tooltipData.ToString();
                }
                this.backGround.setTooltipData(tooltipData);
                this.lastPlague = tooltipData;
            }
            bool     visible = this.lblProtectionType.Visible;
            int      num3    = 0;
            TimeSpan span    = new TimeSpan();

            if (GameEngine.Instance.World.isVillageInterdictProtected(this.m_selectedVillage))
            {
                DateTime time  = GameEngine.Instance.World.getInterdictTime(this.m_selectedVillage);
                DateTime time2 = VillageMap.getCurrentServerTime();
                span = (TimeSpan)(time - time2);
                num3 = 1;
                spanArray[this.numInfos] = span;
                numArray[this.numInfos]  = num3;
                this.numInfos++;
            }
            if (GameEngine.Instance.World.isVillagePeaceTimeProtected(this.m_selectedVillage))
            {
                DateTime time3 = GameEngine.Instance.World.getPeaceTime(this.m_selectedVillage);
                DateTime time4 = VillageMap.getCurrentServerTime();
                TimeSpan span2 = (TimeSpan)(time3 - time4);
                if (span2 > span)
                {
                    span = span2;
                    num3 = 2;
                    spanArray[this.numInfos] = span;
                    numArray[this.numInfos]  = num3;
                    this.numInfos++;
                }
            }
            if (this.numInfos > 0)
            {
                if (this.selectedProtection < this.numInfos)
                {
                    num3 = numArray[(this.numInfos - 1) - this.selectedProtection];
                    span = spanArray[(this.numInfos - 1) - this.selectedProtection];
                }
                else
                {
                    this.selectedProtection = 0;
                }
            }
            switch (num3)
            {
            case 1:
            {
                int    totalSeconds = (int)span.TotalSeconds;
                string str          = VillageMap.createBuildTimeStringFull(totalSeconds);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Interdict", "Interdict");
                this.lblProtectionType.Visible      = true;
                break;
            }

            case 2:
            {
                int    secsLeft = (int)span.TotalSeconds;
                string str2     = VillageMap.createBuildTimeStringFull(secsLeft);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str2;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Peace", "Peace");
                this.lblProtectionType.Visible      = true;
                break;
            }

            default:
                this.lblProtected.TextDiffOnly      = "";
                this.lblProtectionType.TextDiffOnly = "";
                this.lblProtectionType.Visible      = false;
                break;
            }
            if (visible != this.lblProtectionType.Visible)
            {
                this.updateSize();
                if (!visible)
                {
                    this.selectedProtection = 0;
                }
            }
            if (numInfos != this.numInfos)
            {
                if (this.numInfos >= 2)
                {
                    this.leftButton.Visible  = true;
                    this.rightButton.Visible = true;
                }
                else
                {
                    this.leftButton.Visible  = false;
                    this.rightButton.Visible = false;
                }
            }
        }
Пример #10
0
        public void update()
        {
            this.backGround.update();
            int[]      numArray  = new int[3];
            TimeSpan[] spanArray = new TimeSpan[3];
            int        numInfos  = this.numInfos;

            this.numInfos = 0;
            bool     visible = this.lblProtected.Visible;
            int      num2    = 0;
            TimeSpan span    = new TimeSpan();

            if (GameEngine.Instance.World.isVillageExcommunicated(this.m_selectedVillage))
            {
                DateTime time  = GameEngine.Instance.World.getExcommunicationTime(this.m_selectedVillage);
                DateTime time2 = VillageMap.getCurrentServerTime();
                span = (TimeSpan)(time - time2);
                num2 = 3;
                spanArray[this.numInfos] = span;
                numArray[this.numInfos]  = num2;
                this.numInfos++;
            }
            if (GameEngine.Instance.World.isVillageInterdictProtected(this.m_selectedVillage))
            {
                DateTime time3 = GameEngine.Instance.World.getInterdictTime(this.m_selectedVillage);
                DateTime time4 = VillageMap.getCurrentServerTime();
                span = (TimeSpan)(time3 - time4);
                num2 = 1;
                spanArray[this.numInfos] = span;
                numArray[this.numInfos]  = num2;
                this.numInfos++;
            }
            if (GameEngine.Instance.World.isVillagePeaceTimeProtected(this.m_selectedVillage))
            {
                DateTime time5 = GameEngine.Instance.World.getPeaceTime(this.m_selectedVillage);
                DateTime time6 = VillageMap.getCurrentServerTime();
                TimeSpan span2 = (TimeSpan)(time5 - time6);
                if (span2 > span)
                {
                    span = span2;
                    num2 = 2;
                }
                spanArray[this.numInfos] = span2;
                numArray[this.numInfos]  = 2;
                this.numInfos++;
            }
            if (GameEngine.Instance.World.isVillageVacationProtected(this.m_selectedVillage))
            {
                num2 = 4;
                numArray[this.numInfos] = 4;
                this.numInfos++;
            }
            if (this.numInfos > 0)
            {
                if (this.selectedProtection < this.numInfos)
                {
                    num2 = numArray[(this.numInfos - 1) - this.selectedProtection];
                    span = spanArray[(this.numInfos - 1) - this.selectedProtection];
                }
                else
                {
                    this.selectedProtection = 0;
                }
            }
            switch (num2)
            {
            case 1:
            {
                int    totalSeconds = (int)span.TotalSeconds;
                string str          = VillageMap.createBuildTimeStringFull(totalSeconds);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Interdict", "Interdict");
                this.lblProtectionType.Visible      = true;
                this.lblProtected.Visible           = true;
                break;
            }

            case 2:
            {
                int    secsLeft = (int)span.TotalSeconds;
                string str2     = VillageMap.createBuildTimeStringFull(secsLeft);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str2;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Peace", "Peace");
                this.lblProtectionType.Visible      = true;
                this.lblProtected.Visible           = true;
                break;
            }

            case 3:
            {
                int    num5 = (int)span.TotalSeconds;
                string str3 = VillageMap.createBuildTimeStringFull(num5);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Excom_For_X_Time", "No Monks for") + " : " + str3;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Excom", "Excommunicated");
                this.lblProtectionType.Visible      = true;
                this.lblProtected.Visible           = true;
                break;
            }

            case 4:
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked", "Cannot be attacked");
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Vacation", "Vacation Mode");
                this.lblProtectionType.Visible      = true;
                this.lblProtected.Visible           = true;
                break;

            default:
                this.lblProtectionType.Visible = false;
                this.lblProtected.Visible      = false;
                break;
            }
            if (visible != this.lblProtected.Visible)
            {
                this.updateSize();
                if (!visible)
                {
                    this.selectedProtection = 0;
                }
            }
            if (numInfos != this.numInfos)
            {
                if (this.numInfos >= 2)
                {
                    this.leftButton.Visible  = true;
                    this.rightButton.Visible = true;
                }
                else
                {
                    this.leftButton.Visible  = false;
                    this.rightButton.Visible = false;
                }
            }
        }
        public void addPlayers()
        {
            this.wallScrollArea.clearControls();
            int y = 0;

            this.lineList.Clear();
            int yourVotes = 0;

            if (this.parishMembers != null)
            {
                foreach (ParishMember member in this.parishMembers)
                {
                    if (member.userID == RemoteServices.Instance.UserID)
                    {
                        yourVotes = member.numSpareVotes;
                        break;
                    }
                }
                if ((GameEngine.Instance.World.getRank() + 1) < GameEngine.Instance.LocalWorldData.MinParishVoteRank)
                {
                    int minParishVoteRank = GameEngine.Instance.LocalWorldData.MinParishVoteRank;
                    yourVotes = 0;
                    this.votesAvailableLabel.Text         = SK.Text("ParishPanel_Rank_Required", "Rank Required") + " : " + Rankings.getRankingName(minParishVoteRank - 1) + " ( " + minParishVoteRank.ToString() + " )";
                    this.votesAvailableLabel.Size         = new Size(400, 40);
                    this.votesAvailableLabel.Font         = FontManager.GetFont("Arial", 12f, FontStyle.Regular);
                    this.voteCapLabelValue.Visible        = false;
                    this.voteCapLabel.Visible             = false;
                    this.votesAvailableLabelValue.Visible = false;
                }
                else
                {
                    this.votesAvailableLabelValue.Text = yourVotes.ToString();
                }
                this.parishMembers.Sort(this.parishMemberComparer);
                int position = 0;
                foreach (ParishMember member2 in this.parishMembers)
                {
                    VoteLine control = new VoteLine();
                    if (y != 0)
                    {
                        y += 5;
                    }
                    control.Position = new Point(0, y);
                    if (member2.numVotesReceived > this.voteCap)
                    {
                        int voteCap = this.voteCap;
                    }
                    control.init(member2.userName, member2.userID, member2.rank, member2.points, this.votingAllowed, member2.numSpareVotes, member2.numVotesReceived, member2.factionID, yourVotes, position, this);
                    this.wallScrollArea.addControl(control);
                    y += control.Height;
                    this.lineList.Add(control);
                    position++;
                }
            }
            this.wallScrollArea.Size = new Size(this.wallScrollArea.Width, y);
            if (y < this.wallScrollBar.Height)
            {
                this.wallScrollBar.Visible = false;
            }
            else
            {
                this.wallScrollBar.Visible         = true;
                this.wallScrollBar.NumVisibleLines = this.wallScrollBar.Height;
                this.wallScrollBar.Max             = y - this.wallScrollBar.Height;
            }
            this.wallScrollArea.invalidate();
            this.wallScrollBar.invalidate();
            this.stewardLabel.Text = SK.Text("ParishWallPanel_Steward", "Steward") + " : " + this.currentLeaderName;
            this.m_userIDOnCurrent = this.currentLeaderID;
            TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - this.lastProclamationTime);

            if (this.currentLeaderID == RemoteServices.Instance.UserID)
            {
                this.proclamationButton.Visible = true;
                if (span.TotalDays >= 7.0)
                {
                    this.proclamationButton.Enabled = true;
                    this.proclamationLabel.Visible  = false;
                }
                else
                {
                    this.proclamationButton.Enabled = false;
                    this.proclamationLabel.Visible  = true;
                }
            }
            else
            {
                this.proclamationButton.Visible = false;
                this.proclamationLabel.Visible  = false;
            }
            this.update();
        }
        public void addPlayers()
        {
            this.wallScrollArea.clearControls();
            int y = 0;

            this.lineList.Clear();
            int yourVotes = 0;

            if (this.provinceMembers != null)
            {
                foreach (ParishMember member in this.provinceMembers)
                {
                    if (member.userID == RemoteServices.Instance.UserID)
                    {
                        yourVotes = member.numSpareVotes;
                        break;
                    }
                }
                this.provinceMembers.Sort(this.parishMemberComparer);
                int position = 0;
                foreach (ParishMember member2 in this.provinceMembers)
                {
                    VoteLine control = new VoteLine();
                    if (y != 0)
                    {
                        y += 5;
                    }
                    control.Position = new Point(0, y);
                    int numVotesReceived = member2.numVotesReceived;
                    if (numVotesReceived > this.voteCap)
                    {
                        numVotesReceived = this.voteCap;
                    }
                    control.init(member2.userName, member2.userID, member2.rank, member2.points, this.votingAllowed, member2.numSpareVotes, numVotesReceived, member2.areaID, member2.factionID, yourVotes, position, this);
                    this.wallScrollArea.addControl(control);
                    y += control.Height;
                    this.lineList.Add(control);
                    position++;
                }
            }
            this.wallScrollArea.Size = new Size(this.wallScrollArea.Width, y);
            if (y < this.wallScrollBar.Height)
            {
                this.wallScrollBar.Visible = false;
            }
            else
            {
                this.wallScrollBar.Visible         = true;
                this.wallScrollBar.NumVisibleLines = this.wallScrollBar.Height;
                this.wallScrollBar.Max             = y - this.wallScrollBar.Height;
            }
            this.wallScrollArea.invalidate();
            this.wallScrollBar.invalidate();
            this.stewardLabel.Text = SK.Text("ParishWallPanel_Governor", "Governor") + " : " + this.currentLeaderName;
            this.m_userIDOnCurrent = this.currentLeaderID;
            TimeSpan span = (TimeSpan)(VillageMap.getCurrentServerTime() - this.lastProclamationTime);

            if (this.currentLeaderID == RemoteServices.Instance.UserID)
            {
                this.proclamationButton.Visible = true;
                if (span.TotalDays >= 3.0)
                {
                    this.proclamationButton.Enabled = true;
                    this.proclamationLabel.Visible  = false;
                }
                else
                {
                    this.proclamationButton.Enabled = false;
                    this.proclamationLabel.Visible  = true;
                }
            }
            else
            {
                this.proclamationButton.Visible = false;
                this.proclamationLabel.Visible  = false;
            }
            this.update();
        }
        public void update()
        {
            this.backGround.update();
            int[]      numArray  = new int[3];
            TimeSpan[] spanArray = new TimeSpan[3];
            int        numInfos  = this.numInfos;

            this.numInfos = 0;
            bool     visible = this.lblProtectionType.Visible;
            int      num2    = 0;
            TimeSpan span    = new TimeSpan();

            if (GameEngine.Instance.World.isVillageInterdictProtected(this.m_selectedVillage))
            {
                DateTime time  = GameEngine.Instance.World.getInterdictTime(this.m_selectedVillage);
                DateTime time2 = VillageMap.getCurrentServerTime();
                span = (TimeSpan)(time - time2);
                num2 = 1;
                spanArray[this.numInfos] = span;
                numArray[this.numInfos]  = num2;
                this.numInfos++;
            }
            if (GameEngine.Instance.World.isVillagePeaceTimeProtected(this.m_selectedVillage))
            {
                DateTime time3 = GameEngine.Instance.World.getPeaceTime(this.m_selectedVillage);
                DateTime time4 = VillageMap.getCurrentServerTime();
                TimeSpan span2 = (TimeSpan)(time3 - time4);
                if (span2 > span)
                {
                    span = span2;
                    num2 = 2;
                }
                spanArray[this.numInfos] = span2;
                numArray[this.numInfos]  = 2;
                this.numInfos++;
            }
            if (GameEngine.Instance.World.isVillageVacationProtected(this.m_selectedVillage))
            {
                num2 = 3;
                numArray[this.numInfos] = 3;
                this.numInfos++;
            }
            if (this.numInfos > 0)
            {
                if (this.selectedProtection < this.numInfos)
                {
                    num2 = numArray[(this.numInfos - 1) - this.selectedProtection];
                    span = spanArray[(this.numInfos - 1) - this.selectedProtection];
                }
                else
                {
                    this.selectedProtection = 0;
                }
            }
            switch (num2)
            {
            case 1:
            {
                int    totalSeconds = (int)span.TotalSeconds;
                string str          = VillageMap.createBuildTimeStringFull(totalSeconds);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Interdict", "Interdict");
                this.lblProtectionType.Visible      = true;
                break;
            }

            case 2:
            {
                int    secsLeft = (int)span.TotalSeconds;
                string str2     = VillageMap.createBuildTimeStringFull(secsLeft);
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked_For_X_Time", "Cannot be attacked for") + " : " + str2;
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Peace", "Peace");
                this.lblProtectionType.Visible      = true;
                break;
            }

            case 3:
                this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Be_Attacked", "Cannot be attacked");
                this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Vacation", "Vacation Mode");
                this.lblProtectionType.Visible      = true;
                break;

            default:
            {
                int num5 = GameEngine.Instance.World.getVillageFaction(InterfaceMgr.Instance.OwnSelectedVillage);
                int num6 = GameEngine.Instance.World.getVillageFaction(this.m_selectedVillage);
                if (GameEngine.Instance.World.isUserVillage(this.m_selectedVillage))
                {
                    this.lblProtected.TextDiffOnly      = SK.Text("OtherVillagePanel_Cannot_Attack_Own_Village", "Cannot attack your own village");
                    this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Your_Village", "Your Village");
                    this.lblProtectionType.Visible      = true;
                }
                else if ((num5 == num6) && (num5 >= 0))
                {
                    if (GameEngine.Instance.LocalWorldData.Alternate_Ruleset != 1)
                    {
                        this.lblProtected.TextDiffOnly = SK.Text("OtherVillagePanel_Cannot_Attack_Faction_Member", "Cannot attack Faction Member");
                    }
                    this.lblProtectionType.TextDiffOnly = SK.Text("OtherVillagePanel_Your_Faction", "Your Faction");
                    this.lblProtectionType.Visible      = true;
                }
                else
                {
                    this.lblProtected.TextDiffOnly = "";
                    this.lblProtectionType.Visible = false;
                }
                break;
            }
            }
            if (visible != this.lblProtectionType.Visible)
            {
                this.updateSize();
                if (!visible)
                {
                    this.selectedProtection = 0;
                }
            }
            if (numInfos != this.numInfos)
            {
                if (this.numInfos >= 2)
                {
                    this.leftButton.Visible  = true;
                    this.rightButton.Visible = true;
                }
                else
                {
                    this.leftButton.Visible  = false;
                    this.rightButton.Visible = false;
                }
            }
        }
        public void updateEmptyVillageText(int selectedVillage)
        {
            bool flag  = false;
            bool flag2 = false;

            if (GameEngine.Instance.World.isSpecial(selectedVillage) && GameEngine.Instance.World.isAttackableSpecial(selectedVillage))
            {
                bool flag3 = this.isTallTreasureChestPanel(selectedVillage);
                if (flag3 != this.wasTall)
                {
                    this.init(selectedVillage);
                    flag = true;
                }
                flag2 = flag3;
            }
            if (!flag && GameEngine.Instance.LocalWorldData.AIWorld)
            {
                bool flag4 = false;
                switch (GameEngine.Instance.World.getSpecial(selectedVillage))
                {
                case 7:
                case 9:
                case 11:
                case 13:
                    flag4 = true;
                    break;

                default:
                    flag4 = false;
                    break;
                }
                if (flag4 != this.wasAiShort)
                {
                    this.init(selectedVillage);
                }
            }
            NumberFormatInfo nFI = GameEngine.NFI;

            this.m_selectedVillage                  = selectedVillage;
            this.buyVillageButton.Enabled           = true;
            this.attackButton_AI.Enabled            = true;
            this.scoutButton_AI.Enabled             = true;
            this.scoutButton_Resources.Enabled      = true;
            this.treasureCastleTimeoutLabel.Visible = false;
            this.backGround_AI.Visible              = false;
            this.backGround_Enemy.Visible           = false;
            this.backGround_Resources.Visible       = false;
            this.backGround_Charter.Visible         = false;
            this.special = false;
            this.invasionLabel.Visible = false;
            this.backGround_AI.removeWikiLink(this.wikiLink);
            this.wikiLink = null;
            int type = GameEngine.Instance.World.getSpecial(selectedVillage);

            if (SpecialVillageTypes.IS_TREASURE_CASTLE(type))
            {
                this.wikiLink = this.backGround_AI.addWikiLink(0x31);
            }
            else if ((type == 15) || (type == 0x11))
            {
                this.wikiLink = this.backGround_AI.addWikiLink(50);
            }
            if (!GameEngine.Instance.World.isSpecial(selectedVillage))
            {
                this.backGround_Charter.Visible = true;
                this.backGround_Charter.updateHeading(SK.Text("EmptyVillagePanel_Available_Village", "New Village Charter"));
                this.backGround_Charter.updatePanelTypeFromVillageID(selectedVillage);
                this.backGround_Charter.stretchBackground();
                base.Parent.Invalidate();
                double villageGoldCost = GameEngine.Instance.LocalWorldData.villageGoldCost;
                double num4            = GameEngine.Instance.World.calcVillageDistance(InterfaceMgr.Instance.getSelectedMenuVillage(), selectedVillage) * GameEngine.Instance.LocalWorldData.villageCostDistanceMultiplier;
                villageGoldCost *= num4 + 1.0;
                int numOwnedVillages = GameEngine.Instance.World.numVillagesOwned();
                int num6             = (int)villageGoldCost;
                num6               *= numOwnedVillages;
                villageGoldCost     = num6;
                this.goldLabel.Text = ((int)villageGoldCost).ToString("N", nFI);
                WorldData localWorldData = GameEngine.Instance.LocalWorldData;
                Point     point          = GameEngine.Instance.World.getVillageLocation(InterfaceMgr.Instance.OwnSelectedVillage);
                Point     point2         = GameEngine.Instance.World.getVillageLocation(selectedVillage);
                double    d = ((point.X - point2.X) * (point.X - point2.X)) + ((point.Y - point2.Y) * (point.Y - point2.Y));
                d  = Math.Sqrt(d) * ((localWorldData.CaptainsMoveSpeed * localWorldData.gamePlaySpeed) * ResearchData.CaptainTimes[GameEngine.Instance.World.UserResearchData.Research_Courtiers]);
                d *= CardTypes.getArmySpeed(GameEngine.Instance.World.UserCardData);
                string str = VillageMap.createBuildTimeString((int)d);
                this.travelTimeLabel.Text              = str;
                this.travelTimeLabel.CustomTooltipID   = 0x4e20;
                this.travelTimeLabel.CustomTooltipData = (int)d;
                int num8 = 0;
                if (GameEngine.Instance.LocalWorldData.Alternate_Ruleset != 1)
                {
                    num8 = ResearchData.getVillageBuyHonourCost(numOwnedVillages);
                    if (((num8 > 0) && GameEngine.Instance.World.FourthAgeWorld) && (numOwnedVillages < GameEngine.Instance.World.MostAge4Villages))
                    {
                        num8 = 0;
                    }
                }
                if (num8 > 0)
                {
                    this.honourImage.Visible = true;
                    this.honourLabel.Visible = true;
                    this.honourLabel.Text    = num8.ToString("N", nFI);
                }
                else
                {
                    this.honourImage.Visible = false;
                    this.honourLabel.Visible = false;
                }
            }
            else
            {
                this.special = true;
                if (GameEngine.Instance.World.isAttackableSpecial(selectedVillage))
                {
                    this.backGround_AI.Visible = true;
                    this.backGround_AI.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage));
                    this.backGround_AI.updatePanelTypeFromVillageID(selectedVillage);
                    if (SpecialVillageTypes.IS_TREASURE_CASTLE(type))
                    {
                        if (GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage))
                        {
                            this.attackButton_AI.Enabled = false;
                        }
                        if (flag2)
                        {
                            this.updateTreasureCastleTimeout();
                            this.treasureCastleTimeoutLabel.Visible = true;
                            this.attackButton_AI.Enabled            = false;
                        }
                    }
                }
                else if ((type >= 100) && (type <= 0xc7))
                {
                    this.backGround_Resources.Visible = true;
                    this.backGround_Resources.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage));
                    this.backGround_Resources.updatePanelTypeFromVillageID(selectedVillage);
                    this.scoutButton_Resources.Enabled = false;
                }
                else
                {
                    this.backGround_Enemy.Visible = true;
                    if (type == 30)
                    {
                        switch (GameEngine.Instance.World.getAIInvasionMarkerState(selectedVillage))
                        {
                        case 0:
                            this.backGround_Enemy.updateHeading(SK.Text("Invasion_None", "No Invasion Sighted"));
                            break;

                        case 1:
                        {
                            this.backGround_Enemy.updateHeading(SK.Text("Invasion_Planned", "Invasion Sighted"));
                            DateTime time = GameEngine.Instance.World.getNextAIInvasionDate(selectedVillage);
                            if (time != DateTime.MinValue)
                            {
                                TimeSpan span = (TimeSpan)(time - VillageMap.getCurrentServerTime());
                                this.invasionLabel.Visible = true;
                                this.invasionLabel.Text    = VillageMap.createBuildTimeString((int)span.TotalSeconds);
                            }
                            break;
                        }

                        case 2:
                            this.backGround_Enemy.updateHeading(SK.Text("Invasion_Inprogress", "Invasion In Progress"));
                            break;
                        }
                    }
                    else
                    {
                        this.backGround_Enemy.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage));
                    }
                    this.backGround_Enemy.updatePanelTypeFromVillageID(selectedVillage);
                }
                if (!GameEngine.Instance.World.isScoutableSpecial(selectedVillage) || GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage))
                {
                    this.scoutButton_AI.Enabled        = false;
                    this.scoutButton_Resources.Enabled = false;
                }
                else
                {
                    this.scoutButton_AI.Enabled        = true;
                    this.scoutButton_Resources.Enabled = true;
                }
            }
        }
Пример #15
0
        public void init(int villageID, bool reset)
        {
            NumberFormatInfo nFI;
            int   scoutResourceCarryLevel;
            Color white  = ARGBColors.White;
            Color black  = ARGBColors.Black;
            Color color1 = ARGBColors.White;

            this.m_selectedVillage = villageID;
            this.m_ownVillage      = InterfaceMgr.Instance.OwnSelectedVillage;
            base.clearControls();
            int y = 0x27;

            this.mainBackgroundImage.Image    = (Image)GFXLibrary.body_background_canvas;
            this.mainBackgroundImage.ClipRect = new Rectangle(new Point(), base.Size);
            this.mainBackgroundImage.Position = new Point(0, y);
            this.mainBackgroundImage.Size     = new Size(base.Size.Width, base.Size.Height - y);
            this.mainBackgroundImage.Tile     = true;
            base.addControl(this.mainBackgroundImage);
            this.backgroundBottomEdge.Image    = (Image)GFXLibrary.popup_border_bottom;
            this.backgroundBottomEdge.Position = new Point(0, base.Height - 2);
            base.addControl(this.backgroundBottomEdge);
            this.backgroundRightEdge.Image    = (Image)GFXLibrary.popup_border_rhs;
            this.backgroundRightEdge.Position = new Point(base.Width - 2, y);
            base.addControl(this.backgroundRightEdge);
            this.cardbar.Position = new Point(0, 4);
            this.mainBackgroundImage.addControl(this.cardbar);
            this.cardbar.init(7);
            this.gfxImage.Image    = (Image)GFXLibrary.scout_screen_illustration_01;
            this.gfxImage.Position = new Point(20, 0x47);
            this.mainBackgroundImage.addControl(this.gfxImage);
            this.sliderImage.Position = new Point(0x2c, 0x11c);
            this.sliderImage.Margin   = new Rectangle(0x20, 0x3f, 0x20, 0x19);
            this.sliderImage.Value    = 0;
            this.sliderImage.Max      = 0;
            this.sliderImage.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.tracksMoved));
            this.mainBackgroundImage.addControl(this.sliderImage);
            this.sliderImage.Create((Image)GFXLibrary.scout_screen_slider, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar, (Image)GFXLibrary.scout_screen_slider_bar);
            this.arrowImage.Image    = (Image)GFXLibrary.scout_screen_arrowbox;
            this.arrowImage.Position = new Point(0xee, 0x11c);
            this.mainBackgroundImage.addControl(this.arrowImage);
            this.scoutingLabel.Text            = SK.Text("ScoutPopup_Scouting_Target", "Scouting") + " '" + GameEngine.Instance.World.getVillageNameOrType(villageID) + "'";
            this.scoutingLabel.Color           = white;
            this.scoutingLabel.DropShadowColor = black;
            this.scoutingLabel.Position        = new Point(0, 0xf3);
            this.scoutingLabel.Size            = new Size(700, 30);
            this.scoutingLabel.Font            = FontManager.GetFont("Arial", 16f, FontStyle.Regular);
            this.scoutingLabel.Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
            this.mainBackgroundImage.addControl(this.scoutingLabel);
            if (AttackTargetsPanel.isFavourite(this.m_selectedVillage))
            {
                this.targetVillageFavourite.ImageNorm       = (Image)GFXLibrary.star_market_1;
                this.targetVillageFavourite.CustomTooltipID = 0x83b;
            }
            else
            {
                this.targetVillageFavourite.ImageNorm       = (Image)GFXLibrary.star_market_3;
                this.targetVillageFavourite.CustomTooltipID = 0x7e2;
            }
            this.targetVillageFavourite.OverBrighten = true;
            this.targetVillageFavourite.Position     = new Point(650, 0xf4);
            this.targetVillageFavourite.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.villageFavouriteClicked));
            this.targetVillageFavourite.Data = 0;
            this.mainBackgroundImage.addControl(this.targetVillageFavourite);
            this.numLabel.Text            = "";
            this.numLabel.Color           = white;
            this.numLabel.DropShadowColor = black;
            this.numLabel.Position        = new Point(0x3f, 0x17);
            this.numLabel.Size            = new Size(0x3b, 0x18);
            this.numLabel.Font            = FontManager.GetFont("Arial", 18f, FontStyle.Regular);
            this.numLabel.Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.sliderImage.addControl(this.numLabel);
            this.timeLabel.Text            = "00:00:00";
            this.timeLabel.Color           = white;
            this.timeLabel.DropShadowColor = black;
            this.timeLabel.Position        = new Point(-28, 0x17);
            this.timeLabel.Size            = new Size(0xbf, 0x18);
            this.timeLabel.Font            = FontManager.GetFont("Arial", 12f, FontStyle.Regular);
            this.timeLabel.Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.arrowImage.addControl(this.timeLabel);
            int index = 0;
            int type  = GameEngine.Instance.World.getSpecial(villageID);

            switch (type)
            {
            case 3:
            case 4:
                index = 0x18;
                break;

            case 5:
            case 6:
                index = 0x19;
                break;

            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
                index = 0x1c;
                break;

            case 15:
            case 0x10:
            case 0x11:
            case 0x12:
                index = 0x35;
                break;

            case 40:
            case 0x29:
            case 0x2a:
            case 0x2b:
            case 0x2c:
            case 0x2d:
            case 0x2e:
            case 0x2f:
            case 0x30:
            case 0x31:
            case 50:
                index = 0x36;
                break;

            case 0x33:
            case 0x34:
            case 0x35:
            case 0x36:
            case 0x37:
            case 0x38:
            case 0x39:
            case 0x3a:
            case 0x3b:
            case 60:
                index = 0x37;
                break;

            case 0x3d:
            case 0x3e:
            case 0x3f:
            case 0x40:
            case 0x41:
            case 0x42:
            case 0x43:
            case 0x44:
            case 0x45:
            case 70:
                index = 0x38;
                break;

            case 0x47:
            case 0x48:
            case 0x49:
            case 0x4a:
            case 0x4b:
            case 0x4c:
            case 0x4d:
            case 0x4e:
            case 0x4f:
            case 80:
                index = 0x39;
                break;

            case 0x51:
            case 0x52:
            case 0x53:
            case 0x54:
            case 0x55:
            case 0x56:
            case 0x57:
            case 0x58:
            case 0x59:
            case 90:
                index = 0x3a;
                break;

            case 100:
                if (HolidayPeriods.xmas(VillageMap.getCurrentServerTime()))
                {
                    index = 0x3b;
                }
                else
                {
                    index = 0x1d;
                }
                break;

            case 0x6a:
                index = 30;
                break;

            case 0x6b:
                index = 0x1f;
                break;

            case 0x6c:
                index = 0x21;
                break;

            case 0x6d:
                index = 0x20;
                break;

            case 0x70:
                index = 0x22;
                break;

            case 0x71:
                index = 0x23;
                break;

            case 0x72:
                index = 0x24;
                break;

            case 0x73:
                index = 0x29;
                break;

            case 0x74:
                index = 0x25;
                break;

            case 0x75:
                index = 40;
                break;

            case 0x76:
                index = 0x2a;
                break;

            case 0x77:
                index = 0x2d;
                break;

            case 0x79:
                index = 0x2c;
                break;

            case 0x7a:
                index = 0x26;
                break;

            case 0x7b:
                index = 0x2b;
                break;

            case 0x7c:
                index = 0x2e;
                break;

            case 0x7d:
                index = 0x2f;
                break;

            case 0x7e:
                index = 0x30;
                break;

            case 0x80:
                index = 0x3d;
                break;

            case 0x81:
                index = 60;
                break;

            case 130:
                index = 0x3e;
                break;

            case 0x83:
                index = 0x3f;
                break;

            case 0x84:
                index = 0x40;
                break;

            case 0x85:
                index = 0x27;
                break;

            default:
                if (GameEngine.Instance.World.isRegionCapital(villageID))
                {
                    index = 0x31;
                }
                else if (GameEngine.Instance.World.isCountyCapital(villageID))
                {
                    index = 50;
                }
                else if (GameEngine.Instance.World.isProvinceCapital(villageID))
                {
                    index = 0x33;
                }
                else if (GameEngine.Instance.World.isCountryCapital(villageID))
                {
                    index = 0x34;
                }
                else
                {
                    index = GameEngine.Instance.World.getVillageSize(villageID);
                }
                break;
            }
            switch (type)
            {
            case 0x6a:
            case 0x6b:
            case 0x6c:
            case 0x6d:
            case 0x70:
            case 0x71:
            case 0x72:
            case 0x73:
            case 0x74:
            case 0x75:
            case 0x76:
            case 0x77:
            case 0x79:
            case 0x7a:
            case 0x7b:
            case 0x7c:
            case 0x7d:
            case 0x7e:
            case 0x80:
            case 0x81:
            case 130:
            case 0x83:
            case 0x84:
            case 0x85:
            {
                WorldMap.SpecialVillageCache cache = GameEngine.Instance.World.getSpecialVillageData(villageID, false);
                if (cache == null)
                {
                    goto Label_0B37;
                }
                nFI = GameEngine.NFI;
                CustomSelfDrawPanel.CSDLabel control = new CustomSelfDrawPanel.CSDLabel {
                    Text            = cache.resourceLevel.ToString("N", nFI),
                    Position        = new Point(0x9e, 0x55),
                    Size            = new Size(150, 20),
                    Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER,
                    Color           = white,
                    DropShadowColor = black,
                    Font            = FontManager.GetFont("Arial", 12f, FontStyle.Regular)
                };
                this.arrowImage.addControl(control);
                scoutResourceCarryLevel = GameEngine.Instance.LocalWorldData.ScoutResourceCarryLevel;
                int num5 = GameEngine.Instance.World.UserResearchData.Research_Foraging;
                scoutResourceCarryLevel = (CardTypes.adjustForagingLevel(GameEngine.Instance.World.UserCardData, scoutResourceCarryLevel) * ResearchData.foragingResearch[num5]) / 2;
                switch (type)
                {
                case 0x77:
                case 0x79:
                case 0x7a:
                case 0x7b:
                case 0x7c:
                case 0x7d:
                case 0x7e:
                case 0x80:
                case 0x81:
                case 130:
                case 0x83:
                case 0x84:
                case 0x85:
                    scoutResourceCarryLevel /= 10;
                    goto Label_0A92;
                }
                break;
            }

            default:
                goto Label_0B37;
            }
Label_0A92:
            this.m_carryLevel                       = scoutResourceCarryLevel;
            this.scoutCarryingLabel.Text            = this.m_carryLevel.ToString("N", nFI);
            this.scoutCarryingLabel.Position        = new Point(0, 90);
            this.scoutCarryingLabel.Size            = new Size(this.sliderImage.Width, 20);
            this.scoutCarryingLabel.Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
            this.scoutCarryingLabel.Color           = white;
            this.scoutCarryingLabel.DropShadowColor = black;
            this.scoutCarryingLabel.Font            = FontManager.GetFont("Arial", 12f, FontStyle.Regular);
            this.sliderImage.addControl(this.scoutCarryingLabel);
Label_0B37:
            this.targetImage.Image    = (Image)GFXLibrary.scout_screen_icons[index];
            this.targetImage.Position = new Point(0xb5, 5);
            this.arrowImage.addControl(this.targetImage);
            WorldData localWorldData = GameEngine.Instance.LocalWorldData;
            Point     point          = GameEngine.Instance.World.getVillageLocation(InterfaceMgr.Instance.OwnSelectedVillage);
            Point     point2         = GameEngine.Instance.World.getVillageLocation(villageID);
            int       x    = point.X;
            int       num7 = point.Y;
            int       num8 = point2.X;
            int       num9 = point2.Y;
            double    d    = ((x - num8) * (x - num8)) + ((num7 - num9) * (num7 - num9));

            d = Math.Sqrt(d) * ((localWorldData.ScoutsMoveSpeed * localWorldData.gamePlaySpeed) * ResearchData.ScoutTimes[GameEngine.Instance.World.UserResearchData.Research_Horsemanship]);
            this.storedPreCardDistance = d;
            d *= CardTypes.getScoutSpeed(GameEngine.Instance.World.UserCardData);
            string str = VillageMap.createBuildTimeString((int)d);

            this.timeLabel.Text              = str;
            this.timeLabel.CustomTooltipID   = 0x4e20;
            this.timeLabel.CustomTooltipData = (int)d;
            this.launchButton.ImageNorm      = (Image)GFXLibrary.button_with_inset_normal;
            this.launchButton.ImageOver      = (Image)GFXLibrary.button_with_inset_over;
            this.launchButton.ImageClick     = (Image)GFXLibrary.button_with_inset_pushed;
            this.launchButton.Position       = new Point(520, 0x144);
            this.launchButton.Text.Text      = SK.Text("ScoutPopup_Go", "Go");
            this.launchButton.Text.Font      = FontManager.GetFont("Arial", 16f, FontStyle.Regular);
            this.launchButton.TextYOffset    = 1;
            this.launchButton.Text.Color     = ARGBColors.Black;
            this.launchButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.launch), "ScoutPopupPanel_launch");
            this.launchButton.Enabled = false;
            this.mainBackgroundImage.addControl(this.launchButton);
            this.scoutHonourLabel.Text            = "";
            this.scoutHonourLabel.Color           = white;
            this.scoutHonourLabel.DropShadowColor = black;
            this.scoutHonourLabel.Position        = new Point(0, 410);
            this.scoutHonourLabel.Size            = new Size(700, 30);
            this.scoutHonourLabel.Font            = FontManager.GetFont("Arial", 11f, FontStyle.Regular);
            this.scoutHonourLabel.Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
            this.scoutHonourLabel.Visible         = false;
            this.mainBackgroundImage.addControl(this.scoutHonourLabel);
            if ((type >= 100) && (type <= 0xc7))
            {
                this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Stash_Out_Of_Range", "No Honour will be received, the stash is out of range.");
            }
            else if (type == 5)
            {
                this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Wolf_Lair_Out_Of_Range", "No Honour will be received, the Wolf Lair is out of range.");
            }
            else if (type == 3)
            {
                this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Bandit_Camp_Out_Of_Range", "No Honour will be received, the Bandit Camp is out of range.");
            }
            else if (((type == 7) || (type == 9)) || ((type == 11) || (type == 13)))
            {
                this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_AI_castle_Out_Of_Range", "No Honour will be received, the AI Castle is out of range.");
            }
            else if (((type == 15) || (type == 0x11)) || SpecialVillageTypes.IS_TREASURE_CASTLE(type))
            {
                this.scoutHonourLabel.Text = SK.Text("LaunchAttackPopup_Paladin_No_Honour", "No honour will be received for destroying this type of AI castle");
            }
            else
            {
                this.scoutHonourLabel.Text = SK.Text("ScoutPopup_No_Honour_Village_Out_Of_Range", "No Honour will be received, the village is out of range.");
            }
            this.scoutHonourLabel.Visible = GameEngine.Instance.World.isScoutHonourOutOfRange(InterfaceMgr.Instance.OwnSelectedVillage, villageID) && ((type <= 100) || (type > 0xc7));
            this.titleImage.Image         = (Image)GFXLibrary.popup_title_bar;
            this.titleImage.Position      = new Point(0, 0);
            base.addControl(this.titleImage);
            this.titleLabel.Text            = SK.Text("OwnVillagePanel_Send_Out_Scouts", "Send Out Scouts");
            this.titleLabel.Color           = Color.FromArgb(0xff, 0xff, 0xff);
            this.titleLabel.DropShadowColor = black;
            this.titleLabel.Position        = new Point(20, 5);
            this.titleLabel.Size            = new Size(base.Width, 0x20);
            this.titleLabel.Font            = FontManager.GetFont("Arial", 18f, FontStyle.Bold);
            this.titleLabel.Alignment       = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
            this.titleImage.addControl(this.titleLabel);
            this.closeButton.ImageNorm  = (Image)GFXLibrary.int_button_close_normal;
            this.closeButton.ImageOver  = (Image)GFXLibrary.int_button_close_over;
            this.closeButton.ImageClick = (Image)GFXLibrary.int_button_close_in;
            this.closeButton.Position   = new Point(0x293, 5);
            this.closeButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.closeClick), "ScoutPopupPanel_close");
            this.titleImage.addControl(this.closeButton);
            CustomSelfDrawPanel.WikiLinkControl.init(this.titleImage, 0x22, new Point(0x261, 5));
            if (GameEngine.Instance.getVillage(this.m_ownVillage) != null)
            {
                this.onVillageLoadUpdate(this.m_ownVillage, true);
            }
            else
            {
                GameEngine.Instance.downloadCurrentVillage();
            }
        }