Jump to content

FM2009 Ingame Scout/Editor Framework Released! (incl. source code)


DrBernhard

Recommended Posts

  • Replies 331
  • Created
  • Last Reply

Code:

public static DateTime GetDate(int days2, int days1, int year2, int year1)

{

uint tmpYear1 = 0;

uint tmpYear2 = 0;

uint tmpDay1 = 0;

uint tmpDay2 = 0;

uint tmpYear = 0;

uint tmpDay = 0;

try

{

tmpYear1 = Convert.ToUInt32(year1);

tmpYear2 = Convert.ToUInt32(year2);

tmpDay1 = Convert.ToUInt32(days1);

tmpDay2 = Convert.ToUInt32(days2);

}

catch (Exception ex)

{

}

string sYearHex = String.Format("{0:x2}", tmpYear1) + String.Format("{0:x2}", tmpYear2).ToUpper();

string sDayHex = String.Format("{0:x2}", tmpDay1) + String.Format("{0:x2}", tmpDay2).ToUpper();

//Now we Convert HEX values to Integer

tmpYear = Convert.ToUInt32(sYearHex, 16); // Year

tmpDay = Convert.ToUInt32(sDayHex, 16); // Days into Year

DateTime tmpDate = new DateTime((int)tmpYear, 1, 1); //Declare a NEW Date using Year.

DateTime tmpDTM;

tmpDTM = tmpDate.AddDays(tmpDay); // Add the Days into year to the date giving the correct Date.

return tmpDTM; // Return date.

}

Link to post
Share on other sites

Hi DrBernhard,

Just wandering whether you could help me out here. Basically I would like to create an editor to edit the players stuff. One of the main thing that I wanna to do is to edit a whole group of players in a single go without one by one.

