Skip to content

Commit 027663a

Browse files
committed
Merge branch 'test' into master
2 parents f4dd1b1 + 740eb5d commit 027663a

File tree

2 files changed

+83
-75
lines changed

2 files changed

+83
-75
lines changed

README.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
<p style="color: red; font-weight: bold;">* 注意代码中的注释,已经明确标出了玩家自定义区域,和脚本核心区域,请不要修改脚本核心区域中的代码。</p>
104104

105105
### 其他设置(非必要)
106-
* 所有枪械单独设置系数 `ratio`
107-
* 所有枪械单独设置下蹲系数系数 `ctrlmodeRatio`
106+
* 所有枪械单独系数请在 `canUse` 中设置
107+
* 所有枪械单独下蹲系数请在 `canUse` 中设置
108108
* [扩展开发教程:增加一把新的枪械/修改一把枪械的数据](https://github.com/kiccer/Soldier76/issues/24)
109109
* [扩展开发教程:设置自定义瞄准判断条件](https://github.com/kiccer/Soldier76/issues/52)
110110

@@ -230,14 +230,23 @@ G键 | 功能
230230
* 十分欢迎愿意给本项目精调弹道的小伙伴
231231
* 我们也同样欢迎其他项目的小伙伴入驻,一起交流技术话题
232232

233+
### 常见问题
234+
* Q:毫无反应?
235+
- A1:请先排除无线鼠标、GHUB
236+
- A2:请确认你是否启动了宏 (默认为开启大写)
237+
* Q:在桌面有反应,在游戏里没反应?
238+
- A:关闭驱动,重新以管理员身份启动驱动
239+
* Q:代码中的注释全是乱码?
240+
- A1:你的驱动可能是 `GHUB`,目前暂时不支持
241+
- A2:你可能使用了 `导入`功能,`lua` 文件是直接复制粘贴进编辑器里的,不能使用 `导入`
242+
* Q:枪头直接怼地上,拉都拉不起来?
243+
- A:调整 ADS (如果你有此疑问,你肯定没看上面的教程)
244+
233245
### 问题反馈
234246
* 使用脚本时有任何疑问,或脚本存在不足之处可以在 [`Issues`](https://github.com/kiccer/Soldier76/issues) 反馈给我
235247

236248
### 关于宏
237-
* 宏就像是一个心灵手巧的瞎子
238-
* 它能帮你做更复杂细腻的操作
239-
* 但无法根据实时情况进行变通
240-
* 所以菜的人依旧菜得真实……
249+
宏就像是一个心灵手巧的瞎子,它能帮你做更复杂细腻的操作,但无法根据实时情况进行变通,所以菜的人依旧菜得真实……
241250

242251
### 关于游戏公平性问题
243252
我赞同 [@liantian-cn](https://github.com/liantian-cn/logitech-pubg/tree/f816d1da3e2d5cf82708bf4225b4cf3f03c06332#q2-%E6%80%8E%E4%B9%88%E7%9C%8B%E5%BE%85%E9%BC%A0%E6%A0%87%E5%AE%8F) 的观点。

Soldier76.lua

+68-69
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,34 @@ userInfo = {
5656
end,
5757
},
5858

59-
-- 支持的枪械,排列顺序即是配置顺序,可以自行调整。启用设置:0 - 不启用 | 1 - 启用 | 2 - 启用并开启连发功能
60-
-- The arrangement order is the configuration order, which can be adjusted by yourself.
61-
-- 0 - Disable | 1 - Enable | 2 - Enable and turn on the auto fire function
59+
-- 支持的枪械,排列顺序即是配置顺序,可以自行调整。
60+
-- 模式:0 - 不启用 | 1 - 启用 | 2 - 开启连点
61+
-- 系数:枪械自身系数,基于 ADS 进行调整 (ADS为全局系数,此处为自身系数)
62+
-- 下蹲系数:下蹲时的系数,基于 ADS 和 自身系数
6263
canUse = {
6364
[".45"] = {
64-
{ "UMP45", 1 }, -- 基础镜 + 扩容,Bizon (基础镜即可),Vector (补偿 + 基础镜 + 扩容) | Reddot + Mag,Bizon (Reddot),Vector (Komp + Reddot + Mag)
65-
{ "Tommy Gun", 1 }, -- 扩容 | Mag
65+
-- 枪械 模式 系数 下蹲系数
66+
{ "UMP45", 1, 1, 0.8 }, -- 基础镜 + 扩容,Bizon (基础镜即可),Vector (补偿 + 基础镜 + 扩容) | Reddot + Mag,Bizon (Reddot),Vector (Komp + Reddot + Mag)
67+
{ "Tommy Gun", 1, 1, 0.8 }, -- 扩容 | Mag
6668
},
69+
-- 枪械 模式 系数 下蹲系数
6770
["9mm"] = {
68-
{ "Vector", 1 }, -- 基础镜 + 扩容 | Reddot + Mag
69-
{ "Micro UZI", 1 }, -- 扩容 | Mag
71+
{ "Vector", 1, 1, 0.8 }, -- 基础镜 + 扩容 | Reddot + Mag
72+
{ "Micro UZI", 1, 1, 0.8 }, -- 扩容 | Mag
7073
},
7174
["5.56"] = {
72-
{ "M416", 1 }, -- 补偿 + 基础镜 + 直角 + 枪托 + 扩容 | Komp + Reddot + Triangular grip + Gunstock + Mag
73-
{ "SCAR-L", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
74-
{ "QBZ", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
75-
{ "G36C", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
76-
{ "M16A4", 2 }, -- 补偿 + 基础镜 + 枪托 + 扩容 | Komp + Reddot + Gunstock + Mag
75+
-- 枪械 模式 系数 下蹲系数
76+
{ "M416", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 枪托 + 扩容 | Komp + Reddot + Triangular grip + Gunstock + Mag
77+
{ "SCAR-L", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
78+
{ "QBZ", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
79+
{ "G36C", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
80+
{ "M16A4", 2, 1, 0.8 }, -- 补偿 + 基础镜 + 枪托 + 扩容 | Komp + Reddot + Gunstock + Mag
7781
},
7882
["7.62"] = {
79-
{ "AKM", 1 }, -- 补偿 + 基础镜 + 扩容 | Komp + Reddot + Mag
80-
{ "Beryl M762", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
81-
{ "DP-28", 1 }, -- 基础镜 | Reddot
83+
-- 枪械 模式 系数 下蹲系数
84+
{ "AKM", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 扩容 | Komp + Reddot + Mag
85+
{ "Beryl M762", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
86+
{ "DP-28", 1, 1, 0.8 }, -- 基础镜 | Reddot
8287
},
8388
},
8489

@@ -286,11 +291,9 @@ function pubg.isAimingState (mode)
286291
return switch[mode]()
287292
end
288293

289-
pubg["M16A4"] = function ()
294+
pubg["M16A4"] = function (gunName)
290295

291-
return pubg.execOptions({
292-
ratio = 1,
293-
ctrlmodeRatio = 0.8,
296+
return pubg.execOptions(gunName, {
294297
interval = 108,
295298
ballistic = {
296299
{1, 0},
@@ -307,11 +310,9 @@ pubg["M16A4"] = function ()
307310

308311
end
309312

310-
pubg["SCAR-L"] = function ()
313+
pubg["SCAR-L"] = function (gunName)
311314

312-
return pubg.execOptions({
313-
ratio = 1,
314-
ctrlmodeRatio = 0.8,
315+
return pubg.execOptions(gunName, {
315316
interval = 96,
316317
ballistic = {
317318
{1, 0},
@@ -327,11 +328,9 @@ pubg["SCAR-L"] = function ()
327328

328329
end
329330

330-
pubg["Beryl M762"] = function ()
331+
pubg["Beryl M762"] = function (gunName)
331332

332-
return pubg.execOptions({
333-
ratio = 1,
334-
ctrlmodeRatio = 0.8,
333+
return pubg.execOptions(gunName, {
335334
interval = 86,
336335
ballistic = {
337336
{1, 0},
@@ -350,11 +349,9 @@ pubg["Beryl M762"] = function ()
350349

351350
end
352351

353-
pubg["Tommy Gun"] = function ()
352+
pubg["Tommy Gun"] = function (gunName)
354353

355-
return pubg.execOptions({
356-
ratio = 1,
357-
ctrlmodeRatio = 0.8,
354+
return pubg.execOptions(gunName, {
358355
interval = 84,
359356
ballistic = {
360357
{1, 0},
@@ -367,11 +364,9 @@ pubg["Tommy Gun"] = function ()
367364

368365
end
369366

370-
pubg["G36C"] = function ()
367+
pubg["G36C"] = function (gunName)
371368

372-
return pubg.execOptions({
373-
ratio = 1,
374-
ctrlmodeRatio = 0.8,
369+
return pubg.execOptions(gunName, {
375370
interval = 80,
376371
ballistic = {
377372
{1, 0},
@@ -386,11 +381,9 @@ pubg["G36C"] = function ()
386381

387382
end
388383

389-
pubg["Vector"] = function ()
384+
pubg["Vector"] = function (gunName)
390385

391-
return pubg.execOptions({
392-
ratio = 1,
393-
ctrlmodeRatio = 0.8,
386+
return pubg.execOptions(gunName, {
394387
interval = 55,
395388
ballistic = {
396389
{1, 0},
@@ -404,11 +397,9 @@ pubg["Vector"] = function ()
404397

405398
end
406399

407-
pubg["Micro UZI"] = function ()
400+
pubg["Micro UZI"] = function (gunName)
408401

409-
return pubg.execOptions({
410-
ratio = 1,
411-
ctrlmodeRatio = 0.8,
402+
return pubg.execOptions(gunName, {
412403
interval = 46,
413404
ballistic = {
414405
{1, 0},
@@ -423,11 +414,9 @@ pubg["Micro UZI"] = function ()
423414

424415
end
425416

426-
pubg["UMP45"] = function ()
417+
pubg["UMP45"] = function (gunName)
427418

428-
return pubg.execOptions({
429-
ratio = 1,
430-
ctrlmodeRatio = 0.8,
419+
return pubg.execOptions(gunName, {
431420
interval = 94,
432421
ballistic = {
433422
{1, 0},
@@ -440,11 +429,9 @@ pubg["UMP45"] = function ()
440429

441430
end
442431

443-
pubg["AKM"] = function ()
432+
pubg["AKM"] = function (gunName)
444433

445-
return pubg.execOptions({
446-
ratio = 1,
447-
ctrlmodeRatio = 0.8,
434+
return pubg.execOptions(gunName, {
448435
interval = 99,
449436
ballistic = {
450437
{1, 0},
@@ -460,11 +447,9 @@ pubg["AKM"] = function ()
460447

461448
end
462449

463-
pubg["M416"] = function ()
450+
pubg["M416"] = function (gunName)
464451

465-
return pubg.execOptions({
466-
ratio = 1,
467-
ctrlmodeRatio = 0.8,
452+
return pubg.execOptions(gunName, {
468453
interval = 85,
469454
ballistic = {
470455
{1, 0},
@@ -482,11 +467,9 @@ pubg["M416"] = function ()
482467

483468
end
484469

485-
pubg["QBZ"] = function ()
470+
pubg["QBZ"] = function (gunName)
486471

487-
return pubg.execOptions({
488-
ratio = 1,
489-
ctrlmodeRatio = 0.8,
472+
return pubg.execOptions(gunName, {
490473
interval = 87,
491474
ballistic = {
492475
{1, 0},
@@ -502,11 +485,9 @@ pubg["QBZ"] = function ()
502485

503486
end
504487

505-
pubg["DP-28"] = function ()
488+
pubg["DP-28"] = function (gunName)
506489

507-
return pubg.execOptions({
508-
ratio = 1,
509-
ctrlmodeRatio = 0.8,
490+
return pubg.execOptions(gunName, {
510491
interval = 100,
511492
ballistic = {
512493
{1, 0},
@@ -520,8 +501,23 @@ pubg["DP-28"] = function ()
520501

521502
end
522503

504+
-- [[通过枪械名查找在 canuse 中的项]]
505+
function pubg.canUseFindByGunName (gunName)
506+
local forList = { ".45", "9mm", "5.56", "7.62" }
507+
508+
for i = 1, #forList do
509+
local bulletType = forList[i]
510+
for j = 1, #userInfo.canUse[bulletType] do
511+
local item = userInfo.canUse[bulletType][j]
512+
if item[1] == gunName then
513+
return item
514+
end
515+
end
516+
end
517+
end
518+
523519
--[[ FormatFactory ]]
524-
function pubg.execOptions (options)
520+
function pubg.execOptions (gunName, options)
525521

526522
--[[
527523
@@ -542,6 +538,8 @@ function pubg.execOptions (options)
542538
543539
]]
544540

541+
local gunInfo = pubg.canUseFindByGunName(gunName)
542+
545543
-- Temporary container
546544
local ballisticConfig1 = {}
547545
-- Temporary container (v3.0)
@@ -555,7 +553,8 @@ function pubg.execOptions (options)
555553
end
556554
for j = 1, nextCount do
557555
ballisticConfig1[ballisticIndex] =
558-
options.ballistic[i][2] * pubg.generalSensitivityRatio * options.ratio
556+
-- options.ballistic[i][2] * pubg.generalSensitivityRatio * options.ratio
557+
options.ballistic[i][2] * pubg.generalSensitivityRatio * gunInfo[3]
559558
ballisticIndex = ballisticIndex + 1
560559
end
561560
end
@@ -578,7 +577,7 @@ function pubg.execOptions (options)
578577
amount = #ballisticConfig2, -- Number of bullets
579578
interval = options.interval, -- Time of each bullet
580579
ballistic = ballisticConfig2, -- ballistic data
581-
ctrlmodeRatio = options.ctrlmodeRatio, -- Individual recoil coefficient for each gun when squatting
580+
ctrlmodeRatio = gunInfo[4], -- Individual recoil coefficient for each gun when squatting
582581
}
583582

584583
end
@@ -602,7 +601,7 @@ function pubg.init ()
602601
-- one series
603602
gunCount = gunCount + 1 -- Accumulative number of firearms configuration files
604603
pubg.gun[type][gunCount] = gunName -- Adding available firearms to the Arsenal
605-
pubg.gunOptions[type][gunCount] = pubg[gunName]() -- Get firearms data and add it to the configuration library
604+
pubg.gunOptions[type][gunCount] = pubg[gunName](gunName) -- Get firearms data and add it to the configuration library
606605

607606
-- 单独设置连发
608607
pubg.gunOptions[type][gunCount].autoContinuousFiring = ({ 0, 0, 1 })[
@@ -1020,7 +1019,7 @@ end
10201019
function pubg.outputLogGunSwitchTable ()
10211020
local forList = { ".45", "9mm", "5.56", "7.62" }
10221021
local allCount = 0
1023-
local resStr = " canUse_i\t series_i\t Series\t Gun Name\n\n"
1022+
local resStr = " canUse_i\t series_i\t Series\t ratio\t ctrl ratio\t Gun Name\n\n"
10241023

10251024
for i = 1, #forList do
10261025
local type = forList[i]
@@ -1032,7 +1031,7 @@ function pubg.outputLogGunSwitchTable ()
10321031
local tag = gunName == pubg.gun[pubg.bulletType][pubg.gunIndex] and "=> " or " "
10331032
gunCount = gunCount + 1
10341033
allCount = allCount + 1
1035-
resStr = table.concat({ resStr, tag, allCount, "\t", tag, gunCount, "\t", tag, type, "\t", tag, gunName, "\n" })
1034+
resStr = table.concat({ resStr, tag, allCount, "\t", tag, gunCount, "\t", tag, type, "\t", tag, userInfo.canUse[type][j][3], "\t", tag, userInfo.canUse[type][j][4], "\t", tag, gunName, "\n" })
10361035
end
10371036
end
10381037

0 commit comments

Comments
 (0)