• Visit Rebornbuddy
  • [Plugin] NaiceMatrix StatisticProvider and Client for Android (FREE)

    Discussion in 'Plugins' started by naice, Apr 13, 2013.

    Thread Status:
    Not open for further replies.
    1. nsb1128

      nsb1128 New Member

      Joined:
      Mar 12, 2013
      Messages:
      40
      Likes Received:
      0
      Trophy Points:
      0

      I'll ask around with some friends, I'm of no help other than suggestions lol, but will do what I can to help try to find the answers thanks again for the support
       
    2. naice

      naice New Member

      Joined:
      Apr 13, 2013
      Messages:
      24
      Likes Received:
      0
      Trophy Points:
      0
      It's brewing in the kitchen, can you smell it? That increddible good smelling success! It's not that far away. Await it.
       
    3. Hawker

      Hawker Well-Known Member Buddy Core Dev

      Joined:
      Jan 15, 2010
      Messages:
      2,510
      Likes Received:
      69
      Trophy Points:
      48
      This app takes a copy of your battletag. That should not be needed. Can you rewrite it so that it doesn't have sensitive information about botting accounts being shared?
       
    4. bambam922

      bambam922 Well-Known Member Moderator

      Joined:
      Jan 15, 2010
      Messages:
      6,073
      Likes Received:
      27
      Trophy Points:
      48
      In addition to Hawker's request, I request that you upload your releases to the board.
      We do not allow links to the users' personal website for a release.

      Please upload your updated version to the board or provide a SVN repository.
       
    5. Gniller

      Gniller Community Developer

      Joined:
      Sep 29, 2012
      Messages:
      384
      Likes Received:
      5
      Trophy Points:
      16
      That's not good from a security point of view, may be used badly by the wrong people. Although i can see how this seems useful from the programmers perspective.

      I assume it is used to link unique information to specific bots, however the secure way to do this would be by character name (which is also used by trinity notify my android notifications)

      I do understand the buddy team intervenes for security reasons but i am also happy to see they don't take action to quick, as i believe this plugin isn't meant harmful at all!
       
    6. naice

      naice New Member

      Joined:
      Apr 13, 2013
      Messages:
      24
      Likes Received:
      0
      Trophy Points:
      0
      currently it is used to identify a account i need that tag to get the statistics work, but i could hash it. anyway that will make it impossible to identify a account if char names are equal.



      since i dont understand why svn on my server differs from a direct dl on my server i decided to freeze development for publicity. i won't agree to sensless restrictions nor will i aggree to put my sources else where...

      Anyway for those who are running the service and want to hash their btag replace the contents of the file /NaiceMatrix/AccountManagement/NaiceAccountNotificationHandler.cs with the following code:
      Code:
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      
      using Zeta;
      using Zeta.Common;
      using Zeta.Common.Plugins;
      using System.Windows;
      using Zeta.CommonBot;
      using Zeta.Internals.Actors;
      using Zeta.CommonBot.Items;
      using System.IO;
      using System.Security.Cryptography;
      
      namespace NaiceMatrix.AccountManagement
      {
          public class NaiceAccountNotificationHandler
          {
              #region Singleton
              private static NaiceAccountNotificationHandler _instance = null;
              public static NaiceAccountNotificationHandler Instance
              {
                  get
                  {
                      if (_instance == null)
                          _instance = new NaiceAccountNotificationHandler();
                      return _instance;
                  }
              }
              private NaiceAccountNotificationHandler()
              {
              }
              #endregion
      
              private DateTime _dtLastUpdate = DateTime.MinValue;
      
              public void OnPulse()
              {
                  if (Settings.NotificationAPIKey == "")
                      return;
      
                  if ((DateTime.Now - _dtLastUpdate).TotalMinutes > Settings.WEBSERVICE_PostAccountIntervall)
                  {
                      if (Settings.DUMP_DEBUG)
                      {
                          NaiceMatrix.I(" ");
                          NaiceMatrix.I("BEGIN REPORT");
                          NaiceMatrix.I(" ");
                      }
                      if (_dtLastUpdate == DateTime.MinValue)
                      {
                          // skip first report!
                          _dtLastUpdate = DateTime.Now;
                      }
      
                      if (ZetaDia.IsInGame && !ZetaDia.IsLoadingWorld && !ZetaDia.IsPlayingCutscene &&
                          ZetaDia.Me != null && ZetaDia.Me.IsValid && ZetaDia.Service != null && ZetaDia.Service.CurrentHero != null)
                      {
                          string url = Settings.NotificationAPIUrl + Settings.WEBSERVICE_PostAccountModule;
                          string postData =
                              string.Format("{0}\n{1}",
                                  Settings.NotificationAPIKey,
                                  GenerateAccountDataString());
      
                          // perform http post
                          try
                          {
                              Tools.DoHttpPost(url, postData);
                          }
                          catch (Exception ex)
                          {
                              NaiceMatrix.L(ex.Message);
                          }
      
                          _dtLastUpdate = DateTime.Now;
                      }
                  }
              }
      
              public static string GenerateAccountDataString()
              {
                  StringBuilder dStr = new StringBuilder();
                  if (Zeta.CommonBot.BotMain.CurrentBot != null)
                      dStr.AppendFormat("BotName={0}\n", Zeta.CommonBot.BotMain.CurrentBot.Name);
                  
                  if (ZetaDia.Service != null && ZetaDia.Service.CurrentHero != null)
                  {
                      dStr.AppendFormat("HeroName={0}\n", ZetaDia.Service.CurrentHero.Name);
                      dStr.AppendFormat("HeroBattleTagName={0}\n", GetHash(ZetaDia.Service.CurrentHero.BattleTagName));
                      dStr.AppendFormat("HeroClass={0}\n", ZetaDia.Service.CurrentHero.Class.ToString());
                      dStr.AppendFormat("HeroCurrentDifficulty={0}\n", ZetaDia.Service.CurrentHero.CurrentDifficulty.ToString());
                      dStr.AppendFormat("HeroLevel={0}\n", ZetaDia.Service.CurrentHero.Level);
                      dStr.AppendFormat("HeroAct={0}\n", ZetaDia.Service.CurrentHero.Act.ToString());
                  }
      
                  if (ZetaDia.Me != null && ZetaDia.Me.IsValid)
                  {
                      if (ZetaDia.Me.Inventory != null)
                          dStr.AppendFormat("Coinage={0}\n", ZetaDia.Me.Inventory.Coinage);
      
                      dStr.AppendFormat("MeName={0}\n", ZetaDia.Me.Name);
                      dStr.AppendFormat("MeXPNextLevel={0}\n", ZetaDia.Me.ExperienceNextLevel);
                      dStr.AppendFormat("MeXP={0}\n", ZetaDia.Me.CurrentExperience);
                      dStr.AppendFormat("MeXPParagon={0}\n", ZetaDia.Me.ParagonCurrentExperience);
                      dStr.AppendFormat("MeXPParagonNextLevel={0}\n", ZetaDia.Me.ParagonExperienceNextLevel);
                      dStr.AppendFormat("MeLevel={0}\n", ZetaDia.Me.Level);
                      dStr.AppendFormat("MeLevelCap={0}\n", ZetaDia.Me.LevelCap);
                      dStr.AppendFormat("MeLevelParagon={0}\n", ZetaDia.Me.ParagonLevel);
                      dStr.AppendFormat("MeParagonGoldFind={0}\n", ZetaDia.Me.ParagonGoldFindTotal);
                      dStr.AppendFormat("MeParagonMagicFind={0}\n", ZetaDia.Me.ParagonMagicFindTotal);
                  }
      
                  dStr.AppendFormat("GameStatsDeathPerHour={0}\n", GameStats.Instance.DeathsPerHour);
                  dStr.AppendFormat("GameStatsXPPerHour={0}\n", GameStats.Instance.ExpPerHour);
                  dStr.AppendFormat("GameStatsGamesPerHour={0}\n", GameStats.Instance.GamesPerHour);
                  dStr.AppendFormat("GameStatsGoldPerHour={0}\n", GameStats.Instance.GoldPerHour);
                  
                  byte[] toEncodeAsBytes = Encoding.UTF8.GetBytes(dStr.ToString());
                  string returnValue = System.Convert.ToBase64String(toEncodeAsBytes);
                  return returnValue;
              }
      
              private static string DumpProperties<T>(string prefix, T obj)
              {
                  Type type = obj.GetType();
                  StringBuilder dStr = new StringBuilder();
                  foreach (var prop in type.GetProperties())
                  {
                      try
                      {
                          string name = prop.Name;
                          object value = prop.GetValue(obj, null);
      
      
                          dStr.AppendFormat("{0}{1}={2}\n", prefix, name, value.ToString());
                      }
                      catch (Exception e)
                      {
                          NaiceMatrix.I("StatError: {0}", e.Message);
                      }
                  }
      
                  return dStr.ToString();
              }
      
              public static string GetHash(string text)
              {
                  var CSP = new SHA256CryptoServiceProvider();
      
                  byte[] arrayData;
                  byte[] arrayResult;
                  string result = null;
                  string temp = null;
      
                  arrayData = Encoding.ASCII.GetBytes(text);
                  arrayResult = CSP.ComputeHash(arrayData);
                  for (int i = 0; i < arrayResult.Length; i++)
                  {
                      temp = Convert.ToString(arrayResult[i], 16);
                      if (temp.Length == 1)
                          temp = "0" + temp;
                      result += temp;
                  }
                  return result;
              }
          
          
          }
      }
      
      after using this the service will DELETE all your previous statistics!
       
      Last edited: Apr 23, 2013
    7. yulu

      yulu New Member

      Joined:
      Mar 12, 2013
      Messages:
      18
      Likes Received:
      0
      Trophy Points:
      1
      can't download this plugin´╝îand no url neither
      can you pm your own svn?
       
    8. nsb1128

      nsb1128 New Member

      Joined:
      Mar 12, 2013
      Messages:
      40
      Likes Received:
      0
      Trophy Points:
      0
      not sure if this plugin will continue to be supported after reading up again, but hopefully it will. I really enjoy it!

      I'm back with a couple of suggestions/ VERY minor help hopefully:

      2 things buddystats does:
      start fresh with pickups every time the bot is started over, currently I have to keep track of the last pick up and look up from there to know what's been picked up - would be great for the items picked up screen to zero out every new session.

      the second thing is it does show ilvl, just doesn't differentiate between sets/leg - couldn't you see how this plugin identifies the ilvl and incorporate it into your plugin? and hopefully add in the set/leg into your tooltip as well

      anyway great plugin and hopefully it will continue to be worked on and can be improved to the point of being the go to app of this kind!
       
    9. bambam922

      bambam922 Well-Known Member Moderator

      Joined:
      Jan 15, 2010
      Messages:
      6,073
      Likes Received:
      27
      Trophy Points:
      48
      Closed as author decided that he can't comply with our rules.
      Have a nice day.
       
    Thread Status:
    Not open for further replies.

    Share This Page