For example, I load up the editor with a savelist of100 players with different PA and CA. And would it be possible for me to implement a single button (much alike "healing"), let say set the CA to 150 and PA to 170 and apply it to the whole players (i.e. without amending each player's CA and PA individually and save it one by one)? Do you get what I mean? Is that possible to do so?

And if could, would you be able to enlighten me a bit and show me some direction as my programming language is a bit rusty. Many thanks.

Link to post
Share on other sites

Code:

public static DateTime GetDate(int days2, int days1, int year2, int year1)

{

uint tmpYear1 = 0;

uint tmpYear2 = 0;

uint tmpDay1 = 0;

uint tmpDay2 = 0;

uint tmpYear = 0;

uint tmpDay = 0;

try

{

tmpYear1 = Convert.ToUInt32(year1);

tmpYear2 = Convert.ToUInt32(year2);

tmpDay1 = Convert.ToUInt32(days1);

tmpDay2 = Convert.ToUInt32(days2);

}

catch (Exception ex)

{

}

string sYearHex = String.Format("{0:x2}", tmpYear1) + String.Format("{0:x2}", tmpYear2).ToUpper();

string sDayHex = String.Format("{0:x2}", tmpDay1) + String.Format("{0:x2}", tmpDay2).ToUpper();

//Now we Convert HEX values to Integer

tmpYear = Convert.ToUInt32(sYearHex, 16); // Year

tmpDay = Convert.ToUInt32(sDayHex, 16); // Days into Year

DateTime tmpDate = new DateTime((int)tmpYear, 1, 1); //Declare a NEW Date using Year.

DateTime tmpDTM;

tmpDTM = tmpDate.AddDays(tmpDay); // Add the Days into year to the date giving the correct Date.

return tmpDTM; // Return date.

}

where would this go?

Link to post
Share on other sites

as far as i know the skills that you are talking about are 1 to 100 values.

which basically means you need to divide them by 5.

there are some skills that are indeed stored in sbytes from -127 to 127 but those aren't the skills you see in game as 0 - 20 values

so like this.

txtPlayerCorners.Text = (currentPlayer.TechnicalSkills.Corners / 5).ToString();

Link to post
Share on other sites

thought so, still cant get it to work. Think it may be when I'm converting the linq query to a datatable (which then gets displayed in datagridview) :/

Your ReadDateTime function In ProcessManager.cs should be this:

public static DateTime ReadDateTime(int address)

{

byte[] buffer = ReadProcessMemory(address, 4);

Return Converters.DateConverter.GetDate(buffer(0), buffer(1), buffer(2), buffer(3))

}

Link to post
Share on other sites

thanks neevesc, I'd worked that out but it stills gives an exception.

Year, Month, and Day parameters describe an un-representable DateTime.

System.ArgumentOutOfRangeException

I have a lot of filters in my search criteria, and its only giving an exception on Ages, this is despite being able to return age results in a datagridview.

Link to post
Share on other sites

thanks neevesc, I'd worked that out but it stills gives an exception.

Year, Month, and Day parameters describe an un-representable DateTime.

System.ArgumentOutOfRangeException

I have a lot of filters in my search criteria, and its only giving an exception on Ages, this is despite being able to return age results in a datagridview.

It's proberly to do with the players with no name. I had a similar problem with clubs with no name. So what I did was add the follwoing code in ObjectManager.cs, replacing the line

internalList.Add(newObject);

{

if ((newObject) is Club) {

Club myClub = (Club)typeof(Club).GetConstructor(new System.Type[] { typeof(int) }).Invoke(new object[] { objectAddress });

if (string.IsNullOrEmpty(myClub.Name.ToString)) {

}

//Debug.WriteLine(myClub.ID)

else {

internalList.Add(newObject);

}

}

else {

internalList.Add(newObject);

}

}

The above code will only add a club where the club name is not null or "" (empty string).

You could do the same for players, and this should then sovle you problem.

Link to post
Share on other sites

so I should have...

int objectAddress = ProcessManager.ReadInt32(memoryAddress + (i * 4));

               T newObject = (T)typeof(T).GetConstructor(new System.Type[] { typeof(int) }).Invoke(new object[] { objectAddress });
               //internalList.Add(newObject);

               //CLUB
               if ((newObject) is Club)
               {
                   Club myClub = (Club)typeof(Club).GetConstructor(new System.Type[] { typeof(int) }).Invoke(new object[] { objectAddress });
                   if (string.IsNullOrEmpty(myClub.Name.ToString()))
                   {
                   }
                   //Debug.WriteLine(myClub.ID)
                   else
                   {
                       internalList.Add(newObject);
                   }
               }

               else
               {
                   internalList.Add(newObject);
               }
               //END OF CLUB

               //PLAYER
               if ((newObject) is Player)
               {
                   Player myPlayer = (Player)typeof(Player).GetConstructor(new System.Type[] { typeof(int) }).Invoke(new object[] { objectAddress });
                   if (string.IsNullOrEmpty(myPlayer.ToString()))
                   {
                   }
                   //Debug.WriteLine(myPlayer.ID)
                   else
                   {
                       internalList.Add(newObject);
                   }
               }

               else
               {
                   internalList.Add(newObject);
               }
               //END OF PLAYER

Still returns the same error, looking at the stack return I can see that when players have no name, their ages are returned with the same exception error

Link to post
Share on other sites

BTW

If you check your Minimum Sale Value with the Sale Value in game.

Remember to add this bit of code.

if(numSaleValueMin.Value > 0)

filter = filter.Where(p => p.SaleValue >= numSaleValueMin.Value);

else

filter = filter.Where(p => p.SaleValue >= -2);

otherwise the players that are indispensable to a club won't show up.

seeing how their saleValue = -1

Link to post
Share on other sites

oh btw

you still do need to check if year = 0;

you need to add this line to the code i posted before

if (tmpYear == 0) tmpYear = 1999;

it goes above

DateTime tmpDate = new DateTime((int)tmpYear, 1, 1); //Declare a NEW Date using Year.

So basically it's the same as what immuner had before.

i have the same issue you do without that line btw.

Link to post
Share on other sites

Would this source code work on a Mac?

I'm toying with the idea of writing a Mac editor

I don't know much about the Mac, but proberly not, as this uses Microsoft.NET framework. Not sure if this is available for the Mac.

Link to post
Share on other sites

First of all, sorry for the late response

Had loads of personal things to do the last week, so I will throw in some new code tomorrow :-)

