protected void Page_Load(object sender, EventArgs e) { inPage p = (inPage)this.Master; village = p.CurrentVillage; int village_id; int.TryParse(Request["village"], out village_id); if (village_id == 0) { Response.Redirect("village.aspx?id=" + this.village.ToString(), true); return; } ISession session = (ISession)Context.Items[Constant.NHibernateSessionSign]; target = session.Get<Village>(village_id); if (target == null) { this.pHasVillage.Visible = false; this.pVillageNotFound.Visible = true; return; } this.pHasVillage.Visible = true; this.pVillageNotFound.Visible = false; if (this.target.Player.ID == (int)Session["user"]) this.pIsOwner.Visible = true; else this.pIsOwner.Visible = false; }
protected void ibAdd_Click(object sender, ImageClickEventArgs e) { GridViewRow gvr = ((GridViewRow)(((ImageButton)(sender)).NamingContainer)); string name = ((TextBox)gvr.FindControl("txtName")).Text; int districtId = Convert.ToInt32(((DropDownList)gvr.FindControl("ddlDistrict")).SelectedValue); int tehsilId = Convert.ToInt32(((DropDownList)gvr.FindControl("ddlTehsil")).SelectedValue); Village fd = new Village(); fd.VillageName = name; fd.TehsilId = tehsilId; try { vMethods.Add(fd); BindGrid(); js.ShowAlert(this, "Village created succesfully!"); } catch (Exception ex) { if (ex.InnerException.InnerException.Message.Contains("UNIQUE")) { js.ShowAlert(this, "Village already exists! Please try another name."); } else { js.ShowAlert(this, ex.Message); } } }
void Start() { rank = UnitRank.Knight; //Debug.Log("Knight Start has been called"); // Get current tile position CurrentTile = transform.GetComponentInParent<Tile>(); //Debug.Log ("CurrentTile : "+CurrentTile); //this will find the village associated with this Knight, which will be the variable home. PathFind = transform.gameObject.GetComponentInParent<PathFinding>(); List<Tile> tiles = PathFind.GetTiles(CurrentTile); //Debug.Log (tiles.Count); foreach (Tile t in tiles) { if (t.HasVillage) { Home = t.Village.transform.GetComponent<Village>(); } } _neutral = false; _home = false; _enemy = false; _water = false; // TODO: Test purposes only CurrentTile.HasKnight = true; //Debug.Log(CurrentTile); Glow = transform.FindChild("Glow").gameObject; }
public Baths(Village v) : base(v) { Name = "Thermes"; Hp = MaxHp = 50; this.CostPrice = 500; }
public Brothel(Village v) : base(v) { Name = "Maison Close"; Hp = MaxHp = 50; this.CostPrice = 300; }
protected void Page_Load(object sender, EventArgs e) { current = ((inPage)(this.Master)).CurrentVillage; this.NHibernateSession = ((inPage)(this.Master)).NHibernateSession; Player currentPlayer = this.NHibernateSession.Load<Player>(Session["user"]); this.pSpears.Visible = (this.current.VillageTroopData.SpearInVillage != 0); this.pAxe.Visible = (this.current.VillageTroopData.AxeInVillage != 0); this.pSword.Visible = (this.current.VillageTroopData.SwordInVillage != 0); this.pScout.Visible = (this.current.VillageTroopData.ScoutInVillage != 0); this.pLight.Visible = (this.current.VillageTroopData.LightCavalry != 0); this.pHeavy.Visible = (this.current.VillageTroopData.HeavyCavalry != 0); this.pRam.Visible = (this.current.VillageTroopData.RamInVillage != 0); this.pCatapult.Visible = (this.current.VillageTroopData.CatapultInVillage != 0); this.pNoble.Visible = (this.current.VillageTroopData.NobleInVillage != 0); if (currentPlayer.GraphicalVillage) { GraphicVillageInfo pGraphicVillageInfo = (GraphicVillageInfo)Page.LoadControl("GraphicVillageInfo.ascx"); pGraphicVillageInfo.CurrentVillage = current; pGraphicVillageInfo.DisplayBuildingLevel = currentPlayer.ShowBuildingLevel; this.pVillageInfo.Controls.Add(pGraphicVillageInfo); return; } else { TextVillageInfo pTextVillageInfo = (TextVillageInfo)Page.LoadControl("TextVillageInfo.ascx"); pTextVillageInfo.CurrentVillage = current; this.pVillageInfo.Controls.Add(pTextVillageInfo); return; } }
protected void Page_Load(object sender, EventArgs e) { inPage p = (inPage)this.Master; village = p.CurrentVillage; int iType = 0; int.TryParse(Request["type"], out iType); PlayerSettingType type = PlayerSettingFactory.GetPlayerSettingType(iType); this.tbProfileType.Rows[(int)type].Cells[0].Attributes.Add("class", "selected"); switch (type) { case PlayerSettingType.Email: ChangeEmailAddress ucChangeEmailAddress = (ChangeEmailAddress)Page.LoadControl("ChangeEmailAddress.ascx"); this.pProfile.Controls.Add(ucChangeEmailAddress); return; break; case PlayerSettingType.ChangePassword: ChangePassword ucChangePassword = (ChangePassword)Page.LoadControl("ChangePassword.ascx"); this.pProfile.Controls.Add(ucChangePassword); return; break; default: UserProfile ucUserProfile = (UserProfile)Page.LoadControl("UserProfile.ascx"); this.pProfile.Controls.Add(ucUserProfile); return; break; } }
protected void Page_Load(object sender, EventArgs e) { inPage p = (inPage)this.Master; village = p.CurrentVillage; int player_id = 0; int.TryParse(Request["player"], out player_id); if (player_id == 0) { this.pUserExists.Visible = false; this.pUserNotFound.Visible = true; return; } ISession session = (ISession)Context.Items[Constant.NHibernateSessionSign]; this.player = session.Get<Player>(player_id); if (this.player == null) { this.pUserExists.Visible = false; this.pUserNotFound.Visible = true; return; } this.pUserNotFound.Visible = false; this.pUserExists.Visible = true; this.gvVillages.DataSource = this.player.Villages; System.Web.UI.WebControls.HyperLinkField field = (HyperLinkField)this.gvVillages.Columns[0]; field.DataNavigateUrlFormatString = "village_info.aspx?id=" + this.village.ID.ToString() + "&village={0}"; this.gvVillages.DataBind(); this.pSelf.Visible = (this.player.ID == (int)Session["user"]); }
public ReportTableRow(Village village, Report report) { _report = report; if (village == report.Defender.Village) { _village = report.Defender.Village; _villageOther = report.Attacker.Village; } else { _village = report.Attacker.Village; _villageOther = report.Defender.Village; } Cells.Add(new Cell(string.Empty, Report.GetCircleImage(report))); Cells.Add(new Cell(string.Empty, Report.GetInfoImage(report))); Cells.Add(new Cell(_village.LocationString)); if (_village.HasPlayer) { Cells.Add(new Cell(_village.Player.Name)); } else { Cells.Add(new Cell()); } Cells.Add(new Cell(report.Date)); }
void Start () { rank = UnitRank.Peasant; CurrentTile = transform.GetComponentInParent<Tile>(); // This will find the village associated with this peasant, which will be the variable home. PathFind = transform.gameObject.GetComponentInParent<PathFinding>(); List<Tile> tiles = PathFind.GetTiles(CurrentTile); foreach (Tile t in tiles) { if (t.HasVillage) { Home = t.Village.transform.GetComponent<Village>(); } } _neutral = false; _home = false; _enemy = false; _water = false; CurrentTile.HasPeasant = true; Glow = transform.FindChild("Glow").gameObject; // Box = transform.FindChild("IsBusy").gameObject; Box.SetActive(false); }
public ChurchInfo(Village village, int churchLevel, Color color) { Village = village; ChurchLevel = churchLevel; Color = color; Transparancy = 50; }
public OfferingWarehouse(Village v) : base(v) { Name = "Sanctuaire"; Hp = MaxHp = 50; this.CostPrice = 150; }
public PartyRoom(Village v) : base(v) { Name = "Salle des Fêtes"; Hp = MaxHp = 50; this.CostPrice = 250; }
public Theater(Village v) : base(v) { Name = "Théâtre"; Hp = MaxHp = 50; this.CostPrice = 650; }
public void initializeCannon(Village v, GameObject cannonPrefab) { Tile tileAt = v.getLocatedAt (); GameObject newCannon = Network.Instantiate(cannonPrefab, new Vector3(tileAt.point.x, 0.15f, tileAt.point.y), tileAt.transform.rotation, 0) as GameObject; Unit u = newCannon.GetComponent<Unit>(); Tile toplace = null; foreach (Tile a in tileAt.getNeighbours()) { if(a.prefab == null && a.getOccupyingUnit() == null && a.getColor() == tileAt.getColor()) { toplace = a; } } if(toplace == null) { toplace = tileAt; } gameObject.networkView.RPC ("moveUnitPrefabNet",RPCMode.AllBuffered,u.networkView.viewID,new Vector3(toplace.point.x, 0.15f, toplace.point.y)); u.networkView.RPC ("setLocationNet", RPCMode.AllBuffered, toplace.networkView.viewID); u.networkView.RPC ("setUnitTypeNet", RPCMode.AllBuffered, (int)UnitType.CANNON); u.networkView.RPC ("setVillageNet", RPCMode.AllBuffered, v.networkView.viewID); u.networkView.RPC ("setActionNet", RPCMode.AllBuffered, (int)UnitActionType.ReadyForOrders); u.getLocation ().networkView.RPC ("setOccupyingUnitNet", RPCMode.AllBuffered, u.networkView.viewID); v.gameObject.networkView.RPC("addGoldNet", RPCMode.AllBuffered, -35); v.gameObject.networkView.RPC("addWoodNet", RPCMode.AllBuffered, -12); v.gameObject.networkView.RPC("addUnitNet", RPCMode.AllBuffered, newCannon.networkView.viewID); }
internal Village GetEntity() { Village v = new Village { Name = name, Confidence = 0 }; v.Id = id; v.Position = new Location(x, y); return v; }
public TablePlace(Village v) : base(v) { Name = "Autel sacré"; Hp = MaxHp = 100000; this.CostPrice = 0; }
protected void Page_Load(object sender, EventArgs e) { this.Village = ((inPage)(this.Master)).CurrentVillage; if (this.Village[BuildingType.Academy] > 0) this.pConstructed.Visible = true; else this.pNotConstruct.Visible = true; switch (Request["page"]) { case "create": CreateHero pCreateHero = (CreateHero)Page.LoadControl(@"CreateHero.ascx"); pCreateHero.Village = this.Village; this.tblMenu.Rows[1].Cells[0].Attributes.Add("class", "selected"); this.heroPanel.Controls.Add(pCreateHero); break; case "details": HeroDetails pHeroDetails = (HeroDetails)Page.LoadControl(@"HeroDetails.ascx"); pHeroDetails.Village = this.Village; this.tblMenu.Rows[0].Cells[0].Attributes.Add("class", "selected"); this.heroPanel.Controls.Add(pHeroDetails); break; default: HeroList pHeroList = (HeroList)Page.LoadControl(@"HeroList.ascx"); pHeroList.Village = this.Village; this.tblMenu.Rows[0].Cells[0].Attributes.Add("class", "selected"); this.heroPanel.Controls.Add(pHeroList); break; } }
//constructor public static Unit CreateComponent( UnitType unitType, Tile location, Village v, GameObject PeasantPrefab ) { Tile toplace = null; foreach (Tile a in location.getNeighbours()) { if(a.prefab == null && a.getOccupyingUnit() == null && a.getColor() == location.getColor()) { toplace = a; } } if(toplace == null) { toplace = location; } GameObject o = Instantiate(PeasantPrefab, new Vector3(toplace.point.x, 0.15f, toplace.point.y), toplace.transform.rotation) as GameObject; Unit theUnit = o.AddComponent<Unit>(); theUnit.locatedAt = toplace; theUnit.myType = unitType; theUnit.myVillage = v; theUnit.myAction = UnitActionType.ReadyForOrders; location.setOccupyingUnit (theUnit); return theUnit; }
/// <summary> /// Shows the time in the Distance buttons for the specified villages and speed /// </summary> public void ShowTime(Village start, Village end, ShowDistanceEnum speed) { if (start != null && end != null) { TimeSpan time = Village.TravelTime(start, end, Unit); switch (speed) { case ShowDistanceEnum.ArrivalTime: Text = Tools.Common.GetShortPrettyDate(World.Default.Settings.ServerTime.Add(time)); break; case ShowDistanceEnum.ReturnTime: Text = Tools.Common.GetShortPrettyDate(World.Default.Settings.ServerTime.Add(time + time)); break; case ShowDistanceEnum.TravelTime: Text = time.ToString(); break; case ShowDistanceEnum.TravelTime2: Text = (time + time).ToString(); break; } } else { Text = ""; } }
static void RepairAll(Village v) { foreach (Buildings.BuildingsModel b in v.BuildingsList) { b.Repair(b.MaxHp); } }
public AttackPlanFrom(AttackPlan plan, Village attacker, Unit slowestUnit) { Debug.Assert(slowestUnit != null); Plan = plan; Attacker = attacker; SlowestUnit = slowestUnit; }
public Tavern(Village v) : base(v) { CostPrice = 100; Name = "Taverne"; Hp = MaxHp = 50; this.CostPrice = 250; }
public VillageModel(Village v) { id = v.Id; name = v.Name; //Owner = v.OwnerId; x = v.Position.X; y = v.Position.Y; }
protected void Page_Load(object sender, EventArgs e) { inPage p = (inPage)this.Master; this.Village = p.CurrentVillage; if (this.Village[BuildingType.Farm] > 0) this.pConstructed.Visible = true; else this.pNotConstruct.Visible = true; }
public Forge(Village v, JobsModel job) : base(v) { Name = "Forge"; _name = Name; Hp = MaxHp = 50; _job = job; this.CostPrice = 100; }
protected void Page_Load(object sender, EventArgs e) { village = ((inPage)this.Master).CurrentVillage; ISession session; if (this.IsPostBack) { this.x = (int)ViewState["x"]; this.y = (int)ViewState["y"]; return; } int target = 0; int.TryParse(Request["target"], out target); int.TryParse(Request["x"], out this.x); int.TryParse(Request["y"], out this.y); IList<Village> villages = null; session = (ISession)Context.Items["NHibernateSession"]; // x!=0 và y!=0 => center x,y // x hoặc y = 0, target = 0 => center this village // x hoặc y =0, target !=0, targetVillage != null => center targetVillage // x hoặc y =0, target !=0, targetVillage == null => center this village if (this.x != 0 && this.y != 0) { villages = beans.Map.GetMap(this.x, this.y, session); this.targetVillage = this.village; } else if (target == 0) { villages = beans.Map.GetMap(this.village, session); this.targetVillage = this.village; this.x = targetVillage.X; this.y = targetVillage.Y; } else { targetVillage = session.Get<Village>(target); if (targetVillage == null) targetVillage = this.village; villages = beans.Map.GetMap(targetVillage, session); this.x = targetVillage.X; this.y = targetVillage.Y; } ViewState["x"] = this.x; ViewState["y"] = this.y; IList<Point> villageCoordinates = new List<Point>(villages.Count); foreach (Village v in villages) villageCoordinates.Add(new Point(7 + v.X - this.x, 7 + v.Y - this.y)); this.FillMap(villages, villageCoordinates); }
protected void Page_Load(object sender, EventArgs e) { current = ((inPage)(this.Master)).CurrentVillage; if (this.current[BuildingType.ClayPit] > 0) this.pConstructed.Visible = true; else this.pNotConstruct.Visible = true; }
public MilitaryCamp(Village v, JobsModel job) : base(v) { Name = "QG"; _name = Name; Hp = MaxHp = 50; _job = job; this.CostPrice = 800; }
public Restaurant(Village v, JobsModel job) : base(v) { Name = "Restaurant"; _name = Name; Hp = MaxHp = 50; _job = job; this.CostPrice = 400; }
public static List <string> SetPrereqCombo(Account acc, Village vill) { var ret = new List <string>(); for (int i = 5; i <= 45; i++) // Go through each building { var building = (BuildingEnum)i; // Don't show these buildings: if (building == BuildingEnum.GreatWarehouse || building == BuildingEnum.GreatGranary ) { continue; } if (vill.Build.Buildings.Any(x => x.Type == building)) { continue; } if (vill.Build.Tasks.Any(x => x.Building == building)) { continue; } (var reqTribe, var prerequisites) = BuildingsData.GetBuildingPrerequisites((BuildingEnum)i); if (reqTribe != TribeEnum.Any && reqTribe != acc.AccInfo.Tribe) { continue; } ret.Add(building.ToString()); } return(ret); }
public void PacifyVillage(Village village, IEnumerable <global::Empire> empiresWhichHelpedPacification = null) { SimulationDescriptor value = this.SimulationDescriptorDatabase.GetValue(BarbarianCouncil.VillageStatusPacified); village.SwapDescriptor(value); if (!village.HasBeenPacified) { village.HasBeenPacified = true; SimulationDescriptor value2 = this.SimulationDescriptorDatabase.GetValue(Village.PacifiedVillage); if (value2 != null) { Diagnostics.Assert(village.PointOfInterest != null); village.PointOfInterest.SwapDescriptor(value2); village.SwapDescriptor(value2); } for (int i = village.StandardUnits.Count - 1; i >= 0; i--) { Unit unit = village.StandardUnits[i]; this.GameEntityRepositoryService.Unregister(unit); village.RemoveUnit(unit); unit.Dispose(); } if (empiresWhichHelpedPacification != null) { foreach (global::Empire empire in empiresWhichHelpedPacification) { this.EventService.Notify(new EventVillagePacified(empire, village)); } } if (village.Converter != null && village.Converter.ConvertedVillages != null) { DepartmentOfTheInterior.ClearFIMSEOnConvertedVillage(village.Converter, village.PointOfInterest); village.Converter.RemoveConvertedVillage(village); village.Converter = null; } } }
private static bool CheckExcludeCrop(Village vill, BuildingTask task) { foreach (var res in vill.Build.Buildings.Where(x => x.Type == BuildingEnum.Woodcutter)) { if (res.Level < task.Level) { if (res.Level == task.Level - 1 && res.UnderConstruction) { continue; //if on level below + is being upgraded to that lvl } return(false); } } foreach (var res in vill.Build.Buildings.Where(x => x.Type == BuildingEnum.ClayPit)) { if (res.Level < task.Level) { if (res.Level == task.Level - 1 && res.UnderConstruction) { continue; //if on level below + is being upgraded to that lvl } return(false); } } foreach (var res in vill.Build.Buildings.Where(x => x.Type == BuildingEnum.IronMine)) { if (res.Level < task.Level) { if (res.Level == task.Level - 1 && res.UnderConstruction) { continue; //if on level below + is being upgraded to that lvl } return(false); } } return(true); }
/// <summary> /// Returns nearest villages to the player /// </summary> /// <param name="villagesCount"> /// Limiter for the output /// </param> /// <param name="onlyAllowed"> /// Boolean that represents if function won't return the villages that /// player cannot visit yet, since it's too far. /// </param> /// <returns> /// List of the nearest villages /// </returns> public IList <Village> GetNearestVillages(int villagesCount, bool onlyAllowed = true) { // Cache current village Village currentVillage = this.CurrentVillage; // Ref list of all villages IList <Village> allVillages = Program.Villages.Villages; // Sort villages by distance List <Village> sortedVillages = allVillages .OrderByDescending(ma => ma.GetDistanceTo(currentVillage)) .ToList(); // Remove current village // Always on the first position, so can use .Skip, but this is safer. sortedVillages.Remove(currentVillage); // Process only allowed villages (villages that player can go to and survive) if (onlyAllowed) { // Make a duplication of the sortedVillages to prevent memory bleeding IList <Village> sortedVillagesOld = sortedVillages.ToList(); // Can be replaced with a LINQ expression (.Where) foreach (Village village in sortedVillagesOld) { // Check if player can travel if (!CanTravelTo(village)) { sortedVillages.Remove(village); } } } // Return [villagesCount] villages return(sortedVillages.Take(villagesCount).ToList()); }
//sets destination to nearest village //when destination is reached gather resources private void Gathering(StateController controller) { //Debug.Log("GatherAction ?? " + destinationSet + "helo"); //if(!destinationSet) SetVillageDestination(controller); // checking if navmesh agent is at destination if (ArrivedAtLocation(controller)) { if (controller.targetLocation != null) { destinationSet = false; Village v = (Village)controller.targetLocation; v.AIGather(controller.self); // Debug.Log("enemy at targte destination of : " + controller.targetLocation.ToString()); //clearing village CDlist if exceeds a random amount int rand = UnityEngine.Random.Range(1, controller.villageList.Count); if (controller.villageCDlist.Count > rand) { controller.villageCDlist.Clear(); } controller.villageCDlist.Add(v); } } }
private void game_menu_tellstories_village_on_consequence(MenuCallbackArgs args) { Village village = Settlement.CurrentSettlement.Village; if (!_villagesToldTo.ContainsKey(village)) { _villagesToldTo.Add(village, new ToldStoriesTo()); } if (_villagesToldTo[village]._hasToldStories == false) { DoTellStories(_villagesToldTo[village]); } else if (_villagesToldTo[village]._hasToldStories) { if (CampaignTime.Now >= _villagesToldTo[village]._daysToResetStories) { DoTellStories(_villagesToldTo[village]); } else { InformationManager.DisplayMessage(new InformationMessage("You have already told war stories to these villagers today, come back on " + _villagesToldTo[village]._daysToResetStories)); } } }
public static void OffVillagePlan(Account acc, Village vill) { DeffVillagePlan(acc, vill); BuildingHelper.AddBuildingTask(acc, vill, new BuildingTask() { TaskType = BuildingHelper.BuildingType.General, Building = Classificator.BuildingEnum.Academy, Level = 15 }); BuildingHelper.AddBuildingTask(acc, vill, new BuildingTask() { TaskType = BuildingHelper.BuildingType.General, Building = Classificator.BuildingEnum.Stable, Level = 20 }); BuildingHelper.AddBuildingTask(acc, vill, new BuildingTask() { TaskType = BuildingHelper.BuildingType.General, Building = Classificator.BuildingEnum.Workshop, Level = 1 }); BuildingHelper.AddBuildingTask(acc, vill, new BuildingTask() { TaskType = BuildingHelper.BuildingType.General, Building = Classificator.BuildingEnum.RallyPoint, Level = 15 }); BuildingHelper.AddBuildingTask(acc, vill, new BuildingTask() { TaskType = BuildingHelper.BuildingType.General, Building = Classificator.BuildingEnum.TournamentSquare, Level = 1 }); }
public void Run() { //tries eevery loc Alst = new Village("Alst", false); Schvenig = new Village("Schvenig", false); Wessig = new Village("Wessig", false); // TO DO: Complete this section Uster = new Village("Uster", true); Badden = new Village("badden", false); Maeland = new Village("Maeland", false); Helmholtz = new Village("Helmholtz", false); Alst.VillageSetup(0, Schvenig, Wessig); Schvenig.VillageSetup(14, Maeland, Helmholtz); // TO DO: Complete this section Wessig.VillageSetup(19, Uster, Badden); Uster.VillageSetup(28, null, null); Badden.VillageSetup(11, null, null); Maeland.VillageSetup(9, null, null); Helmholtz.VillageSetup(28, null, null); this.TraverseVillages(Alst); this.Announcement(); }
public void BuyVillage(Village village) { if (village.playerNumber == 1 && village.cost <= gm.player1Gold) { player1Menu.SetActive(false); gm.player1Gold -= village.cost; } else if (village.playerNumber == 2 && village.cost <= gm.player2Gold) { player2Menu.SetActive(false); gm.player2Gold -= village.cost; } else { print("NOT ENOUGH GOLD, SORRY!"); return; } gm.UpdateGoldText(); gm.createdVillage = village; DeselectUnit(); SetCreatableTiles(); }
public async Task <Village> CreateVillageAsync(string name) { if (string.IsNullOrEmpty(name)) { return(null); } if (!IsVillageExists(name)) { var village = new Village { Name = name }; await this.context.Villages.AddAsync(village); return(village); } else { return(this.context.Villages.FirstOrDefault(x => x.Name == name)); } }
public async Task <Result> DeleteVillageAsync(VillageModel model) { var village = new Village { VillageId = model.VillageId }; using (var dataService = DataServiceFactory.CreateDataService()) { try { await dataService.DeleteVillageAsync(village); } catch (DbUpdateException ex) when(ex.InnerException is SqlException sqlException && (sqlException.Number == 547)) { return(Result.Error("Village is already in use")); } catch (Exception ex) { throw ex; } return(Result.Ok()); } }
/// <summary> /// Enters a specific building. /// </summary> /// <param name="acc">Account</param> /// <param name="vill">Village</param> /// <param name="building">Building to enter</param> /// <param name="query">Additional query (to specify tab)</param> /// <param name="dorf">Whether we want to first navigate to dorf (less suspicious)</param> /// <returns>Whether it was successful</returns> public static async Task <bool> EnterBuilding(Account acc, Village vill, Building building, string query = "", bool dorf = true) { // If we are already at the desired building (if gid is correct) Uri currentUri = new Uri(acc.Wb.CurrentUrl); if (HttpUtility.ParseQueryString(currentUri.Query).Get("gid") == ((int)building.Type).ToString()) { return(true); } // If we want to navigate to dorf first if (dorf) { string dorfUrl = $"/dorf{(building.Id < 19 ? 1 : 2)}.php"; if (!acc.Wb.CurrentUrl.Contains(dorfUrl)) { await acc.Wb.Navigate(acc.AccInfo.ServerUrl + dorfUrl); } } await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/build.php?id={building.Id}{query}"); return(true); }
/// <summary> /// Checks whether the resources at more than 95% of the capacity and increases if it's true. /// </summary> /// <param name="acc"></param> /// <param name="vill"></param> private static void AutoExpandStorage(Account acc, Village vill) { if (!vill.Settings.AutoExpandStorage) { return; } double warehouse_delta = vill.Res.Capacity.WarehouseCapacity * 0.95; double granary_delta = vill.Res.Capacity.GranaryCapacity * 0.95; if (warehouse_delta <= vill.Res.Stored.Resources.Wood || warehouse_delta <= vill.Res.Stored.Resources.Clay || warehouse_delta <= vill.Res.Stored.Resources.Iron) { BuildingHelper.UpgradeBuildingForOneLvl(acc, vill, Classificator.BuildingEnum.Warehouse, false); return; } if (granary_delta <= vill.Res.Stored.Resources.Crop) { BuildingHelper.UpgradeBuildingForOneLvl(acc, vill, Classificator.BuildingEnum.Granary, false); } }
private bool CanConvertVillage(Army army, Village village, DepartmentOfTheTreasury departmentOfTheTreasury, List <StaticString> failureFlags) { if (village == null) { failureFlags.Add(ArmyAction.NoCanDoWhileSystemError); return(false); } if (village.HasBeenConverted) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileVillageIsAlreadyConverted); return(false); } if (!village.HasBeenPacified) { failureFlags.Add(ArmyAction_BaseVillage.NoCanDoWhileVillageIsNotPacified); return(false); } if (village.PointOfInterest.SimulationObject.Tags.Contains(DepartmentOfDefense.PillageStatusDescriptor)) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileVillageIsPillaged); return(false); } if (village.PointOfInterest.SimulationObject.Tags.Contains(DepartmentOfCreepingNodes.InfectedPointOfInterest)) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileVillageIsInfected); return(false); } ConstructionCost[] convertionCost = this.GetConvertionCost(army, village); if (!departmentOfTheTreasury.CanAfford(convertionCost)) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileCannotAfford); this.lastConvertCostDescription = GuiFormater.FormatCost(army.Empire, convertionCost, false, 1, null); return(false); } return(true); }
// Use this for initialization void Start() { //Villager.Create(); Terrain.Instance.Regenerate(); for (int i = 0; i < 2; i++) { Vector2Int villagePos; do { villagePos = new Vector2Int(Random.Range(0, LENGTH), Random.Range(0, WIDTH)); } while (Terrain.Instance.GetTerrainType(villagePos) == global::Terrain.TerrainType.Land); _villages.Add(Village.Create(villagePos)); } // Spawn trees for (int x = 0; x < LENGTH; x++) { for (int y = 0; y < WIDTH; y++) { if (Terrain.Instance.GetTerrainType(new Vector2Int(y, x)) == Terrain.TerrainType.Land && Random.Range(0.0f, 100f) > 99.7f) { Tree.Create(new Vector2Int(x, y)); } } } StartCoroutine("SpawnFood"); for (int i = 0; i < 20; i++) { SpawnFood(); } }
//Once villages have finished being loaded //Villages are rendered/instantiated on the map and the radius is adjusted to fit the size of the village //The ids of villages are set as they are being rendered private void Update() { if (loadDone && !init) { _locations = new Vector2d[_locationStrings.Length]; _spawnedObjects = new List <GameObject>(); for (int i = 0; i < locationStringsAL.Count; i++) { var location = Conversions.StringToLatLon(locationStringsAL[i].getLat() + ", " + locationStringsAL[i].getLng()); //var instance = Instantiate(getPrefab(locationStringsAL[i].getEmail())); GameObject instance = Instantiate(getPrefab(locationStringsAL[i].getEmail())); Transform radScale = instance.transform.Find("RadiusScale"); radScale.localScale += new Vector3((locationStringsAL[i].getSize() - 1), 0, (locationStringsAL[i].getSize() - 1)); //var instance = Instantiate(_markerPrefab); Village prefabScript = instance.GetComponent <Village>(); prefabScript.setID(locationStringsAL[i].getEmail(), locationStringsAL[i].getVillageID()); instance.transform.localPosition = _map.GeoToWorldPosition(location, true); instance.transform.localScale = new Vector3(_spawnScale, _spawnScale, _spawnScale); _spawnedObjects.Add(instance); } init = true; loadingPanel.SetActive(false); } if (loadDone && init) { for (int i = 0; i < locationStringsAL.Count; i++) { var spawnedObject = _spawnedObjects[i]; var location = Conversions.StringToLatLon(locationStringsAL[i].getLat() + ", " + locationStringsAL[i].getLng()); //Debug.Log("Right Here: " + i); spawnedObject.transform.localPosition = _map.GeoToWorldPosition(location, true); spawnedObject.transform.localScale = new Vector3(_spawnScale, _spawnScale, _spawnScale); } } }
private static bool CheckPrerequiresites(BuildingModel building, Village village, List <BuildingModel> allBuildings) { if (!building.Prerequiresites?.Any() ?? true) { return(true); } foreach (var prereq in building.Prerequiresites) { var prereqBuilding = allBuildings.FirstOrDefault(x => x.Name == prereq.Name); var villageBuilding = village.BuildingSlots.FirstOrDefault(x => x.BuildingId == prereqBuilding?.BuildingId); if (villageBuilding == null && prereq.Level < 1) { return(true); } if (villageBuilding == null || villageBuilding.Level < prereq.Level) { return(false); } } return(true); }
public ActionResult Create([Bind(Include = "Id,Name,UnionId")] Village village) { if (ModelState.IsValid) { db.Villages.Add(village); db.SaveChanges(); int parentId = 0; var parent = db.Treeviews.Where(i => i.HierarchyTypeId == (int)Enums.Union && i.KeyOfThatHierarchy == village.UnionId); if (parent != null) { parentId = parent.FirstOrDefault().Id; } var treeview = new Treeview { HierarchyTypeId = (int)Enums.Village, KeyOfThatHierarchy = village.Id, Label = village.Name, ParentId = parentId }; db.Treeviews.Add(treeview); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UnionId = new SelectList(db.Unions, "Id", "Name", village.UnionId); return(View(village)); }
/// <summary> /// Adds all building prerequisites for this building if they do not exist yet. After this you should call RemoveDuplicates(). /// </summary> /// <param name="acc"></param> /// <param name="vill"></param> /// <param name="building"></param> /// <returns>True if we have all prerequisite buildings, false otherwise</returns> public static bool AddBuildingPrerequisites(Account acc, Village vill, Classificator.BuildingEnum building) { (var tribe, var prereqs) = GetBuildingPrerequisites(building); if (acc.AccInfo.Tribe != tribe) { return(false); } if (prereqs.Count == 0) { return(true); } var ret = true; foreach (var prereq in prereqs) { var prereqBuilding = vill.Build.Buildings.FirstOrDefault(x => x.Type == prereq.Building && x.Level >= prereq.Level ); //prereqired building already exists if (prereqBuilding != null) { continue; } //check if we have its prerequisites AddBuildingPrerequisites(acc, vill, prereq.Building); AddBuildingTask(acc, vill, new BuildingTask() { Building = prereq.Building, Level = prereq.Level, TaskType = BuildingType.General }); ret = false; } return(ret); }
public void TraverseVillages(Village CurrentVillage) { if (Hugi.FoundAstrilde) { return; } // Here Hugi records his travels, as any Norse Hero will do: Hugi.HugiJournal.Add(new JournalEntry(CurrentVillage.VillageName, CurrentVillage.distanceFromPreviousVillage)); try { Console.WriteLine("I am in {0}", CurrentVillage.VillageName); if (CurrentVillage.isAstrildgeHere) { Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName); Console.WriteLine("**** FEELING HAPPY!!! ******"); Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked()); Hugi.FoundAstrilde = true; } } catch (NullReferenceException) { } // TO DO: Complete this section to make the Recursion work }
/// <summary> /// Upgrades storage of the village /// </summary> /// <param name="acc">Account</param> /// <param name="vill">Village</param> /// <param name="building">Storage building</param> private static void UpgradeStorage(Account acc, Village vill, BuildingEnum building) { var task = new BuildingTask() { Building = building, TaskType = Classificator.BuildingType.General }; var current = vill.Build.Buildings.FirstOrDefault(x => x.Type == building && (x.Level != 20 || (x.Level != 19 && x.UnderConstruction)) ); if (current == null) { task.ConstructNew = true; task.Level = 1; } else { task.Level = current.Level + 1; } BuildingHelper.AddBuildingTask(acc, vill, task, false); }
public void TraverseVillages(Village CurrentVillage) { if (Hugi.FoundAstrilde) { return; } Hugi.HugiJournal.Add(new JournalEntry(CurrentVillage.VillageName, CurrentVillage.distanceFromPreviousVillage)); try { Console.WriteLine("I am in {0}", CurrentVillage.VillageName); if (CurrentVillage.isAstrildgeHere) { Console.WriteLine("I found Dear Astrildge in {0}", CurrentVillage.VillageName); Console.WriteLine("**** FEELING HAPPY!!! ******"); Console.WriteLine("Astrilde, I walked {0} vika to find you. Will you marry me?", Hugi.CalculateDistanceWalked()); Hugi.FoundAstrilde = true; } TraverseVillages(CurrentVillage.east); TraverseVillages(CurrentVillage.west); } catch (NullReferenceException) { } }
public static void UpdateVillageById(this ObservableCollection <Village> villages, Village newVillage) { var oldVillage = villages.Where(v => v.VillageId == newVillage.VillageId).FirstOrDefault(); if (oldVillage == null) { throw new Exception($"Village not found."); } oldVillage.UpdatePropertyIfNotEquals(v => v.VillageName, newVillage.VillageName); oldVillage.UpdatePropertyIfNotEquals(v => v.IsActive, newVillage.IsActive); oldVillage.UpdatePropertyIfNotEquals(v => v.IsCapital, newVillage.IsCapital); }
public void SetText(Village vill, int standing) { MyText.text = vill.VillageName + ": " + standing.ToString(); }
public void VillageSetup(int _prevVillageDist, Village _westVillage, Village _eastVillage) { east = _eastVillage; west = _westVillage; distanceFromPreviousVillage = _prevVillageDist; }
public static Village UpdateInfo(IWebDriver driver, Village village) { driver.FindElement(By.CssSelector("#navigation > .village.resourceView")).Click(); var container = WaitUntilElementExists(driver, By.Id("resourceFieldContainer"), 5); var fields = container.FindElements(By.XPath("//div[contains(@class, 'buildingSlot')]")); var result = new List <BuildingSlot>(); foreach (var field in fields) { var css = field.GetAttribute("class"); var splitted = css.Split(" "); var id = splitted.FirstOrDefault(x => x.Contains("gid")); var slot = splitted.FirstOrDefault(x => x.Contains("buildingSlot")); var match = Regex.Match(css, @"level\d\d?", RegexOptions.IgnoreCase); var stateMatch = Regex.Match(css, @"(^|\s)(good|notNow|maxLevel|underConstruction)\s", RegexOptions.IgnoreCase); if (!match.Success || !int.TryParse(match.Value.Replace("level", string.Empty), out int l)) { l = -1; } if (!stateMatch.Success || !Enum.TryParse <BuildingSlotState>(stateMatch.Value, true, out var state)) { state = BuildingSlotState.Gray; } result.Add(new BuildingSlot { Id = slot, BuildingId = id, Level = l, State = state }); } var canBuildinDorf1 = driver.FindElements(By.XPath("//div[contains(@class, 'buildingSlot') and contains(@class, 'good')]"))?.Any() ?? false; driver.FindElement(By.CssSelector("#navigation > .village.buildingView")).Click(); var slots = driver.FindElement(By.Id("village_map")).FindElements(By.XPath("//div[contains(@class, 'buildingSlot')]")); foreach (var slot in slots) { var css = slot.GetAttribute("class"); var matchId = Regex.Match(css, @"g\d\d?", RegexOptions.IgnoreCase); var id = matchId.Success ? matchId.Value : string.Empty; var matchSlotId = Regex.Match(css, @"aid\d\d?", RegexOptions.IgnoreCase); var slotId = matchSlotId.Success ? matchSlotId.Value : string.Empty; if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(slotId)) { var level = slot.FindElements(By.CssSelector("div.labelLayer"))?.FirstOrDefault()?.Text; if (string.IsNullOrEmpty(level) || !int.TryParse(level.Replace("level", string.Empty), out int l)) { l = -1; } var colorLayerCss = slot.FindElements(By.CssSelector("div.level"))?.FirstOrDefault()?.GetAttribute("class"); var state = BuildingSlotState.Empty; if (!string.IsNullOrEmpty(colorLayerCss)) { var stateMatch = Regex.Match(colorLayerCss, @"(^|\s)(good|notNow|maxLevel|underConstruction)\s", RegexOptions.IgnoreCase); if (!stateMatch.Success || !Enum.TryParse <BuildingSlotState>(stateMatch.Value, true, out state)) { state = BuildingSlotState.Gray; } } result.Add(new BuildingSlot { Id = slotId, BuildingId = id, Level = l, State = state }); } } var canBuildInDorf2 = driver.FindElements(By.XPath("//div[contains(@class, 'buildingSlot')]/div[contains(@class, 'good')]"))?.Any() ?? false; // update buildings village.BuildingSlots = result; village.CanBuild = canBuildinDorf1 || canBuildInDorf2; var buildingList = driver.FindElements(By.CssSelector(".boxes.buildingList"))?.FirstOrDefault(); var dorf1Time = TimeSpan.Zero; var dorf2Time = TimeSpan.Zero; if (buildingList != null) { var durations = buildingList.FindElements(By.CssSelector("div.buildDuration span.timer")); if (durations.Any()) { var timers = durations.Select(x => TimeSpan.FromSeconds(int.Parse(x.GetAttribute("value")))).OrderBy(x => x.TotalMilliseconds).ToList(); dorf1Time = timers[0]; if (timers.Count > 1) { dorf2Time = timers[1]; } } } village.Dorf1BuildTimeLeft = dorf1Time; village.Dorf2BuildTimeLeft = dorf2Time; return(village); }
protected override Village ExecuteInVillage(ScenarioContext context, Village source) { return(UpdateInfo(_driver, source)); }
private static string GetVillageDisplayName(Village village) { return($"{village.Name} ({village.CoordinateX}|{village.CoordinateY})"); }
private string[] BuildInsertQuery( QueryBuilder qb, Character character, IReadOnlyList <User> users, IReadOnlyList <MarketItem> marketplaceItems, IReadOnlyList <Skills> skills, IReadOnlyList <SyntyAppearance> syntyAppearances, IReadOnlyList <Appearance> appearances, IReadOnlyList <Resources> resources, IReadOnlyList <CharacterState> charStates, IReadOnlyList <Statistics> charStats, IReadOnlyList <InventoryItem> invItems, IReadOnlyList <Village> villages, IReadOnlyList <VillageHouse> villageHouses) { var queries = new List <string>(); var query = new StringBuilder(); User user = users.FirstOrDefault(x => x.Id == character.UserId); if (user == null) { return(new string[0]); } if (importedUsers.Add(user.Id)) { query.AppendLine(qb.Insert(user)); } Skills skill = skills.FirstOrDefault(x => x.Id == character.SkillsId); if (skill != null) { query.AppendLine(qb.Insert(skill)); } SyntyAppearance appearance = syntyAppearances.FirstOrDefault(x => x.Id == character.SyntyAppearanceId); if (appearance != null) { query.AppendLine(qb.Insert(appearance)); } Appearance appearance_old = appearances.FirstOrDefault(x => x.Id == character.AppearanceId); if (appearance_old != null) { query.AppendLine(qb.Insert(appearance_old)); } Resources resx = resources.FirstOrDefault(x => x.Id == character.ResourcesId); if (resx != null) { query.AppendLine(qb.Insert(resx)); } CharacterState state = charStates.FirstOrDefault(x => x.Id == character.StateId); if (state != null) { query.AppendLine(qb.Insert(state)); } Statistics statistics = charStats.FirstOrDefault(x => x.Id == character.StatisticsId);; if (statistics != null) { query.AppendLine(qb.Insert(statistics)); } query.AppendLine(qb.Insert(character)); queries.Add(query.ToString()); query.Clear(); InventoryItem[] inventoryItems = invItems.Where(x => x.CharacterId == character.Id).ToArray(); if (inventoryItems.Length > 0) { if (inventoryItems.Length > 100) { for (var i = 0; i < inventoryItems.Length;) { var take = inventoryItems.Skip(i * 100).Take(100).ToArray(); queries.Add(qb.InsertMany(take)); i += take.Length; } } else { queries.Add(qb.InsertMany(inventoryItems)); } } MarketItem[] marketItems = marketplaceItems.Where(x => x.SellerCharacterId == character.Id).ToArray(); if (marketItems.Length > 0) { foreach (var ma in marketItems) { if (ma.Amount > 10_000_0000) { ma.Amount = 10_000_000; } if (ma.PricePerItem > 10_000_0000) { ma.PricePerItem = 10_000_000; } } if (marketItems.Length > 100) { for (var i = 0; i < marketItems.Length;) { var take = marketItems.Skip(i * 100).Take(100).ToArray(); queries.Add(qb.InsertMany(take)); i += take.Length; } } else { queries.Add(qb.InsertMany(marketItems)); } } Village village = villages.FirstOrDefault(x => x.UserId == user.Id); if (village != null) { queries.Add(qb.Insert(village)); } if (village != null) { VillageHouse[] villageHouse = villageHouses.Where(x => x.VillageId == village.Id).ToArray(); if (villageHouse.Length > 0) { if (villageHouse.Length > 100) { for (var i = 0; i < villageHouse.Length;) { var take = villageHouse.Skip(i * 100).Take(100).ToArray(); queries.Add(qb.InsertMany(take)); i += take.Length; } } else { queries.Add(qb.InsertMany(villageHouse)); } } } return(queries.ToArray()); }
public void ReadPacket(PacketReader reader) { var offset = 0x2A; LastVisit = TimeSpan.FromSeconds(reader.ReadInt32()); Unknown1 = reader.ReadInt32(); Timestamp = DateTimeConverter.FromUnixTimestamp(reader.ReadInt32()); Unknown2 = reader.ReadInt32(); UserID = reader.ReadInt64(); ShieldDuration = TimeSpan.FromSeconds(reader.ReadInt32()); Unknown3 = reader.ReadInt32(); Unknown4 = reader.ReadInt32(); Compressed = reader.ReadBoolean(); Home = new Village(); Home.Read(reader); Avatar = new Avatar(); // Seems like a whole object Unknown6 = reader.ReadInt32(); UserID1 = reader.ReadInt64(); UserID2 = reader.ReadInt64(); Avatar.ID = UserID1; switch (reader.ReadByte()) { case 0: break; case 1: Avatar.Clan = new Clan(); Avatar.Clan.ID = reader.ReadInt64(); Avatar.Clan.Name = reader.ReadString(); Avatar.Clan.Badge = reader.ReadInt32(); reader.ReadInt32(); Avatar.Clan.Level = reader.ReadInt32(); offset += 1; break; case 2: // clanless but clan castle built? var lel = reader.ReadInt64(); break; } if (Unknown7 = reader.ReadBoolean()) { Unknown8 = reader.ReadInt64(); } if (Unknown9 = reader.ReadBoolean()) { Unknown10 = reader.ReadInt64(); } reader.Seek(offset, SeekOrigin.Current); Unknown11 = reader.ReadInt32(); AllianceCastleLevel = reader.ReadInt32(); // -1 if not constructed AllianceCastleUnitCapacity = reader.ReadInt32(); AllianceCastleUnitCount = reader.ReadInt32(); Avatar.TownHallLevel = reader.ReadInt32(); Avatar.Username = reader.ReadString(); FacebookID = reader.ReadString(); Avatar.Level = reader.ReadInt32(); Avatar.Experience = reader.ReadInt32(); Avatar.Gems = reader.ReadInt32(); Gems1 = reader.ReadInt32(); Unknown14 = reader.ReadInt32(); Unknown15 = reader.ReadInt32(); Avatar.Trophies = reader.ReadInt32(); Avatar.AttacksWon = reader.ReadInt32(); Avatar.AttacksLost = reader.ReadInt32(); Avatar.DefensesWon = reader.ReadInt32(); Avatar.DefensesLost = reader.ReadInt32(); Unknown16 = reader.ReadInt32(); Unknown17 = reader.ReadInt32(); Unknown18 = reader.ReadInt32(); if (Unknown19 = reader.ReadBoolean()) { Unknown20 = reader.ReadInt64(); } Unknown21 = reader.ReadByte(); Unknown22 = reader.ReadInt32(); Unknown23 = reader.ReadInt32(); Unknown24 = reader.ReadInt32(); Unknown25 = reader.ReadInt32(); //TODO: Implement those things cause we are not actually storing them. var count1 = reader.ReadInt32(); for (int i = 0; i < count1; i++) { var id = reader.ReadInt32(); // resource id from resources.csv var capacity = reader.ReadInt32(); } var count2 = reader.ReadInt32(); for (int i = 0; i < count2; i++) { var id = reader.ReadInt32(); // resource id from resources.csv var amount = reader.ReadInt32(); } var count3 = reader.ReadInt32(); for (int i = 0; i < count3; i++) { var id = reader.ReadInt32(); // unit id from characters.csv var amount = reader.ReadInt32(); } var count4 = reader.ReadInt32(); for (int i = 0; i < count4; i++) { var id = reader.ReadInt32(); // spell id from spells.csv var amount = reader.ReadInt32(); } var count5 = reader.ReadInt32(); for (int i = 0; i < count5; i++) { var id = reader.ReadInt32(); // unit id from characters.csv var level = reader.ReadInt32(); } var count6 = reader.ReadInt32(); for (int i = 0; i < count6; i++) { var id = reader.ReadInt32(); // spell id from spells.csv var level = reader.ReadInt32(); } var count7 = reader.ReadInt32(); for (int i = 0; i < count7; i++) { var id = reader.ReadInt32(); // hero id from heros.csv var level = reader.ReadInt32(); } var count8 = reader.ReadInt32(); for (int i = 0; i < count8; i++) { var id = reader.ReadInt32(); // hero id from heros.csv var health = reader.ReadInt32(); } var count9 = reader.ReadInt32(); for (int i = 0; i < count9; i++) { var id = reader.ReadInt32(); // hero id from heros.csv var state = reader.ReadInt32(); } var count10 = reader.ReadInt32(); for (int i = 0; i < count10; i++) { var id = reader.ReadInt32(); // unit id from characters.csv var amount = reader.ReadInt32(); var level = reader.ReadInt32(); } var count11 = reader.ReadInt32(); for (int i = 0; i < count11; i++) { var id = reader.ReadInt32(); // mission id from missions.csv } var count12 = reader.ReadInt32(); for (int i = 0; i < count12; i++) { var id = reader.ReadInt32(); // achievement id from achievements.csv } var count13 = reader.ReadInt32(); for (int i = 0; i < count13; i++) { var id = reader.ReadInt32(); // achievement id from achievements.csv var progress = reader.ReadInt32(); } var count14 = reader.ReadInt32(); for (int i = 0; i < count14; i++) { var id = reader.ReadInt32(); // npc id from npcs.csv var stars = reader.ReadInt32(); } var count15 = reader.ReadInt32(); for (int i = 0; i < count15; i++) { var id = reader.ReadInt32(); // npc id from npcs.csv var gold = reader.ReadInt32(); } var count16 = reader.ReadInt32(); for (int i = 0; i < count16; i++) { var id = reader.ReadInt32(); // npc id from npcs.csv var elixir = reader.ReadInt32(); } Unknown26 = reader.ReadInt32(); Unknown27 = reader.ReadInt32(); Unknown28 = reader.ReadInt32(); }