#author("2025-04-16T06:04:34+00:00","default:yoya","yoya")
#author("2025-04-16T06:11:04+00:00","default:yoya","yoya")
[[Windower/Lua]]

* 気になる [#bcfa1e1d]

- https://github.com/xurion/ffxi-sparks
- https://github.com/xurion/ffxi-sparks/blob/master/Sparks.lua

 sparks_packet_id = 0x110

 function get_sparks()
   local sparks_packet = windower.packets.last_incoming(sparks_packet_id)
   if sparks_packet == nil then
     return 0
   else
     return get_sparks_value_from_packet(sparks_packet)
   end
 end

 function get_sparks_value_from_packet(packet)
   local parsed = packets.parse('incoming', packet)
   local total_sparks = 0
   if parsed['_unknown1'] == 1 then --This field is used to determine if your sparks are over 65,536. If so, the 'Sparks Total' field is only the value above that.
     total_sparks = 65536
   end
   total_sparks = total_sparks + parsed['Sparks Total']
   return total_sparks
 end


* 駄目だった。古いかも? [#l1513346]

- https://github.com/sethmccauley/Addons/blob/master/sparks/sparks.lua#L202

 windower.register_event('incoming chunk',function(id,data,modified,injected,blocked)
 	if id == 0x110 then -- Update Current Sparks via 110
 		local header, value1, value2, Unity1, Unity2, Unknown = data:unpack('II')
 		current_sparks = value1
 	end
 end)