• Visit Rebornbuddy
  • How to write plugins?

    Discussion in 'Community Developer Forum' started by Devilsbones, Feb 11, 2016.

    1. Devilsbones

      Devilsbones New Member

      Joined:
      Apr 5, 2014
      Messages:
      42
      Likes Received:
      0
      Trophy Points:
      0
      I'd like to get into writing some plugins for DemonBuddy. Is there any documentation on this anywhere? I can look at the other plugins for examples, and have been doing that. However, for everything I want to do, I have to find a place someone has already done a similar thing. It would be nice to figure out how to get the data I need to do new things. For example:

      • Is there somewhere to find all the possible functions of ZetaDia? For a specific example I was wondering if you could detect if town portal was being channeled/cast?
      • How can you find the name of a specific buff to see if it is active? For a specific example, I'd like to know if In-geom buff was active.
      • How can you find if a specific items is equipped or if a legendary gem is socketed? I can find an example of a specific gem, but if I couldn't, how do I figure out which is which on my own?

      Any help is appreciated!
       
    2. Hirocho

      Hirocho Member

      Joined:
      Sep 24, 2015
      Messages:
      44
      Likes Received:
      0
      Trophy Points:
      6
      This is not the right forum, Go to the developer forum.

      The question has been asked many times so you can search before.

      Regards
       
    3. Devilsbones

      Devilsbones New Member

      Joined:
      Apr 5, 2014
      Messages:
      42
      Likes Received:
      0
      Trophy Points:
      0
      Indeed. I'm not sure exactly how I missed a whole forum. Oh well. Thanks!
       
    4. xzjv

      xzjv Community Developer

      Joined:
      Mar 17, 2014
      Messages:
      1,243
      Likes Received:
      46
      Trophy Points:
      48
      There is no reference that I'm aware of. We use DemonBuddy.exe as a reference in Visual Studio project with ReSharper in order to get IntelliSense when accessing the object (and so the solutions compile) that solves most of the problem. Anything that needs more research can be discovered using a reflection tool on the .exe DotPeek / ILSpy and go browse the code.




      Code:
      
              private static bool CheckVisualEffectNoneForPower(ACD commonData, SNOPower power)
              {
                  if (commonData.GetAttribute<int>(((int)power << 12) + ((int)ActorAttributeType.PowerBuff0VisualEffectNone & 0xFFF)) == 1)
                      return true;
      
      
                  return false;
              }
      
      //....
      
                  var isCastingTownPortal = CheckVisualEffectNoneForPower(commonData, SNOPower.UseStoneOfRecall);
                  var isCastingTeleport = CheckVisualEffectNoneForPower(commonData, SNOPower.TeleportToPlayer_Cast);
                  var isCastingWaypoint = CheckVisualEffectNoneForPower(commonData, SNOPower.TeleportToWaypoint_Cast);
      
      
      
      
      I'm not aware of a reliable way to check 'if a specific gem is socketed in gear that you have currently equipped'. Have a look at \Cache\CacheData.Inventory.cs in Trinity. You can loop through all actors that are items and find the ones that have 'Socket' as the inventory slot. You would know if they are socketed 'somewhere' but this also includes being socketed into items that may be in the stash.


      Its all about the debug tools to find this sort of thing. You would have to write some code to log the current buffs and then make the buff appear and see what its called. I recently wrote a bunch of code to read the cooldowns of skills and buffs so you can find the names of all active cooldowns (which will also have the buff names). In Trinity Advanced turn on 'Cooldowns' logging option.

      [Trinity 2.14.39] Buff Cooldown: Power=P2_ItemPassive_Unique_Ring_038 (430674) Start=7948 End=8908 Duration=960 (16s) StartAttr=BuffIconStartTick8 Remaining=14.583s (91.15%) Finished=False Offset=739 EndOffset=-136 CurrentTime=7209 GameCurrentDif=739 Key=8 Variant=AllElements

      [Trinity 2.14.39] Skill Cooldown: Power=X1_Crusader_LawsOfJustice2 (342280) Start=7879 End=9010 Duration=1131 (18.85s) StartAttr=PowerCooldownStart Remaining=17.083s (90.63%) Finished=False Offset=670 EndOffset=-355 CurrentTime=7209 GameCurrentDif=670 Key=-1
       

    Share This Page