Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
xAranaktu authored Oct 2, 2017
1 parent 6602ee9 commit 20ac67a
Show file tree
Hide file tree
Showing 73 changed files with 20,495 additions and 0 deletions.
333 changes: 333 additions & 0 deletions FIFA 18 - IniToCT.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=IniToCT 18.Exe
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Fileversion=1.3
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <array.au3>
#include <File.au3>
#include <String.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <GuiTreeView.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("IniToCT 18", 555, 493, 695, 183)
$Label1 = GUICtrlCreateLabel(".INI files to convert:", 10, 10, 260, 17, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
$TreeView1 = GUICtrlCreateTreeView(10, 35, 260, 321, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_CHECKBOXES))
$Button1 = GUICtrlCreateButton("Select all", 300, 35, 140, 25)
$Button2 = GUICtrlCreateButton("Open selected in notepad", 300, 70, 140, 25)
$Progress1 = GUICtrlCreateProgress(35, 415, 500, 33)
GUICtrlSetState(-1, $GUI_HIDE)
$Button3 = GUICtrlCreateButton("Convert!", 300, 255, 140, 25)
$Label2 = GUICtrlCreateLabel("Converting...", 32, 375, 500, 22, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlSetState(-1, $GUI_HIDE)
$Button4 = GUICtrlCreateButton("Donate", 300, 325, 140, 25)
$Button5 = GUICtrlCreateButton("GitHub", 300, 290, 140, 25)
$Label3 = GUICtrlCreateLabel("", 32, 456, 500, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
GUICtrlSetState(-1, $GUI_HIDE)
$Button6 = GUICtrlCreateButton("Restore original files", 300, 105, 140, 25)
$Radio1 = GUICtrlCreateRadio("Convert to .CT", 300, 195, 90, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("Convert to .txt", 300, 220, 90, 17)
$Button7 = GUICtrlCreateButton("About", 456, 325, 70, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global Const $OrginalIniFilePath = @ScriptDir & "\ORG_INIFILES\"
Global Const $UserIniFilePath = @ScriptDir & "\USER_INIFILES\"
Global Const $ConvertedCT = @ScriptDir & "\Converted.CT"
Global Const $Convertedtxt = @ScriptDir & "\Converted.txt"


Global $countChanges = 0
Global $allSelected = False
Global $outputCT = True
Global $hTreeItems[35]

Dim $arrSections[0], $arrValues[0]

FillGUITree()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
selectAll()
Case $Button2
openInNotepad()
Case $Button3
Start()
Case $Button4
Donate()
Case $Button5
Github()
Case $Button6
RestoreOriginal()
Case $Button7
About()
EndSwitch
WEnd

Func About()
If @Compiled Then
Local $ver = FileGetVersion(@ScriptFullPath)
Else
Local $ver = "Not compiled"
EndIf
Local $txt = "Tool created by Aranaktu" & @CRLF & _
"File version: " & $ver & @CRLF & _
"For more info visit GitHub."
MsgBox(0, "About", $txt)
EndFunc ;==>About

Func Github()
ShellExecute("https://github.com/xAranaktu/FIFA-18---iniToCT")
EndFunc ;==>Github

Func Donate()
ShellExecute("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=J8F4UH72WG7RY")
EndFunc ;==>Donate

Func RestoreOriginal()
If MsgBox(4, "", "Are you sure that you want to restore ALL original .ini files?") = 7 Then
MsgBox(64, "", "Restoring file process aborted by the user.")
Return
EndIf

Local $IniFiles = _FileListToArray($OrginalIniFilePath, "*")
Local $failed = False
For $i = 1 To UBound($IniFiles) - 1
If FileCopy($OrginalIniFilePath & $IniFiles[$i], $UserIniFilePath & $IniFiles[$i], 1) = 0 Then
$failed = True
ExitLoop
EndIf
Next

If $failed Then
MsgBox(16, "", "Restoring process failed. :(")
Else
MsgBox(64, "", "Restoring process completed! :)")
EndIf
EndFunc ;==>RestoreOriginal

Func Start()
GUICtrlSetState($Progress1, $GUI_SHOW)
GUICtrlSetState($Label2, $GUI_SHOW)
GUICtrlSetState($Label3, $GUI_SHOW)

If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then
$outputCT = True
Else
$outputCT = False
EndIf

UpdateProgressBar(0, "")


Local $currentFile = ""
Local $selectedItems = 0
For $i = 0 To UBound($hTreeItems) - 1
If BitAND(GUICtrlRead($hTreeItems[$i]), $GUI_CHECKED) Then
$selectedItems += 1
$currentFile = _GUICtrlTreeView_GetText($TreeView1, $hTreeItems[$i])
UpdateProgressBar((100 / UBound($hTreeItems)) * $i, "Converting: " & $currentFile)
CompareIni($currentFile)
Else
UpdateProgressBar((100 / UBound($hTreeItems)) * $i, "Converting:")
EndIf
Next

If $selectedItems > 0 And $countChanges > 0 Then
CreateScript()
UpdateProgressBar(100, "CONVERTED!")
If MsgBox(4, "DONE!", "Your .ini files has been converted." & @CRLF & "You have made " & $countChanges & " changes in " & $selectedItems & " file(s)." & @CRLF & "Do you want to execute script now?") = 6 Then
If $outputCT = True Then
ShellExecute($ConvertedCT)
Else
ShellExecute($Convertedtxt)
EndIf
EndIf
ElseIf $selectedItems = 0 Then
MsgBox(48, "", "Whoops... It seems that you didn't selected anything.")
ElseIf $countChanges = 0 Then
MsgBox(48, "", "Whoops... It seems that you didn't changed anything in .ini files.")
Else
MsgBox(48, "", "Unknown error")
EndIf

Dim $arrSections[0], $arrValues[0] ; cleaning arrays
$selectedItems = 0
$countChanges = 0
GUICtrlSetState($Progress1, $GUI_HIDE)
GUICtrlSetState($Label2, $GUI_HIDE)
GUICtrlSetState($Label3, $GUI_HIDE)
EndFunc ;==>Start

Func UpdateProgressBar($val, $text)
GUICtrlSetData($Progress1, $val)
GUICtrlSetData($Label3, $text)
EndFunc ;==>UpdateProgressBar

Func selectAll()
$allSelected = Not $allSelected
For $i = 0 To UBound($hTreeItems) - 1
_GUICtrlTreeView_SetChecked($TreeView1, $hTreeItems[$i], $allSelected)
Next

If $allSelected Then
GUICtrlSetData($Button1, "Unselect all")
Else
GUICtrlSetData($Button1, "Select all")
EndIf
EndFunc ;==>selectAll

Func openInNotepad()
For $i = 0 To UBound($hTreeItems) - 1
If BitAND(GUICtrlRead($hTreeItems[$i]), $GUI_CHECKED) Then
ShellExecute($UserIniFilePath & _GUICtrlTreeView_GetText($TreeView1, $hTreeItems[$i]))
EndIf
Next
EndFunc ;==>openInNotepad

Func FillGUITree()
Local $IniFiles = _FileListToArray($OrginalIniFilePath, "*")
For $i = 1 To UBound($IniFiles) - 1
$hTreeItems[$i - 1] = GUICtrlCreateTreeViewItem($IniFiles[$i], $TreeView1)
Next
EndFunc ;==>FillGUITree

Func CreateScript()
Local $fScriptTemplate = @ScriptDir & "\data\ScriptTemplate.txt"

If Not FileExists($fScriptTemplate) Then
MsgBox(16, "ERROR!", "ScriptTemplate file does't exists. Did you deleted it? :(")
Return
EndIf

Local $strLenTemp = 0
Local $sumStrLen = 0

Dim $arrTemplate

_FileReadToArray($fScriptTemplate, $arrTemplate, 0)

For $i = 0 To UBound($arrSections) - 1
_ArrayInsert($arrTemplate, 23, "str" & $i & ":") ; Create label for string to be compared
_ArrayInsert($arrTemplate, 24, " db " & "'" & $arrSections[$i] & "', 0") ; Our string
Next

For $i = 0 To UBound($arrSections) - 1
_ArrayInsert($arrTemplate, 23, "label_str" & $i & ":") ;
_ArrayInsert($arrTemplate, 24, " mov eax," & IntOrFloat($arrValues[$i])) ; Here we mov our changed value into eax register
_ArrayInsert($arrTemplate, 25, " jmp exit_iniConverter") ;
_ArrayInsert($arrTemplate, 26, "") ;
Next

For $i = 0 To UBound($arrSections) - 1
$strLenTemp = StringLen($arrSections[$i])
$sumStrLen += $strLenTemp
_ArrayInsert($arrTemplate, 21, " mov rcx, #" & $strLenTemp)
_ArrayInsert($arrTemplate, 22, " mov rsi, str" & $i)
_ArrayInsert($arrTemplate, 23, " mov rdi, rbx")
_ArrayInsert($arrTemplate, 24, " rep cmpsb")
_ArrayInsert($arrTemplate, 25, " je label_str" & $i)
Next

_ArrayInsert($arrTemplate, 2, 'alloc(cave_iniConverter,$' & (105*$countChanges)+$sumStrLen & ',"FIFA18.exe"+1B1F371) // (105 bytes * Numberofchangedstuff) + SizeOfStrings')

For $i = 0 To UBound($arrSections) - 1
_ArrayInsert($arrTemplate, 7, "label(label_str" & $i & ")")
Next

If $outputCT = True Then
If ScriptToCT($arrTemplate) = 0 Then
Return
EndIf
Else
_FileWriteFromArray($Convertedtxt, $arrTemplate)
EndIf
EndFunc ;==>CreateScript

Func ScriptToCT($arrTemplate)
Local $fCT_Template = @ScriptDir & "\data\CT_Template.CT"

If Not FileExists($fCT_Template) Then
MsgBox(16, "ERROR!", "CT_Template file does't exists. Did you deleted it? :(")
Return 0
EndIf

Dim $arrInScriptToCT
_FileReadToArray($fCT_Template, $arrInScriptToCT, 0)
For $i = 0 To UBound($arrTemplate) - 1
_ArrayInsert($arrInScriptToCT, 10, $arrTemplate[UBound($arrTemplate) - $i - 1])
Next
_FileWriteFromArray($ConvertedCT, $arrInScriptToCT)
Return 1

EndFunc ;==>ScriptToCT

Func IntOrFloat($ValueToCheck)
; If value from .ini file contains '.' then it's float value, otherwise it's int.
If StringInStr($ValueToCheck, ".") = 0 Then
Return "(int)" & $ValueToCheck ; (int)
Else
Return "(float)" & $ValueToCheck ; (float)
EndIf
EndFunc ;==>IntOrFloat

Func CompareIni($iniName)
Local $fOrg = $OrginalIniFilePath & $iniName
Local $fUser = $UserIniFilePath & $iniName

If Not FileExists($fOrg) Then
MsgBox(16, "ERROR!", $fOrg & " not exists")
Return
ElseIf Not FileExists($fUser) Then
MsgBox(16, "ERROR!", $fUser & " not exists")
Return
EndIf

Local $arrOriginalFile[_FileCountLines($fOrg)]
Local $arrUserFile[_FileCountLines($fUser)]

_FileReadToArray($fOrg, $arrOriginalFile)
_FileReadToArray($fUser, $arrUserFile)

If $arrOriginalFile[0] <> $arrUserFile[0] Then
MsgBox(16, "ERROR!", "Original lines: " & $arrOriginalFile[0] & @CRLF & "User file lines: " & $arrUserFile[0])
Return
EndIf

Local $Section = "" ; INI Section name goes here
Local $temp = "" ; Temp var for multi purpose
Local $firstChar = ''
Local $lastChar = ''
For $i = 1 To $arrOriginalFile[0]
$firstChar = StringLeft($arrOriginalFile[$i], 1)
$lastChar = StringRight($arrOriginalFile[$i], 1)
If $firstChar == "[" Then
$Section = _StringBetween($arrOriginalFile[$i], "[", "]")[0] ; Remove '[' and ']' from section name because we don't need it.
ElseIf $firstChar == "/" Or StringIsSpace($firstChar) Then
ContinueLoop ; Skip empty and comment lines
EndIf

If $arrOriginalFile[$i] <> $arrUserFile[$i] Then
$temp = StringStripWS($arrUserFile[$i], 8) ; Strips the white space in a string.
$temp = StringSplit($temp, "//")[1] ; Remove comment

_ArrayAdd($arrSections, $Section & "/" & StringSplit($temp, "=")[1]) ; Add changed setting name to array
_ArrayAdd($arrValues, StringSplit($temp, "=")[2]) ; Add changed setting value to array
$countChanges += 1
EndIf

Next
EndFunc ;==>CompareIni
51 changes: 51 additions & 0 deletions ORG_INIFILES/board.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[BOARD]
SACKING_ENABLED = 1
MIN_POINTS = 15 // Minimum number of points the manager must have to avoid being sacked.
POINTS_WIN = 5 // Board confidence points added for winning a game.
POINTS_DRAW = 1 // Board confidence points added for a draw game.
POINTS_LOSS = -5 // Board confidence points added for losing a game. It can be negative.
LOSING_STREAK = 6 // Number of games that the manager must loss in a row to be considered a losing streak.
FIRST_CHECK = 15 // Number of games that the team must play before the first board check.
INTERVAL_BETWEEN_CHECK = 5 // Number of games played before doing a check again.
INTERVAL_BETWEEN_PREFORMANCE_EMAILS = 14 // Number of days before sent the next Your Performance so Far e-mail

//Point loss or gain for objectives
LEAGUE_OBJECTIVE_RESULT_POINTS_0 = -90 //Significantly fail
LEAGUE_OBJECTIVE_RESULT_POINTS_1 = -25 //Fail
LEAGUE_OBJECTIVE_RESULT_POINTS_2 = 25 //Succeeded
LEAGUE_OBJECTIVE_RESULT_POINTS_3 = 50 //Overachived
LEAGUE_OBJECTIVE_RESULT_POINTS_4 = 75 //Significantly overachived

DOM_CUP_OBJECTIVE_RESULT_POINTS_0 = -15 //Significantly fail
DOM_CUP_OBJECTIVE_RESULT_POINTS_1 = -5 //Fail
DOM_CUP_OBJECTIVE_RESULT_POINTS_2 = 10 //Succeeded
DOM_CUP_OBJECTIVE_RESULT_POINTS_3 = 20 //Overachived
DOM_CUP_OBJECTIVE_RESULT_POINTS_4 = 30 //Significantly overachived

EU_CUP_OBJECTIVE_RESULT_POINTS_0 = -30 //Significantly fail
EU_CUP_OBJECTIVE_RESULT_POINTS_1 = -10 //Fail
EU_CUP_OBJECTIVE_RESULT_POINTS_2 = 20 //Succeeded
EU_CUP_OBJECTIVE_RESULT_POINTS_3 = 40 //Overachived
EU_CUP_OBJECTIVE_RESULT_POINTS_4 = 65 //Significantly overachived

GAP_RATIO_RANGE_0 = 1.0 // very close to objective
GAP_RATIO_RANGE_1 = 1.0
GAP_RATIO_RANGE_2 = 2.0
GAP_RATIO_RANGE_3 = 2.0
GAP_RATIO_RANGE_4 = 3.0 // very far to objective

GAP_RATIO_PENALTY_HELP_0 = 0.2 // very close to objective
GAP_RATIO_PENALTY_HELP_1 = 0.4
GAP_RATIO_PENALTY_HELP_2 = 0.6
GAP_RATIO_PENALTY_HELP_3 = 0.8
GAP_RATIO_PENALTY_HELP_4 = 1.0 // very far from objective

LATE_JOB_CHANGE_MAX_GAMES = 10 // Maximum number of games that the manager plays after the job change to consider this a late job change
LATE_JOB_CHANGE_MAX_MODIFIER = 1.0 // Maximum modifier to be applied at the EOS review if the manager has changed the job late in the season (values closer to 0 will reduce the penalty modifier applied)
SACK_AVOID_CHANCE = 10 // Chance to not be sacked if the current season objectives cannot be achieved (ranges from 0 to 100)
SACK_AVOID_CHANCE_GREAT_LAST_SEASON = 40 // Chance to not be sacked if the current season objectives cannot be achieved, but the previous season was great (ranges from 0 to 100)

POPULARITY_RATING_OFFSET_POINTS = 5
POPULARITY_RATING_WARNING_POINTS = 40
POPULARITY_RATING_FIRED_POINTS = 30
POPULARITY_RATING_SAVED_POINTS = 50
12 changes: 12 additions & 0 deletions ORG_INIFILES/cmStories.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[CLUB_WORTH_STORY]
CLUB_WORTH_THRESHOLD = 500000000
CLUB_WORTH_INCREASE_RICH_CLUBS = 10 //percentage
CLUB_WORTH_INCREASE_NORMAL_CLUBS = 30 //percentage

[YOUTH_DEV_STORY]
NUM_PLAYERS_PRIORITY_HIGH = 4
NUM_PLAYERS_PRIORITY_LOW = 3
YOUTH_DEV_RATING_THRESHOLD = 6
YOUTH_MIN_POTENTIAL_PRIORITY_HIGH = 85
YOUTH_MIN_POTENTIAL_PRIORITY_LOW = 75
YOUTH_MAX_AGE = 21
Loading

0 comments on commit 20ac67a

Please sign in to comment.