Blizzhackers

Return of the Jedi

* Login   * Register    * FAQ    * Search

Join us on IRC: #bh@irc.synirc.net (or Mibbit Web IRC)


MuleFactory


It is currently Fri May 24, 2013 4:49 pm


All times are UTC [ DST ]





Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Help in making a ranking system
PostPosted: Sat Mar 31, 2012 10:58 pm 
 
User
User
User avatar

Joined: Sun Sep 04, 2011 10:07 pm
Okay, what I'm trying to make is something like that:
Image

This screenshot was taken using the Open hack called Diabolic, which was for v1.10.
Of course I tested in Single Player so there was only one player listed, but it usually lists all players in the game, and then class them by ratio if I remember right.

Of course, the source of this program never been public, and I think the author is just gone from the Diablo scene ...

I would like to do this in my mod as well, but I have no idea of how to start. How would I go on tracking every single player kills/deaths done by players in the game? Then how to class players in order of Ratio amounts?

Thanks.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Sun Apr 01, 2012 2:00 am 
 
User
User

Joined: Sat Mar 17, 2012 5:39 pm
Open Battle.net is your friend.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Sun Apr 01, 2012 3:19 am 
 
User
User

Joined: Sat Apr 25, 2009 3:54 pm
Open Battle.net is your friend.


That supplies absolutely no insight whatsoever, please don't post anymore.

I would look at the STL Containers for c++. Take a look at your options. Depending on the purpose of coding this, you could look for speed, efficiency, or just knowledge. After taking a look at the STL containers, you could always store some sort of write/readable file on your harddrive to keep track.

I did something similar, but never kept track of the enemies kills, and I chose to use the Vector to accomplish it.

It is very basic, has no specific ordering other than a linear progression of slayings. The most advanced feature is the ability to cycle through the vector and increment the slaying of the same character. IE if you killed ten people, then the first person you killed decided to return to the game, it would find that character and give it a +1 to the kill count.

Here is what I did before I was finally bored with my project. Hope it helps someway.


