Ejemplo n.º 1
0
        public bool showArmy(WorldMap.LocalArmyData army)
        {
            WorldMap.VillageData data;
            if (!this.FilterActive || (InterfaceMgr.Instance.WorldMapMode != 0))
            {
                return(true);
            }
            switch (this.filterMode)
            {
            case 6:
                if (!GameEngine.Instance.World.isAttackingArmy(army.armyID))
                {
                    goto Label_00F2;
                }
                return(true);

            case 8:
                if (army.lootType >= 0)
                {
                    goto Label_00F2;
                }
                data = GameEngine.Instance.World.getVillageData(army.targetVillageID);
                if (data == null)
                {
                    goto Label_00F2;
                }
                switch (data.special)
                {
                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                case 13:
                case 15:
                case 0x11:
                    return(true);
                }
                break;

            case 3:
                if (!GameEngine.Instance.World.isForagingArmy(army.armyID))
                {
                    goto Label_00F2;
                }
                return(true);

            default:
                goto Label_00F2;
            }
            if (SpecialVillageTypes.IS_TREASURE_CASTLE(data.special))
            {
                return(true);
            }
Label_00F2:
            return(false);
        }
        public void updateOtherVillageText(int selectedVillage)
        {
            bool flag = false;

            if (GameEngine.Instance.World.isSpecial(selectedVillage) && GameEngine.Instance.World.isAttackableSpecial(selectedVillage))
            {
                bool flag2 = this.isTallTreasureChestPanel(selectedVillage);
                if (flag2 != this.wasTall)
                {
                    this.init(selectedVillage);
                }
                flag = flag2;
            }
            this.m_selectedVillage = selectedVillage;
            this.backGround.updateHeading(GameEngine.Instance.World.getVillageNameOrType(selectedVillage));
            this.backGround.updatePanelTypeFromVillageID(selectedVillage);
            if (selectedVillage < 0)
            {
                this.attackButton.Enabled = false;
            }
            else if (GameEngine.Instance.World.isAttackableSpecial(selectedVillage))
            {
                this.attackButton.Enabled = true;
                if (SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(selectedVillage)))
                {
                    if (GameEngine.Instance.World.isCapital(InterfaceMgr.Instance.OwnSelectedVillage))
                    {
                        this.attackButton.Enabled = false;
                    }
                    if (flag)
                    {
                        this.updateTreasureCastleTimeout();
                        this.treasureCastleTimeoutLabel.Visible = true;
                        this.attackButton.Enabled = false;
                    }
                }
            }
            else if (!GameEngine.Instance.World.isCapital(selectedVillage) && (GameEngine.Instance.World.getVillageUserID(selectedVillage) >= 0))
            {
                this.attackButton.Enabled = true;
            }
            else
            {
                this.attackButton.Enabled = false;
            }
        }
 private void cancelCastleAttackCallBack(CancelCastleAttack_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             GameEngine.Instance.World.deleteArmy(returnData.oldArmyID);
             if (SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(returnData.armyData.targetVillageID)))
             {
                 GameEngine.Instance.World.setLastTreasureCastleAttackTime(DateTime.MinValue);
             }
         }
         this.btnCancel.Visible = false;
         if (this.m_parent != null)
         {
             this.m_parent.init(false);
         }
     }
 }
