Jump to content


Photo

Intercepting outgoing packets


    1 reply to this topic

    #1 Saydn

    Saydn

      Member

    • Members
    • PipPip
    • 11 posts

      Posted 28 June 2014 - 12:48 PM

      Hey,

       

      I'm looking into making a plugin to read every outgoing packet, and instead of sending it, cancelling the packet and adding the action to a queue to.

       

      I'm getting my head around windower.register_event('outgoing text'.. and but what I'm really stuck on is how to cancel the spell before the packet is sent? I've seen it done in gearswap but was unable to track the origin of the cancel_spell() function.

       

      Another thing that concerns me is that if I cancel the spell in my plugin, obviously I don't want gearswap to change gear on it, will cancelling the spell stop gearswap or will I need to temporarily disable gearswap somehow?

       

      Any and all advice is welcome.

      Also, if I wanted to make this publicly available, what's the process for that?

       

      Thanks.



      #2 Arcon

      Arcon

        Advanced Member

      • Windower Staff
      • 1189 posts
      • LocationMunich, Germany

      Posted 28 June 2014 - 02:44 PM

      I assume you only want to do that for outgoing action packets?

       

      The queue library might be of help here:

       

      require('queues')
      
      packet_queue = Q{}
      
      windower.register_event('outgoing chunk', function(id, data, modified, blocked, injected)
          if id ~= 0x01A or blocked or injected then
              return
          end
      
          packet_queue:push(modified)
      
          return true
      end)
      

       

      This will save all outgoing packets in the specified queue. Then you have to inject them again with the following:
       

      while not packet_queue:empty() do
          local data = packet_queue:pop()
          windower.packets.inject_outgoing(data:unpack('b7'), data)
      end
      

       

      (The data:unpack('b7') retrieves the ID of the packet from that string.)

       

      As for committing addons, check this page. If you want to develop addons, you should probably join our IRC channel, that's where we hang out and discuss Lua and our place in the universe.






      1 user(s) are reading this topic

      0 members, 1 guests, 0 anonymous users