8000 [Battlemod] Several updates and fixes. by KenshiDRK · Pull Request #2053 · Windower/Lua · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Battlemod] Several updates and fixes. #2053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions addons/battlemod/battlemod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require 'generic_helpers'
require 'parse_action_packet'
require 'statics'

_addon.version = '3.30'
_addon.version = '3.31'
_addon.name = 'BattleMod'
_addon.author = 'Byrth, maintainer: SnickySnacks'
_addon.commands = {'bm','battlemod'}
Expand Down Expand Up @@ -76,6 +76,18 @@ windower.register_event('addon command', function(command, ...)
elseif command:lower() == 'crafting' then
crafting = not crafting
windower.add_to_chat(121,'Battlemod: Display crafting results flipped! - '..tostring(crafting))
elseif command:lower() == 'showblocks' then
showblocks = not showblocks
windower.add_to_chat(121,'Battlemod: Show blocks with shield flipped! - '..tostring(showblocks))
elseif command:lower() == 'showguards' then
showguards = not showguards
windower.add_to_chat(121,'Battlemod: Show guarding on hits flipped! - '..tostring(showguards))
elseif command:lower() == 'showcritws' then
showcritws = not showcritws
windower.add_to_chat(121,'Battlemod: Show critical hit on ws/mob tp flipped! - '..tostring(showcritws))
elseif command:lower() == 'showrollinfo' then
showrollinfo = not showrollinfo
windower.add_to_chat(121,'Battlemod: Show lucky/unlucky rolls flipped! - '..tostring(showrollinfo))
elseif command:lower() == 'colortest' then
local counter = 0
local line = ''
Expand Down Expand Up @@ -112,6 +124,10 @@ windower.register_event('addon command', function(command, ...)
print(' 4. cancelmulti - Cancels multiple consecutive identical lines ('..tostring(cancelmulti)..')')
print(' 5. showonernames - Shows the name of the owner on pet messages ('..tostring(showownernames)..')')
print(' 6. crafting - Enables early display of crafting results ('..tostring(crafting)..')')
print(' 7. showblocks - Shows if a hit was blocked with shield ('..tostring(showblocks)..')')
print(' 8. showguards - Shows if a hit was guarded ('..tostring(showguards)..')')
print(' 9. showcritws - Shows if a ws or mob ability was a critical hit (shows on multihit if atleast 1 hit was a crit) ('..tostring(showcritws)..')')
print(' 10. showrollinfo - Shows lucky/unlucky rolls ('..tostring(showrollinfo)..')')
print('Utilities: 1. colortest - Shows the 509 possible colors for use with the settings file')
print(' 2. reload - Reloads settings file')
print(' 3. unload - Unloads Battlemod')
Expand All @@ -127,7 +143,7 @@ windower.register_event('incoming text',function (original, modified, color, col
a,z = string.find(original,'Equipment changed')

if a and not block_equip then
windower.send_command('@wait 1;lua i battlemod flip_block_equip')
flip_block_equip:schedule(1)
block_equip = true
elseif a and block_equip then
modified = true
Expand All @@ -138,7 +154,7 @@ windower.register_event('incoming text',function (original, modified, color, col
c,z = string.find(original,'You must close the currently open window to use that command')

if (a or b or c) and not block_cannot then
windower.send_command('@wait 1;lua i battlemod flip_block_cannot')
flip_block_cannot:schedule(1)
block_cannot = true
elseif (a or b or c) and block_cannot then
modified = true
Expand Down
39 changes: 19 additions & 20 deletions addons/battlemod/parse_action_packet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function parse_action_packet(act)

if r.message ~= 0 and m.message ~= 0 then
if m.message == r.message or (condensecrits and S{1,67}:contains(m.message) and S{1,67}:contains(r.message)) then
if (m.effect == r.effect) or (S{1,67}:contains(m.message) and S{0,2,4}:contains(m.effect) and S{0,2,4}:contains(r.effect)) then -- combine kicks and crits
if (m.effect == r.effect) or (S{1,67}:contains(m.message) and S{0,1,2,3}:contains(m.effect) and S{0,1,2,3}:contains(r.effect)) then -- combine kicks and crits
if m.reaction == r.reaction then --or (S{8,10}:contains(m.reaction) and S{8,10}:contains(r.reaction)) then -- combine hits and guards
-- windower.add_to_chat(8, 'Condensed: '..m.message..':'..r.message..' - '..m.effect..':'..r.effect..' - '..m.reaction..':'..r.reaction)
r.number = r.number + 1
Expand Down Expand Up @@ -303,37 +303,25 @@ function parse_action_packet(act)
end
end

local roll = showrollinfo and act.category == 6 and corsair_rolls[act.param] and corsair_rolls[act.param][m.param] or ''
local reaction_lookup = reaction_offsets[act.category] and (m.reaction - reaction_offsets[act.category]) or 0
local has_line_break = string.find(res.action_messages[m.message].en, '${lb}') and true or false
local prefix = (not has_line_break or simplify) and S{1,3,4,6,11,13,14,15}:contains(act.category) and (bit.band(m.unknown,1)==1 and 'Cover! ' or '')
..(bit.band(m.unknown,4)==4 and 'Magic Burst! ' or '') --Used on Swipe/Lunge MB
..(bit.band(m.unknown,8)==8 and 'Immunobreak! ' or '') --Unused? Displayed directly on message
..(bit.band(m.unknown,16)==16 and 'Critical Hit! ' or '') --Unused? Crits have their own message
..(reaction_lookup == 4 and 'Blocked! ' or '')
..(reaction_lookup == 2 and 'Guarded! ' or '')
..(reaction_lookup == 3 and S{3,4,6,11,13,14,15}:contains(act.category) and 'Parried! ' or '') or '' --Unused? They are send the same as missed
local prefix2 = has_line_break and S{1,3,4,6,11,13,14,15}:contains(act.category) and (bit.band(m.unknown,1)==1 and 'Cover! ' or '')
..(bit.band(m.unknown,2)==2 and 'Resist! ' or '')
..(bit.band(m.unknown,4)==4 and 'Magic Burst! ' or '') --Used on Swipe/Lunge MB
..(bit.band(m.unknown,8)==8 and 'Immunobreak! ' or '') --Unused? Displayed directly on message
8000 ..(bit.band(m.unknown,16)==16 and 'Critical Hit! ' or '') --Unused? Crits have their own message
..(reaction_lookup == 4 and 'Blocked! ' or '')
..(reaction_lookup == 2 and 'Guarded! ' or '')
..(reaction_lookup == 3 and S{3,4,6,11,13,14,15}:contains(act.category) and 'Parried! ' or '') or '' --Unused? They are send the same as missed
local prefix = (not has_line_break or simplify) and get_prefix(act.category, m.effect, m.message, m.unknown, reaction_lookup) or ''
local prefix2 = has_line_break and get_prefix(act.category, m.effect, m.message, m.unknown, reaction_lookup) or ''
local message = prefix..make_condensedamage_number(m.number)..( clean_msg((msg or tostring(m.message))
:gsub('${spell}',color_it(act.action.spell or 'ERROR 111',color_arr.spellcol))
:gsub('${ability}',color_it(act.action.ability or 'ERROR 112',color_arr.abilcol))
:gsub('${item}',color_it(act.action.item or 'ERROR 113',color_arr.itemcol))
:gsub('${item2}',count..color_it(act.action.item2 or 'ERROR 121',color_arr.itemcol))
:gsub('${weapon_skill}',color_it(act.action.weapon_skill or 'ERROR 114',color_arr.wscol))
:gsub('${abil}',m.simp_name or 'ERROR 115')
:gsub('${numb}',numb or 'ERROR 116')
:gsub('${numb}',numb..roll or 'ERROR 116')
:gsub('${actor}\'s',color_it(act.actor.name or 'ERROR 117',color_arr[act.actor.owner or act.actor.type])..'\'s'..act.actor.owner_name)
:gsub('${actor}',color_it(act.actor.name or 'ERROR 117',color_arr[act.actor.owner or act.actor.type])..act.actor.owner_name)
:gsub('${target}\'s',targ)
:gsub('${target}',targ)
:gsub('${lb}','\7'..prefix2)
:gsub('${number}',act.action.number or m.param)
:gsub('${number}',(act.action.number or m.param)..roll)
:gsub('${status}',m.status or 'ERROR 120')
:gsub('${gil}',m.param..' gil'), m.message))
if m.message == 377 and act.actor_id == Self.id then
Expand Down Expand Up @@ -654,7 +642,7 @@ function player_info(id)

if not filt then
if player_table.is_npc then
if player_table.index>1791 then
if player_table.index>1791 or player_table.charmed then
typ = 'other_pets'
filt = 'other_pets'
owner = 'other'
Expand Down Expand Up @@ -712,7 +700,7 @@ function player_info(id)
end
end
if not typ then typ = 'debug' end
return {name=player_table.name,id=id,is_npc = player_table.is_npc,type=typ,damage=dmg,filter=filt,owner=(owner or nil), owner_name=(owner_name or ''),race = player_table.race}
return {name=player_table.monstrosity_name or player_table.name,id=id,is_npc = player_table.is_npc,type=typ,damage=dmg,filter=filt,owner=(owner or nil), owner_name=(owner_name or ''),race = player_table.race}
end

function get_spell(act)
Expand Down Expand Up @@ -908,6 +896,17 @@ function color_filt(col,is_me)
end
end

function get_prefix(category, effect, message, unknown, reaction_lookup)
local prefix = S{1,3,4,6,11,13,14,15}:contains(category) and (bit.band(unknown,1)==1 and 'Cover! ' or '')
..(bit.band(unknown,4)==4 and 'Magic Burst! ' or '') --Used on Swipe/Lunge MB
..(bit.band(unknown,8)==8 and 'Immunobreak! ' or '') --Unused? Displayed directly on message
..(showcritws and bit.band(effect,2)==2 and S{1,3,11}:contains(category) and message~=67 and 'Critical Hit! ' or '') --Unused? Crits have their own message
..(showblocks and reaction_lookup == 4 and 'Blocked! ' or '')
..(showguards and reaction_lookup == 2 and 'Guarded! ' or '')
..(reaction_lookup == 3 and S{3,4,6,11,13,14,15}:contains(category) and 'Parried! ' or '') --Unused? They are send the same as missed
return prefix
end

function condense_actions(action_array)
for i,v in pairs(action_array) do
local comb_table = {}
Expand Down
40 changes: 39 additions & 1 deletion addons/battlemod/statics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,40 @@ replacements_map = {
}
}

corsair_rolls = {
[98] = {[5] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Fighter's Roll
[99] = {[3] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Monk's Roll
[100] = {[3] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Healer's Roll
[101] = {[5] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Wizard's Roll
[102] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Warlock's Roll
[103] = {[5] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Rogue's Roll
[104] = {[3] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Gallant's Roll
[105] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Chaos Roll
[106] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Beast Roll
[107] = {[2] = ' (Lucky Roll!)', [6] = ' (Unlucky Roll!)'}, -- Choral Roll
[108] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Hunter's Roll
[109] = {[2] = ' (Lucky Roll!)', [6] = ' (Unlucky Roll!)'}, -- Samurai Roll
[110] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Ninja Roll
[111] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Drachen Roll
[112] = {[5] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Evoker's Roll
[113] = {[2] = ' (Lucky Roll!)', [6] = ' (Unlucky Roll!)'}, -- Magus's Roll
[114] = {[5] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Corsair's Roll
[115] = {[3] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Puppet Roll
[116] = {[3] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Dancer's Roll
[117] = {[2] = ' (Lucky Roll!)', [6] = ' (Unlucky Roll!)'}, -- Scholar's Roll
[118] = {[3] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Bolter's Roll
[119] = {[2] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Caster's Roll
[120] = {[3] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Courser's Roll
[121] = {[4] = ' (Lucky Roll!)', [9] = ' (Unlucky Roll!)'}, -- Blitzer's Roll
[122] = {[5] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Tactician's Roll
[302] = {[3] = ' (Lucky Roll!)', [10] = ' (Unlucky Roll!)'}, -- Allies' Roll
[303] = {[5] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Miser's Roll
[304] = {[2] = ' (Lucky Roll!)', [10] = ' (Unlucky Roll!)'}, -- Companion's Roll
[305] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Avenger's Roll
[390] = {[3] = ' (Lucky Roll!)', [7] = ' (Unlucky Roll!)'}, -- Naturalit's Roll
[391] = {[4] = ' (Lucky Roll!)', [8] = ' (Unlucky Roll!)'}, -- Runeist's Roll
}

domain_buffs = S{
250, -- EF Badge
257, -- Besieged
Expand Down Expand Up @@ -170,7 +204,7 @@ default_settings_table = {line_aoe = 'AOE ${numb} '..string.char(129,168).
line_nonumber = '[${actor}] ${abil} '..string.char(129,168)..' ${target}',
line_notarget = '[${actor}] ${abil} '..string.char(129,168)..' ${number}',
line_roll = '${actor} ${abil} '..string.char(129,168)..' ${target} '..string.char(129,170)..' ${number}',
condensedamage=true,condensetargets=true,cancelmulti=true,oxford=true,commamode=false,targetnumber=true,condensetargetname=false,swingnumber=true,sumdamage=true,condensecrits=false,showownernames=false,crafting=true,}
condensedamage=true,condensetargets=true,cancelmulti=true,oxford=true,commamode=false,targetnumber=true,condensetargetname=false,swingnumber=true,sumdamage=true,condensecrits=false,showownernames=false,crafting=true,showblocks=true,showguards=true,showcritws=false,showrollinfo=false}

message_map = {}
for n=1,700,1 do
Expand Down Expand Up @@ -596,6 +630,10 @@ default_settings = [[
<simplify>true</simplify>
<showownernames>false</showownernames>
<crafting>true</crafting>
<showblocks>true</showblocks>
<showguards>true</showguards>
<showcritws>false</showcritws>
<showrollinfo>false</showrollinfo>
<line_aoe>AOE ${numb} ]]..string.char(129,168)..[[ ${target}</line_aoe>
<line_aoebuff>${actor} ${abil} ]]..string.char(129,168)..[[ ${target} (${status})</line_aoebuff>
<line_full>[${actor}] ${numb} ${abil} ]]..string.char(129,168)..[[ ${target}</line_full>
Expand Down
0