Ejemplo n.º 4
0
 private void cancelCastleAttackCallBack(CancelCastleAttack_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             GameEngine.Instance.World.setHonourData(returnData.currentHonourLevel, returnData.currentHonourRate);
             GameEngine.Instance.World.deleteArmy(returnData.oldArmyID);
             if (SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(returnData.armyData.targetVillageID)))
             {
                 GameEngine.Instance.World.setLastTreasureCastleAttackTime(DateTime.MinValue);
             }
         }
         this.update();
         this.returnButton.Visible = false;
     }
     else
     {
         this.forceReturnOff = false;
     }
 }
        public override void setData(GetReport_ReturnType returnData)
        {
            base.setData(returnData);
            bool flag  = true;
            bool flag2 = false;

            this.lblResult.Text = SK.Text("GENERIC_The_Attacker_Wins", "The Attacker Wins");
            switch (returnData.reportType)
            {
            case 0x79:
            case 0x7a:
            case 0x7e:
            case 0x15:
            case 0x1a:
            case 0x1b:
            case 0x36:
            case 0x37:
            case 0x38:
            case 0x39:
                base.lblMainText.Text = base.reportOwner + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text = SK.Text("Reports_Scouts_Out", "Scouts");
                if (returnData.otherUser.Length != 0)
                {
                    base.lblSecondaryText.Text = returnData.otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                    break;
                }
                if (returnData.reportType == 0x15)
                {
                    if (returnData.defendingVillage < 0)
                    {
                        base.lblSecondaryText.Text = SK.Text("GENERIC_An_Empty_Village", "An empty village");
                    }
                    else
                    {
                        base.lblSecondaryText.Text = GameEngine.Instance.World.getVillageName(returnData.defendingVillage);
                    }
                }
                else if (returnData.reportType == 0x1a)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_A_Bandit_Camp", "A Bandit Camp");
                }
                else if (returnData.reportType == 0x1b)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_A_Wolf_Lair", "A Wolf Lair");
                }
                else if (returnData.reportType == 0x36)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_Rats_Castle", "Rat's Castle");
                }
                else if (returnData.reportType == 0x37)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_Snakes_Castle", "Snake's Castle");
                }
                else if (returnData.reportType == 0x38)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_Pigs_Castle", "Pig's Castle");
                }
                else if (returnData.reportType == 0x39)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_Wolfs_Castle", "Wolf's Castle");
                }
                else if (returnData.reportType == 0x79)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_Paladin_Castle", "Paladin's Castle");
                }
                else if (returnData.reportType == 0x7a)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_Paladin_Castle", "Paladin's Castle");
                }
                else if (returnData.reportType == 0x7e)
                {
                    string[] strArray = new string[] { SK.Text("GENERIC_Treasure_Castle", "Treasure Castle"), " ", SK.Text("GENERIC_TREASURE_CASTLE_LEVEL", "Level"), " : ", (returnData.genericData31 + 1).ToString() };
                    base.lblSecondaryText.Text = string.Concat(strArray);
                    this.lblScouts.Position    = new Point(0, base.lblDate.Rectangle.Bottom + 5);
                    this.lblScouts.Size        = new Size(base.Width, 0x1a);
                    this.lblScouts.Alignment   = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
                    this.lblScouts.Text        = SK.Text("GENERIC_Treasure_Chests", "Treasure Chests") + " : " + returnData.genericData32.ToString();
                    this.lblScouts.Visible     = true;
                    flag = false;
                }
                break;

            case 0x16:
                this.btnViewCastle.Visible = false;
                if (returnData.otherUser.Length != 0)
                {
                    base.lblMainText.Text = returnData.otherUser;
                }
                else
                {
                    base.lblMainText.Text = SK.Text("GENERIC_An_Unknown_Player", "An Unknown Player");
                }
                base.lblMainText.Text = base.lblMainText.Text + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text = SK.Text("Reports_Scouts_Out", "Scouts");
                if (returnData.otherUser.Length == 0)
                {
                    base.lblSecondaryText.Text = SK.Text("GENERIC_An_Empty_Village", "An empty village");
                }
                else
                {
                    base.lblSecondaryText.Text = base.reportOwner + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")";
                }
                if (!returnData.successStatus)
                {
                    this.lblResult.Text = SK.Text("GENERIC_The_Defender_Wins", "The Defender Wins");
                }
                goto Label_06CD;

            case 0x17:
                base.lblMainText.Text  = base.reportOwner + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")";
                base.lblSubTitle.Text  = SK.Text("Reports_Forages", "Forages");
                this.lblResult.Visible = false;
                if (returnData.genericData6 <= 0)
                {
                    goto Label_06CD;
                }
                this.lblResult.Text    = SK.Text("SeasonalBonus", "Seasonal Bonus");
                this.lblResult.Visible = true;
                base.lblDate.Y        -= 50;
                this.lblHonour.Y      -= 50;
                this.lblResult.Y      += 0x23;
                this.lblResult.Font    = FontManager.GetFont("Arial", 12f, FontStyle.Regular);
                switch (returnData.genericData6)
                {
                case 2:
                    this.lblScouts.Text = SK.Text("REPORTS_SeasonalWheelSpins2", "Tier 2 Wheel Spin");
                    goto Label_053C;

                case 3:
                    this.lblScouts.Text = SK.Text("REPORTS_SeasonalWheelSpins3", "Tier 3 Wheel Spin");
                    goto Label_053C;
                }
                this.lblScouts.Text = SK.Text("REPORTS_SeasonalWheelSpins1", "Tier 1 Wheel Spin");
                goto Label_053C;

            default:
                goto Label_06CD;
            }
            if (!returnData.successStatus)
            {
                this.lblResult.Text        = SK.Text("GENERIC_The_Defender_Wins", "The Defender Wins");
                this.btnViewCastle.Visible = false;
            }
            goto Label_06CD;