If you can convert the code to Java (C# is almost identical in terms of syntax) then you have your Mac version :)

******** Mac-memoryaddresses will be different

is EuroMember not working? African countries are showing as EU Members?

EuroMembers will be fixxed in new version

oh btw

you still do need to check if year = 0;

you need to add this line to the code i posted before

if (tmpYear == 0) tmpYear = 1999;

it goes above

DateTime tmpDate = new DateTime((int)tmpYear, 1, 1); //Declare a NEW Date using Year.

So basically it's the same as what immuner had before.

i have the same issue you do without that line btw.

Will find the best fix for datetimes and update the framework.

Does anyone know if i can see if a player is injured?

I know how to return the injury adress but how do i know if they have an injury

Just check a few non-injured players and note the byte values down (prob 0x00000 etc). Check if that's true. Then the player doesn't have an injury.

It's proberly to do with the players with no name. I had a similar problem with clubs with no name. So what I did was add the follwoing code in ObjectManager.cs, replacing the line

internalList.Add(newObject);

{

if ((newObject) is Club) {

Club myClub = (Club)typeof(Club).GetConstructor(new System.Type[] { typeof(int) }).Invoke(new object[] { objectAddress });

if (string.IsNullOrEmpty(myClub.Name.ToString)) {

}

//Debug.WriteLine(myClub.ID)

else {

internalList.Add(newObject);

}

}

else {

internalList.Add(newObject);

}

}

The above code will only add a club where the club name is not null or "" (empty string).

You could do the same for players, and this should then sovle you problem.

Just do something like

if (newObject.GetType() == typeof(Club))
{
if(string.IsNullOrEmpty(((Club)newObject).Name)) continue;
}

Would be way faster.

Link to post
Share on other sites

Still can't manage to figure out how to see if someone is injured.

i found this

MemAdress---InjuryAddress--Difference--Injury

428031760 --- 426056940 -- 1974820 -- 1 month heavy

418864016 --- 418036932 -- 827084 ---- 1 week heavy

444877808 --- 444667312 -- 210496 ----- 2 weeks light

428075576 --- 426058604 -- 2016972----- not injured

i don't see any logic in that.

the injuryadress stays the same after healing.

but in game the injury goes away O.o

Link to post
Share on other sites

Can someone help me. I have made a program that searches for players but I want to select a player from a list box and, when a button is pressed, have the player's attribute shown in textboxes. Could someone please help me. Muchly appreciated. Any help will be credited in the program. Cheers

email me at dave.chapperz@gmail.com

Can anyone help me please? I really need this. Thanks. When will the assemblies be out for 9.2.0 version?

Link to post
Share on other sites

Can someone help me. I have made a program that searches for players but I want to select a player from a list box and, when a button is pressed, have the player's attribute shown in textboxes. Could someone please help me. Muchly appreciated. Any help will be credited in the program. Cheers

email me at dave.chapperz@gmail.com

use one of the listboxes functions to generate a method that get's called up once you click on the listbox?

load up the player and add it's attributes to the textboxes?

Link to post
Share on other sites

private void btnActive_Click(object sender, EventArgs e)

{

IEnumerable<Player> filter = fmDataContext.Players;

Player player = ((Player)fmDataContext.ActiveObject);

if (player != null)

{

filter = filter.Where(p => p.ID.Equals(player.ID));

gridPlayers.AutoGenerateColumns = true;

gridPlayers.DataSource = (from p in filter

select

new

{

ID = p.ID,

FullName = p.ToString(),

NickName = p.Nickname,

CA = p.CurrentPlayingAbility,

PA = p.PotentialPlayingAbility,

Age = p.Age,

Value = String.Format("{0:€ #,##0;(€ #,##0)}", p.Value),

SaleValue = String.Format("{0:€ #,##0;(€ #,##0)}", p.SaleValue)

}).ToList();

}

}

public void ShowInfo(Player currentPlayer)

{

txtPlayerID.Text = currentPlayer.ID.ToString();

txtPlayerName.Text = currentPlayer.ToString();

txtPlayerClub.Text = currentPlayer.Team.Club.Name.ToString();

txtPlayerNationality.Text = currentPlayer.Nationality.Name.ToString();

txtPlayerIntCaps.Text = currentPlayer.InternationalCaps.ToString();

txtPlayerDateOfBirth.Text = currentPlayer.DateOfBirth.ToShortDateString();

txtPlayerAge.Text = currentPlayer.Age.ToString();

txtPlayerLength.Text = currentPlayer.Length.ToString();

txtPlayerWeight.Text = currentPlayer.Weight.ToString();

txtPlayerValue.Text = String.Format("{0:€ #,##0;(€ #,##0)}", currentPlayer.Value);

txtPlayerSaleValue.Text = String.Format("{0:€ #,##0;(€ #,##0)}", currentPlayer.SaleValue);

txtPlayerContractStart.Text = currentPlayer.Contract.ContractStarted.ToShortDateString();

txtPlayerContractEnd.Text = currentPlayer.Contract.ContractExpiryDate.ToShortDateString();

txtSalary.Text = String.Format("{0:€ #,##0;(€ #,##0)}", currentPlayer.Contract.WagePerWeek);

txtPlayerFoot.Text = GetFoot(currentPlayer);

txtPlayerCA.Text = currentPlayer.CurrentPlayingAbility.ToString();

txtPlayerPA.Text = currentPlayer.PotentialPlayingAbility.ToString();

txtPlayerPositions.Text = currentPlayer.PositionalSkills.ToString() ;

//-- Technical Skills --//

txtPlayerCorners.Text = (currentPlayer.TechnicalSkills.Corners / 5).ToString();

txtPlayerCrossing.Text = (currentPlayer.TechnicalSkills.Crossing / 5).ToString();

txtPlayerDribbling.Text = (currentPlayer.TechnicalSkills.Dribbling / 5).ToString();

txtPlayerFinishing.Text = (currentPlayer.TechnicalSkills.Finishing / 5).ToString();

txtPlayerFirstTouch.Text = (currentPlayer.TechnicalSkills.FirstTouch/ 5).ToString();

txtPlayerFreeKicks.Text = (currentPlayer.TechnicalSkills.Freekicks / 5).ToString();

txtPlayerHeading.Text = (currentPlayer.TechnicalSkills.Heading / 5).ToString();

txtPlayerLongShots.Text = (currentPlayer.TechnicalSkills.LongShots / 5).ToString();

txtPlayerLongThrows.Text = (currentPlayer.TechnicalSkills.Longthrows / 5).ToString();

txtPlayerMarking.Text = (currentPlayer.TechnicalSkills.Marking / 5).ToString();

txtPlayerPassing.Text = (currentPlayer.TechnicalSkills.Passing / 5).ToString();

txtPlayerPenalty.Text = (currentPlayer.TechnicalSkills.PenaltyTaking / 5).ToString();

txtPlayerTackling.Text = (currentPlayer.TechnicalSkills.Tackling / 5).ToString();

txtPlayerTechnique.Text = (currentPlayer.TechnicalSkills.Technique / 5).ToString();

//-- GoalKeeping Skills --//

txtPlayerAerial.Text = (currentPlayer.GoalKeepingSkills.AerialAbility / 5).ToString();

txtPlayerCommand.Text = (currentPlayer.GoalKeepingSkills.CommandOfArea / 5).ToString();

txtPlayerCommunication.Text = (currentPlayer.GoalKeepingSkills.Communication / 5).ToString();

txtPlayerEccentricity.Text = (currentPlayer.GoalKeepingSkills.Eccentricity / 5).ToString();

txtPlayerHandling.Text = (currentPlayer.GoalKeepingSkills.Handling / 5).ToString();

txtPlayerKicking.Text = (currentPlayer.GoalKeepingSkills.Kicking / 5).ToString();

txtPlayerOneonOnes.Text = (currentPlayer.GoalKeepingSkills.OneOnOnes / 5).ToString();

txtPlayerReflexes.Text = (currentPlayer.GoalKeepingSkills.Reflexes / 5).ToString();

txtPlayerRushingOut.Text = (currentPlayer.GoalKeepingSkills.RushingOut / 5).ToString();

txtPlayerPunch.Text = (currentPlayer.GoalKeepingSkills.TendencyToPunch / 5).ToString();

txtPlayerThrowing.Text = (currentPlayer.GoalKeepingSkills.Throwing / 5).ToString();

//-- Mental Skills --//

txtPlayerAgression.Text = (currentPlayer.MentalSkills.Aggression / 5).ToString();

txtPlayerAnticipation.Text = (currentPlayer.MentalSkills.Anticipation / 5).ToString();

txtPlayerBravery.Text = (currentPlayer.MentalSkills.Bravery / 5).ToString();

txtPlayerComposure.Text = (currentPlayer.MentalSkills.Composure / 5).ToString();

txtPlayerConcentration.Text = (currentPlayer.MentalSkills.Concentration / 5).ToString();

txtPlayerCreativity.Text = (currentPlayer.MentalSkills.Creativity / 5).ToString();

txtPlayerDecisions.Text = (currentPlayer.MentalSkills.Decisions / 5).ToString();

txtPlayerDetermination.Text = (currentPlayer.MentalSkills.Determination / 5).ToString();

txtPlayerFlair.Text = (currentPlayer.MentalSkills.Flair / 5).ToString();

txtPlayerInfluence.Text = (currentPlayer.MentalSkills.Influence / 5).ToString();

txtPlayerOfftheBall.Text = (currentPlayer.MentalSkills.OffTheBall / 5).ToString();

txtPlayerPositioning.Text = (currentPlayer.MentalSkills.Positioning / 5).ToString();

txtPlayerTeamwork.Text = (currentPlayer.MentalSkills.Teamwork / 5).ToString();

txtPlayerWorkRate.Text = (currentPlayer.MentalSkills.Workrate / 5).ToString();

//-- Physical Skills --//

txtPlayerAcceleration.Text = (currentPlayer.PhysicalSkills.Acceleration / 5).ToString();

txtPlayerAgility.Text = (currentPlayer.PhysicalSkills.Agility / 5).ToString();

txtPlayerBalance.Text = (currentPlayer.PhysicalSkills.Balance / 5).ToString();

txtPlayerJumping.Text = (currentPlayer.PhysicalSkills.Jumping / 5).ToString();

txtPlayerNaturalFitness.Text = (currentPlayer.PhysicalSkills.NaturalFitness / 5).ToString();

txtPlayerPace.Text = (currentPlayer.PhysicalSkills.Pace / 5).ToString();

txtPlayerStamina.Text = (currentPlayer.PhysicalSkills.Stamina / 5).ToString();

txtPlayerStrength.Text = (currentPlayer.PhysicalSkills.Strength / 5).ToString();

//-- Hidden Skills --//

txtPlayerConsistency.Text = (currentPlayer.HiddenSkills.Consistency / 5).ToString();

txtPlayerDirtyness.Text = (currentPlayer.HiddenSkills.Dirtyness / 5).ToString();

txtPlayerImportantMatches.Text = (currentPlayer.HiddenSkills.ImportantMatches / 5).ToString();

txtPlayerInjuryProness.Text = (currentPlayer.HiddenSkills.InjuryProness / 5).ToString();

txtPlayerVersatility.Text = (currentPlayer.HiddenSkills.Versatility / 5).ToString();

//-- Other Skills --//

txtPlayerCondition.Text = currentPlayer.Condition.ToString();

txtPlayerMorale.Text = currentPlayer.Morale.ToString();

txtPlayerHappiness.Text = currentPlayer.Contract.Happiness.ToString();

txtPlayerSquadNo.Text = currentPlayer.Contract.SquadNumber.ToString();

}

Link to post
Share on other sites

        private void LoadMenuItem_Click(object sender, EventArgs e)
       {
           fmDataContext = new FMDataContext();
       }

This is the code i have used to load the data. Is this right?

@ Puzzle. Is the code you posted for the active player in Football Manager or the active player in the list box which is used to search players? Thanks in advance mate!

Link to post
Share on other sites

You do load the data.

and i retrieve the active player.

but the code i have for the text stuff works for any player.

so if you search for one.

You could also compare the text in your listbox with the name of the players in your fmDataContext.

And get the player from that and use it.

Link to post
Share on other sites

Hello to everyone and a happy new year! I just found out the correct addresses for 9.2.0 for DrBernhard's Framework. I am currently testing them to make sure everything is ok. But since i am not a member in DrBernhard's Google Code project i don't really know where to post the files.

Since every Memory Address is different in 9.2 i am thinking about implementing a version check to make it backwards compatible with 9.1

Any ideas on where i can post the files are welcome! (when they're done of course)

Cheers to everyone.

[update]

1. Just found out that the offsets are the same in 9.2.0 (The ones that were correct in the first place ;) )

2. All 9.2.0 compatibility implemented & backwards compatibility with 9.1.0

3. Tested and everything is working as in FM 9.1.0

4. Fixed Club's Country Offset

5. Implemented Team Type (First Team, U21s)

6. Fixed Club Status Offset

7. Added Player Jadedness

P.S. Where is everyone i thought this was a hot topic :p

Link to post
Share on other sites

Yeap i'm greek (and i know you are, too :p )

I sent you a pm with my msn account add me and i'll send the files to you

Btw i have also fixed the Club's country address in the framework, the Team Type (First Team, U21) that was there but wasn't implemented, and the Club Status (Professional, Semi-Pro, Amateur) which was returning 0's (the offset was close but wrong)

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...