Ejemplo n.º 1
0
 public static void showAdminEdit()
 {
     AdminInfoPopup popup = new AdminInfoPopup {
         btnSend = { Visible = true },
         textBox1 = { ReadOnly = false, Text = adminMessage }
     };
     popup.init();
     popup.Show();
     lastPopup = popup;
 }
Ejemplo n.º 2
0
        public static void showAdminEdit()
        {
            AdminInfoPopup popup = new AdminInfoPopup {
                btnSend  = { Visible = true },
                textBox1 = { ReadOnly = false, Text = adminMessage }
            };

            popup.init();
            popup.Show();
            lastPopup = popup;
        }
Ejemplo n.º 3
0
 public static void showMessage()
 {
     if (adminMessage.StartsWith("http://"))
     {
         string[] strArray = adminMessage.Split(delims);
         if (strArray.Length > 0)
         {
             VideoWindow.ShowVideo(strArray[0], false);
             return;
         }
     }
     AdminInfoPopup popup = new AdminInfoPopup {
         btnSend = { Visible = false },
         textBox1 = { ReadOnly = true, Text = adminMessage }
     };
     popup.init();
     popup.Show();
     popup.btnExit.Focus();
     lastPopup = popup;
     RemoteServices.Instance.ShowAdminMessage = false;
 }
Ejemplo n.º 4
0
        public static void showMessage()
        {
            if (adminMessage.StartsWith("http://"))
            {
                string[] strArray = adminMessage.Split(delims);
                if (strArray.Length > 0)
                {
                    VideoWindow.ShowVideo(strArray[0], false);
                    return;
                }
            }
            AdminInfoPopup popup = new AdminInfoPopup {
                btnSend  = { Visible = false },
                textBox1 = { ReadOnly = true, Text = adminMessage }
            };

            popup.init();
            popup.Show();
            popup.btnExit.Focus();
            lastPopup = popup;
            RemoteServices.Instance.ShowAdminMessage = false;
        }
Ejemplo n.º 5
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"));
        }