Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → /clan rank

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 9

1

Topic: /clan rank

list table clan :
- cid
- short
- name
- motd
- creation_time
- <new>

how to create new table clan storage?
example : rank -> clan_set_rank
and how to call/get command : (clan_get_rank) from new table creator.
this command active for full member (peon to chieftain).

thanks,

2

Re: /clan rank

Why do you need a new table if the table "clan" already exists?
If you mean a new field "rank" in the table "clan" then look into ready functions like

Basically you need to to add a new property to t_clan struct and modify sql_load_clans, sql_write_clans functions in sql_common.cpp.
Then implement clan_get_rank, clan_set_rank functions to return it from t_clan like other properties.

Do not ask for support in PM.

3

Re: /clan rank

HarpyWar wrote:

Why do you need a new table if the table "clan" already exists?
If you mean a new field "rank" in the table "clan" then look into ready functions like

Basically you need to to add a new property to t_clan struct and modify sql_load_clans, sql_write_clans functions in sql_common.cpp.
Then implement clan_get_rank, clan_set_rank functions to return it from t_clan like other properties.

i confused for this source xD
please give me a few source code for example please, because if clantag -> the source are converted int to str ?
thanks,

4

Re: /clan rank

https://github.com/pvpgn/pvpgn-server/b … .h#L59-L75
https://github.com/pvpgn/pvpgn-server/b … #L396-L406
https://github.com/pvpgn/pvpgn-server/b … #L492-L494

Do not ask for support in PM.

5 (edited by vallcerealz 22.09.2016 21:38)

Re: /clan rank

for example : clan_get_nameclan(clan);
why use it ?

this code in clan.cpp :

extern char const *clan_get_name(t_clan * clan)
        {
            if (!(clan))
            {
                eventlog(eventlog_level_error, __FUNCTION__, "got NULL clan");
                return NULL;
            }

            return clan->clanname;
        }

why use clan_get_name(t_clan * clan) ?

why not use same like in : account_wrap.cpp
example :

extern char const * account_get_email(t_account * account)
        {
            if (account == nullptr)
            {
                eventlog(eventlog_level_error, __FUNCTION__, "got NULL account");
                return nullptr;
            }

            return account_get_strattr(account, "BNET\\acct\\email");
        }

or we can use :

extern char const * account_get_rankclan(t_clan* clan)
        {
            if (account == nullptr)
            {
                eventlog(eventlog_level_error, __FUNCTION__, "got NULL account");
                return nullptr;
            }

            return account_get_strattr(account, "clan\\rankclan");
        }

this is same like : forums.harpywar.com/viewtopic.php?id=909
but , its for clan channel

thanks,
sorry nubie for code --"

6

Re: /clan rank

I don't know why. May be these parts were implemented by different people. May be there was another reason.

Do not ask for support in PM.

7

Re: /clan rank

HarpyWar wrote:

I don't know why. May be these parts were implemented by different people. May be there was another reason.

its works?

// get value
channelname = account_get_strattr(account, "BNET\\clan\\clan_channel")

// set value
account_set_strattr(account, "BNET\\clan\\clan_channel", channelname)

it 's been a different implement from account and clan (id and cid)
t_account and t_clan

account = id , clan = cid

8

Re: /clan rank

If you dig deeper into account_get_strattr you'll see that it uses attrgroup_get_attr function that is part of the attribute layer that is used only for accounts.
You can try do this, but I don't recommend. You should understand that actually the attribute layer is a cache layer, but clan implementation uses directly database select/update/insert without a caching (actually with a simple caching, because it fills the t_clan struct from db and then the struct uses to read data).
There a situation may occur when the attrubute layer will rewrite some clan fields in db with outdated data (that was cached before), or you will receive outdated data from the cache when it was already updated in db from other code parts where the attribute layer is not used.
In other words there may be data mismatch for the clan fields that you will get/set this way.

You can read some details about database implementation here https://github.com/pvpgn/pvpgn-server/issues/85

Do not ask for support in PM.

9

Re: /clan rank

HarpyWar wrote:

If you dig deeper into account_get_strattr you'll see that it uses attrgroup_get_attr function that is part of the attribute layer that is used only for accounts.
You can try do this, but I don't recommend. You should understand that actually the attribute layer is a cache layer, but clan implementation uses directly database select/update/insert without a caching (actually with a simple caching, because it fills the t_clan struct from db and then the struct uses to read data).
There a situation may occur when the attrubute layer will rewrite some clan fields in db with outdated data (that was cached before), or you will receive outdated data from the cache when it was already updated in db from other code parts where the attribute layer is not used.
In other words there may be data mismatch for the clan fields that you will get/set this way.

You can read some details about database implementation here https://github.com/pvpgn/pvpgn-server/issues/85

okay , thanks for suggest smile
maybe later I 'll ask you again with some of its source ...

Posts: 9

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 1 guest, 0 registered users

forums.pvpgn.pro → [EN] The Source Code → /clan rank