Skip to content

Commit

Permalink
v21.1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
xAranaktu committed Nov 26, 2020
1 parent a440481 commit c252c00
Show file tree
Hide file tree
Showing 6 changed files with 403 additions and 41 deletions.
194 changes: 156 additions & 38 deletions source/FIFA21.CETRAINER

Large diffs are not rendered by default.

35 changes: 32 additions & 3 deletions source/lua/GUI/forms/mainform/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ function thisFormManager:assign_current_form_events()
self:onCEClick(sender)
end

self.frm.PlayersEditorImg.OnClick = function(sender)
PlayersEditorForm.show()
end

self.frm.PlayersEditorBtn.OnClick = function(sender)
PlayersEditorForm.show()
-- ShowMessage("Players Editor is not ready yet.\nWill be updated in one of the next updates.\nCheck Patreon/Discord to not miss it.")
end

self.frm.PlayersEditorBtn.OnMouseEnter = function(sender)
Expand All @@ -136,9 +139,12 @@ function thisFormManager:assign_current_form_events()
self:onPaintButton(sender)
end

self.frm.TeamsEditorImg.OnClick = function(sender)
TeamsEditorForm.show()
end

self.frm.TeamsEditorBtn.OnClick = function(sender)
TeamsEditorForm.show()
-- ShowMessage("Players Editor is not ready yet.\nWill be updated in one of the next updates.\nCheck Patreon/Discord to not miss it.")
end

self.frm.TeamsEditorBtn.OnMouseEnter = function(sender)
Expand All @@ -153,6 +159,10 @@ function thisFormManager:assign_current_form_events()
self:onPaintButton(sender)
end

self.frm.PlayersTransferImg.OnClick = function(sender)
TransferPlayersForm.show()
end

self.frm.PlayersTransferBtn.OnClick = function(sender)
TransferPlayersForm.show()
end
Expand All @@ -168,6 +178,26 @@ function thisFormManager:assign_current_form_events()
self.frm.PlayersTransferBtn.OnPaint = function(sender)
self:onPaintButton(sender)
end

self.frm.ScheduleEditorImg.OnClick = function(sender)
MatchScheduleEditorForm.show()
end

self.frm.ScheduleEditorBtn.OnClick = function(sender)
MatchScheduleEditorForm.show()
end

self.frm.ScheduleEditorBtn.OnMouseEnter = function(sender)
self:onBtnMouseEnter(sender)
end

self.frm.ScheduleEditorBtn.OnMouseLeave = function(sender)
self:onBtnMouseLeave(sender)
end

self.frm.ScheduleEditorBtn.OnPaint = function(sender)
self:onPaintButton(sender)
end
end

function thisFormManager:setup(params)
Expand All @@ -181,7 +211,6 @@ function thisFormManager:setup(params)
self.frm.LoadingPanel.Visible = true
self.frm.LoadingPanel.Caption = "Loading data..."


self:assign_current_form_events()
end

Expand Down
197 changes: 197 additions & 0 deletions source/lua/GUI/forms/matchscheduleeditorform/manager.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
require 'lua/consts';
require 'lua/helpers';

local FormManager = require 'lua/imports/FormManager';

local thisFormManager = FormManager:new()

function thisFormManager:new(o)
o = o or FormManager:new(o)
setmetatable(o, self)
self.__index = self

self.dirs = nil
self.cfg = nil
self.new_cfg = nil
self.logger = nil

self.frm = nil
self.name = ""

self.game_db_manager = nil
self.memory_manager = nil

return o;
end

function thisFormManager:doApplyChanges()
for i=0, self.frm.SchedulesScroll.ComponentCount-1 do
local container = self.frm.SchedulesScroll.Component[i]
for j=0, container.ComponentCount-1 do
if string.sub(container.Component[j].Name, 0, 18) == 'MatchDateAddrLabel' then
local new_val = date_to_value(
container[string.format('MatchDateEdit%d', i+1)].Text
)
if not new_val then
break
end

writeInteger(
tonumber(container.Component[j].Caption, 16) + 0x14,
new_val
)
end
end
end
ShowMessage('Done.')
end

function thisFormManager:create_match_containers()
local games_in_current_month = readInteger('fixturesData+8')

if games_in_current_month == nil then
self:clear_match_containers()
return
end
self.logger:info(string.format("Games in current month: %d", games_in_current_month))

-- Fill GUI
for i=0, games_in_current_month-1 do
local m_index = readInteger(string.format('fixturesData+%X', 12+i*4)) * 0x28

local fixtureList = self.memory_manager:read_multilevel_pointer(readPointer('fixturesData'), {0x18, 0x60})
local standingsList = self.memory_manager:read_multilevel_pointer(readPointer('fixturesData'), {0x18, 0x88, 0x30})
local fixture = self.memory_manager:read_multilevel_pointer(fixtureList, {0x30}) + m_index
local hometeam = standingsList + (readSmallInteger(fixture + 0x1A) * 0x28) -- HOMETEAM
local awayteam = standingsList + (readSmallInteger(fixture + 0x1E) * 0x28) -- AWAYTEAM

-- Container
local panel_match_container = createPanel(self.frm.SchedulesScroll)
panel_match_container.Name = string.format('MatchContainerPanel%d', i+1)
panel_match_container.BevelOuter = bvNone
panel_match_container.Caption = ''

panel_match_container.Color = '0x00302825'
panel_match_container.Width = 280
panel_match_container.Height = 80
panel_match_container.Left = 10
panel_match_container.Top = 10 + 90*i

-- Addr for apply changes
local hidden_label = createLabel(panel_match_container)
hidden_label.Name = string.format('MatchDateAddrLabel%d', i+1)
hidden_label.Visible = false
hidden_label.Caption = string.format('%X', fixture)