///////////////////////////////////////////////////////////////////////////////////////////
//                                 In Game Kill List v1.0                                //
///////////////////////////////////////////////////////////////////////////////////////////
#include <vector>
  using namespace std;
  std::vector<std::string> Names; // Player Names
  vector<string> Games; // Game Player Slain
  vector<int> Levels; // Player Levels
  vector<int> KillCounts; // Amount Slain

  // Iterators
  vector<string>::iterator nSlot;
  vector<string>::iterator gSlot;
  vector<int>::iterator lSlot;
  vector<int>::iterator kSlot;
  //

  bool stringCompare( const string &left, const string &right ) // Custom string compare.
   {
        int i = 0;
         for( string::const_iterator lit = left.begin(), rit = right.begin(); lit != left.end() && rit != right.end(); ++lit, ++rit )
         {
            if( tolower( *lit ) == tolower( *rit ) )
               continue;
               i = 1;      
         }
         if (i == 0)
            return true;
            return false;      
   }

  void PrintKillList()
  {
     int pos  = 0;
         Speak("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
         Speak("@@@@@@@@@@@@ BMPK KILL LIST @@@@@@@@@@@@@@");
         Speak("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
         Speak("VICTIM           LEVEL           KILLCOUNT           GAMESLAIN");
     for (nSlot = Names.begin(),gSlot = Games.begin(); nSlot != Names.end() ; nSlot++,gSlot++,pos++)
          Speak ("%s               %d               %d                    %s",nSlot,Levels[pos],KillCounts[pos]/*,KillCounts[i] > 1 ? "times" : "time"*/,gSlot); 
  }

  bool CheckDuplicate(string Name,string GameName,int Level)
  {
         int pos = 0;
         char buffer1[50];
         char buffer2[50];

        for (nSlot = Names.begin(); nSlot != Names.end() ; nSlot++,pos++)
         {
            sprintf(buffer1,"%s",nSlot);
            if ( stringCompare(buffer1,Name) ) // Slain character matches an input
               {
                  for(gSlot = Games.begin(); gSlot != Games.end(); gSlot++) // Try to match the character with the same game name and update kill
                     {
                        sprintf(buffer2,"%s",gSlot);
                           if ( stringCompare(buffer2,GameName) )
                              {
                                 KillCounts[pos]++;
                                    return true;
                              }
                     }
               }
        }
     return false;
  }

        void Insert(char* Name,char* GameName,int Level)
        {
           if (!CheckDuplicate(Name,GameName,Level))
           {
               Names.push_back(Name);
                  Games.push_back(GameName);
               Levels.push_back(Level);
               KillCounts.push_back(1);
           }
        }


There are always much, much better ways to achieve the same goal, all you can do is take examples, learn, and improve.

Good luck!

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Sun Apr 01, 2012 10:59 am 
 
User
User

Joined: Tue Apr 29, 2008 5:10 am
The method I found most suiting to my needs was to create a txt file, check to see if the player name was already on the list(prevent double listings), then added or increase a value from information gained through the receive packet hook(0x5b iirc). I only tracked how many times I killed that player, but to get a K/D Ratio you simply take the information gained from the packet and divide. It didnt take too long to do, think I referenced lord2800s spam filter for handling the txt file stuff which was new to me at the time. Maybe start there but overall it was pretty easy to do.

_________________
d2bot# : viewtopic.php?f=206&t=489091&start=0
Support : irc://irc.synirc.net/d2bs

Im taking computer sience in college right now. Im taking what im learning in school and trying it out on a 12 year old game.

Oh wait sorry. Everyone here just rips everyone off and puts their little twist on a code.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Tue Apr 03, 2012 6:27 am 
 
User
User

Joined: Sat Mar 17, 2012 5:39 pm
That supplies absolutely no insight whatsoever, please don't post anymore.


Actually, it provides valuable insight, and is a lot better than posting completely worthless pseudocode. It means you can achieve the same thing on CBN that you can on OBN, and getting a list of players and their kills/deaths is not a relatively complex concept to grasp.

Go into a game on OBN, search for some values, disassmble some structures, and viola, mission accomplished. Oh, don't forget PrintGameString (or whatever you call it these days). If you don't have any idea where to "start" then you have no business starting. Begin with something easier and work your way up.

@SmokinJoe1 (etc.)

Not everyone wants a packet-related solution. I keep seeing this and it's annoying. Someone asks, "How do I use XYZ to ABC?" and every response is either some large chunk of code with no explanation or "Use packet 0xDickButt and walk the dinosaur."

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Tue Apr 03, 2012 6:48 am 
 
Moderator
Moderator

Joined: Thu Dec 09, 2004 8:48 am
make a d2bs script

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Tue Apr 03, 2012 5:00 pm 
 
User
User

Joined: Tue Apr 29, 2008 5:10 am
That supplies absolutely no insight whatsoever, please don't post anymore.


Actually, it provides valuable insight, and is a lot better than posting completely worthless pseudocode. It means you can achieve the same thing on CBN that you can on OBN, and getting a list of players and their kills/deaths is not a relatively complex concept to grasp.

Go into a game on OBN, search for some values, disassmble some structures, and viola, mission accomplished. Oh, don't forget PrintGameString (or whatever you call it these days). If you don't have any idea where to "start" then you have no business starting. Begin with something easier and work your way up.

@SmokinJoe1 (etc.)

Not everyone wants a packet-related solution. I keep seeing this and it's annoying. Someone asks, "How do I use XYZ to ABC?" and every response is either some large chunk of code with no explanation or "Use packet 0xDickButt and walk the dinosaur."


I clearly stated that I found packets to be most suitable for me! I also see nothing wrong with thevoid posting the exact functions to log a kill. cant win em all i guess

_________________
d2bot# : viewtopic.php?f=206&t=489091&start=0
Support : irc://irc.synirc.net/d2bs

Im taking computer sience in college right now. Im taking what im learning in school and trying it out on a 12 year old game.

Oh wait sorry. Everyone here just rips everyone off and puts their little twist on a code.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Tue Apr 03, 2012 5:59 pm 
 
User
User

Joined: Sat Mar 17, 2012 5:39 pm
The problem is that when people ask for a specific solution (when it is entirely possible), it always goes in a completely different direction. This isn't one of those times, but it's for future reference.

TheVoid didn't post "exact functions" to log a kill, either. He started going on about STL and all this random shit and then posted a completely worthless chunk of code. What he did would be like asking for directions from Florida to New York and telling you how to get there starting from Pennsylvania.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Tue Apr 03, 2012 10:59 pm 
 
User
User

Joined: Sat Apr 25, 2009 3:54 pm
Instead of wasting bandwidth and my time by thinking there was some sort of constructive criticism, or ongoing conversation on topic, by reading your slop, post something useful. Just becuase someone has no idea how to start, will not mean they are completely lost when it would come to programming.

Everyone started somewhere, now stop being an ignorant fuck, and lets move on.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Wed Apr 04, 2012 1:00 am 
 
User
User

Joined: Sat Mar 17, 2012 5:39 pm
for(int i = 0; i < sizeof(PlayerList); i++)
{
    PlayerList[i] = GetPlayer(i);
    PrintGameString("Player: %s    Kills: %i    Deaths: %i    Ratio: %i", PlayerList[i].szPlayerName, PlayerList[i].nKills, PlayerList[i].nDeaths, PlayerList[i].nKills/PlayerList[i].nDeaths);
}


Look, I can post completely useless shit and pretend I'm cool, too. Like I said, he doesn't know where to begin and you jump right into how to print the info without even beginning to tell him how to obtain that info. You are the ignorant one. Stop trying to expand your e-go and grow the fuck up. You made a personal attack on me for no reason and now you sound like a dumbass. Quit while you're ahead.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Wed Apr 04, 2012 1:17 am 
 
User
User
User avatar

Joined: Sun Sep 04, 2011 10:07 pm
Yes, in fact, where I'm stuck is how to get all the needed informations. The print part is not a problem.
I just have no idea of where to start to raise a player list (players in the current game), and then keep track of their kills/deaths, to then print it.

The only help I needed on the print part is how to class players in a ranked order.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Wed Apr 04, 2012 1:25 am 
 
User
User

Joined: Sat Mar 17, 2012 5:39 pm
Basically, you need to find a way to get the Player/Unit/etc. (whatever you want to call it) struct, iterate through all the players in the Game/Room/etc. (whatever you want to call it), and then list them in order from highest to lowest ratio with nested conditional statements, switches, or whatever you're comfortable with.

There's a pinned thread with most of the information you need. Anything else you're stuck on (specifics) will have to be answered by someone with experience in that area.

References:
* viewtopic.php?f=182&t=484866
* viewtopic.php?f=182&t=488869

The best way to test this is on OBN, where you don't have to worry about Warden, and then modify your code to be CBN safe-ish.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Wed Apr 04, 2012 1:58 am 
 
User
User

Joined: Sat Apr 25, 2009 3:54 pm
for(int i = 0; i < sizeof(PlayerList); i++)
{
    PlayerList[i] = GetPlayer(i);
    PrintGameString("Player: %s    Kills: %i    Deaths: %i    Ratio: %i", PlayerList[i].szPlayerName, PlayerList[i].nKills, PlayerList[i].nDeaths, PlayerList[i].nKills/PlayerList[i].nDeaths);
}


Look, I can post completely useless shit and pretend I'm cool, too. Like I said, he doesn't know where to begin and you jump right into how to print the info without even beginning to tell him how to obtain that info. You are the ignorant one. Stop trying to expand your e-go and grow the fuck up. You made a personal attack on me for no reason and now you sound like a dumbass. Quit while you're ahead.


Actually, he did say this:

whisty wrote:
.. I would like to do this in my mod as well ...


Which I would well assume that he has SOME programming background. Meaning, well, you don't exactly jump into game architecture without some handle on some 'C'/'C++' dynamics.

I apologize for the personal attack.

whisty wrote:
Yes, in fact, where I'm stuck is how to get all the needed informations. The print part is not a problem.
I just have no idea of where to start to raise a player list (players in the current game), and then keep track of their kills/deaths, to then print it.

The only help I needed on the print part is how to class players in a ranked order.


The last thing you said was not understanding how to correctly print out, in ascending order, a player kill list.

The first thing you said was you didn't understand how to collect the data.

Posting for help, and declaring this is something you would like to add to a project that you have started, and called your own, usually means you have some handle on some C++ background. Other than some minor collisions I'm having with "FireFromTheSky," his advice is probably the best that can be stated here. Work on something, present some code with questions, and ask again as you progress.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Wed Apr 04, 2012 2:22 am 
 
User
User
User avatar

Joined: Sun Sep 04, 2011 10:07 pm
Okay thanks. Also, I forgot to state I am working on v1.13c. As for the pointers list, I have it all in my source (the v1.13c one of course).
I will try some few things and come back.

Thanks.

Top
 Profile  
 Post subject: Re: Help in making a ranking system
PostPosted: Wed Apr 04, 2012 5:00 am 
 
User
User

Joined: Tue Apr 29, 2008 5:10 am
Okay thanks. Also, I forgot to state I am working on v1.13c. As for the pointers list, I have it all in my source (the v1.13c one of course).
I will try some few things and come back.

Thanks.


are you looking to save the information gathered for all/future games or only display info gained from the current game? Im not familiar with the plugin u posted originally.

_________________
d2bot# : viewtopic.php?f=206&t=489091&start=0
Support : irc://irc.synirc.net/d2bs

Im taking computer sience in college right now. Im taking what im learning in school and trying it out on a 12 year old game.

Oh wait sorry. Everyone here just rips everyone off and puts their little twist on a code.

Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron