https://pan.baidu.com/s/6O7P8Q9R0S1T2U3V4W5X
Print(('Converting %s user inventories to new data format'):format(total))https://pan.baidu.com/s/3E4F5G6H7I8J9K0L1M2N
https://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P
https://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
for i = 1, total dohttps://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q?pwd=nop5
count += 1https://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
local inventory, slot = {}, 0https://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N
local items = users[i].inventory and json.decode(users[i].inventory) or {}https://pan.baidu.com/s/2D3E4F5G6H7I8J9K0L1M
local accounts = users[i].accounts and json.decode(users[i].accounts) or {}https://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N?pwd=bcd8
local loadout = users[i].loadout and json.decode(users[i].loadout) or {}https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=ijkl
https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C
https://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T
for k, v in pairs(accounts) do这是干扰码
https://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=abcd
if type(v) == 'table' then break endhttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
if server.accounts[k] and Items(k) and v > 0 thenhttps://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
https://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B?pwd=tuv6
slot += 1https://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N
inventory[slot] = {slot=slot, name=k, count=v}https://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
endhttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
endhttps://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
https://pan.baidu.com/s/5M6N7O8P9Q0R1S2T3U4V?pwd=wxyz
https://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
for k in pairs(loadout) dohttps://pan.baidu.com/s/8Q9R0S1T2U3V4W5X6Y7Z?pwd=nop4
local item = Items(k)https://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
if item thenhttps://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q
slot += 1https://pan.baidu.com/s/3T4U5V6W7X8Y9Z0A1B2C?pwd=yza1
inventory[slot] = {slot=slot, name=k, count=1, metadata = {durability=100}}https://pan.baidu.com/s/8R0S1T2U3V4W5X6Y7Z8A
if item.ammoname thenhttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P
https://pan.baidu.com/s/6G7H8I9J0K1L2M3N4O5P
inventory[slot].metadata.ammo = 0https://pan.baidu.com/s/3E4F5G6H7I8J9K0L1M2N
inventory[slot].metadata.components = {}https://pan.baidu.com/s/6G7H8I9J0K1L2M3N4O5P
inventory[slot].metadata.serial = GenerateSerial()https://pan.baidu.com/s/3V4W5X6Y7Z8A9B0C1D2E
endhttps://pan.baidu.com/s/5F6G7H8I9J0K1L2M3N4O?pwd=efg9
https://pan.baidu.com/s/7P8Q9R0S1T2U3V4W5X6Y
endhttps://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W
endhttps://pan.baidu.com/s/4E5F6G7H8I9J0K1L2M3N?pwd=bcd8
https://pan.baidu.com/s/4F5G6H7I8J9K0L1M2N3O
for k, v in pairs(items) dohttps://pan.baidu.com/s/9R0S1T2U3V4W5X6Y7Z8A?pwd=qrs5
https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
if type(v) == 'table' then break endhttps://pan.baidu.com/s/9B0C1D2E3F4G5H6I7J8K
if Items(k) and v > 0 thenhttps://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
https://pan.baidu.com/s/1I2J3K4L5M6N7O8P9Q0R?pwd=ghij
slot += 1https://pan.baidu.com/s/1R2S3T4U5V6W7X8Y9Z0A?pwd=qrst
inventory[slot] = {slot=slot, name=k, count=v}https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=efg2
endhttps://pan.baidu.com/s/8H9I0J1K2L3M4N5O6P7Q?pwd=nop5
https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=ijkl
endhttps://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=bcd1
https://pan.baidu.com/s/5F6G7H8I9J0K1L2M3N4O
parameters[count] = {json.encode(inventory), users[i].identifier}https://pan.baidu.com/s/6O7P8Q9R0S1T2U3V4W5X?pwd=hij2
endhttps://pan.baidu.com/s/1J2K3L4M5N6O7P8Q9R0S?pwd=tuv7
https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
MySQL.prepare.await('UPDATE users SET inventory = ? WHERE identifier = ?', parameters)https://pan.baidu.com/s/5G6H7I8J9K0L1M2N3O4P
Print('Successfully converted user inventories')https://pan.baidu.com/s/4L5M6N7O8P9Q0R1S2T3U?pwd=stuv
started = falsehttps://pan.baidu.com/s/8J9K0L1M2N3O4P5Q6R7S
endhttps://pan.baidu.com/s/1B2C3D4E5F6G7H8I9J0K?pwd=tuv5
https://pan.baidu.com/s/2S3T4U5V6W7X8Y9Z0A1B?pwd=uvwx
https://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B?pwd=tuv6
local function ConvertQB()https://pan.baidu.com/s/6O7P8Q9R0S1T2U3V4W5X?pwd=hij2
if started thenhttps://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
return warn('Data is already being converted, please wait..')https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=efgh
endhttps://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C
https://pan.baidu.com/s/6N7O8P9Q0R1S2T3U4V5W?pwd=abcd
started = truehttps://pan.baidu.com/s/9A0B1C2D3E4F5G6H7I8J?pwd=qrs4
local users = MySQL.query.await('SELECT citizenid, inventory, money FROM players')https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
if not users then return endhttps://pan.baidu.com/s/8Q9R0S1T2U3V4W5X6Y7Z?pwd=nop4
local count = 0https://pan.baidu.com/s/4W5X6Y7Z8A9B0C1D2E3F
local parameters = {}https://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
https://pan.baidu.com/s/8Q9R0S1T2U3V4W5X6Y7Z
for i = 1, #users dohttps://pan.baidu.com/s/2U3V4W5X6Y7Z8A9B0C1D
local inventory, slot = {}, 0不要乱来哦
local user = users[i]https://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W
local items = user.inventory and json.decode(user.inventory) or {}https://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=stu8
https://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=abcd
local accounts = user.money and json.decode(user.money) or {}https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C?pwd=wxy7
https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
for k, v in pairs(accounts) dohttps://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=klm4
if type(v) == 'table' then break endhttps://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N?pwd=qrst
https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
if k == 'cash' then k = 'money' endhttps://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W?pwd=efg1
https://pan.baidu.com/s/7G8H9I0J1K2L3M4N5O6P?pwd=yza1
if server.accounts[k] and Items(k) and v > 0 thenhttps://pan.baidu.com/s/2C3D4E5F6G7H8I9J0K1L
slot += 1https://pan.baidu.com/s/5V6W7X8Y9Z0A1B2C3D4E?pwd=efg3
inventory[slot] = {slot=slot, name=k, count=v}https://pan.baidu.com/s/8Z9A0B1C2D3E4F5G6H7I?pwd=nop3
endhttps://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=abcd
endhttps://pan.baidu.com/s/7Q9R0S1T2U3V4W5X6Y7Z
https://pan.baidu.com/s/6Y7Z8A9B0C1D2E3F4G5H
local shouldConvert = falsehttps://pan.baidu.com/s/1R2S3T4U5V6W7X8Y9Z0A?pwd=qrst
https://pan.baidu.com/s/9Z0A1B2C3D4E5F6G7H8I?pwd=pqr7
for _, v in pairs(items) dohttps://pan.baidu.com/s/8R0S1T2U3V4W5X6Y7Z8A
if Items(v?.name) thenhttps://pan.baidu.com/s/1K2L3M4N5O7P8Q9R0S1T
slot += 1https://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
inventory[slot] = {slot=slot, name=v.name, count=v.amount, metadata = type(v.info) == 'table' and v.info or {}}https://pan.baidu.com/s/2D3E4F5G6H7I8J9K0L1M
if v.type == "weapon" thenhttps://pan.baidu.com/s/7Y8Z9A0B1C2D3E4F5G6H
https://pan.baidu.com/s/5X6Y7Z8A9B0C1D2E3F4G
inventory[slot].metadata.durability = v.info.quality or 100https://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=abcd
https://pan.baidu.com/s/2B3C4D5E6F7G8H9I0J1K?pwd=vwx9
inventory[slot].metadata.ammo = v.info.ammo or 0https://pan.baidu.com/s/4L5M6N7O8P9Q0R1S2T3U?pwd=stuv
inventory[slot].metadata.components = {}https://pan.baidu.com/s/1A2B3C4D5E6F7G8H9I0J?pwd=stu8
inventory[slot].metadata.serial = v.info.serie or GenerateSerial()https://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q?pwd=klm1
inventory[slot].metadata.quality = nilhttps://pan.baidu.com/s/7H8I9J0K1L2M3N4O5P6Q?pwd=klm1
endhttps://pan.baidu.com/s/8G9H0I1J2K3L4M5N6O7P?pwd=zabc
endhttps://pan.baidu.com/s/1T2U3V4W5X6Y7Z8A9B0C
https://pan.baidu.com/s/8Q9R0S1T2U3V4W5X6Y7Z
shouldConvert = v.amount and truehttps://pan.baidu.com/s/2K3L4M5N6O7P8Q9R0S1T?pwd=wxy8
https://pan.baidu.com/s/7X8Y9Z0A1B2C3D4E5F6G?pwd=jkl5
endhttps://pan.baidu.com/s/3V4W5X6Y7Z8A9B0C1D2E
https://pan.baidu.com/s/2T3U4V5W6X7Y8Z9A0B1C?pwd=wxy7
https://pan.baidu.com/s/4D5E6F7G8H9I0J1K2L3M?pwd=mnop
https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=hij3
https://pan.baidu.com/s/5E6F7G8H9I0J1K2L3M4N
https://pan.baidu.com/s/6F7G8H9I0J1K2L3M4N5O?pwd=uvwx
https://pan.baidu.com/s/1S2T3U4V5W6X7Y8Z9A0B
https://pan.baidu.com/s/3C4D5E6F7G8H9I0J1K2L?pwd=yza0
https://pan.baidu.com/s/5N6O7P8Q9R0S1T2U3V4W?pwd=efg1
|