Label_053C:
            this.lblScouts.Position  = this.lblResult.Position;
            this.lblScouts.Y        += 0x16;
            this.lblScouts.Size      = this.lblResult.Size;
            this.lblScouts.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER;
            this.lblScouts.Font      = FontManager.GetFont("Arial", 12f, FontStyle.Regular);
            this.lblScouts.Visible   = true;
            flag  = false;
            flag2 = true;
Label_06CD:
            if ((returnData.reportType == 0x1b) && (returnData.genericData6 > 0))
            {
                this.lblWolves.Text    = SK.Text("GENERIC_Wolves", "Wolves") + " " + returnData.genericData6.ToString();
                this.lblWolves.Visible = true;
            }
            if (returnData.defendingVillage >= 0)
            {
                this.mapTarget          = GameEngine.Instance.World.getVillageLocation(returnData.defendingVillage);
                this.targetZoomLevel    = 10000.0;
                base.btnUtility.Visible = true;
            }
            else
            {
                base.btnUtility.Visible = false;
            }
            if ((returnData.genericData3 < 100) || (returnData.genericData3 > 0xc7))
            {
                base.lblFurther.Visible = false;
                if (flag)
                {
                    this.lblScouts.Text    = SK.Text("GENERIC_Scouts", "Scouts") + " " + returnData.genericData2.ToString("N", base.nfi) + "/" + returnData.genericData1.ToString("N", base.nfi);
                    this.lblScouts.Visible = true;
                }
                if (returnData.reportType != 0x27)
                {
                    this.btnViewCastle.Visible = true;
                }
                base.imgFurther.Visible = false;
            }
            else
            {
                this.btnViewCastle.Visible = false;
                if (!flag2)
                {
                    this.lblScouts.Visible = false;
                }
                base.lblSecondaryText.Text = SpecialVillageTypes.getName((returnData.genericData3 - 100) + 100, Program.mySettings.LanguageIdent);
                switch (returnData.genericData3)
                {
                case 0x6a:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_wood;
                    break;

                case 0x6b:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_stone;
                    break;

                case 0x6c:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_iron;
                    break;

                case 0x6d:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_pitch;
                    break;

                case 0x70:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_ale;
                    break;

                case 0x71:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_apples;
                    break;

                case 0x72:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_bread;
                    break;

                case 0x73:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_veg;
                    break;

                case 0x74:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_meat;
                    break;

                case 0x75:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_cheese;
                    break;

                case 0x76:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_fish;
                    break;

                case 0x77:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_clothing;
                    break;

                case 0x79:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_furniture;
                    break;

                case 0x7a:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_venison;
                    break;

                case 0x7b:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_salt;
                    break;

                case 0x7c:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_spice;
                    break;

                case 0x7d:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_silk;
                    break;

                case 0x7e:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_metalwork;
                    break;

                case 0x80:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_pikes;
                    break;

                case 0x81:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_bows;
                    break;

                case 130:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_swords;
                    break;

                case 0x83:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_armour;
                    break;

                case 0x84:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_catapults;
                    break;

                case 0x85:
                    base.imgFurther.Image = (Image)GFXLibrary.com_32_wine;
                    break;
                }
                base.imgFurther.setSizeToImage();
                base.imgFurther.Position  = new Point((base.Width / 2) - base.imgFurther.Width, base.btnForward.Position.Y);
                base.lblFurther.Text      = returnData.genericData4.ToString("N", base.nfi);
                base.lblFurther.Position  = new Point(base.Width / 2, base.btnForward.Position.Y);
                base.lblFurther.Size      = new Size(base.Width / 2, 0x1a);
                base.lblFurther.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT;
                base.showFurtherInfo();
                if (returnData.genericData5 > 0)
                {
                    this.lblHonour.Text    = SK.Text("GENERIC_Honour", "Honour") + " : " + returnData.genericData5.ToString();
                    this.lblHonour.Visible = true;
                }
            }
            base.lblMainText.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.attackerDoubleClick), "Reports_Attacker_DClick");
            base.lblSecondaryText.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.defenderDoubleClick), "Reports_Defender_DClick");
        }
