• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Q: BN given/surname?

    Discussion in 'Archives' started by yury2808, Aug 5, 2011.

    1. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      Heya,

      It seem to be more WoW/LUA spcific question, but still - maybe someone aware about it:

      How to really get the BattleNet given/surname of the friend? All "BNGetXXX" functions returns these as WoW escape sequences (|Kg9|k for example), and I was not able to find the final answer how to parse it to real name...

      Of course, it would be even better if this one could be obtained with HB API, but LUA will work for me as well.

      Thank you,

      Me.
       
    2. raphus

      raphus Administrator Staff Member Moderator Buddy Core Dev

      Joined:
      Jun 17, 2010
      Messages:
      2,094
      Likes Received:
      492
      Trophy Points:
      83
      Code:
      Lua.Events.AttachEvent("CHAT_MSG_BN_WHISPER", HandleBNWhisper);
      ....
      
      void HandleBNWhisper(object sender, LuaEventArgs args)
      {
            string message = args.Args[0].ToString();
            string presenceId = args.Args[12].ToString();
            string senderName = Lua.GetReturnVal<string>(string.Format("return BNGetFriendInfoByID({0})", presenceId), 3);
      }
       
    3. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      This one is "toon" (ingame character) name, not a given/surname.
       
    4. raphus

      raphus Administrator Staff Member Moderator Buddy Core Dev

      Joined:
      Jun 17, 2010
      Messages:
      2,094
      Likes Received:
      492
      Trophy Points:
      83
      docs/api/BNGetFriendInfoByID - World of Warcraft Programming: A Guide and Reference for Creating WoW Addons


      Code:
      string firstName= Lua.GetReturnVal(string.Format("return BNGetFriendInfoByID({0})", presenceId), 1);
      
      string lastName= Lua.GetReturnVal(string.Format("return BNGetFriendInfoByID({0})", presenceId), 2);
      or

      Code:
      var result = Lua.GetReturnValues(string.Format("return BNGetFriendInfoByID({0})", presenceId));
      string firstName = result[1];
      string lastName = result[2];
      string charName = result[3];
      
       
    5. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      These strings are escape sequences in form |K[gsf]\d|k, there is no real text in it, i.e. no name/surname. These are only becomes visible when WoW renders it on screen.
       
    6. yury2808

      yury2808 New Member

      Joined:
      Jun 30, 2011
      Messages:
      53
      Likes Received:
      0
      Trophy Points:
      0
      HB Developers: please, add the API to obtain the real friend's name & surname info!
       

    Share This Page