public void viewCastleCallback(ViewCastle_ReturnType returnData) { if (returnData.Success) { int num = GameEngine.Instance.World.getSpecial(InterfaceMgr.Instance.SelectedVillage); this.closeControl(true); InterfaceMgr.Instance.getMainTabBar().selectDummyTab(6); int villageID = returnData.villageID; int campMode = 0; switch (num) { case 3: campMode = 1; villageID = -2; break; case 5: campMode = 2; villageID = -3; break; } GameEngine.Instance.InitCastleView(returnData.castleMapSnapshot, returnData.castleTroopsSnapshot, returnData.keepLevel, campMode, returnData.defencesLevel, villageID, returnData.landType); CastleMapBattlePanel2.fromWorld(); InterfaceMgr.Instance.castleBattleTimes(returnData.lastCastleTime, returnData.lastTroopTime); } }
public CastleMapBattlePanel2() { this.dockableControl = new DockableControl(this); this.InitializeComponent(); base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); base.SelfDrawBackground = true; Instance = this; }
public void viewCastleCallback(ViewCastle_ReturnType returnData) { if (returnData.Success) { this.closeControl(true); InterfaceMgr.Instance.getMainTabBar().selectDummyTab(6); GameEngine.Instance.InitCastleView(returnData.castleMapSnapshot, returnData.castleTroopsSnapshot, returnData.keepLevel, 0, returnData.defencesLevel, returnData.villageID, returnData.landType); CastleMapBattlePanel2.fromWorld(); InterfaceMgr.Instance.castleBattleTimes(returnData.lastCastleTime, returnData.lastTroopTime); } }
public void init(bool attackerVictory, BattleTroopNumbers startingTroops, BattleTroopNumbers endingTroops, int attackType, int villageID, GetReport_ReturnType returnData, CastleMapBattlePanel2 parent) { base.ShowClose = false; this.lblVillageName.Text = SK.Text("BattleResultPopup_Village_Name", "Village Name"); this.lblAttackType.Text = SK.Text("GENERIC_Attack_Type", "Attack Type"); this.btnClose.Text = SK.Text("GENERIC_Close", "Close"); this.btnMinimise.Text = SK.Text("BattleResultPopup_Minimise", "Minimise"); this.label1.Text = SK.Text("GENERIC_Peasants", "Peasants"); this.label2.Text = SK.Text("GENERIC_Archers", "Archers"); this.label3.Text = SK.Text("GENERIC_Pikemen", "Pikemen"); this.label4.Text = SK.Text("GENERIC_Swordsmen", "Swordsmen"); this.label11.Text = SK.Text("GENERIC_Attackers", "Attackers"); this.label12.Text = SK.Text("GENERIC_Defenders", "Defenders"); this.label6.Text = SK.Text("GENERIC_Catapults", "Catapults"); this.label5.Text = SK.Text("GENERIC_Captains", "Captains"); this.lblWolves.Text = SK.Text("GENERIC_Wolves", "Wolves"); this.btnShowResources.Text = SK.Text("GENERIC_Show_Resources", "Show Resources"); this.lblHonour.Text = SK.Text("GENERIC_Honour", "Honour"); this.lblSpoils.Text = SK.Text("GENERIC_Honour", "Honour"); this.lblResult.Text = SK.Text("BattleResultPopup_Defender_won", "The Defender Won"); base.Title = this.Text = SK.Text("BattleResultPopup_Battle_Results", "Battle Results"); this.showPostTutorialThingy = false; if (returnData == null) { returnData = new GetReport_ReturnType(); returnData.successStatus = true; returnData.genericData11 = 0x18; returnData.reportType = 0x4f; returnData.genericData20 = -1; returnData.reportTime = DateTime.Now; List<int> list = GameEngine.Instance.World.getUserVillageIDList(); if (list.Count > 0) { returnData.defendingVillage = list[0]; } this.showPostTutorialThingy = true; } m_parent = parent; this.m_villageID = villageID; this.m_reportReturnData = returnData; this.lblAttackersPeasants.Text = endingTroops.numAttackingPeasants.ToString() + "/" + startingTroops.numAttackingPeasants.ToString() + "\n"; this.lblAttackersArchers.Text = endingTroops.numAttackingArchers.ToString() + "/" + startingTroops.numAttackingArchers.ToString() + "\n"; this.lblAttackersPikemen.Text = endingTroops.numAttackingPikemen.ToString() + "/" + startingTroops.numAttackingPikemen.ToString() + "\n"; this.lblAttackersSwordsmen.Text = endingTroops.numAttackingSwordsmen.ToString() + "/" + startingTroops.numAttackingSwordsmen.ToString() + "\n"; if (((!attackerVictory && (endingTroops.numAttackingPeasants == 0)) && ((endingTroops.numAttackingArchers == 0) && (endingTroops.numAttackingPikemen == 0))) && (endingTroops.numAttackingSwordsmen == 0)) { endingTroops.numAttackingCatapults = 0; } this.lblAttackersCatapults.Text = endingTroops.numAttackingCatapults.ToString() + "/" + startingTroops.numAttackingCatapults.ToString() + "\n"; this.lblAttackersCaptains.Text = endingTroops.numAttackingCaptains.ToString() + "/" + startingTroops.numAttackingCaptains.ToString() + "\n"; this.lblDefendersPeasants.Text = endingTroops.numDefendingPeasants.ToString() + "/" + startingTroops.numDefendingPeasants.ToString() + "\n"; this.lblDefendersArchers.Text = endingTroops.numDefendingArchers.ToString() + "/" + startingTroops.numDefendingArchers.ToString() + "\n"; this.lblDefendersPikemen.Text = endingTroops.numDefendingPikemen.ToString() + "/" + startingTroops.numDefendingPikemen.ToString() + "\n"; this.lblDefendersSwordsmen.Text = endingTroops.numDefendingSwordsmen.ToString() + "/" + startingTroops.numDefendingSwordsmen.ToString(); this.lblDefendersCaptains.Text = endingTroops.numDefendingCaptains.ToString() + "/" + startingTroops.numDefendingCaptains.ToString(); if (returnData.reportType == 0x18) { this.lblVillageName.Text = SK.Text("GENERIC_Bandit_Camp", "Bandit Camp"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x19) { this.lblVillageName.Text = SK.Text("GENERIC_Wolf_Camp", "Wolf Lair"); this.lblWolves.Visible = true; this.lblDefendersArchers.Visible = false; this.lblDefendersPikemen.Visible = false; this.lblDefendersSwordsmen.Visible = false; this.lblDefendersCaptains.Visible = false; this.lblDefendersPeasants.Text = endingTroops.numDefendingSwordsmen.ToString() + "/" + startingTroops.numDefendingSwordsmen.ToString(); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x3a) { this.lblVillageName.Text = SK.Text("GENERIC_Rats_Castle", "Rat's Castle"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x3b) { this.lblVillageName.Text = SK.Text("GENERIC_Snakes_Castle", "Snake's Castle"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 60) { this.lblVillageName.Text = SK.Text("GENERIC_Pigs_Castle", "Pig's Castle"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x3d) { this.lblVillageName.Text = SK.Text("GENERIC_Wolfs_Castle", "Wolf's Castle"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x7b) { this.lblVillageName.Text = SK.Text("GENERIC_Paladin_Castle", "Paladin's Castle"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x7c) { this.lblVillageName.Text = SK.Text("GENERIC_Paladin_Castle", "Paladin's Castle"); this.lblAttackType.Text = ""; } else if (returnData.reportType == 0x7d) { string[] strArray = new string[] { SK.Text("GENERIC_Treasure_Castle", "Treasure Castle"), " ", SK.Text("GENERIC_TREASURE_CASTLE_LEVEL", "Level"), " : ", (returnData.genericData31 + 1).ToString() }; this.lblVillageName.Text = string.Concat(strArray); this.lblAttackType.Text = ""; } else { this.lblVillageName.Text = GameEngine.Instance.World.getVillageName(villageID); this.lblAttackType.Text = CastlesCommon.getAttackTypeLabel(attackType); } if (returnData == null) { returnData = new GetReport_ReturnType(); } string otherUser = returnData.otherUser; string str2 = ""; string str3 = SK.Text("GENERIC_The_Attacker_Wins", "The Attacker Wins"); string str4 = ""; NumberFormatInfo nFI = GameEngine.NFI; string reportAboutUser = returnData.reportAboutUser; if ((reportAboutUser == null) || (reportAboutUser.Length == 0)) { reportAboutUser = RemoteServices.Instance.UserName; } this.btnShowResources.Visible = false; switch (returnData.reportType) { case 1: str2 = reportAboutUser + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")"; if (otherUser.Length != 0) { string text1 = otherUser + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")"; break; } SK.Text("GENERIC_An_Empty_Village", "An empty village"); break; case 3: case 0x3e: case 0x3f: case 0x40: case 0x41: case 0x4f: this.lblSpoils.Text = ""; this.lblHonour.Text = ""; switch (returnData.reportType) { case 0x3e: str2 = SK.Text("GENERIC_CharacterName_Rat", "Rat"); break; case 0x3f: str2 = SK.Text("GENERIC_CharacterName_Snake", "Snake"); break; case 0x40: str2 = SK.Text("GENERIC_CharacterName_Pig", "Pig"); break; case 0x41: str2 = SK.Text("GENERIC_CharacterName_Wolf", "Wolf"); break; case 0x4f: str2 = SK.Text("GENERIC_CharacterName_The_Enemy", "The Enemy"); break; case 3: if (otherUser.Length == 0) { str2 = SK.Text("GENERIC_An_Unknown_Player", "An Unknown Player"); } else { str2 = otherUser; } str2 = str2 + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")"; break; } if (returnData.genericData11 < 0) { this.lblHonour.Text = SK.Text("GENERIC_Honour_Cost", "Honour Cost") + " : " + returnData.genericData11.ToString("N", nFI); } else { this.lblHonour.Text = SK.Text("GENERIC_Honour", "Honour") + " : " + returnData.genericData11.ToString("N", nFI); } if (otherUser.Length == 0) { SK.Text("GENERIC_An_Empty_Village", "An empty village"); } else { string text2 = reportAboutUser + " (" + GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + ")"; } if (returnData.successStatus) { str3 = SK.Text("GENERIC_The_Defender_Wins", "The Defender Wins"); } else if ((returnData.genericData20 == 0) && (returnData.genericData21 >= 0)) { if ((returnData.genericData30 == 11) || (returnData.genericData30 == 13)) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Was_Attacked", "Was attacked"); } else { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Captured", "Captured"); } } else if ((returnData.genericData20 == 10) && (returnData.genericData21 >= 0)) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Made_a_Vassal", "Made a vassal"); } else if ((returnData.genericData20 == 5) && (returnData.genericData21 >= 0)) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Has_Been_Razed", "Has been razed"); } else if (returnData.genericData20 == 6) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Has_Been_Raided", "Has been raided"); this.lblSpoils.Text = returnData.genericData21.ToString("N", nFI) + " " + SK.Text("GENERIC_Gold_Raided", "Gold raided"); } else { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Was_Attacked", "Was attacked"); } if (returnData.genericData20 == 2) { this.lblSpoils.Text = ((((((((returnData.genericData22 + returnData.genericData23) + returnData.genericData24) + returnData.genericData25) + returnData.genericData26) + returnData.genericData27) + returnData.genericData28) + returnData.genericData29)).ToString("N", nFI) + " " + SK.Text("GENERIC_Resources_Lost", "Resources lost"); this.btnShowResources.Visible = true; } else if (returnData.genericData20 > 0x3e8) { if (returnData.genericData22 >= 0) { this.lblSpoils.Text = VillageBuildingsData.getBuildingName(returnData.genericData22); } if (returnData.genericData23 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData23); } if (returnData.genericData24 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData24); } if (returnData.genericData25 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData25); } if (returnData.genericData26 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData26); } if (returnData.genericData27 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData27); } if (returnData.genericData28 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData28); } if (returnData.genericData29 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData29); } this.lblSpoils.Text = this.lblSpoils.Text + " - " + SK.Text("GENERIC_Destroyed", "Destroyed"); } else if (returnData.genericData20 == 0x3e8) { this.lblSpoils.Text = SK.Text("GENERIC_You_Had_No_buildings_Destroyed", "You had no buildings that could be destroyed."); } else if (returnData.genericData20 == 1) { this.lblSpoils.Text = SK.Text("GENERIC_The_Attack_Failed", "The attack failed."); } goto Label_16A2; case 0x18: case 0x19: case 0x3a: case 0x3b: case 60: case 0x3d: case 0x7b: case 0x7c: case 0x7d: str2 = reportAboutUser + " (" + GameEngine.Instance.World.getVillageName(returnData.attackingVillage) + ")"; switch (returnData.reportType) { case 0x18: SK.Text("GENERIC_A_Bandit_Camp", "A Bandit Camp"); break; case 0x19: SK.Text("GENERIC_A_Wolf_Lair", "A Wolf Lair"); break; case 0x3a: SK.Text("GENERIC_Rats_Castle", "Rat's Castle"); break; case 0x3b: SK.Text("GENERIC_Snakes_Castle", "Snake's Castle"); break; case 60: SK.Text("GENERIC_Pigs_Castle", "Pig's Castle"); break; case 0x3d: SK.Text("GENERIC_Wolfs_Castle", "Wolf's Castle"); break; case 0x7b: SK.Text("GENERIC_Paladin_Castle", "Paladin's Castle"); break; case 0x7c: SK.Text("GENERIC_Paladin_Castle", "Paladin's Castle"); break; case 0x7d: SK.Text("GENERIC_Treasure_Castle", "Treasure Castle"); break; } this.lblSpoils.Text = ""; this.lblHonour.Text = SK.Text("GENERIC_Honour", "Honour") + " : " + returnData.genericData11.ToString("N", nFI); if (!returnData.successStatus) { str3 = SK.Text("GENERIC_The_Defender_Wins", "The Defender Wins"); } else if (((returnData.reportType == 0x7d) && (returnData.genericData20 >= 700)) && (returnData.genericData20 < 710)) { this.lblHonour.Text = ""; switch (returnData.genericData20) { case 700: str4 = SK.Text("REPORTS_TreasureWheelSpins1", "Treasure Found : Tier 1 Wheel Spin"); break; case 0x2bd: str4 = SK.Text("REPORTS_TreasureWheelSpins2", "Treasure Found : Tier 2 Wheel Spin"); break; case 0x2be: str4 = SK.Text("REPORTS_TreasureWheelSpins3", "Treasure Found : Tier 3 Wheel Spin"); break; case 0x2bf: str4 = SK.Text("REPORTS_TreasureWheelSpins4", "Treasure Found : Tier 4 Wheel Spin"); break; case 0x2c0: str4 = SK.Text("REPORTS_TreasureWheelSpins5", "Treasure Found : Tier 5 Wheel Spin"); break; } } if (returnData.genericData21 == 1) { } goto Label_16A2; default: goto Label_16A2; } this.lblSpoils.Text = ""; if (!returnData.successStatus) { str3 = SK.Text("GENERIC_The_Defender_Wins", "The Defender Wins"); } else if ((returnData.genericData20 == 0) && (returnData.genericData21 >= 0)) { if ((returnData.genericData30 == 11) || (returnData.genericData30 == 13)) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Successfully_Attacked", "Successfully attacked"); } else { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Captured", "Captured"); } } else if ((returnData.genericData20 == 10) && (returnData.genericData21 >= 0)) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Made_a_Vassal", "Made a vassal"); } else if ((returnData.genericData20 == 5) && (returnData.genericData21 >= 0)) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Has_Been_Razed", "Has been razed"); } else if (returnData.genericData20 == 6) { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Has_Been_Raided", "Has been raided"); this.lblSpoils.Text = returnData.genericData21.ToString("N", nFI) + " " + SK.Text("GENERIC_Gold_Raided", "Gold raided"); } else { str4 = GameEngine.Instance.World.getVillageName(returnData.defendingVillage) + " - " + SK.Text("GENERIC_Successfully_Attacked", "Successfully attacked"); } if (returnData.genericData11 < 0) { this.lblHonour.Text = SK.Text("GENERIC_Honour_Cost", "Honour Cost") + " : " + returnData.genericData11.ToString("N", nFI); } else { this.lblHonour.Text = SK.Text("GENERIC_Honour", "Honour") + " : " + returnData.genericData11.ToString("N", nFI); } if (returnData.genericData20 != 0) { if (returnData.genericData20 == 2) { this.lblSpoils.Text = ((((((((returnData.genericData22 + returnData.genericData23) + returnData.genericData24) + returnData.genericData25) + returnData.genericData26) + returnData.genericData27) + returnData.genericData28) + returnData.genericData29)).ToString("N", nFI) + " " + SK.Text("GENERIC_Resources_Taken", "Resources taken"); this.btnShowResources.Visible = true; } else if (returnData.genericData20 > 0x3e8) { if (returnData.genericData22 >= 0) { this.lblSpoils.Text = VillageBuildingsData.getBuildingName(returnData.genericData22); } if (returnData.genericData23 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData23); } if (returnData.genericData24 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData24); } if (returnData.genericData25 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData25); } if (returnData.genericData26 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData26); } if (returnData.genericData27 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData27); } if (returnData.genericData28 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData28); } if (returnData.genericData29 >= 0) { this.lblSpoils.Text = this.lblSpoils.Text + ", " + VillageBuildingsData.getBuildingName(returnData.genericData29); } this.lblSpoils.Text = this.lblSpoils.Text + " - " + SK.Text("GENERIC_Destroyed", "Destroyed"); } else if (returnData.genericData20 == 0x3e8) { this.lblSpoils.Text = SK.Text("GENERIC_No_Destroyable_Buildings", "There were no destroyable buildings."); } else if (returnData.genericData20 == 1) { this.lblSpoils.Text = SK.Text("GENERIC_Attack_Failed", "This attack failed."); } } Label_16A2: this.lblResult.Text = str3; this.lblDate.Text = returnData.reportTime.ToString(); this.lblTargetVillageNameAndInfo.Text = str4; this.lblDate.Text = this.m_reportReturnData.reportTime.ToString(); }