• Welcome to Valhalla Legends Archive.
 

Wildcards and Ip bans

Started by Gangz, October 15, 2003, 02:30 AM

Previous topic - Next topic

MyndFyre

For example (sorry I'm using C#), I have an enumeration set up for flags.


[Flags]
public enum UserFlags
{
  Blizzard = 0x01,
  Moderator = 0x02,
  Speaker = 0x04,
  BnetAdmin = 0x08,
  Squelched = 0x20,
  Guest = 0x40
}

Then I use bitwise operators to check for concurrency.  In C#, the | operator is OR, & operator is AND, ! is NOT, and ^ is XOR.

private void User_Joined(UserEventArgs e)
{
  // e.Name is the screen name,
  // e.Flags are the user's flags,
  // e.Text is (currently) the user's statstring and product ID.
  User u = new User(e.Name, e.Flags, e.Text);

  // Here's the important part:
  bool isSquelched = ((u.Flags & UserFlags.Squelched) == UserFlags.Squelched);


That last statement ANDs the user's flags with the one flag UserFlags.Squelched.  The result is either 0x00 (no flags) or UserFlags.Squelched.  If it's 0x00, then it does NOT equal UserFlags.Squelched, and the boolean isSquelched is assigned false; otherwise (blinding flash of the obvious) it is assigned true.

Hope this helps!
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Gangz

wow thanks fo the input on the ip bans..I have used all you information together and i have it figured out so it cant be bypassed form any angle and it responds quickly....=) Now..i need to learn wild cards for the perfect ops bot...thanks Again everyone!!