Skip to content

Commit

Permalink
Merge branch 'test' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kiccer committed Oct 17, 2020
2 parents f4dd1b1 + 740eb5d commit 027663a
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 75 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
<p style="color: red; font-weight: bold;">* 注意代码中的注释,已经明确标出了玩家自定义区域,和脚本核心区域,请不要修改脚本核心区域中的代码。</p>

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

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

### 常见问题
* Q:毫无反应?
- A1:请先排除无线鼠标、GHUB
- A2:请确认你是否启动了宏 (默认为开启大写)
* Q:在桌面有反应,在游戏里没反应?
- A:关闭驱动,重新以管理员身份启动驱动
* Q:代码中的注释全是乱码?
- A1:你的驱动可能是 `GHUB`,目前暂时不支持
- A2:你可能使用了 `导入`功能,`lua` 文件是直接复制粘贴进编辑器里的,不能使用 `导入`
* Q:枪头直接怼地上,拉都拉不起来?
- A:调整 ADS (如果你有此疑问,你肯定没看上面的教程)

### 问题反馈
* 使用脚本时有任何疑问,或脚本存在不足之处可以在 [`Issues`](https://github.com/kiccer/Soldier76/issues) 反馈给我

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

### 关于游戏公平性问题
我赞同 [@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) 的观点。
Expand Down
137 changes: 68 additions & 69 deletions Soldier76.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,34 @@ userInfo = {
end,
},

-- 支持的枪械,排列顺序即是配置顺序,可以自行调整。启用设置:0 - 不启用 | 1 - 启用 | 2 - 启用并开启连发功能
-- The arrangement order is the configuration order, which can be adjusted by yourself.
-- 0 - Disable | 1 - Enable | 2 - Enable and turn on the auto fire function
-- 支持的枪械,排列顺序即是配置顺序,可以自行调整。
-- 模式:0 - 不启用 | 1 - 启用 | 2 - 开启连点
-- 系数:枪械自身系数,基于 ADS 进行调整 (ADS为全局系数,此处为自身系数)
-- 下蹲系数:下蹲时的系数,基于 ADS 和 自身系数
canUse = {
[".45"] = {
{ "UMP45", 1 }, -- 基础镜 + 扩容,Bizon (基础镜即可),Vector (补偿 + 基础镜 + 扩容) | Reddot + Mag,Bizon (Reddot),Vector (Komp + Reddot + Mag)
{ "Tommy Gun", 1 }, -- 扩容 | Mag
-- 枪械 模式 系数 下蹲系数
{ "UMP45", 1, 1, 0.8 }, -- 基础镜 + 扩容,Bizon (基础镜即可),Vector (补偿 + 基础镜 + 扩容) | Reddot + Mag,Bizon (Reddot),Vector (Komp + Reddot + Mag)
{ "Tommy Gun", 1, 1, 0.8 }, -- 扩容 | Mag
},
-- 枪械 模式 系数 下蹲系数
["9mm"] = {
{ "Vector", 1 }, -- 基础镜 + 扩容 | Reddot + Mag
{ "Micro UZI", 1 }, -- 扩容 | Mag
{ "Vector", 1, 1, 0.8 }, -- 基础镜 + 扩容 | Reddot + Mag
{ "Micro UZI", 1, 1, 0.8 }, -- 扩容 | Mag
},
["5.56"] = {
{ "M416", 1 }, -- 补偿 + 基础镜 + 直角 + 枪托 + 扩容 | Komp + Reddot + Triangular grip + Gunstock + Mag
{ "SCAR-L", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "QBZ", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "G36C", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "M16A4", 2 }, -- 补偿 + 基础镜 + 枪托 + 扩容 | Komp + Reddot + Gunstock + Mag
-- 枪械 模式 系数 下蹲系数
{ "M416", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 枪托 + 扩容 | Komp + Reddot + Triangular grip + Gunstock + Mag
{ "SCAR-L", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "QBZ", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "G36C", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "M16A4", 2, 1, 0.8 }, -- 补偿 + 基础镜 + 枪托 + 扩容 | Komp + Reddot + Gunstock + Mag
},
["7.62"] = {
{ "AKM", 1 }, -- 补偿 + 基础镜 + 扩容 | Komp + Reddot + Mag
{ "Beryl M762", 1 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "DP-28", 1 }, -- 基础镜 | Reddot
-- 枪械 模式 系数 下蹲系数
{ "AKM", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 扩容 | Komp + Reddot + Mag
{ "Beryl M762", 1, 1, 0.8 }, -- 补偿 + 基础镜 + 直角 + 扩容 | Komp + Reddot + Triangular grip + Mag
{ "DP-28", 1, 1, 0.8 }, -- 基础镜 | Reddot
},
},

Expand Down Expand Up @@ -286,11 +291,9 @@ function pubg.isAimingState (mode)
return switch[mode]()
end

pubg["M16A4"] = function ()
pubg["M16A4"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 108,
ballistic = {
{1, 0},
Expand All @@ -307,11 +310,9 @@ pubg["M16A4"] = function ()

end

pubg["SCAR-L"] = function ()
pubg["SCAR-L"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 96,
ballistic = {
{1, 0},
Expand All @@ -327,11 +328,9 @@ pubg["SCAR-L"] = function ()

end

pubg["Beryl M762"] = function ()
pubg["Beryl M762"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 86,
ballistic = {
{1, 0},
Expand All @@ -350,11 +349,9 @@ pubg["Beryl M762"] = function ()

end

pubg["Tommy Gun"] = function ()
pubg["Tommy Gun"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 84,
ballistic = {
{1, 0},
Expand All @@ -367,11 +364,9 @@ pubg["Tommy Gun"] = function ()

end

pubg["G36C"] = function ()
pubg["G36C"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 80,
ballistic = {
{1, 0},
Expand All @@ -386,11 +381,9 @@ pubg["G36C"] = function ()

end

pubg["Vector"] = function ()
pubg["Vector"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 55,
ballistic = {
{1, 0},
Expand All @@ -404,11 +397,9 @@ pubg["Vector"] = function ()

end

pubg["Micro UZI"] = function ()
pubg["Micro UZI"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 46,
ballistic = {
{1, 0},
Expand All @@ -423,11 +414,9 @@ pubg["Micro UZI"] = function ()

end

pubg["UMP45"] = function ()
pubg["UMP45"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 94,
ballistic = {
{1, 0},
Expand All @@ -440,11 +429,9 @@ pubg["UMP45"] = function ()

end

pubg["AKM"] = function ()
pubg["AKM"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 99,
ballistic = {
{1, 0},
Expand All @@ -460,11 +447,9 @@ pubg["AKM"] = function ()

end

pubg["M416"] = function ()
pubg["M416"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 85,
ballistic = {
{1, 0},
Expand All @@ -482,11 +467,9 @@ pubg["M416"] = function ()

end

pubg["QBZ"] = function ()
pubg["QBZ"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 87,
ballistic = {
{1, 0},
Expand All @@ -502,11 +485,9 @@ pubg["QBZ"] = function ()

end

pubg["DP-28"] = function ()
pubg["DP-28"] = function (gunName)

return pubg.execOptions({
ratio = 1,
ctrlmodeRatio = 0.8,
return pubg.execOptions(gunName, {
interval = 100,
ballistic = {
{1, 0},
Expand All @@ -520,8 +501,23 @@ pubg["DP-28"] = function ()

end

-- [[通过枪械名查找在 canuse 中的项]]
function pubg.canUseFindByGunName (gunName)
local forList = { ".45", "9mm", "5.56", "7.62" }

for i = 1, #forList do
local bulletType = forList[i]
for j = 1, #userInfo.canUse[bulletType] do
local item = userInfo.canUse[bulletType][j]
if item[1] == gunName then
return item
end
end
end
end

--[[ FormatFactory ]]
function pubg.execOptions (options)
function pubg.execOptions (gunName, options)

--[[
Expand All @@ -542,6 +538,8 @@ function pubg.execOptions (options)
]]

local gunInfo = pubg.canUseFindByGunName(gunName)

-- Temporary container
local ballisticConfig1 = {}
-- Temporary container (v3.0)
Expand All @@ -555,7 +553,8 @@ function pubg.execOptions (options)
end
for j = 1, nextCount do
ballisticConfig1[ballisticIndex] =
options.ballistic[i][2] * pubg.generalSensitivityRatio * options.ratio
-- options.ballistic[i][2] * pubg.generalSensitivityRatio * options.ratio
options.ballistic[i][2] * pubg.generalSensitivityRatio * gunInfo[3]
ballisticIndex = ballisticIndex + 1
end
end
Expand All @@ -578,7 +577,7 @@ function pubg.execOptions (options)
amount = #ballisticConfig2, -- Number of bullets
interval = options.interval, -- Time of each bullet
ballistic = ballisticConfig2, -- ballistic data
ctrlmodeRatio = options.ctrlmodeRatio, -- Individual recoil coefficient for each gun when squatting
ctrlmodeRatio = gunInfo[4], -- Individual recoil coefficient for each gun when squatting
}

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

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

for i = 1, #forList do
local type = forList[i]
Expand All @@ -1032,7 +1031,7 @@ function pubg.outputLogGunSwitchTable ()
local tag = gunName == pubg.gun[pubg.bulletType][pubg.gunIndex] and "=> " or " "
gunCount = gunCount + 1
allCount = allCount + 1
resStr = table.concat({ resStr, tag, allCount, "\t", tag, gunCount, "\t", tag, type, "\t", tag, gunName, "\n" })
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" })
end
end

Expand Down

0 comments on commit 027663a

Please sign in to comment.