private void ReadAreaRawData(byte[] entrie) { // Coordinates of trees for every are obtained with the program G2Map // ValidTrees are those accessible by the player // Invalid tress are trees that the player can not reach without cheating devices, like a tree beyond other trees Location = entrie[0]; ValidTrees = new TreeCoordinates[entrie[1]]; var ofs = 2; for (int i = 0; i < ValidTrees.Length; i++) { ValidTrees[i] = new TreeCoordinates() { X = entrie[ofs], Y = entrie[ofs + 1] }; ofs += 2; } InvalidTrees = new TreeCoordinates[entrie[ofs]]; ofs += 1; for (int i = 0; i < InvalidTrees.Length; i++) { InvalidTrees[i] = new TreeCoordinates() { X = entrie[ofs], Y = entrie[ofs + 1] }; ofs += 2; } }
private TreesArea(byte[] entry) { // Coordinates of trees were obtained with the program G2Map // ValidTrees are those accessible by the player Location = entry[0]; var valid = new TreeCoordinates[entry[1]]; var ofs = 2; for (int i = 0; i < valid.Length; i++, ofs += 2) { valid[i] = new TreeCoordinates(entry[ofs], entry[ofs + 1]); } // Invalid tress are trees that the player can not reach without cheating devices, like a tree beyond other trees var invalid = new TreeCoordinates[entry[ofs]]; ofs++; for (int i = 0; i < invalid.Length; i++, ofs += 2) { invalid[i] = new TreeCoordinates(entry[ofs], entry[ofs + 1]); } CreatePivotLists(valid, invalid, out PivotModerate, out PivotLow); #if DEBUG ValidTrees = valid; InvalidTrees = invalid; #endif }
private void ReadAreaRawData(byte[] entry) { // Coordinates of trees were obtained with the program G2Map // ValidTrees are those accessible by the player Location = entry[0]; ValidTrees = new TreeCoordinates[entry[1]]; var ofs = 2; for (int i = 0; i < ValidTrees.Length; i++, ofs += 2) { ValidTrees[i] = new TreeCoordinates(entry[ofs], entry[ofs + 1]); } // Invalid tress are trees that the player can not reach without cheating devices, like a tree beyond other trees InvalidTrees = new TreeCoordinates[entry[ofs]]; ofs++; for (int i = 0; i < InvalidTrees.Length; i++, ofs += 2) { InvalidTrees[i] = new TreeCoordinates(entry[ofs], entry[ofs + 1]); } }
private TreesArea(byte[] entry) { // Coordinates of trees were obtained with the program G2Map // ValidTrees are those accessible by the player Location = entry[0]; ValidTrees = new TreeCoordinates[entry[1]]; var ofs = 2; for (int i = 0; i < ValidTrees.Length; i++, ofs += 2) { ValidTrees[i] = new TreeCoordinates(entry[ofs], entry[ofs + 1]); } // Invalid tress are trees that the player can not reach without cheating devices, like a tree beyond other trees InvalidTrees = new TreeCoordinates[entry[ofs]]; ofs++; for (int i = 0; i < InvalidTrees.Length; i++, ofs += 2) { InvalidTrees[i] = new TreeCoordinates(entry[ofs], entry[ofs + 1]); } // For legality purposes, only the tree index is needed. // Group the trees data by their index; trees that share indexes are indistinguishable from one another ValidTreeIndex = ValidTrees.Select(t => t.Index).Distinct().OrderBy(i => i).ToArray(); InvalidTreeIndex = InvalidTrees.Select(t => t.Index).Distinct().OrderBy(i => i).Except(ValidTreeIndex).ToArray(); // Check for every trainer pivot index if there are trees with moderate encounter and low encounter available in the area TrainerModerateEncounterTree = new TreeEncounterAvailable[PivotCount]; TrainerLowEncounterTree = new TreeEncounterAvailable[PivotCount]; for (int i = 0; i < PivotCount; i++) { var TrainerModerateTrees = TrainerModerateTreeIndex[i]; TrainerModerateEncounterTree[i] = GetAvailableModerate(TrainerModerateTrees); TrainerLowEncounterTree[i] = GetAvailableLow(TrainerModerateTrees); } }