Untitled
unknown
lua
a year ago
8.9 kB
10
Indexable
function dedbawiy(sender, tItem, iName, iUID, iType)
local listBox, index, name, uid, itemType
if sender then
listBox = sender.Control[0].Control[2]
if listBox == nil then return end
index = listBox.ItemIndex
if index == -1 then return end
name = tItem[listBox.ItemIndex].name
uid = tItem[listBox.ItemIndex].id
itemType = tItem[listBox.ItemIndex].type
else
name = iName
uid = iUID
itemType = iType
end
local addr = getAddressSafe("ipizednt")
if addr == nil then return end
local itemAddr = getAddressSafe(addr+0x101)
if itemAddr == nil then return end
local mrOwner = getAddressList().getMemoryRecordByID(24079)
if mrOwner ~= nil then
local mrCount = mrOwner.count-2
if mrCount == 32 then messageDialog("The maximum number of items has been reached!\n\nPlease remove some items.",0) return end
local mrItem, mrSubItem, mrSubItem2, mrPreset, pos, enums, enumsIndexed
mrItem, pos = findRecord(mrOwner, name)
local itemAddress = getAddressSafe(itemAddr+(0x12*mrCount))
if not mrItem then
mrItem = createRecord(mrOwner, name, vtGrouped, itemAddr+(0x12*mrCount), nil)
mrItem.Color = Color.Child3
mrItem.options = "[moHideChildren,moDeactivateChildrenAsWell]"
mrItem.DontSave = true
-- Is Active ?
mrSubItem = createRecord(mrItem, "Is Active ?", vtByte, "+0", nil)
mrSubItem.Color = 0x000FFFF
mrSubItem.DropDownReadOnly = true
mrSubItem.DropDownDescriptionOnly = true
mrSubItem.DisplayAsDropDownListItem = true
mrSubItem.DropDownList.Text = typeOptionStringMaps["binaryOptionType"]
mrSubItem.Value = 1
-- Item Type
enums = {
[9] = TrID[229390],
[24] = TrID[294181],
[1] = TrID[294180],
}
enumsIndexed = enumsToStringList(enums, true)
mrSubItem = createRecord(mrItem, "Item Type", vtByte, "+0x1", nil)
mrSubItem.Color = 0x000FFFF
mrSubItem.DropDownReadOnly = true
mrSubItem.DropDownDescriptionOnly = true
mrSubItem.DisplayAsDropDownListItem = true
mrSubItem.DropDownList.Text = enumsIndexed
mrSubItem.Value = itemType
-- Unique ID
mrSubItem = createRecord(mrItem, "Unique ID", vtDword, "+0x2", nil)
mrSubItem.Color = 0x000FFFF
mrSubItem.Value = uid
if dependencies({9, 24}, itemType) then
mrSubItem = createRecord(mrItem, TrID[900002], vtGrouped, nil, nil )
mrSubItem.Color = Color.SeparatorSmall
-- Player Position's Filter
enums = {
[0] = "All Roles",
[1] = "Defending Roles (GK/DC)",
[2] = "Midfield Roles (DM/M/AM C)",
[3] = "Flank Roles (D/WB/M/AM RL)",
[4] = "Attacking Roles (ST)",
}
enumsIndexed = enumsToStringList(enums, true)
mrSubItem = createRecord(mrItem, "Player Position Filter", vtByte, "+0x6", nil)
mrSubItem.Color = Color.ReadMe
mrSubItem.DropDownReadOnly = true
mrSubItem.DropDownDescriptionOnly = true
mrSubItem.DisplayAsDropDownListItem = true
mrSubItem.DropDownList.Text = enumsIndexed
mrSubItem.Value = 0
-- Player Position's Familiarity Filter
enums = {
[18] = "Natural",
[15] = "Accomplished",
[12] = "Competent",
}
enumsIndexed = enumsToStringList(enums, true)
mrSubItem = createRecord(mrItem, "Player Position's Familiarity Filter", vtByte, "+0x7", nil)
mrSubItem.Color = Color.ReadMe
mrSubItem.DropDownReadOnly = true
mrSubItem.DropDownDescriptionOnly = true
mrSubItem.DisplayAsDropDownListItem = true
mrSubItem.DropDownList.Text = enumsIndexed
mrSubItem.Value = 18
end
mrSubItem = createRecord(mrItem, TrID[900002], vtGrouped, nil, nil )
mrSubItem.Color = Color.SeparatorSmall
-- Fitness & Morale Modifier
mrSubItem = createRecord(mrItem, "Fitness & Morale Modifier >", vtGrouped, "+0x8", nil)
mrSubItem.Color = Color.Child4
mrSubItem.options = "[moHideChildren,moDeactivateChildrenAsWell]"
mrPreset = createRecord(mrSubItem, 'Presets >', vtGrouped, nil, nil )
mrPreset.Options = "[moHideChildren,moDeactivateChildrenAsWell]"
mrPreset.Color = 0x0080FF
-- Mentality Destroyed
mrSubItem2 = createRecord(mrPreset, "Mentality Destroyed", vtGrouped, nil, nil)
mrSubItem2.Color = Color.Text
mrSubItem2.OnActivate = function(record, before, currentstate)
writeByte(itemAddress+0x9, 5)
writeSmallInteger(itemAddress+0xA, 5000)
writeSmallInteger(itemAddress+0xC, 5000)
writeSmallInteger(itemAddress+0xE, 1000)
return false
end
-- Healthy Fit (default)
mrSubItem2 = createRecord(mrPreset, "Healthy Fit (default)", vtGrouped, nil, nil)
mrSubItem2.Color = Color.Text
mrSubItem2.OnActivate = function(record, before, currentstate)
writeByte(itemAddress+0x9, 20)
writeSmallInteger(itemAddress+0xA, 10000)
writeSmallInteger(itemAddress+0xC, 10000)
writeSmallInteger(itemAddress+0xE, 0)
return false
end
-- A Doping Player
mrSubItem2 = createRecord(mrPreset, "A Doping Player", vtGrouped, nil, nil)
mrSubItem2.Color = Color.Text
mrSubItem2.OnActivate = function(record, before, currentstate)
writeByte(itemAddress+0x9, 25)
writeSmallInteger(itemAddress+0xA, 15000)
writeSmallInteger(itemAddress+0xC, 15000)
writeSmallInteger(itemAddress+0xE, 0)
return false
end
-- Superman (Don't Use On GK/DC)
mrSubItem2 = createRecord(mrPreset, "Superman (Don't Use On GK/DC)", vtGrouped, nil, nil)
mrSubItem2.Color = Color.Text
mrSubItem2.OnActivate = function(record, before, currentstate)
writeByte(itemAddress+0x9, 127)
writeSmallInteger(itemAddress+0xA, 32500)
writeSmallInteger(itemAddress+0xC, 32500)
writeSmallInteger(itemAddress+0xE, -127)
return false
end
mrSubItem2 = createRecord(mrSubItem, TrID[900002], vtGrouped, nil, nil )
mrSubItem2.Color = Color.SeparatorSmall
-- Fitness & Morale Modifier Switcher
mrSubItem2 = createRecord(mrSubItem, "Use Fitness & Morale Modifier", vtByte, "+0", nil)
mrSubItem2.Color = 0x000FFFF
mrSubItem2.DropDownReadOnly = true
mrSubItem2.DropDownDescriptionOnly = true
mrSubItem2.DisplayAsDropDownListItem = true
mrSubItem2.DropDownList.Text = typeOptionStringMaps["binaryOptionType"]
-- Morale
mrSubItem2 = createRecord(mrSubItem, "Morale", vtByte, "+0x1", nil)
mrSubItem2.Color = Color.Text
-- Overall Physical Conditio
mrSubItem2 = createRecord(mrSubItem, "Overall Physical Condition", vtWord, "+0x2", nil)
mrSubItem2.Color = Color.Text
-- Match Sharpness
mrSubItem2 = createRecord(mrSubItem, "Match Sharpness", vtWord, "+0x4", nil)
mrSubItem2.Color = Color.Text
-- Fatigue
mrSubItem2 = createRecord(mrSubItem, "Fatigue", vtWord, "+0x6", nil)
mrSubItem2.Color = Color.Text
mrSubItem2.ShowAsSigned = true
-- Attributes Modifier
mrSubItem = createRecord(mrItem, "Attributes Modifier >", vtGrouped, "+0x10", nil)
mrSubItem.Color = Color.Child4
mrSubItem.options = "[moHideChildren,moDeactivateChildrenAsWell]"
-- Attributes Modifier Switcher
mrSubItem2 = createRecord(mrSubItem, "Use Attributes Modifier", vtByte, "+0", nil)
mrSubItem2.Color = 0x000FFFF
mrSubItem2.DropDownReadOnly = true
mrSubItem2.DropDownDescriptionOnly = true
mrSubItem2.DisplayAsDropDownListItem = true
mrSubItem2.DropDownList.Text = typeOptionStringMaps["binaryOptionType"]
-- All Attributes Value
mrSubItem2 = createRecord(mrSubItem, "Set the Player's All Attributes value to", vtCustom, "+0x1", nil, "FM Attribute")
mrSubItem2.Color = Color.Text
writeQword(addr+(0x8*mrCount), itemAddress)
writeByte(addr+0x100, mrCount+1)
ipizednt[name] = {
indx = mrCount,
mrec = mrItem,
addr = mrItem.getCurrentAddress(),
data = readBytes(mrItem.getCurrentAddress(), 0x12, true),
}
mrItem.OnDestroy = function()
table.removekey(ipizednt, name)
local itemCount = readByte(addr+0x100)
if itemCount then
if itemCount <= mrOwner.count-2 then
local data = readBytes(mrItem.getCurrentAddress()+0x12, (32 - mrCount+1)*0x12, true)
writeBytes(mrItem.getCurrentAddress(), data)
for k, v in pairs(ipizednt) do
if mrCount <= v.indx then
ipizednt[k].indx = v.indx - 1
ipizednt[k].addr = itemAddr + (0x12 * ipizednt[k].indx)
ipizednt[k].data = readBytes(ipizednt[k].addr, 0x12, true)
ipizednt[k].mrec.Address = ipizednt[k].addr
end
end
end
itemCount = itemCount - 1
writeByte(addr+0x100, itemCount)
writeQword(addr+(itemCount*0x8), 0)
end
end
else
ipizednt[name].indx = pos-2
ipizednt[name].addr = itemAddr+((pos-2)*0x12)
ipizednt[name].data = readBytes(ipizednt[name].addr, 0x12, true)
ipizednt[name].mrec.Address = ipizednt[name].addr
end
end
end
Editor is loading...
Leave a Comment