From a827f9214eb8e6c6ad9ae0f81fd4f4621c8045fb Mon Sep 17 00:00:00 2001 From: KenshiDRK Date: Sat, 13 Mar 2021 22:46:15 +0100 Subject: [PATCH 01/20] [Battlemod] Singular/Plural addition Added singular/plural handling. Added common/proper noum handling. Added quantity of items for message id 377 (Treasury autostack option sometimes interfere with it). Some minor changes. --- addons/battlemod/battlemod.lua | 89 ++++++++++--- addons/battlemod/generic_helpers.lua | 163 +++++++++++++++++++++++ addons/battlemod/parse_action_packet.lua | 153 +++++++++++++++++---- addons/battlemod/statics.lua | 14 +- 4 files changed, 370 insertions(+), 49 deletions(-) diff --git a/addons/battlemod/battlemod.lua b/addons/battlemod/battlemod.lua index fdf1a25966..ca551b9827 100644 --- a/addons/battlemod/battlemod.lua +++ b/addons/battlemod/battlemod.lua @@ -12,7 +12,7 @@ require 'generic_helpers' require 'parse_action_packet' require 'statics' -_addon.version = '3.29' +_addon.version = '3.30' _addon.name = 'BattleMod' _addon.author = 'Byrth, maintainer: SnickySnacks' _addon.commands = {'bm','battlemod'} @@ -24,7 +24,7 @@ end) windower.register_event('login',function (name) if debugging then windower.debug('login') end - windower.send_command('@wait 10;lua i battlemod options_load;') + options_load:schedule(10) end) windower.register_event('addon command', function(command, ...) @@ -149,12 +149,10 @@ windower.register_event('incoming text',function (original, modified, color, col local item = string.char(0x1E) if not bm_message(original) then if original:endswith(endline) then --allow add_to_chat messages with the modes we blocking - blocked = true - return blocked + return true end elseif original:endswith(endline) and string.find(original, item) then --block items action messages - blocked = true - return blocked + return true end end @@ -251,9 +249,42 @@ ActionPacket.open_listener(parse_action_packet) windower.register_event('incoming chunk',function (id,original,modified,is_injected,is_blocked) if debugging then windower.debug('incoming chunk '..id) end + +------- ITEM QUANTITY ------- + if id == 0x020 and parse_quantity then + --local packet = packets.parse('incoming', original) + local item = original:unpack("H",0x0D) + local count = original:unpack("I",0x05) + if item == 0 then return end + if item_quantity.id == item then + item_quantity.count = count..' ' + end -------- ACTION MESSAGE ------- - if id == 0x29 then +------- NOUNS AND PLURAL ENTITIES ------- + elseif id == 0x00E then + local mob_id = original:unpack("I",0x05) + local mask = original:unpack("C",0x0B) + local chat_info = original:unpack("C",0x28) + if bit.band(mask,4) == 4 then + if bit.band(chat_info,32) == 0 and not common_nouns:contains(mob_id) then + table.insert(common_nouns, mob_id) + elseif bit.band(chat_info,64) == 64 and not plural_entities:contains(mob_id) then + table.insert(plural_entities, mob_id) + elseif bit.band(chat_info,64) == 0 and plural_entities:contains(mob_id) then --Gears can change their grammatical number when they lose 2 gear? + for i, v in pairs(plural_entities) do + if v == mob_id then + table.remove(plural_entities, i) + break + end + end + end + end + elseif id == 0x00B then --Reset tables on Zoning + common_nouns = T{} + plural_entities = T{} + +------- ACTION MESSAGE ------- + elseif id == 0x29 then local am = {} am.actor_id = original:unpack("I",0x05) am.target_id = original:unpack("I",0x09) @@ -266,6 +297,9 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec local actor = player_info(am.actor_id) local target = player_info(am.target_id) + local actor_article = common_nouns:contains(am.actor_id) and 'The ' or '' + local target_article = common_nouns:contains(am.target_id) and 'The ' or '' + targets_condensed = false -- Filter these messages if not check_filter(actor,target,0,am.message_id) then return true end @@ -284,9 +318,16 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec windower.add_to_chat(color, msg) else local msg = res.action_messages[am.message_id][language] + if plural_entities:contains(am.actor_id) then + msg = plural_actor(msg) + end + if plural_entities:contains(am.target_id) then + msg = plural_target(msg) + end + local msg = clean_msg(msg :gsub('${status}',status or '') - :gsub('${target}',targ) - :gsub('${number}',number or '') + :gsub('${target}',target_article..targ) + :gsub('${number}',number or '')) windower.add_to_chat(color, msg) end elseif am.message_id == 206 and condensetargets then -- Wears off messages @@ -307,7 +348,7 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec if not multi_targs[status] and not stat_ignore:contains(am.param_1) then multi_targs[status] = {} multi_targs[status][1] = target - windower.send_command('@wait 0.5;lua i battlemod multi_packet '..status) + multi_packet:schedule(0.5, status) elseif not (stat_ignore:contains(am.param_1)) then multi_targs[status][#multi_targs[status]+1] = target else @@ -315,16 +356,23 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec -- Sneak, Invis, etc. that you don't want to see on a delay multi_targs[status] = {} multi_targs[status][1] = target - windower.send_command('@lua i battlemod multi_packet '..status) + multi_packet(status) end am.message_id = false elseif passed_messages:contains(am.message_id) then local item,status,spell,skill,number,number2 + local outstr = res.action_messages[am.message_id][language] + if plural_entities:contains(am.actor_id) then + outstr = plural_actor(outstr) + end + if plural_entities:contains(am.target_id) then + outstr = plural_target(outstr) + end - local fields = fieldsearch(res.action_messages[am.message_id][language]) + local fields = fieldsearch(outstr) if fields.status then - if log_form_debuffs:contains(am.param_1) then + if log_form_messages:contains(am.message_id) then status = res.buffs[am.param_1].english_log else status = nf(res.buffs[am.param_1],language) @@ -369,17 +417,17 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec skill = 'to be level '..am.param_1..' ('..ratings_arr[am.param_2-63]..')' end end - local outstr = (res.action_messages[am.message_id][language] - :gsub('$\123actor\125',color_it((actor.name or '') .. (actor.owner_name or ""),color_arr[actor.owner or actor.type])) + outstr = (clean_msg(outstr + :gsub('$\123actor\125',actor_article..color_it((actor.name or '') .. (actor.owner_name or ""),color_arr[actor.owner or actor.type])) :gsub('$\123status\125',status or '') :gsub('$\123item\125',color_it(item or '',color_arr.itemcol)) - :gsub('$\123target\125',color_it(target.name or '',color_arr[target.owner or target.type])) + :gsub('$\123target\125',target_article..color_it(target.name or '',color_arr[target.owner or target.type])) :gsub('$\123spell\125',color_it(spell or '',color_arr.spellcol)) :gsub('$\123skill\125',color_it(skill or '',color_arr.abilcol)) :gsub('$\123number\125',number or '') :gsub('$\123number2\125',number2 or '') :gsub('$\123skill\125',skill or '') - :gsub('$\123lb\125','\7')) + :gsub('$\123lb\125','\7'))) windower.add_to_chat(res.action_messages[am.message_id]['color'],outstr) am.message_id = false elseif debugging and res.action_messages[am.message_id] then @@ -429,9 +477,10 @@ end) function multi_packet(...) local ind = table.concat({...},' ') local targets = assemble_targets(multi_actor[ind],multi_targs[ind],0,multi_msg[ind]) - local outstr = res.action_messages[multi_msg[ind]][language] + local outstr = targets_condensed and plural_target(res.action_messages[multi_msg[ind]][language]) or res.action_messages[multi_msg[ind]][language] + outstr = clean_msg(outstr :gsub('$\123target\125',targets) - :gsub('$\123status\125',ind) + :gsub('$\123status\125',ind)) windower.add_to_chat(res.action_messages[multi_msg[ind]].color,outstr) multi_targs[ind] = nil multi_msg[ind] = nil diff --git a/addons/battlemod/generic_helpers.lua b/addons/battlemod/generic_helpers.lua index 4bb5ef14ca..1759cafcef 100644 --- a/addons/battlemod/generic_helpers.lua +++ b/addons/battlemod/generic_helpers.lua @@ -114,3 +114,166 @@ function check_filter(actor,target,category,msg) return true end + +function actor_noun(msg) + if msg then + msg = msg + :gsub('${actor}', 'The ${actor}') + end + return msg +end + +function plural_actor(msg) + if msg then + msg = msg + :gsub('${actor} hits ', '${actor} hit ') + :gsub('${actor} casts ', '${actor} cast ') + :gsub('${actor} starts ', '${actor} start ') + :gsub('${actor} defeats ', '${actor} defeat ') + :gsub('${actor} gains ', '${actor} gain ') + :gsub('${actor} attains ', '${actor} attain ') + :gsub('${actor} loses ', '${actor} lose ') + :gsub('${actor} falls ', '${actor} fall ') + :gsub("${actor}'s ", '${actor} ') + :gsub('${actor} misses ' , '${actor} miss ') + :gsub('${actor} calls ' , '${actor} call ') + :gsub('${actor} learns ' , '${actor} learn ') + :gsub('${actor} uses ' , '${actor} use ') + :gsub('${actor} is ' , '${actor} are ') + :gsub('${actor} takes ' , '${actor} take ') + :gsub('${actor} does ' , '${actor} do ') + :gsub('${actor} lacks ' , '${actor} lack ') + :gsub('${actor} redies ' , '${actor} ready ') + :gsub('${actor} earns ' , '${actor} earn ') + :gsub('${actor} scores ' , '${actor} score ') + :gsub('${actor} successfully removes ' , '${actor} successfully remove ') + :gsub('${actor} achieves ' , '${actor} achieve ') + :gsub('${actor} mugs ' , '${actor} mug ') + :gsub('${actor} steals ' , '${actor} steal ') + :gsub('${actor} fails ' , '${actor} fail ') + :gsub(' but finds nothing' , ' but find nothing') + :gsub(' and finds ${item}' , ' and find ${item}') + :gsub('${actor} recovers ' , '${actor} recover ') + :gsub('${ability}, but misses' , '${ability}, but miss') + :gsub(' but misses ${target}' , ' but miss ${target}') + :gsub('${actor} covers ' , '${actor} cover ') + :gsub('${actor} already has ' , '${actor} already have ') + :gsub('${actor} attempts ' , '${actor} attempt ') + :gsub(' but lacks ' , ' but lack ') + :gsub('${actor} destroys ' , '${actor} destroy ') + :gsub('${actor} absorbs ' , '${actor} absorb ') + :gsub('${actor} eats ' , '${actor} eat ') + :gsub('${actor} leads ' , '${actor} lead ') + :gsub('${actor} has ' , '${actor} have ') + :gsub('${actor} obtains ' , '${actor} obtain ') + :gsub(' and finds ${number}' , ' and find ${number}') + end + return msg +end + +function plural_target(msg) + if msg then + msg = msg + :gsub('${target} takes ', '${target} take ') + :gsub('${target} is ', '${target} are ') + :gsub('${target} recovers ', '${target} recover ') + :gsub("${target}'s ", '${target} ') + :gsub('${target} falls ', '${target} fall ') + :gsub('${target} uses ', '${target} use ') + :gsub('${target} resists', '${target} resist') + :gsub('${target} vanishes', '${target} vanish') + :gsub('${target} receives ', '${target} receive ') + :gsub('${target} seems ${skill}', '${target} seem ${skill}') + :gsub('${lb}It seems to have ', '${lb}They seem to have ') + :gsub('${target} gains ', '${target} gain ') + :gsub('${target} evades', '${target} evade') + :gsub('${target} regains ', '${target} regain ') + :gsub('${target} narrowly escapes ', '${target} narrowly escape ') + :gsub('${target} obtains ', '${target} obtain ') + :gsub('${target} learns ', '${target} learn ') + :gsub('${target} loses ', '${target} lose ') + :gsub('${target} was ', '${target} were ') + :gsub('${target} has ', '${target} have ') + :gsub('${target} completely resists ', '${target} completely resist ') + :gsub('${target} now has ', '${target} now have ') + :gsub('${target} feels ', '${target} feel ') + :gsub('${target} stands ', '${target} stand ') + end + return msg +end + +function clean_msg(msg) + if msg then + msg = msg + :gsub(' The ', ' the ') + msg = msg + :gsub('%. the ', '. The ') + :gsub(': the ', ': The ') + :gsub('! the ', '! The ') + end + return msg +end + +function grammatical_number_fix(msg, number) + if msg then + if number == 1 then + msg = msg + :gsub(' points', ' point') + :gsub('${number} Ballista Points', '${number} Ballista Point') + :gsub('healed of ${number} status ailments', 'healed of ${number} status ailment') + :gsub('magical effects from', 'magical effect from') + else + msg = msg + :gsub(' absorbs', ' absorb') + :gsub(' Petra', ' Petras') + :gsub('disappears', 'disappear') + :gsub('attributes is', 'attributes are') + :gsub('status effect is', 'status effects are') + :gsub('piece', 'pieces') + :gsub('Finishing move now ', 'Finishing moves now ') + end + end + return msg +end + +function item_article_fix(id,id2,msg) + if id then + if string.gmatch(msg, ' a ${item}') then + local article = res.items_grammar[id] and res.items_grammar[id].article + if article == 1 then + msg = string.gsub(msg,' a ${item}',' an ${item}') + end + end + end + if id2 then + if string.gmatch(msg, ' a ${item2}') then + local article = res.items_grammar[id2] and res.items_grammar[id2].article + if article == 1 then + msg = string.gsub(msg,' a ${item2}',' an ${item2}') + end + end + end + return msg +end + +function add_item_article(id) + local article = '' + local article_type = res.items_grammar[id] and res.items_grammar[id].article or nil + if id then + if article_type == 2 then + article = 'pair of ' + elseif article_type == 3 then + article = 'suit of ' + end + end + return article +end + +function send_delayed_message(color,msg) + local message = msg + :gsub('${count}', item_quantity.count) + windower.add_to_chat(color,message) + item_quantity.id = 0 + item_quantity.count = '' + parse_quantity = false +end diff --git a/addons/battlemod/parse_action_packet.lua b/addons/battlemod/parse_action_packet.lua index 83f2f09b85..99352f45db 100644 --- a/addons/battlemod/parse_action_packet.lua +++ b/addons/battlemod/parse_action_packet.lua @@ -11,6 +11,7 @@ function parse_action_packet(act) act.actor = player_info(act.actor_id) act.action = get_spell(act) -- Pulls the resources line for the action act.actor.name = act.actor and act.actor.name and string.gsub(act.actor.name,'-', string.char(0x81,0x7C)) --fix for ffxi chat splits on trusts with - + targets_condensed = false if not act.action then return act @@ -190,7 +191,7 @@ function parse_action_packet(act) elseif m.message == 435 or m.message == 436 then m.simp_name = act.action.name..' (JAs)' elseif m.message == 437 or m.message == 438 then m.simp_name = act.action.name..' (JAs and TP)' elseif m.message == 439 or m.message == 440 then m.simp_name = act.action.name..' (SPs, JAs, TP, and MP)' - elseif T{252,265,268,269,271,272,274,275,379,650}:contains(m.message) then m.simp_name = 'Magic Burst! '..act.action.name + elseif T{252,265,268,269,271,272,274,275,379,650,747}:contains(m.message) then m.simp_name = 'Magic Burst! '..act.action.name elseif not act.action then m.simp_name = '' act.action = {} @@ -216,8 +217,13 @@ function parse_action_packet(act) elseif m.status == 'weight' then m.status = 'weighed down' end end + + -- Some messages uses the english log version of the buff + if not simplify and log_form_messages:contains(m.message) then + m.status = res.buffs[m.param].enl + end --- if m.message == 93 or m.message == 273 then m.status=color_it('Vanish',color_arr['statuscol']) end + -- if m.message == 93 or m.message == 273 then m.status=color_it('Vanish',color_arr['statuscol']) end -- Special Message Handling if m.message == 93 or m.message == 273 then @@ -230,6 +236,10 @@ function parse_action_packet(act) targ = targ..' ('..color_it('attacks and defenses enhanced',color_arr['statuscol'])..')' elseif m.message == 762 and simplify then targ = targ..' ('..color_it('all status parameters boosted',color_arr['statuscol'])..')' + elseif m.message == 779 and simplify then + targ = 'A barrier pulsates around '..targ + elseif m.message == 780 and simplify then + targ = 'Takes aim on '..targ elseif T{158,188,245,324,592,658}:contains(m.message) and simplify then -- When you miss a WS or JA. Relevant for condensed battle. m.status = 'Miss' --- This probably doesn't work due to the if a==nil statement below. @@ -268,6 +278,32 @@ function parse_action_packet(act) end end + if col == 'D' or grammar_numb_msg:contains(m.message) then + msg = grammatical_number_fix(msg, (m.cparam or m.param)) + end + + local count = '' + if m.message == 377 and act.actor_id == Self.id then + parse_quantity = true + item_quantity.id = act.action.item2_id + count = '${count}' + end + + if not simplify then + if act.action.item_id or act.action.item2_id then + msg = item_article_fix(act.action.item_id,act.action.item2_id,msg) + end + if common_nouns:contains(act.actor.id) then + msg = actor_noun(msg) + end + if plural_entities:contains(act.actor.id) then + msg = plural_actor(msg) + end + if targets_condensed or plural_entities:contains(v.target[1].id) then + msg = plural_target(msg) + end + end + 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 "") @@ -285,11 +321,11 @@ function parse_action_packet(act) ..(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 - windower.add_to_chat(color,prefix..make_condensedamage_number(m.number)..( (msg or tostring(m.message)) + 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}',color_it(act.action.item2 or 'ERROR 121',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') @@ -299,6 +335,11 @@ function parse_action_packet(act) :gsub('${number}',act.action.number or m.param) :gsub('${status}',m.status or 'ERROR 120') :gsub('${gil}',m.param..' gil'))) + if m.message == 377 and act.actor_id == Self.id then + send_delayed_message:schedule(0.5,color,message) + else + windower.add_to_chat(color,message) + end if not non_block_messages:contains(m.message) then m.message = 0 end @@ -311,16 +352,20 @@ function parse_action_packet(act) elseif m.add_effect_message > 384 and m.add_effect_message < 399 then m.simp_add_name = skillchain_arr[m.add_effect_message-384] elseif m.add_effect_message > 766 and m.add_effect_message < 769 then m.simp_add_name = skillchain_arr[m.add_effect_message-752] elseif m.add_effect_message > 768 and m.add_effect_message < 771 then m.simp_add_name = skillchain_arr[m.add_effect_message-754] - elseif m.add_effect_message ==603 then m.simp_add_name = 'TH' - elseif m.add_effect_message ==776 then m.simp_add_name = 'AE: Chainbound' + elseif m.add_effect_message == 603 then m.simp_add_name = 'AE: TH' + elseif m.add_effect_message == 605 then m.simp_add_name = 'AE: Death' + elseif m.add_effect_message == 776 then m.simp_add_name = 'AE: Chainbound' else m.simp_add_name = 'AE' end local msg,numb = simplify_message(m.add_effect_message) + if not simplify and common_nouns:contains(act.actor.id) then + msg = actor_noun(msg) + end if m.add_effect_fields.status then numb = m.add_effect_status else numb = pref_suf((m.cadd_effect_param or m.add_effect_param),m.add_effect_message,act.actor.damage,col) end if not act.action then -- windower.add_to_chat(color, 'act.action==nil : '..m.message..' - '..m.add_effect_message..' - '..msg) else - windower.add_to_chat(color,make_condensedamage_number(m.add_effect_number)..(msg + windower.add_to_chat(color,make_condensedamage_number(m.add_effect_number)..(clean_msg(msg :gsub('${spell}',act.action.spell or 'ERROR 127') :gsub('${ability}',act.action.ability or 'ERROR 128') :gsub('${item}',act.action.item or 'ERROR 129') @@ -331,7 +376,7 @@ function parse_action_packet(act) :gsub('${target}',targ) :gsub('${lb}','\7') :gsub('${number}',m.add_effect_param) - :gsub('${status}',m.add_effect_status or 'ERROR 178'))) + :gsub('${status}',m.add_effect_status or 'ERROR 178')))) if not non_block_messages:contains(m.add_effect_message) then m.add_effect_message = 0 end @@ -361,8 +406,11 @@ function parse_action_packet(act) end local msg = simplify_message(m.spike_effect_message) + if not simplify and common_nouns:contains(act.actor.id) then + msg = actor_noun(msg) + end if m.spike_effect_fields.status then numb = m.spike_effect_status else numb = pref_suf((m.cspike_effect_param or m.spike_effect_param),m.spike_effect_message,actor.damage,col) end - windower.add_to_chat(color,make_condensedamage_number(m.spike_effect_number)..(msg + windower.add_to_chat(color,make_condensedamage_number(m.spike_effect_number)..(clean_msg(msg :gsub('${spell}',act.action.spell or 'ERROR 142') :gsub('${ability}',act.action.ability or 'ERROR 143') :gsub('${item}',act.action.item or 'ERROR 144') @@ -373,10 +421,10 @@ function parse_action_packet(act) :gsub((simplify and '${actor}' or '${target}'),targ) :gsub('${lb}','\7') :gsub('${number}',m.spike_effect_param) - :gsub('${status}',m.spike_effect_status or 'ERROR 150'))) - if not non_block_messages:contains(m.spike_effect_message) then - m.spike_effect_message = 0 - end + :gsub('${status}',m.spike_effect_status or 'ERROR 150')))) + if not non_block_messages:contains(m.spike_effect_message) then + m.spike_effect_message = 0 + end end end end @@ -386,11 +434,44 @@ end function pref_suf(param,msg_ID,actor_dmg,col) local outstr = (col == 'D' or dmg_drain_msg:contains(msg_ID)) and color_it(tostring(param),color_arr[actor_dmg]) or tostring(param) - if res.action_messages[msg_ID] and res.action_messages[msg_ID].prefix then - outstr = res.action_messages[msg_ID].prefix..' '..outstr - end - if res.action_messages[msg_ID] and res.action_messages[msg_ID].suffix then - outstr = outstr..' '..res.action_messages[msg_ID].suffix + local msg = res.action_messages[msg_ID] or nil + if msg then + if msg.prefix then + outstr = msg.prefix..' '..outstr + end + if msg.suffix then + if msg.suffix == 'shadow' and param ~= 1 then + outstr = outstr..' shadows' + elseif msg.suffix == 'Petra' and param ~= 1 then + outstr = outstr..' Petras' + elseif msg.suffix == 'effects disappears' and param ~= 1 then + outstr = outstr..' effects disappear' + elseif msg_ID == 641 then + outstr = outstr..' 1 attribute drained' + elseif msg.suffix == 'attributes drained' and param == 1 then + outstr = outstr..' attribute drained' + elseif msg.suffix == 'status effect drained' and param ~= 1 then + outstr = outstr..' status effects drained' + elseif msg.suffix == 'status ailments disappears' and param ~= 1 then + outstr = outstr..' status ailments disappear' + elseif msg.suffix == 'status ailments absorbed' and param == 1 then + outstr = outstr..' status ailment absorbed' + elseif msg.suffix == 'status ailments healed' and param == 1 then + outstr = outstr..' status ailment healed' + elseif msg.suffix == 'status benefits absorbed' and param == 1 then + outstr = outstr..' status benefit absorbed' + elseif msg.suffix == 'status effects removed' and param == 1 then + outstr = outstr..' status effect removed' + elseif msg.suffix == 'magic effects drained' and param == 1 then + outstr = outstr..' magic effect drained' + elseif msg.suffix == 'magical effects received' and param == 1 then + outstr = outstr..' magical effect received' + elseif msg.suffix == 'magical effects copied' and param == 1 then + outstr = outstr..' magical effect copied' + else + outstr = outstr..' '..msg.suffix + end + end end return outstr end @@ -399,7 +480,7 @@ function simplify_message(msg_ID) local msg = res.action_messages[msg_ID][language] local fields = fieldsearch(msg) - if simplify and not T{23,64,133,139,140,204,210,211,212,213,214,350,442,516,531,557,565,582,674}:contains(msg_ID) then + if simplify and not T{23,64,133,204,210,211,212,213,214,350,442,516,531,557,565,582}:contains(msg_ID) then if T{93,273,522,653,654,655,656,85,284,75,114,156,189,248,283,312,323,336,351,355,408,422,423,425,453,659,158,245,324,658}:contains(msg_ID) then fields.status = true end @@ -420,6 +501,10 @@ function simplify_message(msg_ID) fields.actor = true fields.target = true end + + if msg_ID == 139 then + fields.number = true + end local Despoil_msg = {[593] = 'Attack Down', [594] = 'Defense Down', [595] = 'Magic Atk. Down', [596] = 'Magic Def. Down', [597] = 'Evasion Down', [598] = 'Accuracy Down', [599] = 'Slow',} if line_full and fields.number and fields.target and fields.actor then @@ -485,13 +570,20 @@ function assemble_targets(actor,targs,category,msg) for i,v in pairs(targets) do local name + local article = common_nouns:contains(v.id) and not simplify and 'The ' or '' local numb = condensetargetname and samename[v.name] > 1 and ' {'..samename[v.name]..'}' or '' if i == 1 then name = color_it(v.name,color_arr[v.owner or v.type]) - out_str = out_str..name..numb + out_str = out_str..article..name..numb + if samename[v.name] > 1 then + targets_condensed = true + else + targets_condensed = false + end else + targets_condensed = true name = color_it(v.name,color_arr[v.owner or v.type]) - out_str = conjunctions(out_str,name..numb,#targets,i) + out_str = conjunctions(out_str,article..name..numb,#targets,i) end end out_str = string.gsub(out_str,'-', string.char(0x81,0x7C)) --fix for ffxi chat splits on trusts with - @@ -659,6 +751,9 @@ function get_spell(act) if spell then spell.name = color_it(spell[language],color_arr.abilcol) spell.ability = color_it(spell[language],color_arr.abilcol) + if msg_ID == 139 then + spell.number = 'Nothing' + end end elseif fields.weapon_skill then if abil_ID > 256 then -- WZ_RECOVER_ALL is used by chests in Limbus @@ -707,19 +802,25 @@ function get_spell(act) if fields.item then if T{125,593,594,595,596,597,598,599}:contains(msg_ID) then - spell.item = color_it(res.items[effect_val]['english_log'], color_arr.itemcol) + local item_article = not simplify and add_item_article(effect_val) or '' + spell.item = color_it(item_article..res.items[effect_val]['english_log'], color_arr.itemcol) + spell.item_id = res.items[effect_val].id else spell = res.items[abil_ID] + local item_article = not simplify and add_item_article(spell.id) or '' if spell then - spell.name = color_it(spell['english_log'],color_arr.itemcol) - spell.item = color_it(spell['english_log'],color_arr.itemcol) + spell.name = color_it(item_article..spell['english_log'],color_arr.itemcol) + spell.item = color_it(item_article..spell['english_log'],color_arr.itemcol) + spell.item_id = abil_ID end end end if fields.item2 then - local tempspell = res.items[effect_val] - spell.item2 = color_it(tempspell.english_log,color_arr.itemcol) + local item_article = not simplify and add_item_article(effect_val) or '' + local tempspell = (msg_ID == 377 or msg_ID == 674) and res.items_grammar[effect_val] and res.items_grammar[effect_val].plural or item_article..res.items[effect_val].english_log + spell.item2 = color_it(tempspell,color_arr.itemcol) + spell.item2_id = effect_val if fields.number then spell.number = act.targets[1].actions[1].add_effect_param end diff --git a/addons/battlemod/statics.lua b/addons/battlemod/statics.lua index 20b9a80815..436b376165 100644 --- a/addons/battlemod/statics.lua +++ b/addons/battlemod/statics.lua @@ -28,15 +28,21 @@ skillchain_arr = {'Light:','Darkness:','Gravitation:','Fragmentation:','Distorti ratings_arr = {'TW','IEP','EP','DC','EM','T','VT','IT'} current_job = 'NONE' default_filt = false +parse_quantity = false +targets_condensed = false +common_nouns = T{} +plural_entities = T{} +item_quantity = {id = 0, count = ''} rcol = string.char(0x1E,0x01) non_block_messages = T{1,2,7,14,15,24,25,26,30,31,32,33,44,63,67,69,70,77,102,103,110,122,132,152,157,158,161,162,163,165,167,185,187,188,196,197,223,224,225,226,227,228,229,238,245,252,263,264,265,274,275,276,281,282,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,306,317,318,324,352,353,354,357,358,366,367,373,379,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,409,413,451,452,454,522,535,536,537,539,576,577,587,588,592,603,606,648,650,651,658,732,736,746,747,748,749,750,751,752,753,767,768,769,770,781} -passed_messages = T{4,5,6,16,17,18,20,34,35,36,40,47,48,49,64,78,87,88,89,90,112,116,154,170,171,172,173,174,175,176,177,178,191,192,198,204,215,217,218,219,234,246,249,307,315,328,350,336,523,530,531,558,561,563,575,584,601,609,562,610,611,612,613,614,615,616,617,618,619,620,625,626,627,628,629,630,631,632,633,634,635,636,643,660,661,662,62,94,251,308,313,372,8,105,253,679,97,62,94,251,313,308,206,72,38,53} +passed_messages = T{4,5,6,16,17,18,20,34,35,36,38,40,47,48,49,53,62,64,72,78,87,88,89,90,94,97,112,116,154,170,171,172,173,174,175,176,177,178,191,192,198,204,206,215,217,218,219,234,246,249,251,307,308,313,315,328,336,350,523,530,531,558,561,563,575,584,601,609,562,610,611,612,613,614,615,616,617,618,619,620,625,626,627,628,629,630,631,632,633,634,635,636,643,660,661,662,679} agg_messages = T{85,653,655,75,156,189,248,323,355,408,422,425,82,93,116,127,131,134,151,144,146,148,150,166,186,194,230,236,237,242,243,268,271,319,320,364,375,412,414,416,420,424,426,432,433,441,602,645,668,435,437,439} color_redundant = T{26,33,41,71,72,89,94,109,114,164,173,181,184,186,70,84,104,127,128,129,130,131,132,133,134,135,136,137,138,139,140,64,86,91,106,111,175,178,183,81,101,16,65,87,92,107,112,174,176,182,82,102,67,68,69,170,189,15,208,18,25,32,40,163,185,23,24,27,34,35,42,43,162,165,187,188,30,31,14,205,144,145,146,147,148,149,150,151,152,153,190,13,9,253,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,284,285,286,287,292,293,294,295,300,301,301,303,308,309,310,311,316,317,318,319,324,325,326,327,332,333,334,335,340,341,342,343,344,345,346,347,348,349,350,351,355,357,358,360,361,363,366,369,372,374,375,378,381,384,395,406,409,412,415,416,418,421,424,437,450,453,456,458,459,462,479,490,493,496,499,500,502,505,507,508,10,51,52,55,58,62,66,80,83,85,88,90,93,100,103,105,108,110,113,122,168,169,171,172,177,179,180,12,11,37,291} -- 37 and 291 might be unique colors, but they are not gsubbable. block_messages = T{12} block_modes = T{20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,40,41,42,43,56,57,59,60,61,63,104,109,114,162,163,164,165,181,185,186,187,188} black_colors = T{}--352,354,356,388,390,400,402,430,432,442,444,472,474,484,486} dmg_drain_msg = T{132,161,187,227,274,281,736,748,749,802,803} +grammar_numb_msg = T{14,31,133,231,369,370,382,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,403,404,405,411,417,535,536,557,570,571,589,607,651,757,769,770,778,792} domain_buffs = S{ 250, -- EF Badge @@ -176,8 +182,9 @@ message_map[369] = T{403} -- Ultimate Terror spike_effect_valid = {true,false,false,false,false,false,false,false,false,false,false,false,false,false,false} add_effect_valid = {true,true,true,true,false,false,false,false,false,false,true,false,true,false,false} --- These are the debuffs that are expressed in their log form by battlemod -log_form_debuffs = T{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,28,29,30,31,134,135,155,156,157,168,176,177,259,260,261,262,263,264,309,474} +-- These are the debuffs that are expressed in their log form by battlemod (The status variable when using english log is code 14 while the other one is code 13 so it should be handled by messages) +--log_form_debuffs = T{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,28,29,30,31,134,135,155,156,157,168,176,177,259,260,261,262,263,264,309,474} +log_form_messages = T{64,73,82,127,128,130,141,203,204,236,242,270,271,272,277,279,350,374,531,645,754} default_filters = [[ @@ -542,6 +549,7 @@ default_settings = [[ ${numb} ]]..string.char(129,168)..[[ ${target} ${abil} ${numb} ]]..string.char(129,168)..[[ ${target} [${actor}] ${abil} ]]..string.char(129,168)..[[ ${target} + [${actor}] ${abil} ]]..string.char(129,168)..[[ ${number} ${actor} ${abil} ]]..string.char(129,168)..[[ ${target} ]]..string.char(129,170)..[[ ${number} From 5820f9203b421c5a4b2f7de92757bc1ad159f0fc Mon Sep 17 00:00:00 2001 From: KenshiDRK Date: Wed, 17 Mar 2021 03:06:51 +0100 Subject: [PATCH 02/20] fixing a bug fixing a bug --- addons/battlemod/parse_action_packet.lua | 2 +- addons/battlemod/statics.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/battlemod/parse_action_packet.lua b/addons/battlemod/parse_action_packet.lua index 99352f45db..596ac6e2f1 100644 --- a/addons/battlemod/parse_action_packet.lua +++ b/addons/battlemod/parse_action_packet.lua @@ -199,7 +199,7 @@ function parse_action_packet(act) end -- Debuff Application Messages - if message_map[82]:contains(m.message) then + if simplify and message_map[82]:contains(m.message) then if m.status == 'Evasion Down' then m.message = 237 end diff --git a/addons/battlemod/statics.lua b/addons/battlemod/statics.lua index 436b376165..4c64889b2d 100644 --- a/addons/battlemod/statics.lua +++ b/addons/battlemod/statics.lua @@ -134,7 +134,7 @@ message_map[75] = T{283} -- No Effect: Spell, Target message_map[248] = T{355} -- no ability of any kind message_map['No effect'] = T{283,423,659} -- generic "no effect" messages for sorting by category message_map[432] = T{433} -- Receives: Spell, Target -message_map[82] = T{230,236,237,268,271} -- Receives: Spell, Target, Status +message_map[82] = T{230,236,237,267,268,271} -- Receives: Spell, Target, Status message_map[230] = T{266} -- Receives: Spell, Target, Status message_map[319] = T{266} -- Receives: Spell, Target, Status (Generic for avatar buff BPs) message_map[134] = T{287} -- Receives: Spell, Target, Status From 380bab58010fe39b60808b06df73342f815b29e2 Mon Sep 17 00:00:00 2001 From: KenshiDRK Date: Wed, 24 Mar 2021 23:29:09 +0100 Subject: [PATCH 03/20] more fixes more fixes --- addons/battlemod/battlemod.lua | 27 ++++++----- addons/battlemod/generic_helpers.lua | 7 +-- addons/battlemod/parse_action_packet.lua | 57 +++++++++++++++++------- 3 files changed, 60 insertions(+), 31 deletions(-) diff --git a/addons/battlemod/battlemod.lua b/addons/battlemod/battlemod.lua index ca551b9827..12b768eb5f 100644 --- a/addons/battlemod/battlemod.lua +++ b/addons/battlemod/battlemod.lua @@ -418,16 +418,18 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec end end outstr = (clean_msg(outstr - :gsub('$\123actor\125',actor_article..color_it((actor.name or '') .. (actor.owner_name or ""),color_arr[actor.owner or actor.type])) - :gsub('$\123status\125',status or '') - :gsub('$\123item\125',color_it(item or '',color_arr.itemcol)) - :gsub('$\123target\125',target_article..color_it(target.name or '',color_arr[target.owner or target.type])) - :gsub('$\123spell\125',color_it(spell or '',color_arr.spellcol)) - :gsub('$\123skill\125',color_it(skill or '',color_arr.abilcol)) - :gsub('$\123number\125',number or '') - :gsub('$\123number2\125',number2 or '') - :gsub('$\123skill\125',skill or '') - :gsub('$\123lb\125','\7'))) + :gsub('${actor}\'s',actor_article..color_it(actor.name or '',color_arr[actor.owner or actor.type])..'\'s'..actor.owner_name) + :gsub('${actor}',actor_article..color_it(actor.name or '',color_arr[actor.owner or actor.type])..actor.owner_name) + :gsub('${status}',status or '') + :gsub('${item}',color_it(item or '',color_arr.itemcol)) + :gsub('${target}\'s',target_article..color_it(target.name or '',color_arr[target.owner or target.type])..'\'s'..target.owner_name) + :gsub('${target}',target_article..color_it(target.name or '',color_arr[target.owner or target.type])..target.owner_name) + :gsub('${spell}',color_it(spell or '',color_arr.spellcol)) + :gsub('${skill}',color_it(skill or '',color_arr.abilcol)) + :gsub('${number}',number or '') + :gsub('${number2}',number2 or '') + :gsub('${skill}',skill or '') + :gsub('${lb}','\7'))) windower.add_to_chat(res.action_messages[am.message_id]['color'],outstr) am.message_id = false elseif debugging and res.action_messages[am.message_id] then @@ -479,8 +481,9 @@ function multi_packet(...) local targets = assemble_targets(multi_actor[ind],multi_targs[ind],0,multi_msg[ind]) local outstr = targets_condensed and plural_target(res.action_messages[multi_msg[ind]][language]) or res.action_messages[multi_msg[ind]][language] outstr = clean_msg(outstr - :gsub('$\123target\125',targets) - :gsub('$\123status\125',ind)) + :gsub('${target}\'s',targets) + :gsub('${target}',targets) + :gsub('${status}',ind)) windower.add_to_chat(res.action_messages[multi_msg[ind]].color,outstr) multi_targs[ind] = nil multi_msg[ind] = nil diff --git a/addons/battlemod/generic_helpers.lua b/addons/battlemod/generic_helpers.lua index 1759cafcef..c3677a0eb2 100644 --- a/addons/battlemod/generic_helpers.lua +++ b/addons/battlemod/generic_helpers.lua @@ -39,9 +39,10 @@ end function colconv(str,key) -- Used in the options_load() function local out - strnum = tonumber(str) + local strnum = tonumber(str) if strnum >= 256 and strnum < 509 then strnum = strnum - 254 + if strnum == 4 then strnum = 3 end --color 258 can bug chatlog out = string.char(0x1E,strnum) elseif strnum >0 then out = string.char(0x1F,strnum) @@ -134,7 +135,7 @@ function plural_actor(msg) :gsub('${actor} attains ', '${actor} attain ') :gsub('${actor} loses ', '${actor} lose ') :gsub('${actor} falls ', '${actor} fall ') - :gsub("${actor}'s ", '${actor} ') + :gsub("${actor}'s ", "${actor}' ") :gsub('${actor} misses ' , '${actor} miss ') :gsub('${actor} calls ' , '${actor} call ') :gsub('${actor} learns ' , '${actor} learn ') @@ -177,7 +178,7 @@ function plural_target(msg) :gsub('${target} takes ', '${target} take ') :gsub('${target} is ', '${target} are ') :gsub('${target} recovers ', '${target} recover ') - :gsub("${target}'s ", '${target} ') + :gsub("${target}'s ", targets_condensed and '${target} ' or "${target}' ") :gsub('${target} falls ', '${target} fall ') :gsub('${target} uses ', '${target} use ') :gsub('${target} resists', '${target} resist') diff --git a/addons/battlemod/parse_action_packet.lua b/addons/battlemod/parse_action_packet.lua index 596ac6e2f1..21bc48d486 100644 --- a/addons/battlemod/parse_action_packet.lua +++ b/addons/battlemod/parse_action_packet.lua @@ -10,7 +10,7 @@ function parse_action_packet(act) end act.actor = player_info(act.actor_id) act.action = get_spell(act) -- Pulls the resources line for the action - act.actor.name = act.actor and act.actor.name and string.gsub(act.actor.name,'-', string.char(0x81,0x7C)) --fix for ffxi chat splits on trusts with - + act.actor.name = act.actor and act.actor.name and string.gsub(act.actor.name,'[- ]', {['-'] = string.char(0x81,0x7C), [' '] = string.char(0x81,0x3F)}) --fix for ffxi chat splits on trusts with - and spaces targets_condensed = false if not act.action then @@ -329,7 +329,9 @@ function parse_action_packet(act) :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('${actor}',color_it((act.actor.name or 'ERROR 117' ) .. (act.actor.owner_name or "") ,color_arr[act.actor.owner or act.actor.type])) + :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) @@ -358,8 +360,16 @@ function parse_action_packet(act) else m.simp_add_name = 'AE' end local msg,numb = simplify_message(m.add_effect_message) - if not simplify and common_nouns:contains(act.actor.id) then - msg = actor_noun(msg) + if not simplify then + if common_nouns:contains(act.actor.id) then + msg = actor_noun(msg) + end + if plural_entities:contains(act.actor.id) then + msg = plural_actor(msg) + end + if targets_condensed or plural_entities:contains(v.target[1].id) then + msg = plural_target(msg) + end end if m.add_effect_fields.status then numb = m.add_effect_status else numb = pref_suf((m.cadd_effect_param or m.add_effect_param),m.add_effect_message,act.actor.damage,col) end if not act.action then @@ -372,7 +382,9 @@ function parse_action_packet(act) :gsub('${weapon_skill}',act.action.weapon_skill or 'ERROR 130') :gsub('${abil}',m.simp_add_name or act.action.name or 'ERROR 131') :gsub('${numb}',numb or 'ERROR 132') - :gsub('${actor}',color_it(act.actor.name,color_arr[act.actor.owner or act.actor.type])) + :gsub('${actor}\'s',color_it(act.actor.name,color_arr[act.actor.owner or act.actor.type])..'\'s'..act.actor.owner_name) + :gsub('${actor}',color_it(act.actor.name,color_arr[act.actor.owner or act.actor.type])..act.actor.owner_name) + :gsub('${target}\'s',targ) :gsub('${target}',targ) :gsub('${lb}','\7') :gsub('${number}',m.add_effect_param) @@ -406,8 +418,16 @@ function parse_action_packet(act) end local msg = simplify_message(m.spike_effect_message) - if not simplify and common_nouns:contains(act.actor.id) then - msg = actor_noun(msg) + if not simplify then + if common_nouns:contains(act.actor.id) then + msg = actor_noun(msg) + end + if plural_entities:contains(act.actor.id) then + msg = plural_actor(msg) + end + if targets_condensed or plural_entities:contains(v.target[1].id) then + msg = plural_target(msg) + end end if m.spike_effect_fields.status then numb = m.spike_effect_status else numb = pref_suf((m.cspike_effect_param or m.spike_effect_param),m.spike_effect_message,actor.damage,col) end windower.add_to_chat(color,make_condensedamage_number(m.spike_effect_number)..(clean_msg(msg @@ -417,7 +437,9 @@ function parse_action_packet(act) :gsub('${weapon_skill}',act.action.weapon_skill or 'ERROR 145') :gsub('${abil}',m.simp_spike_name or act.action.name or 'ERROR 146') :gsub('${numb}',numb or 'ERROR 147') - :gsub((simplify and '${target}' or '${actor}'),color_it(act.actor.name,color_arr[act.actor.owner or act.actor.type])) + :gsub('${actor}\'s',color_it(act.actor.name,color_arr[act.actor.owner or act.actor.type])..'\'s'..act.actor.owner_name) + :gsub((simplify and '${target}' or '${actor}'),color_it(act.actor.name,color_arr[act.actor.owner or act.actor.type])..act.actor.owner_name) + :gsub('${target}\'s',targ) :gsub((simplify and '${actor}' or '${target}'),targ) :gsub('${lb}','\7') :gsub('${number}',m.spike_effect_param) @@ -569,20 +591,23 @@ function assemble_targets(actor,targs,category,msg) end for i,v in pairs(targets) do - local name - local article = common_nouns:contains(v.id) and not simplify and 'The ' or '' + local name = string.gsub(v.name,' ', string.char(0x81,0x3F)) --fix for ffxi chat splits on space + local article = common_nouns:contains(v.id) and (not simplify or msg == 206) and 'The ' or '' local numb = condensetargetname and samename[v.name] > 1 and ' {'..samename[v.name]..'}' or '' if i == 1 then - name = color_it(v.name,color_arr[v.owner or v.type]) - out_str = out_str..article..name..numb + name = color_it(name,color_arr[v.owner or v.type])..v.owner_name if samename[v.name] > 1 then targets_condensed = true else + if (not simplify or msg == 206) and string.find(res.action_messages[msg][language], '${target}\'s') then + name = color_it(name,color_arr[v.owner or v.type])..(plural_entities:contains(v.id) and '\'' or '\'s')..v.owner_name + end targets_condensed = false end + out_str = out_str..article..name..numb else targets_condensed = true - name = color_it(v.name,color_arr[v.owner or v.type]) + name = color_it(name,color_arr[v.owner or v.type])..v.owner_name out_str = conjunctions(out_str,article..name..numb,#targets,i) end end @@ -637,7 +662,7 @@ function player_info(id) dmg = 'mydmg' end owner = i - owner_name = showownernames and ' (' .. v.mob.name .. ')' + owner_name = showownernames and ' ('..color_it(v.mob.name, color_arr[owner or typ])..')' break elseif type(v) == 'table' and v.mob and v.mob.fellow_index and v.mob.fellow_index == player_table.index then if i == 'p0' then @@ -646,7 +671,7 @@ function player_info(id) dmg = 'mydmg' end owner = i - owner_name = showownernames and ' (' .. v.mob.name .. ')' + owner_name = showownernames and ' ('..color_it(v.mob.name, color_arr[owner or typ])..')' break end end @@ -682,7 +707,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 nil),race = player_table.race} + 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} end function get_spell(act) From e42e631fd24025c1eb50a51904a903757025db7d Mon Sep 17 00:00:00 2001 From: KenshiDRK Date: Thu, 1 Apr 2021 04:46:14 +0200 Subject: [PATCH 04/20] more fixes more fixes --- addons/battlemod/parse_action_packet.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/battlemod/parse_action_packet.lua b/addons/battlemod/parse_action_packet.lua index 21bc48d486..8261adac3c 100644 --- a/addons/battlemod/parse_action_packet.lua +++ b/addons/battlemod/parse_action_packet.lua @@ -268,7 +268,7 @@ function parse_action_packet(act) end local msg,numb = simplify_message(m.message) if not color_arr[act.actor.owner or act.actor.type] then windower.add_to_chat(123,'Battlemod error, missing filter:'..tostring(act.actor.owner)..' '..tostring(act.actor.type)) end - if m.fields.status then numb = m.status else numb = pref_suf((m.cparam or m.param),m.message,act.actor.damage,col) end + if m.fields.status then numb = m.status else numb = pref_suf((m.message == 674 and m.add_effect_param or m.cparam or m.param),m.message,act.actor.damage,col) end if msg and m.message == 70 and not simplify then -- fix pronoun on parry if v.target[1].race == 0 then @@ -599,7 +599,7 @@ function assemble_targets(actor,targs,category,msg) if samename[v.name] > 1 then targets_condensed = true else - if (not simplify or msg == 206) and string.find(res.action_messages[msg][language], '${target}\'s') then + if (not simplify or msg == 206) and #targets == 1 and string.find(res.action_messages[msg][language], '${target}\'s') then name = color_it(name,color_arr[v.owner or v.type])..(plural_entities:contains(v.id) and '\'' or '\'s')..v.owner_name end targets_condensed = false From 04ca84cfa7f789a3b9865f86f905e2724653f0b0 Mon Sep 17 00:00:00 2001 From: RubenatorX Date: Fri, 16 Apr 2021 11:41:56 -0600 Subject: [PATCH 05/20] equipviewer ffxi_path update DO NOT ACCEPT/MERGE THIS till the luacore patch adding `windower.ffxi_path` is deployed --- addons/equipviewer/icon_extractor.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/equipviewer/icon_extractor.lua b/addons/equipviewer/icon_extractor.lua index f5b71853a5..0424e7b58d 100644 --- a/addons/equipviewer/icon_extractor.lua +++ b/addons/equipviewer/icon_extractor.lua @@ -22,12 +22,12 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] --- icon_extractor v1.1.1 +-- icon_extractor v1.1.2 -- Written by Rubenator of Leviathan -- Base Extraction Code graciously provided by Trv of Windower discord local icon_extractor = {} -local game_path_default = windower.pol_path..'\/..\/FINAL FANTASY XI' +local game_path_default = windower.ffxi_path local game_path = game_path_default local string = require('string') From a6f4394d940f0c171bf03da8d77d651981a26c9f Mon Sep 17 00:00:00 2001 From: RubenatorX Date: Fri, 16 Apr 2021 11:47:26 -0600 Subject: [PATCH 06/20] update equipviewer ffxi_path --- addons/equipviewer/equipviewer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/equipviewer/equipviewer.lua b/addons/equipviewer/equipviewer.lua index 24d2078e24..5e76923075 100644 --- a/addons/equipviewer/equipviewer.lua +++ b/addons/equipviewer/equipviewer.lua @@ -426,7 +426,7 @@ windower.register_event('addon command', function (...) if #cmd_args == 0 then error("Must provide path.") log('Current Path: %s':format( - "\""..settings.game_path.."\"" or "(Default): \""..windower.pol_path.."\/..\/FINAL FANTASY XI\"" + "\""..settings.game_path.."\"" or "(Default): \""..windower.ffxi_path )) return end From 2c9d0e650864923baccc9365ff1ccb6393f112f8 Mon Sep 17 00:00:00 2001 From: KenshiDRK Date: Sat, 17 Apr 2021 16:03:10 +0200 Subject: [PATCH 07/20] requested changes requested changes --- addons/battlemod/battlemod.lua | 47 ++-- addons/battlemod/generic_helpers.lua | 283 ++++++++++++++++------- addons/battlemod/parse_action_packet.lua | 77 +++--- addons/battlemod/statics.lua | 55 +++++ 4 files changed, 316 insertions(+), 146 deletions(-) diff --git a/addons/battlemod/battlemod.lua b/addons/battlemod/battlemod.lua index 12b768eb5f..904570df19 100644 --- a/addons/battlemod/battlemod.lua +++ b/addons/battlemod/battlemod.lua @@ -253,8 +253,8 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec ------- ITEM QUANTITY ------- if id == 0x020 and parse_quantity then --local packet = packets.parse('incoming', original) - local item = original:unpack("H",0x0D) - local count = original:unpack("I",0x05) + local item = original:unpack('H',0x0D) + local count = original:unpack('I',0x05) if item == 0 then return end if item_quantity.id == item then item_quantity.count = count..' ' @@ -262,9 +262,9 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec ------- NOUNS AND PLURAL ENTITIES ------- elseif id == 0x00E then - local mob_id = original:unpack("I",0x05) - local mask = original:unpack("C",0x0B) - local chat_info = original:unpack("C",0x28) + local mob_id = original:unpack('I',0x05) + local mask = original:unpack('C',0x0B) + local chat_info = original:unpack('C',0x28) if bit.band(mask,4) == 4 then if bit.band(chat_info,32) == 0 and not common_nouns:contains(mob_id) then table.insert(common_nouns, mob_id) @@ -286,14 +286,14 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec ------- ACTION MESSAGE ------- elseif id == 0x29 then local am = {} - am.actor_id = original:unpack("I",0x05) - am.target_id = original:unpack("I",0x09) - am.param_1 = original:unpack("I",0x0D) - am.param_2 = original:unpack("H",0x11)%2^9 -- First 7 bits - am.param_3 = math.floor(original:unpack("I",0x11)/2^5) -- Rest - am.actor_index = original:unpack("H",0x15) - am.target_index = original:unpack("H",0x17) - am.message_id = original:unpack("H",0x19)%2^15 -- Cut off the most significant bit + am.actor_id = original:unpack('I',0x05) + am.target_id = original:unpack('I',0x09) + am.param_1 = original:unpack('I',0x0D) + am.param_2 = original:unpack('H',0x11)%2^9 -- First 7 bits + am.param_3 = math.floor(original:unpack('I',0x11)/2^5) -- Rest + am.actor_index = original:unpack('H',0x15) + am.target_index = original:unpack('H',0x17) + am.message_id = original:unpack('H',0x19)%2^15 -- Cut off the most significant bit local actor = player_info(am.actor_id) local target = player_info(am.target_id) @@ -318,16 +318,17 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec windower.add_to_chat(color, msg) else local msg = res.action_messages[am.message_id][language] + msg = grammatical_number_fix(msg, number, am.message_id) if plural_entities:contains(am.actor_id) then - msg = plural_actor(msg) + msg = plural_actor(msg, am.message_id) end if plural_entities:contains(am.target_id) then - msg = plural_target(msg) + msg = plural_target(msg, am.message_id) end local msg = clean_msg(msg :gsub('${status}',status or '') :gsub('${target}',target_article..targ) - :gsub('${number}',number or '')) + :gsub('${number}',number or ''), am.message_id) windower.add_to_chat(color, msg) end elseif am.message_id == 206 and condensetargets then -- Wears off messages @@ -363,10 +364,10 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec local item,status,spell,skill,number,number2 local outstr = res.action_messages[am.message_id][language] if plural_entities:contains(am.actor_id) then - outstr = plural_actor(outstr) + outstr = plural_actor(outstr, am.message_id) end if plural_entities:contains(am.target_id) then - outstr = plural_target(outstr) + outstr = plural_target(outstr, am.message_id) end local fields = fieldsearch(outstr) @@ -429,7 +430,7 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec :gsub('${number}',number or '') :gsub('${number2}',number2 or '') :gsub('${skill}',skill or '') - :gsub('${lb}','\7'))) + :gsub('${lb}','\7'), am.message_id)) windower.add_to_chat(res.action_messages[am.message_id]['color'],outstr) am.message_id = false elseif debugging and res.action_messages[am.message_id] then @@ -445,8 +446,8 @@ windower.register_event('incoming chunk',function (id,original,modified,is_injec ------------ SYNTHESIS ANIMATION -------------- elseif id == 0x030 and crafting then - if windower.ffxi.get_player().id == original:unpack("I",5) or windower.ffxi.get_mob_by_target('t') and windower.ffxi.get_mob_by_target('t').id == original:unpack("I",5) then - local crafter_name = (windower.ffxi.get_player().id == original:unpack("I",5) and windower.ffxi.get_player().name) or windower.ffxi.get_mob_by_target('t').name + if windower.ffxi.get_player().id == original:unpack('I',5) or windower.ffxi.get_mob_by_target('t') and windower.ffxi.get_mob_by_target('t').id == original:unpack('I',5) then + local crafter_name = (windower.ffxi.get_player().id == original:unpack('I',5) and windower.ffxi.get_player().name) or windower.ffxi.get_mob_by_target('t').name local result = original:byte(13) if result == 0 then windower.add_to_chat(8,' ------------- NQ Synthesis ('..crafter_name..') -------------') @@ -479,11 +480,11 @@ end) function multi_packet(...) local ind = table.concat({...},' ') local targets = assemble_targets(multi_actor[ind],multi_targs[ind],0,multi_msg[ind]) - local outstr = targets_condensed and plural_target(res.action_messages[multi_msg[ind]][language]) or res.action_messages[multi_msg[ind]][language] + local outstr = targets_condensed and plural_target(res.action_messages[multi_msg[ind]][language], multi_msg[ind]) or res.action_messages[multi_msg[ind]][language] outstr = clean_msg(outstr :gsub('${target}\'s',targets) :gsub('${target}',targets) - :gsub('${status}',ind)) + :gsub('${status}',ind), multi_msg[ind]) windower.add_to_chat(res.action_messages[multi_msg[ind]].color,outstr) multi_targs[ind] = nil multi_msg[ind] = nil diff --git a/addons/battlemod/generic_helpers.lua b/addons/battlemod/generic_helpers.lua index c3677a0eb2..1f015ae554 100644 --- a/addons/battlemod/generic_helpers.lua +++ b/addons/battlemod/generic_helpers.lua @@ -84,7 +84,7 @@ end function fieldsearch(message) local fieldarr = {} - string.gsub(message,"{(.-)}", function(a) fieldarr[a] = true end) + string.gsub(message,'{(.-)}', function(a) fieldarr[a] = true end) return fieldarr end @@ -124,114 +124,223 @@ function actor_noun(msg) return msg end -function plural_actor(msg) +function plural_actor(msg, msg_id) if msg then - msg = msg - :gsub('${actor} hits ', '${actor} hit ') - :gsub('${actor} casts ', '${actor} cast ') - :gsub('${actor} starts ', '${actor} start ') - :gsub('${actor} defeats ', '${actor} defeat ') - :gsub('${actor} gains ', '${actor} gain ') - :gsub('${actor} attains ', '${actor} attain ') - :gsub('${actor} loses ', '${actor} lose ') - :gsub('${actor} falls ', '${actor} fall ') - :gsub("${actor}'s ", "${actor}' ") - :gsub('${actor} misses ' , '${actor} miss ') - :gsub('${actor} calls ' , '${actor} call ') - :gsub('${actor} learns ' , '${actor} learn ') - :gsub('${actor} uses ' , '${actor} use ') - :gsub('${actor} is ' , '${actor} are ') - :gsub('${actor} takes ' , '${actor} take ') - :gsub('${actor} does ' , '${actor} do ') - :gsub('${actor} lacks ' , '${actor} lack ') - :gsub('${actor} redies ' , '${actor} ready ') - :gsub('${actor} earns ' , '${actor} earn ') - :gsub('${actor} scores ' , '${actor} score ') - :gsub('${actor} successfully removes ' , '${actor} successfully remove ') - :gsub('${actor} achieves ' , '${actor} achieve ') - :gsub('${actor} mugs ' , '${actor} mug ') - :gsub('${actor} steals ' , '${actor} steal ') - :gsub('${actor} fails ' , '${actor} fail ') - :gsub(' but finds nothing' , ' but find nothing') - :gsub(' and finds ${item}' , ' and find ${item}') - :gsub('${actor} recovers ' , '${actor} recover ') - :gsub('${ability}, but misses' , '${ability}, but miss') - :gsub(' but misses ${target}' , ' but miss ${target}') - :gsub('${actor} covers ' , '${actor} cover ') - :gsub('${actor} already has ' , '${actor} already have ') - :gsub('${actor} attempts ' , '${actor} attempt ') - :gsub(' but lacks ' , ' but lack ') - :gsub('${actor} destroys ' , '${actor} destroy ') - :gsub('${actor} absorbs ' , '${actor} absorb ') - :gsub('${actor} eats ' , '${actor} eat ') - :gsub('${actor} leads ' , '${actor} lead ') - :gsub('${actor} has ' , '${actor} have ') - :gsub('${actor} obtains ' , '${actor} obtain ') - :gsub(' and finds ${number}' , ' and find ${number}') + if msg_id == 6 then + msg = msg:gsub('${actor} defeats ', '${actor} defeat ') + elseif msg_id == 9 then + msg = msg:gsub('${actor} attains ', '${actor} attain ') + elseif msg_id == 10 then + msg = msg:gsub('${actor} loses ', '${actor} lose ') + elseif msg_id == 11 then + msg = msg:gsub('${actor} falls ', '${actor} fall ') + elseif msg_id == 19 then + msg = msg:gsub('${actor} calls ' , '${actor} call ') + elseif msg_id == 35 then + msg = msg:gsub('${actor} lacks ' , '${actor} lack ') + elseif msg_id == 67 then + msg = msg:gsub('${actor} scores ' , '${actor} score ') + elseif msg_id == 124 then + msg = msg:gsub('${actor} achieves ' , '${actor} achieve ') + elseif msg_id == 129 then + msg = msg:gsub('${actor} mugs ' , '${actor} mug ') + elseif msg_id == 244 then + msg = msg:gsub('${actor} fails ' , '${actor} fail ') + elseif msg_id == 311 then + msg = msg:gsub('${actor} covers ' , '${actor} cover ') + elseif msg_id == 315 then + msg = msg:gsub('${actor} already has ' , '${actor} already have ') + elseif msg_id ==411 then + msg = msg + :gsub('${actor} attempts ' , '${actor} attempt ') + :gsub(' but lacks ' , ' but lack ') + elseif msg_id == 536 then + msg = msg:gsub('${actor} takes ' , '${actor} take ') + elseif msg_id == 563 then + msg = msg:gsub('${actor} destroys ' , '${actor} destroy ') + elseif msg_id == 772 then + msg = msg:gsub('${actor} stands ', '${actor} stand ') + elseif replacements_map.actor.hits:contains(msg_id) then + msg = msg:gsub('${actor} hits ', '${actor} hit ') + elseif replacements_map.actor.misses:contains(msg_id) then + msg = msg:gsub('${actor} misses ' , '${actor} miss ') + elseif replacements_map.actor.starts:contains(msg_id) then + msg = msg:gsub('${actor} starts ', '${actor} start ') + elseif replacements_map.actor.casts:contains(msg_id) then + msg = msg:gsub('${actor} casts ', '${actor} cast ') + if msg_id == 83 then + msg = msg:gsub('${actor} successfully removes ' , '${actor} successfully remove ') + elseif msg_id == 572 or msg_id == 642 then + msg = msg:gsub('${actor} absorbs ' , '${actor} absorb ') + end + elseif replacements_map.actor.readies:contains(msg_id) then + msg = msg:gsub('${actor} readies ' , '${actor} ready ') + elseif replacements_map.actor.recovers:contains(msg_id) then + msg = msg:gsub('${actor} recovers ' , '${actor} recover ') + elseif replacements_map.actor.gains:contains(msg_id) then + msg = msg:gsub('${actor} gains ', '${actor} gain ') + elseif replacements_map.actor.apos:contains(msg_id) then + msg = msg:gsub('${actor}\'s ', '${actor}\' ') + if msg_id == 33 then + msg = msg:gsub('${actor} takes ' , '${actor} take ') + elseif msg_id == 606 then + msg = msg:gsub('${actor} recovers ' , '${actor} recover ') + elseif msg_id == 799 then + msg = msg:gsub('${actor} is ' , '${actor} are ') + end + elseif replacements_map.actor.uses:contains(msg_id) then + msg = msg:gsub('${actor} uses ' , '${actor} use ') + if msg_id == 122 then + msg = msg:gsub('${actor} recovers ' , '${actor} recover ') + elseif msg_id == 123 then + msg = msg:gsub('${actor} successfully removes ' , '${actor} successfully remove ') + elseif msg_id == 126 or msg_id == 136 or msg_id == 528 then + msg = msg:gsub('${actor}\'s ', '${actor}\' ') + elseif msg_id == 137 or msg_id == 153 then + msg = msg:gsub('${actor} fails ' , '${actor} fail ') + elseif msg_id == 139 then + msg = msg:gsub(' but finds nothing' , ' but find nothing') + elseif msg_id == 140 then + msg = msg:gsub(' and finds a ${item2}' , ' and find a ${item2}') + elseif msg_id == 158 then + msg = msg:gsub('${ability}, but misses' , '${ability}, but miss') + elseif msg_id == 585 then + msg = msg:gsub('${actor} is ' , '${actor} are ') + elseif msg_id == 674 then + msg = msg:gsub(' and finds ${number}' , ' and find ${number}') + elseif msg_id == 780 then + msg = msg:gsub('${actor} takes ' , '${actor} take ') + elseif replacements_map.actor.steals:contains(msg_id) then + msg = msg:gsub('${actor} steals ' , '${actor} steal ') + elseif replacements_map.actor.butmissestarget:contains(msg_id) then + msg = msg:gsub(' but misses ${target}' , ' but miss ${target}') + end + elseif replacements_map.actor.is:contains(msg_id) then + msg = msg:gsub('${actor} is ' , '${actor} are ') + elseif replacements_map.actor.learns:contains(msg_id) then + msg = msg:gsub('${actor} learns ' , '${actor} learn ') + elseif replacements_map.actor.has:contains(msg_id) then + msg = msg:gsub('${actor} has ' , '${actor} have ') + elseif replacements_map.actor.obtains:contains(msg_id) then + msg = msg:gsub('${actor} obtains ' , '${actor} obtain ') + elseif replacements_map.actor.does:contains(msg_id) then + msg = msg:gsub('${actor} does ' , '${actor} do ') + elseif replacements_map.actor.leads:contains(msg_id) then + msg = msg:gsub('${actor} leads ' , '${actor} lead ') + elseif replacements_map.actor.eats:contains(msg_id) then + msg = msg:gsub('${actor} eats ' , '${actor} eat ') + if msg_id == 604 then + msg = msg:gsub(' but finds nothing' , ' but find nothing') + end + elseif replacements_map.actor.earns:contains(msg_id) then + msg = msg:gsub('${actor} earns ' , '${actor} earn ') + end end return msg end -function plural_target(msg) +function plural_target(msg, msg_id) if msg then - msg = msg - :gsub('${target} takes ', '${target} take ') - :gsub('${target} is ', '${target} are ') - :gsub('${target} recovers ', '${target} recover ') - :gsub("${target}'s ", targets_condensed and '${target} ' or "${target}' ") - :gsub('${target} falls ', '${target} fall ') - :gsub('${target} uses ', '${target} use ') - :gsub('${target} resists', '${target} resist') - :gsub('${target} vanishes', '${target} vanish') - :gsub('${target} receives ', '${target} receive ') - :gsub('${target} seems ${skill}', '${target} seem ${skill}') - :gsub('${lb}It seems to have ', '${lb}They seem to have ') - :gsub('${target} gains ', '${target} gain ') - :gsub('${target} evades', '${target} evade') - :gsub('${target} regains ', '${target} regain ') - :gsub('${target} narrowly escapes ', '${target} narrowly escape ') - :gsub('${target} obtains ', '${target} obtain ') - :gsub('${target} learns ', '${target} learn ') - :gsub('${target} loses ', '${target} lose ') - :gsub('${target} was ', '${target} were ') - :gsub('${target} has ', '${target} have ') - :gsub('${target} completely resists ', '${target} completely resist ') - :gsub('${target} now has ', '${target} now have ') - :gsub('${target} feels ', '${target} feel ') - :gsub('${target} stands ', '${target} stand ') + if msg_id == 282 then + msg = msg:gsub('${target} evades', '${target} evade') + elseif msg_id == 359 then + msg = msg:gsub('${target} narrowly escapes ', '${target} narrowly escape ') + elseif msg_id == 419 then + msg = msg:gsub('${target} learns ', '${target} learn ') + elseif msg_id == 671 then + msg = msg:gsub('${target} now has ', '${target} now have ') + elseif msg_id == 764 then + msg = msg:gsub('${target} feels ', '${target} feel ') + elseif replacements_map.target.takes:contains(msg_id) then + msg = msg:gsub('${target} takes ', '${target} take ') + if msg_id == 197 then + msg = msg:gsub('${target} resists', '${target} resist') + end + elseif replacements_map.target.is:contains(msg_id) then + msg = msg:gsub('${target} is ', '${target} are ') + elseif replacements_map.target.recovers:contains(msg_id) then + msg = msg:gsub('${target} recovers ', '${target} recover ') + elseif replacements_map.target.apos:contains(msg_id) then --coincidence in 439 and 440 + msg = msg:gsub('${target}\'s ', targets_condensed and '${target} ' or '${target}\' ') + if msg_id == 439 or msg_id == 440 then + msg = msg:gsub('${target} regains ', '${target} regain ') + end + elseif replacements_map.target.falls:contains(msg_id) then + msg = msg:gsub('${target} falls ', '${target} fall ') + elseif replacements_map.target.uses:contains(msg_id) then + msg = msg:gsub('${target} uses ', '${target} use ') + elseif replacements_map.target.resists:contains(msg_id) then + msg = msg:gsub('${target} resists', '${target} resist') + elseif replacements_map.target.vanishes:contains(msg_id) then + msg = msg:gsub('${target} vanishes', '${target} vanish') + elseif replacements_map.target.receives:contains(msg_id) then + msg = msg:gsub('${target} receives ', '${target} receive ') + elseif replacements_map.target.seems:contains(msg_id) then + msg = msg:gsub('${target} seems ${skill}', '${target} seem ${skill}') + if msg_id ~= 174 then + msg = msg:gsub('${lb}It seems to have ', '${lb}They seem to have ') + end + elseif replacements_map.target.gains:contains(msg_id) then + msg = msg:gsub('${target} gains ', '${target} gain ') + elseif replacements_map.target.regains:contains(msg_id) then + msg = msg:gsub('${target} regains ', '${target} regain ') + elseif replacements_map.target.obtains:contains(msg_id) then + msg = msg:gsub('${target} obtains ', '${target} obtain ') + elseif replacements_map.target.loses:contains(msg_id) then + msg = msg:gsub('${target} loses ', '${target} lose ') + elseif replacements_map.target.was:contains(msg_id) then + msg = msg:gsub('${target} was ', '${target} were ') + elseif replacements_map.target.has:contains(msg_id) then + msg = msg:gsub('${target} has ', '${target} have ') + elseif replacements_map.target.compresists:contains(msg_id) then + msg = msg:gsub('${target} completely resists ', '${target} completely resist ') + end end return msg end -function clean_msg(msg) +function clean_msg(msg, msg_id) if msg then msg = msg :gsub(' The ', ' the ') - msg = msg - :gsub('%. the ', '. The ') :gsub(': the ', ': The ') :gsub('! the ', '! The ') + if replacements_map.the.point:contains(msg_id) then + msg = msg:gsub('%. the ', '. The ') + end end return msg end -function grammatical_number_fix(msg, number) +function grammatical_number_fix(msg, number, msg_id) if msg then if number == 1 then - msg = msg - :gsub(' points', ' point') - :gsub('${number} Ballista Points', '${number} Ballista Point') - :gsub('healed of ${number} status ailments', 'healed of ${number} status ailment') - :gsub('magical effects from', 'magical effect from') + if replacements_map.number.points:contains(msg_id) then + msg = msg:gsub(' points', ' point') + elseif msg_id == 411 then + msg = msg:gsub('${number} Ballista Points', '${number} Ballista Point') + elseif msg_id == 589 then + msg = msg:gsub('healed of ${number} status ailments', 'healed of ${number} status ailment') + elseif msg_id == 778 then + msg = msg:gsub('magical effects from', 'magical effect from') + end else - msg = msg - :gsub(' absorbs', ' absorb') - :gsub(' Petra', ' Petras') - :gsub('disappears', 'disappear') - :gsub('attributes is', 'attributes are') - :gsub('status effect is', 'status effects are') - :gsub('piece', 'pieces') - :gsub('Finishing move now ', 'Finishing moves now ') + if replacements_map.number.absorbs:contains(msg_id) then + msg = msg:gsub(' absorbs', ' absorb') + elseif msg_id == 133 then + msg = msg:gsub(' Petra', ' Petras') + elseif replacements_map.number.attributes:contains(msg_id) then + msg = msg:gsub('attributes is', 'attributes are') + elseif replacements_map.number.status:contains(msg_id) then + msg = msg:gsub('status effect is', 'status effects are') + elseif msg_id == 557 then + msg = msg:gsub('piece', 'pieces') + elseif msg_id == 560 then + msg = msg:gsub('Finishing move now ', 'Finishing moves now ') + end + if replacements_map.number.disappears:contains(msg_id) then + msg = msg:gsub('disappears', 'disappear') + end end end return msg diff --git a/addons/battlemod/parse_action_packet.lua b/addons/battlemod/parse_action_packet.lua index 8261adac3c..89c21c22f3 100644 --- a/addons/battlemod/parse_action_packet.lua +++ b/addons/battlemod/parse_action_packet.lua @@ -278,10 +278,6 @@ function parse_action_packet(act) end end - if col == 'D' or grammar_numb_msg:contains(m.message) then - msg = grammatical_number_fix(msg, (m.cparam or m.param)) - end - local count = '' if m.message == 377 and act.actor_id == Self.id then parse_quantity = true @@ -290,6 +286,9 @@ function parse_action_packet(act) end if not simplify then + if col == 'D' or grammar_numb_msg:contains(m.message) then + msg = grammatical_number_fix(msg, (m.cparam or m.param), m.message) + end if act.action.item_id or act.action.item2_id then msg = item_article_fix(act.action.item_id,act.action.item2_id,msg) end @@ -297,30 +296,30 @@ function parse_action_packet(act) msg = actor_noun(msg) end if plural_entities:contains(act.actor.id) then - msg = plural_actor(msg) + msg = plural_actor(msg, m.message) end if targets_condensed or plural_entities:contains(v.target[1].id) then - msg = plural_target(msg) + msg = plural_target(msg, m.message) end end 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 - ..(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 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 + ..(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 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)) @@ -336,7 +335,7 @@ function parse_action_packet(act) :gsub('${lb}','\7'..prefix2) :gsub('${number}',act.action.number or m.param) :gsub('${status}',m.status or 'ERROR 120') - :gsub('${gil}',m.param..' gil'))) + :gsub('${gil}',m.param..' gil'), m.message)) if m.message == 377 and act.actor_id == Self.id then send_delayed_message:schedule(0.5,color,message) else @@ -361,14 +360,17 @@ function parse_action_packet(act) end local msg,numb = simplify_message(m.add_effect_message) if not simplify then + if col == 'D' or grammar_numb_msg:contains(m.add_effect_message) then + msg = grammatical_number_fix(msg, (m.cparam or m.param), m.add_effect_message) + end if common_nouns:contains(act.actor.id) then msg = actor_noun(msg) end if plural_entities:contains(act.actor.id) then - msg = plural_actor(msg) + msg = plural_actor(msg, m.add_effect_message) end if targets_condensed or plural_entities:contains(v.target[1].id) then - msg = plural_target(msg) + msg = plural_target(msg, m.add_effect_message) end end if m.add_effect_fields.status then numb = m.add_effect_status else numb = pref_suf((m.cadd_effect_param or m.add_effect_param),m.add_effect_message,act.actor.damage,col) end @@ -388,7 +390,7 @@ function parse_action_packet(act) :gsub('${target}',targ) :gsub('${lb}','\7') :gsub('${number}',m.add_effect_param) - :gsub('${status}',m.add_effect_status or 'ERROR 178')))) + :gsub('${status}',m.add_effect_status or 'ERROR 178'), m.add_effect_message))) if not non_block_messages:contains(m.add_effect_message) then m.add_effect_message = 0 end @@ -419,14 +421,17 @@ function parse_action_packet(act) local msg = simplify_message(m.spike_effect_message) if not simplify then + if col == 'D' or grammar_numb_msg:contains(m.spike_effect_message) then + msg = grammatical_number_fix(msg, (m.cparam or m.param), m.spike_effect_message) + end if common_nouns:contains(act.actor.id) then msg = actor_noun(msg) end if plural_entities:contains(act.actor.id) then - msg = plural_actor(msg) + msg = plural_actor(msg, m.spike_effect_message) end if targets_condensed or plural_entities:contains(v.target[1].id) then - msg = plural_target(msg) + msg = plural_target(msg, m.spike_effect_message) end end if m.spike_effect_fields.status then numb = m.spike_effect_status else numb = pref_suf((m.cspike_effect_param or m.spike_effect_param),m.spike_effect_message,actor.damage,col) end @@ -443,7 +448,7 @@ function parse_action_packet(act) :gsub((simplify and '${actor}' or '${target}'),targ) :gsub('${lb}','\7') :gsub('${number}',m.spike_effect_param) - :gsub('${status}',m.spike_effect_status or 'ERROR 150')))) + :gsub('${status}',m.spike_effect_status or 'ERROR 150'), m.spike_effect_message))) if not non_block_messages:contains(m.spike_effect_message) then m.spike_effect_message = 0 end @@ -555,9 +560,9 @@ function simplify_message(msg_ID) msg = line_noability elseif line_notarget and fields.actor and fields.number then if msg_ID == 798 then --Maneuver message - msg = line_notarget.."%" + msg = line_notarget..'%' elseif msg_ID == 799 then --Maneuver message with overload - msg = line_notarget.."% (${actor} overloaded)" + msg = line_notarget..'% (${actor} overloaded)' else msg = line_notarget end @@ -862,37 +867,37 @@ function color_filt(col,is_me) --Depends on whether or not the target is you, the same as using in-game colors -- Returns a color code for windower.add_to_chat() -- Does not currently support a Debuff/Buff distinction - if col == "D" then -- Damage + if col == 'D' then -- Damage if is_me then return 28 else return 20 end - elseif col == "M" then -- Misses + elseif col == 'M' then -- Misses if is_me then return 29 else return 21 end - elseif col == "H" then -- Healing + elseif col == 'H' then -- Healing if is_me then return 30 else return 22 end - elseif col == "B" then -- Beneficial effects + elseif col == 'B' then -- Beneficial effects if is_me then return 56 else return 60 end - elseif col == "DB" then -- Detrimental effects (I don't know how I'd split these) + elseif col == 'DB' then -- Detrimental effects (I don't know how I'd split these) if is_me then return 57 else return 61 end - elseif col == "R" then -- Resists + elseif col == 'R' then -- Resists if is_me then return 59 else diff --git a/addons/battlemod/statics.lua b/addons/battlemod/statics.lua index 4c64889b2d..17021d9b0d 100644 --- a/addons/battlemod/statics.lua +++ b/addons/battlemod/statics.lua @@ -44,6 +44,61 @@ black_colors = T{}--352,354,356,388,390,400,402,430,432,442,444,472,474,484,486} dmg_drain_msg = T{132,161,187,227,274,281,736,748,749,802,803} grammar_numb_msg = T{14,31,133,231,369,370,382,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,403,404,405,411,417,535,536,557,570,571,589,607,651,757,769,770,778,792} +replacements_map = { + actor = { + hits = T{1,373}, + casts = T{2,7,42,82,83,85,86,93,113,114,227,228,230,236,237,252,268,271,274,275,309,329,330,331,332,333,334,335,341,342,430,431,432,433,454,533,534,570,572,642,647,653,655}, + starts = T{3,327,716}, + gains = T{8,54,105,166,253,371,372,718,735}, + apos = T{14,16,33,69,70,75,248,310,312,352,353,354,355,382,493,535,574,575,576,577,592,606,798,799}, + misses = T{15,63}, + learns = T{23,45,442}, + uses = T{28,77,100,101,102,103,108,109,110,115,116,117,118,119,120,121,122,123,125,126,127,129,131,133,134,135,136,137,138,139,140,141,142,143,144,146,148,150,153,156,157,158,159,185,186,187,188,189,194,197,221,224,225,226,231,238,242,243,245,303,304,305,306,317,318,319,320,321,322,323,324,360,362,364,369,370,375,376,377,378,379,399,400,401,402,405,406,407,408,409,412,413,414,416,417,418,420,422,424,425,426,435, + 437,439,441,451,452,453,519,520,521,522,526,527,528,529,532,539,560,585,591,593,594,595,596,597,598,599,602,607,608,644,645,646,657,658,663,664,667,668,670,671,672,674,730,734,736,737,738,743,746,747,748,750,752,754,755,758,762,763,764,765,766,778,779,780,792,802,803,804,805,1023}, + is = T{29,49,84,106,191}, + does = T{34,91,192}, + readies = T{43,326,675}, + earns = T{50,368,719}, + steals = T{125,133,453,593,594,595,596,597,598,599}, + recovers = T{152,167}, + butmissestarget = T{188,245,324,658}, + eats = T{600,604}, + leads = T{648,650,651}, + has = T{515,661,665,688}, + obtains = T{582,673}, + }, + target = { + takes = T{2,67,77,110,157,185,196,197,229,252,264,265,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,317,353,379,413,522,648,650,732,747,767,768,800}, + is = T{4,13,64,78,82,86,107,127,128,130,131,134,136,141,148,149,150,151,154,198,203,204,232,236,242,246,270,271,272,277,279,286,287,313,328,350,519,520,521,529,531,586,591,593,594,595,596,597,598,599,645,754,776}, + recovers = T{7,24,25,26,74,102,103,224,238,263,276,306,318,367,373,382,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,651,769,770}, + apos = T{31,38,44,53,73,83,106,112,116,120,121,123,132,159,168,206,221,231,249,285,308,314,321,322,329,330,331,332,333,334,335,341,342,343,344,351,360,361,362,363,364,365,369,374,378,383,399,400,401,402,403,405,407,409,417,418,430,431,435,436,437,438,439,440,459,530,533,534,537,570,571,572,585,606,607,641,642,644,647,676,730,743,756,757,762,792,805,806,1023}, + falls = T{20,113,406,605,646}, + uses = T{79,80}, + resists = T{85,197,284,653,654}, + vanishes = T{93,273}, + receives = T{142,144,145,146,147,237,243,267,268,269,278,320,375,412,414,415,416,420,421,424,432,433,441,532,557,602,668,672,739,755,804}, + seems = T{170,171,172,173,174,175,176,177,178}, + gains = T{186,194,205,230,266,280,319}, + regains = T{357,358,439,440,451,452,539,587,588}, + obtains = T{376,377,565,566,765,766}, + loses = T{426,427,652}, + was = T{97,564}, + has = T{589,684,763}, + compresists = T{655,656}, + }, + number = { + points = T{1,2,8,10,33,38,44,54,67,77,105,110,157,163,185,196,197,223,229,252,253,264,265,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,310,317,352,353,371,372,373,379,382,385,386,387,388,389,390,391,392,393,394,395,396,397,398,413,522,536,576,577,648,650,651,718,721,722,723,724,725,726,727,728,729,732,735,747,767,768,769,770,800}, + absorbs = T{14,31,535}, + disappears = T{14,31,231,400,401,405,535,570,571,607,757,792,}, + attributes = T{369,403,417}, + status = T{370,404}, + + }, + the = { + point = T{33,308,536,800}, + } +} + domain_buffs = S{ 250, -- EF Badge 257, -- Besieged From 97fb5a47e3e9f4e03907b7312c4b477af0783717 Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Sat, 17 Apr 2021 21:50:28 -0700 Subject: [PATCH 08/20] Update addons.xml --- addons/addons.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/addons.xml b/addons/addons.xml index b7ba191326..903c7f5e35 100644 --- a/addons/addons.xml +++ b/addons/addons.xml @@ -648,6 +648,13 @@ https://github.com/Windower/Lua/issues https://discord.gg/b275nMv + + Stubborn + Arico + An addon to block accidental calls for help. + https://github.com/ianandersonlol/stubborn/issues + https://discord.gg/b275nMv + subTarget Sebyg666 From 6f9a66d9c2c66af658de03bc8342544c4a1bcd24 Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Sat, 17 Apr 2021 21:51:14 -0700 Subject: [PATCH 09/20] Add files via upload --- addons/Stubborn/Stubborn.lua | 57 ++++++++++++++++++++++++++++++++++++ addons/Stubborn/readme.md | 7 +++++ 2 files changed, 64 insertions(+) create mode 100644 addons/Stubborn/Stubborn.lua create mode 100644 addons/Stubborn/readme.md diff --git a/addons/Stubborn/Stubborn.lua b/addons/Stubborn/Stubborn.lua new file mode 100644 index 0000000000..8363c6efca --- /dev/null +++ b/addons/Stubborn/Stubborn.lua @@ -0,0 +1,57 @@ +--[[Copyright © 2021, Arico +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --]] + +_addon.name = 'Stubborn' +_addon.author = 'Arico' +_addon.version = '1' +_addon.command = 'stubborn' + +require('pack') +require('strings') +require('logger') +packets = require('packets') + + +windower.register_event('outgoing chunk', function(id, original, modified, injected, blocked) + if id == 0x01a then + local p = packets.parse('outgoing', original) + if p['Category'] == 5 and not injected then + log('You are too stubborn to call for help! Use //stubborn to call for help.') + return true + end + end +end) + +windower.register_event('addon command', function(...) + local target = windower.ffxi.get_mob_by_target("t") + if target and target.claim_id ~= 0 then + local p = packets.new('outgoing', 0x1a, { + ['Target'] = target['id'], + ['Target Index'] = target['index'], + ['Category'] = 5,}) + packets.inject(p) + end +end) \ No newline at end of file diff --git a/addons/Stubborn/readme.md b/addons/Stubborn/readme.md new file mode 100644 index 0000000000..0efb35447b --- /dev/null +++ b/addons/Stubborn/readme.md @@ -0,0 +1,7 @@ +# Stubborn +A Windower 4 addon to prevent unnecessary "Call for help!" + +Stubborn is a light weight replacement to the old CFHProtect addon. + + +If you need to call for help. Type //stubborn From 47300e29d4aa9dd21a151793928871d32b0c5cc1 Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Sun, 18 Apr 2021 10:09:44 -0700 Subject: [PATCH 10/20] Update addons.xml --- addons/addons.xml | 114 +++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/addons/addons.xml b/addons/addons.xml index 903c7f5e35..d5ed626e24 100644 --- a/addons/addons.xml +++ b/addons/addons.xml @@ -15,7 +15,7 @@ AEcho Automatically uses echo drops when you get silenced. Also, uses send to send a message to an alt that you got debuffed. Nitrous (Shiva) - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/nitrous24/Lua/issues @@ -30,13 +30,13 @@ Byrth Stores tells that you receive for later recall. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk AutoControl Automated automaton equipment setting and burden tracker. Nitrous (Shiva) - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/nitrous24/Lua/issues @@ -44,7 +44,7 @@ Chiaia Automatically hits the enter key twice when first starting so you don't timeout on the warning message. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk autoinvite @@ -58,7 +58,7 @@ Arcon Automatically joins or declines party invites. Configurable with blacklist/whitelist mode and auto-decline settings. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk AutoRA @@ -70,7 +70,7 @@ AzureSets Automated blue magic spell setting. Nitrous (Shiva) - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/nitrous24/Lua/issues @@ -85,14 +85,14 @@ Byrth Customizes battle chat messages. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk BattleStations Sjshovan (Apogee) Change or remove the default battle music. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Blist @@ -120,13 +120,13 @@ Byrth Mimics the cancel plugin, but also accepts buff names instead of just IDs. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk cBlock Blacklist addon for FFOChat. Nitrous (Shiva) - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/nitrous24/Lua/issues @@ -148,7 +148,7 @@ Arcon Allows opening links posted into the FFXI chat. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk ChatPorter @@ -162,14 +162,14 @@ Arcon Displays an on-screen clock in a custom format with options to display several different time zones. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk ConsoleBG Arcon Displays a dark (by default) background behind the Windower console to make it more readable. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk digger @@ -183,14 +183,14 @@ Chiaia Helps warp you to Reisenjima using (Dim) Rings. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Distance Arcon Shows the distance to your current target. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk DistancePlus @@ -204,7 +204,7 @@ Cair Emulates BlinkMeNot functionality. Allows for customization of gear display for you or anyone else. https://github.com/cairface/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk DynamisHelper @@ -238,28 +238,28 @@ Tako, Rubenator Displays current equipment grid on screen. Also can show current Ammo count and current Encumbrance. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk eval Aureus Allows developers to run arbitrary lua code in the console. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk FastCS Cair Dramatically speeds up cutscenes by disabling the frame rate cap. Requires the config plugin. https://github.com/cairface/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk FFOColor Nitrous (Shiva) Allows you to show FFOChat text in one of the 5 game chat channels. As well as specify colors for the text https://github.com/nitrous24/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk findAll @@ -293,7 +293,7 @@ Byrth Enables instant linkshell chat after zoning. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk InfoBar @@ -307,7 +307,7 @@ Cair Replaces outgoing text prefixed by % with respective game information. https://github.com/cairface/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Itemizer @@ -335,14 +335,14 @@ Arcon Allows opening links to certain websites from within the game, with an optional search parameter. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Logger Arcon Logs the chat log to a file. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Lookup @@ -356,26 +356,26 @@ Arcon Automatically passes an item on all accounts if lotted by another. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk MacroChanger Banggugyangu Automatically switches Macro Book and Page according to job changes. https://github.com/banggugyangu/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk MobCompass A compass to show your position relative to the target (not players) for geo and has a setup for Sneak attack - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk MountMuzzle Sjshovan (Apogee) Change or remove the default mount music. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk MountRoulette @@ -395,7 +395,7 @@ Nostrum Creates a click-able on-screen macro to help avoid targeting problems while curing. trv - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/trv6/Lua/issues @@ -403,12 +403,12 @@ Glarin of Asura Tracks and displays the Current Floor, Time Remaining, Objective, Floors Completed, Reward Rate, and Potenial Tokens. https://github.com/GlarinAsura/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk obiaway Automatically collect and remove elemental obi based on day/weather/storm conditions. - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Omen @@ -421,14 +421,14 @@ OhShi Keeps track of various event related things. Such as, VW proc messages, mob casting, mob tp moves, TH procs and cor rolls, as well as others. Nitrous (Shiva) - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/nitrous24/Lua/issues Organizer A multi-purpose inventory management solution. Similar to GearCollector. Byrth, Rooks - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/Byrth/Lua-Byrth/issues @@ -436,21 +436,21 @@ Byrth Temporary addon that fixes a null pointer animation error with pets that is causing crashes. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk PetSchool Banggugyangu A helper addon for PUPs using spellcast, it informs spellcast of pet casting (healing or nuking). https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk PetTP SnickySnacks Tracks pet vitals (HP/TP/MP) https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk plasmon @@ -464,14 +464,14 @@ Byrth Allows you to specify which plugins and addons will be used with which characters. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk PointWatch Byrth Allows you to monitor your XP/CP gains and keep track of the Dynamis time limit. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk porter @@ -506,20 +506,20 @@ Byrth Should request spawn packets for players / mobile NPCs that failed to spawn. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Respond Byrth Respond to tells and FFOchat PMs using //r. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Rhombus Creates a highly customizable, click-able, on-screen menu. trv - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk https://github.com/trv6/Lua/issues @@ -527,7 +527,7 @@ Cair Lets you save your Records of Eminence objectives to profiles for easily swapping out objectives. https://github.com/cairface/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk RollTracker @@ -548,14 +548,14 @@ Banggugyangu Informs Spellcast about changes to Sneak Attack and Trick Attack status. https://github.com/banggugyangu/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Scoreboard Suji Basic in-game damage parser. It displays live DPS and works even when chat filters are enabled. https://github.com/jerryhebert/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk setbgm @@ -569,7 +569,7 @@ Byrth Applys spellcast-like command completion (interpretation and target completion) to commands. Includes emotes, /check, and /pcmd. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Silence @@ -590,14 +590,14 @@ Byrth Sends commands between windower instances using IPC. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk SetTarget Arcon Sets the target to a given ID. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk SpeedChecker @@ -646,14 +646,14 @@ Ihm A simple helper addon for Spellcast for Scholar Stratagems. It will automatically calculate the number of stratagems you have and push them into spellcast variables. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Stubborn Arico An addon to block accidental calls for help. https://github.com/ianandersonlol/stubborn/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk subTarget @@ -667,21 +667,21 @@ Arcon Displays information about your current target in memory. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Text Arcon Allows creating and manipulating on-screen text objects through Windower commands. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Treasury Arcon Lots or passes items based on configurable lists, drops unwanted items from the inventory and automatically stacks items when they drop. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk thtracker @@ -702,14 +702,14 @@ Arcon Shows a target's HP percentage next to their health bar as well as party/alliance members's TP. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk translate Byrth Gives a rough JP->EN translation using the resources and custom dictionaries. https://github.com/Byrth/Lua-Byrth/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk TreasurePool @@ -723,7 +723,7 @@ Arcon Updates and reloads all plugins and addons when typing //update. https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk VisibleFavor @@ -751,7 +751,7 @@ Arcon A file-based macro engine https://github.com/Windower/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk zonetimer @@ -814,7 +814,7 @@ Auk Tracks and displays debuffs on your current target. https://github.com/aukon/Lua/issues - https://discord.gg/b275nMv + https://discord.gg/aUrHCvk Tab From 21ad3ea2f98e2a33e5ea2dc2f425b5b56a18ecbc Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Sun, 18 Apr 2021 10:11:10 -0700 Subject: [PATCH 11/20] Update Stubborn.lua --- addons/Stubborn/Stubborn.lua | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/addons/Stubborn/Stubborn.lua b/addons/Stubborn/Stubborn.lua index 8363c6efca..f327c8f2ea 100644 --- a/addons/Stubborn/Stubborn.lua +++ b/addons/Stubborn/Stubborn.lua @@ -9,49 +9,46 @@ modification, are permitted provided that the following conditions are met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of nor the + * Neither the name of Stubborn nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DISCLAIMED. IN NO EVENT SHALL Arico BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --]] - + b275nMv _addon.name = 'Stubborn' _addon.author = 'Arico' _addon.version = '1' _addon.command = 'stubborn' -require('pack') -require('strings') require('logger') packets = require('packets') - windower.register_event('outgoing chunk', function(id, original, modified, injected, blocked) - if id == 0x01a then + if id == 0x01A and not injected then local p = packets.parse('outgoing', original) - if p['Category'] == 5 and not injected then - log('You are too stubborn to call for help! Use //stubborn to call for help.') + if p['Category'] == 5 then return true end end end) windower.register_event('addon command', function(...) - local target = windower.ffxi.get_mob_by_target("t") + local target = windower.ffxi.get_mob_by_target('t') if target and target.claim_id ~= 0 then - local p = packets.new('outgoing', 0x1a, { - ['Target'] = target['id'], - ['Target Index'] = target['index'], - ['Category'] = 5,}) + local p = packets.new('outgoing', 0x01A, { + ['Target'] = target['id'], + ['Target Index'] = target['index'], + ['Category'] = 5, + }) packets.inject(p) end -end) \ No newline at end of file +end) From 0b78aeba70cf035d6a4c2831b48d2b1e01e34ec1 Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Sun, 18 Apr 2021 10:28:48 -0700 Subject: [PATCH 12/20] Update Stubborn.lua --- addons/Stubborn/Stubborn.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/Stubborn/Stubborn.lua b/addons/Stubborn/Stubborn.lua index f327c8f2ea..0d13cea087 100644 --- a/addons/Stubborn/Stubborn.lua +++ b/addons/Stubborn/Stubborn.lua @@ -23,7 +23,7 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --]] - b275nMv + _addon.name = 'Stubborn' _addon.author = 'Arico' _addon.version = '1' From 3c03b0f32844f71380a836862118d34204cee95b Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Sun, 18 Apr 2021 10:29:05 -0700 Subject: [PATCH 13/20] Update readme.md --- addons/Stubborn/readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/Stubborn/readme.md b/addons/Stubborn/readme.md index 0efb35447b..904d26fb95 100644 --- a/addons/Stubborn/readme.md +++ b/addons/Stubborn/readme.md @@ -3,5 +3,4 @@ A Windower 4 addon to prevent unnecessary "Call for help!" Stubborn is a light weight replacement to the old CFHProtect addon. - If you need to call for help. Type //stubborn From dc7474d18a2ef8e73394a23dfc8441832b042333 Mon Sep 17 00:00:00 2001 From: lili-ffxi <40600148+lili-ffxi@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:01:58 +0100 Subject: [PATCH 14/20] Update refresh.lua --- addons/GearSwap/refresh.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/GearSwap/refresh.lua b/addons/GearSwap/refresh.lua index 22de974f95..2bd0135211 100644 --- a/addons/GearSwap/refresh.lua +++ b/addons/GearSwap/refresh.lua @@ -79,7 +79,7 @@ function load_user_files(job_id,user_file) end current_file = nil - gearswap_disabled = true + -- gearswap_disabled = true sets = nil user_env = nil unhandled_command_events = {} @@ -108,7 +108,7 @@ function load_user_files(job_id,user_file) if not path then current_file = nil - gearswap_disabled = true + -- gearswap_disabled = true sets = nil return end @@ -151,16 +151,16 @@ function load_user_files(job_id,user_file) user_env['_G'] = user_env -- Try to load data/_
.lua - local funct, err = loadfile(path) + local funct, err = path and loadfile(path) or function() end -- If the file cannot be loaded, print the error and load the default. - if funct == nil then + if err then print('User file problem: '..err) current_file = nil - gearswap_disabled = true + -- gearswap_disabled = true sets = nil return - else + elseif filename then current_file = filename print('GearSwap: Loaded your '..current_file..' file!') end @@ -172,7 +172,7 @@ function load_user_files(job_id,user_file) if not status then error('GearSwap: File failed to load: \n'..plugin) - gearswap_disabled = true + -- gearswap_disabled = true sets = nil return nil end From f91eb07f652faea65a8ea397783e27b222be63a3 Mon Sep 17 00:00:00 2001 From: lili-ffxi <40600148+lili-ffxi@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:16:48 +0100 Subject: [PATCH 15/20] Update refresh.lua Reverting some changes from previous commit that were unnecessary. --- addons/GearSwap/refresh.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/addons/GearSwap/refresh.lua b/addons/GearSwap/refresh.lua index 2bd0135211..9fb5e95607 100644 --- a/addons/GearSwap/refresh.lua +++ b/addons/GearSwap/refresh.lua @@ -79,7 +79,6 @@ function load_user_files(job_id,user_file) end current_file = nil - -- gearswap_disabled = true sets = nil user_env = nil unhandled_command_events = {} @@ -108,7 +107,6 @@ function load_user_files(job_id,user_file) if not path then current_file = nil - -- gearswap_disabled = true sets = nil return end @@ -151,16 +149,15 @@ function load_user_files(job_id,user_file) user_env['_G'] = user_env -- Try to load data/_
.lua - local funct, err = path and loadfile(path) or function() end + local funct, err = loadfile(path) -- If the file cannot be loaded, print the error and load the default. - if err then + if funct == nil then print('User file problem: '..err) current_file = nil - -- gearswap_disabled = true sets = nil return - elseif filename then + else current_file = filename print('GearSwap: Loaded your '..current_file..' file!') end @@ -172,7 +169,6 @@ function load_user_files(job_id,user_file) if not status then error('GearSwap: File failed to load: \n'..plugin) - -- gearswap_disabled = true sets = nil return nil end From c0903587ab35de2b7798c09d90ff0bab517760cf Mon Sep 17 00:00:00 2001 From: lili-ffxi <40600148+lili-ffxi@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:37:59 +0100 Subject: [PATCH 16/20] Update statics.lua --- addons/GearSwap/statics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/GearSwap/statics.lua b/addons/GearSwap/statics.lua index 257058929d..b32e6c982c 100644 --- a/addons/GearSwap/statics.lua +++ b/addons/GearSwap/statics.lua @@ -198,7 +198,7 @@ slot_map.back = 15 -gearswap_disabled = true +gearswap_disabled = false seen_0x063_type9 = false delay_0x063_v9 = false not_sent_out_equip = {} From 3f07f71cda5e75bebefdb5aa04c52962c6d0ac99 Mon Sep 17 00:00:00 2001 From: lili-ffxi <40600148+lili-ffxi@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:38:48 +0100 Subject: [PATCH 17/20] Update gearswap.lua --- addons/GearSwap/gearswap.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/GearSwap/gearswap.lua b/addons/GearSwap/gearswap.lua index c0ec11c9a4..6e2ee0063d 100644 --- a/addons/GearSwap/gearswap.lua +++ b/addons/GearSwap/gearswap.lua @@ -130,7 +130,6 @@ require 'flow' require 'triggers' initialize_packet_parsing() -gearswap_disabled = false windower.register_event('load',function() windower.debug('load') From e5f19ed2138b0d57e8516219c0e3793de2074049 Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Wed, 5 May 2021 16:15:20 -0700 Subject: [PATCH 18/20] Update Stubborn.lua --- addons/Stubborn/Stubborn.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/Stubborn/Stubborn.lua b/addons/Stubborn/Stubborn.lua index 0d13cea087..a9afce66cd 100644 --- a/addons/Stubborn/Stubborn.lua +++ b/addons/Stubborn/Stubborn.lua @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --]] _addon.name = 'Stubborn' _addon.author = 'Arico' _addon.version = '1' -_addon.command = 'stubborn' +_addon.command = {'stubborn','cfh'} require('logger') packets = require('packets') From 8bd4324bec7bd069f5953a68aea2d611ce12536f Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Wed, 12 May 2021 04:58:21 -0700 Subject: [PATCH 19/20] Update readme.md --- addons/Stubborn/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/Stubborn/readme.md b/addons/Stubborn/readme.md index 904d26fb95..1ca7d48458 100644 --- a/addons/Stubborn/readme.md +++ b/addons/Stubborn/readme.md @@ -3,4 +3,4 @@ A Windower 4 addon to prevent unnecessary "Call for help!" Stubborn is a light weight replacement to the old CFHProtect addon. -If you need to call for help. Type //stubborn +If you need to call for help. Type //stubborn or //cfh. From 331e0c3049ec441921e0a863e1e6952007427947 Mon Sep 17 00:00:00 2001 From: John Arnfield Date: Wed, 12 May 2021 21:26:59 +0100 Subject: [PATCH 20/20] Add support for Gaol in JobChange --- addons/JobChange/jobchange.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/JobChange/jobchange.lua b/addons/JobChange/jobchange.lua index 7b8d41930e..e5068ba14b 100644 --- a/addons/JobChange/jobchange.lua +++ b/addons/JobChange/jobchange.lua @@ -41,8 +41,8 @@ packets = require('packets') res = require ('resources') local temp_jobs = T { 'NIN', 'DNC', 'WAR', 'MNK', 'WHM', 'BLM', 'RDM', 'THF' } -local mog_zones = S { 'Selbina', 'Mhaura', 'Tavnazian Safehold', 'Nashmau', 'Rabao', 'Kazham', 'Norg'} -local moogles = S { 'Moogle', 'Nomad Moogle', 'Green Thumb Moogle' } +local mog_zones = S { 'Selbina', 'Mhaura', 'Tavnazian Safehold', 'Nashmau', 'Rabao', 'Kazham', 'Norg', 'Walk of Echoes [P1]', 'Walk of Echoes [P2]' } +local moogles = S { 'Moogle', 'Nomad Moogle', 'Green Thumb Moogle', 'Pilgrim Moogle' } local log = function(msg) windower.add_to_chat(4,'JobChange: '..msg)