Ejemplo n.º 6
0
        public bool showVillage(WorldMap.VillageData village)
        {
            if (!this.FilterActive || (InterfaceMgr.Instance.WorldMapMode != 0))
            {
                return(true);
            }
            if (this.filterAlwaysShowYourVillages && (village.userID == RemoteServices.Instance.UserID))
            {
                return(true);
            }
            switch (this.filterMode)
            {
            case 1:
                if (village.userID >= 0)
                {
                    if (village.userID != RemoteServices.Instance.UserID)
                    {
                        int userFactionID = RemoteServices.Instance.UserFactionID;
                        if ((userFactionID < 0) || (village.factionID < 0))
                        {
                            return(false);
                        }
                        if (village.factionID != userFactionID)
                        {
                            goto Label_02AE;
                        }
                    }
                    return(true);
                }
                return(false);

            case 2:
                if (village.userID >= 0)
                {
                    if (village.userID != RemoteServices.Instance.UserID)
                    {
                        int factionID = RemoteServices.Instance.UserFactionID;
                        if ((factionID < 0) || (village.factionID < 0))
                        {
                            return(false);
                        }
                        if (village.factionID == factionID)
                        {
                            return(true);
                        }
                        FactionData data2 = GameEngine.Instance.World.getFaction(factionID);
                        FactionData data3 = GameEngine.Instance.World.getFaction(village.factionID);
                        if ((data2 == null) || (data3 == null))
                        {
                            return(false);
                        }
                        if ((data2.houseID != data3.houseID) || (data2.houseID == 0))
                        {
                            goto Label_02AE;
                        }
                    }
                    return(true);
                }
                return(false);

            case 3:
                if (!GameEngine.Instance.World.isForagingSpecial(village.id))
                {
                    if (GameEngine.Instance.World.isForagingVillage(village.id))
                    {
                        return(true);
                    }
                    goto Label_02AE;
                }
                return(true);

            case 4:
            case 5:
                if (!GameEngine.Instance.World.isVillageTrading(village.id))
                {
                    if (village.Capital || GameEngine.Instance.World.isVillageMarketTrading(village.id))
                    {
                        return(true);
                    }
                    goto Label_02AE;
                }
                return(true);

            case 6:
                if (!GameEngine.Instance.World.isVillageInvolvedInAttacks(village.id))
                {
                    goto Label_02AE;
                }
                return(true);

            case 7:
                if (village.userID >= 0)
                {
                    if (village.userID != RemoteServices.Instance.UserID)
                    {
                        if ((RemoteServices.Instance.UserFactionID >= 0) || (village.factionID < 0))
                        {
                            return(false);
                        }
                        FactionData data = GameEngine.Instance.World.getFaction(village.factionID);
                        if (data == null)
                        {
                            return(false);
                        }
                        if (!data.openForApplications)
                        {
                            goto Label_02AE;
                        }
                    }
                    return(true);
                }
                return(false);

            case 8:
                switch (village.special)
                {
                case 3:
                case 5:
                case 7:
                case 9:
                case 11:
                case 13:
                case 15:
                case 0x11:
                    return(true);
                }
                break;

            default:
                goto Label_02AE;
            }
            if (GameEngine.Instance.World.isVillageInvolvedInAIAttacks(village.id))
            {
                return(true);
            }
            if (SpecialVillageTypes.IS_TREASURE_CASTLE(village.special))
            {
                return(true);
            }
Label_02AE:
            return(false);
        }
 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 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;
                }
            }
        }
Ejemplo n.º 9
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();
            }
        }