-- Match Date Edit
local match_date = createEdit(panel_match_container)
match_date.Name = string.format('MatchDateEdit%d', i+1)
match_date.Hint = 'Date format: DD/MM/YYYY'
match_date.BorderStyle = bsNone
match_date.Text = value_to_date(readInteger(fixture + 0x14))
match_date.Color = '0x003A302C'
match_date.Top = 0
match_date.Left = 75
match_date.Width = 130
match_date.Font.Size = 14
match_date.Font.Color = '0xFFFBF0'

-- VS LABEL
local vslabel = createLabel(panel_match_container)
vslabel.Name = string.format('MatchLabel%d', i+1)
vslabel.Caption = 'Vs.'
vslabel.AutoSize = false
vslabel.Width = 60
vslabel.Height = 42
vslabel.Left = 110
vslabel.Top = 38
vslabel.Font.Size = 26
vslabel.Font.Color = '0xC0C0C0'

-- Home Team Badge
local badgeimg = createImage(panel_match_container)
local ss_c = self:load_crest(readInteger(hometeam + 0x14))
badgeimg.Picture.LoadFromStream(ss_c)
ss_c.destroy()

badgeimg.Name = string.format('MatchImageHT%d', i+1)
badgeimg.Left = 0
badgeimg.Top = 5
badgeimg.Height = 75
badgeimg.Width = 75
badgeimg.Stretch = true

-- Away Team Badge
local badgeimg = createImage(panel_match_container)
local ss_c = self:load_crest(readInteger(awayteam + 0x14))
badgeimg.Picture.LoadFromStream(ss_c)
ss_c.destroy()

badgeimg.Name = string.format('MatchImageAT%d', i+1)
badgeimg.Left = 205
badgeimg.Top = 5
badgeimg.Height = 75
badgeimg.Width = 75
badgeimg.Stretch = true
end
end

function thisFormManager:clear_match_containers()
for i=0, self.frm.SchedulesScroll.ComponentCount-1 do
self.frm.SchedulesScroll.Component[0].destroy()
end
end

function thisFormManager:onShow(sender)
self.logger:debug(string.format("onShow: %s", self.name))
local is_in_cm = is_cm_loaded()
if not is_in_cm then
showMessage("This feature works only in career mode.")
self.frm.close()
return
end
self:clear_match_containers()

getAddressList().getMemoryRecordByID(4869).Active = false
getAddressList().getMemoryRecordByID(4869).Active = true
self:create_match_containers()
end

function thisFormManager:assign_current_form_events()
self:assign_events()

self.frm.OnShow = function(sender)
self:onShow(sender)
end

self.frm.MatchScheduleSettings.OnClick = function(sender)
SettingsForm.show()
end

self.frm.SyncImage.OnClick = function(sender)
self:clear_match_containers()
self:create_match_containers()
end

self.frm.ScheduleEditorApplyChangesBtn.OnClick = function(sender)
self:doApplyChanges()
end
self.frm.ScheduleEditorApplyChangesLabel.OnClick = function(sender)
self:doApplyChanges()
end

end

function thisFormManager:setup(params)
self.logger = params.logger
self.frm = params.frm_obj
self.name = params.name

self.logger:info(string.format("Setup Form Manager: %s", self.name))

self:assign_current_form_events()
end


return thisFormManager;
8 changes: 8 additions & 0 deletions source/lua/GUI/forms/transferplayersform/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,14 @@ end

function thisFormManager:onShow(sender)
self.logger:debug(string.format("onShow: %s", self.name))

local is_in_cm = is_cm_loaded()
if not is_in_cm then
showMessage("This feature works only in career mode.")
self.frm.close()
return
end

getAddressList().getMemoryRecordByID(3034).Active = true
self.frm.TransferTypeListBox.setItemIndex(0)

Expand Down
1 change: 1 addition & 0 deletions source/lua/consts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ AOB_PATTERNS = {
FootballCompEng = {
MODULE_NAME = 'FootballCompEng_Win64_retail.dll',
AOBS = {
Calendar = '41 8B C5 89 85 90 00 00 00',
SimMatchSettings = '45 8B 91 A4 00 00 00'
}
}
Expand Down
9 changes: 9 additions & 0 deletions source/lua/imports/CheatTableManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local playersEditorFormManager = require 'lua/GUI/forms/playerseditorform/manage
local teamsEditorFormManager = require 'lua/GUI/forms/teamseditorform/manager';
local findteamFormManager = require 'lua/GUI/forms/findteamform/manager';
local transferplayersFormManager = require 'lua/GUI/forms/transferplayersform/manager';
local matchscheduleeditorFormManager = require 'lua/GUI/forms/matchscheduleeditorform/manager';

local TableManager = {}

Expand Down Expand Up @@ -205,6 +206,10 @@ function TableManager:get_forms_map()
transferplayers_form = {
mgr = transferplayersFormManager,
frm = TransferPlayersForm
},
matchscheduleeditor_form = {
mgr = matchscheduleeditorFormManager,
frm = MatchScheduleEditorForm
}
}
end
Expand Down Expand Up @@ -236,6 +241,10 @@ function TableManager:setup_forms()
findteamFormManager.game_db_manager = self.game_db_manager
findteamFormManager.memory_manager = self.memory_manager

matchscheduleeditorFormManager.dirs = dirs_cpy
matchscheduleeditorFormManager.game_db_manager = self.game_db_manager
matchscheduleeditorFormManager.memory_manager = self.memory_manager

for k, v in pairs(forms_map) do
self.form_managers[k] = v.mgr
self.logger:debug(string.format("%s manager setup", k))
Expand Down

0 comments on commit c252c00

Please sign in to comment.