Vip_followup
Fix bugreport:8301 were groupid wasn't keeping in vip state at new logon. Fix groupid wasn't reload without logout when we wasn't vip anymore Fix decreasing vip_time scenario Add a timer so vip_member doesn't keep status until they logout.
This commit is contained in:
parent
854f8fc502
commit
3b5e527c7f
@ -88,9 +88,8 @@ max_connect_user: -1
|
||||
// See: conf/groups.conf
|
||||
gm_allow_group: 99
|
||||
|
||||
// How often should the server save all files? (In seconds)
|
||||
// Note: Applies to all data files on TXT servers.
|
||||
// On SQL servers, it applies to guilds (character save interval is defined on the map config)
|
||||
// How often should the server save guild infos? (In seconds)
|
||||
// (character save interval is defined on the map config (autosave_time))
|
||||
autosave_time: 60
|
||||
|
||||
// Display information on the console whenever characters/guilds/parties/pets are loaded/saved?
|
||||
|
@ -2309,14 +2309,14 @@ int mapif_vipack(int mapfd, uint32 aid, uint32 vip_time, uint8 isvip, uint32 gro
|
||||
* @param mapfd: link to mapserv for ack
|
||||
* @return 0 if succes
|
||||
*/
|
||||
int loginif_reqviddata(uint32 aid, uint8 type, int add_vip_time, int mapfd) {
|
||||
int loginif_reqviddata(uint32 aid, uint8 type, int32 timediff, int mapfd) {
|
||||
loginif_check(-1);
|
||||
#ifdef VIP_ENABLE
|
||||
WFIFOHEAD(login_fd,15);
|
||||
WFIFOW(login_fd,0) = 0x2742;
|
||||
WFIFOL(login_fd,2) = aid; //aid
|
||||
WFIFOB(login_fd,6) = type; //type
|
||||
WFIFOL(login_fd,7) = add_vip_time; //req_inc_duration
|
||||
WFIFOL(login_fd,7) = timediff; //req_inc_duration
|
||||
WFIFOL(login_fd,11) = mapfd; //req_inc_duration
|
||||
WFIFOSET(login_fd,15);
|
||||
#endif
|
||||
@ -3091,7 +3091,7 @@ int mapif_parse_req_alter_acc(int fd){
|
||||
int aid = RFIFOL(fd,2); // account_id of who ask (-1 if server itself made this request)
|
||||
const char* name = (char*)RFIFOP(fd,6); // name of the target character
|
||||
int operation = RFIFOW(fd,30); // type of operation: 1-block, 2-ban, 3-unblock, 4-unban, 5 changesex, 6 vip, 7 bank
|
||||
int timediff = RFIFOL(fd,32);
|
||||
int32 timediff = RFIFOL(fd,32);
|
||||
int val1 = RFIFOL(fd,36);
|
||||
int val2 = RFIFOL(fd,40);
|
||||
RFIFOSKIP(fd,44);
|
||||
@ -3157,7 +3157,7 @@ int mapif_parse_req_alter_acc(int fd){
|
||||
break;
|
||||
case 6:
|
||||
anwser=(val1&4); // vip_req val1=type, &1 login send return, &2 upd timestamp &4 map send awnser
|
||||
loginif_reqviddata(aid, val1, timediff, fd);
|
||||
loginif_reqviddata(account_id, val1, timediff, fd);
|
||||
break;
|
||||
case 7:
|
||||
anwser=(val1&1); //val&1 request anwser, val1&2 save data
|
||||
|
@ -562,7 +562,7 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
|
||||
Sql_GetData(sql_handle, 18, &data, NULL); acc->old_group = atoi(data);
|
||||
#endif
|
||||
Sql_FreeResult(sql_handle);
|
||||
|
||||
|
||||
// retrieve account regs for the specified user
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `str`,`value` FROM `%s` WHERE `type`='1' AND `account_id`='%d'", db->accreg_db, acc->account_id) )
|
||||
{
|
||||
|
@ -514,7 +514,7 @@ int chrif_parse_reqvipdata(int fd) {
|
||||
struct mmo_account acc;
|
||||
int aid = RFIFOL(fd,2);
|
||||
int8 type = RFIFOB(fd,6);
|
||||
int req_duration = RFIFOL(fd,7);
|
||||
int32 timediff = RFIFOL(fd,7);
|
||||
int mapfd = RFIFOL(fd,11);
|
||||
RFIFOSKIP(fd,15);
|
||||
|
||||
@ -523,14 +523,17 @@ int chrif_parse_reqvipdata(int fd) {
|
||||
time_t vip_time = acc.vip_time;
|
||||
bool isvip = false;
|
||||
|
||||
if( type&2 ) vip_time = now + req_duration; // set new duration
|
||||
if( now < vip_time ) { //isvip
|
||||
if( type&2 ){
|
||||
if(!vip_time) vip_time = now; //new entry
|
||||
vip_time += timediff; // set new duration
|
||||
}
|
||||
if( now < vip_time) { //isvip
|
||||
if(acc.group_id != login_config.vip_sys.group) //only upd this if we're not vip already
|
||||
acc.old_group = acc.group_id;
|
||||
acc.group_id = login_config.vip_sys.group;
|
||||
acc.char_slots = login_config.char_per_account + login_config.vip_sys.char_increase;
|
||||
isvip = true;
|
||||
} else if (vip_time) { //expired or @vip -xx
|
||||
} else { //expired or @vip -xx
|
||||
vip_time = 0;
|
||||
if(acc.group_id == login_config.vip_sys.group) //prevent alteration in case we wasn't registered vip yet
|
||||
acc.group_id = acc.old_group;
|
||||
@ -1233,10 +1236,6 @@ int mmo_auth(struct login_session_data* sd, bool isServer) {
|
||||
timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(NULL), "%Y-%m-%d %H:%M:%S");
|
||||
safestrncpy(acc.last_ip, ip, sizeof(acc.last_ip));
|
||||
acc.unban_time = 0;
|
||||
#ifdef VIP_ENABLE
|
||||
acc.vip_time = 0;
|
||||
acc.old_group = 0;
|
||||
#endif
|
||||
acc.logincount++;
|
||||
|
||||
accounts->save(accounts, &acc);
|
||||
|
@ -2788,7 +2788,7 @@ ACMD_FUNC(char_block)
|
||||
ACMD_FUNC(char_ban)
|
||||
{
|
||||
char * modif_p;
|
||||
int timediff=0;
|
||||
int32 timediff=0; //don't set this as uint as we may want to decrease banned time
|
||||
int bantype=2; //2=account block, 6=char specific
|
||||
char output[256];
|
||||
|
||||
@ -2807,7 +2807,7 @@ ACMD_FUNC(char_ban)
|
||||
|
||||
|
||||
modif_p = atcmd_output;
|
||||
timediff = (int)solve_time(modif_p); //discard seconds
|
||||
timediff = (int32)solve_time(modif_p); //discard seconds
|
||||
|
||||
if (timediff == 0) { //allow negative ?
|
||||
char output[256];
|
||||
@ -9160,7 +9160,7 @@ ACMD_FUNC(langtype)
|
||||
ACMD_FUNC(vip) {
|
||||
struct map_session_data *pl_sd = NULL;
|
||||
char * modif_p;
|
||||
int vipdifftime = 0;
|
||||
int32 vipdifftime = 0;
|
||||
time_t now=time(NULL);
|
||||
|
||||
nullpo_retr(-1, sd);
|
||||
@ -9175,7 +9175,7 @@ ACMD_FUNC(vip) {
|
||||
atcmd_output[sizeof(atcmd_output)-1] = '\0';
|
||||
|
||||
modif_p = atcmd_output;
|
||||
vipdifftime = (int)solve_time(modif_p);
|
||||
vipdifftime = (int32)solve_time(modif_p);
|
||||
if (vipdifftime == 0) {
|
||||
clif_displaymessage(fd, msg_txt(sd,701)); // Invalid time for vip command.
|
||||
clif_displaymessage(fd, msg_txt(sd,702)); // Time parameter format is +/-<value> to alter. y/a = Year, m = Month, d/j = Day, h = Hour, n/mn = Minute, s = Second.
|
||||
|
@ -823,7 +823,7 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email) {
|
||||
* @val1 : extra data value to transfer for operation
|
||||
* @val2 : extra data value to transfer for operation
|
||||
*/
|
||||
int chrif_req_login_operation(int aid, const char* character_name, unsigned short operation_type, int timediff, int val1, int val2) {
|
||||
int chrif_req_login_operation(int aid, const char* character_name, unsigned short operation_type, int32 timediff, int val1, int val2) {
|
||||
chrif_check(-1);
|
||||
|
||||
WFIFOHEAD(char_fd,44);
|
||||
@ -1071,7 +1071,7 @@ int chrif_ban(int fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int chrif_req_charban(int aid, const char* character_name, int timediff){
|
||||
int chrif_req_charban(int aid, const char* character_name, int32 timediff){
|
||||
chrif_check(-1);
|
||||
|
||||
WFIFOHEAD(char_fd,10+NAME_LENGTH);
|
||||
@ -1520,20 +1520,25 @@ void chrif_keepalive_ack(int fd) {
|
||||
session[fd]->flag.ping = 0;/* reset ping state, we received a packet */
|
||||
}
|
||||
|
||||
/**
|
||||
* Received vip-data from char-serv, fill map-serv data
|
||||
* @param fd : char-serv file descriptor (link to char-serv)
|
||||
*/
|
||||
void chrif_parse_ack_vipActive(int fd) {
|
||||
#ifdef VIP_ENABLE
|
||||
int aid = RFIFOL(char_fd,2);
|
||||
uint32 vip_time = RFIFOL(char_fd,6);
|
||||
bool isvip = RFIFOB(char_fd,10);
|
||||
uint32 groupid = RFIFOL(char_fd,11);
|
||||
int aid = RFIFOL(fd,2);
|
||||
uint32 vip_time = RFIFOL(fd,6);
|
||||
bool isvip = RFIFOB(fd,10);
|
||||
uint32 groupid = RFIFOL(fd,11);
|
||||
TBL_PC *sd = map_id2sd(aid);
|
||||
|
||||
if (sd && isvip) {
|
||||
if(sd == NULL) return ;
|
||||
|
||||
sd->group_id = groupid;
|
||||
pc_group_pc_load(sd);
|
||||
if(isvip) {
|
||||
sd->vip.enabled = 1;
|
||||
sd->vip.time = vip_time;
|
||||
sd->group_id = groupid;
|
||||
pc_group_pc_load(sd);
|
||||
|
||||
// Increase storage size for VIP.
|
||||
sd->storage_size = battle_config.vip_storage_increase + MIN_STORAGE;
|
||||
if (sd->storage_size > MAX_STORAGE) {
|
||||
@ -1541,9 +1546,16 @@ void chrif_parse_ack_vipActive(int fd) {
|
||||
sd->storage_size = MAX_STORAGE;
|
||||
}
|
||||
// Magic Stone requirement avoidance for VIP.
|
||||
if (battle_config.vip_gemstone && pc_isvip(sd))
|
||||
if (battle_config.vip_gemstone)
|
||||
sd->special_state.no_gemstone = 2; // need to be done after status_calc_bl(bl,first);
|
||||
}
|
||||
else if (sd->vip.enabled){
|
||||
sd->vip.enabled = 0;
|
||||
sd->vip.time = 0;
|
||||
sd->storage_size = MIN_STORAGE;
|
||||
sd->special_state.no_gemstone = 0;
|
||||
clif_displaymessage(sd->fd,"You're no longer a VIP_Member");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -889,7 +889,7 @@ int merc_call_homunculus(struct map_session_data *sd)
|
||||
|
||||
/**
|
||||
* Receive homunculus data from char server
|
||||
* @param account_id : owner account_id of the homon
|
||||
* @param account_id : owner account_id of the homon
|
||||
* @param sh : homonculus data from char-serv
|
||||
* @param flag : does the creation in inter-serv was a success (0:no,1:yes)
|
||||
* @return 0:failure, 1:sucess
|
||||
|
@ -89,14 +89,14 @@ char log_db_db[32] = "log";
|
||||
Sql* logmysql_handle;
|
||||
|
||||
// DBMap declaartion
|
||||
static DBMap* id_db=NULL; // int id -> struct block_list*
|
||||
static DBMap* pc_db=NULL; // int id -> struct map_session_data*
|
||||
static DBMap* mobid_db=NULL; // int id -> struct mob_data*
|
||||
static DBMap* bossid_db=NULL; // int id -> struct mob_data* (MVP db)
|
||||
static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data*
|
||||
static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters)
|
||||
static DBMap* charid_db=NULL; // int char_id -> struct map_session_data*
|
||||
static DBMap* regen_db=NULL; // int id -> struct block_list* (status_natural_heal processing)
|
||||
static DBMap* id_db=NULL; /// int id -> struct block_list*
|
||||
static DBMap* pc_db=NULL; /// int id -> struct map_session_data*
|
||||
static DBMap* mobid_db=NULL; /// int id -> struct mob_data*
|
||||
static DBMap* bossid_db=NULL; /// int id -> struct mob_data* (MVP db)
|
||||
static DBMap* map_db=NULL; /// unsigned int mapindex -> struct map_data*
|
||||
static DBMap* nick_db=NULL; /// int char_id -> struct charid2nick* (requested names of offline characters)
|
||||
static DBMap* charid_db=NULL; /// int char_id -> struct map_session_data*
|
||||
static DBMap* regen_db=NULL; /// int id -> struct block_list* (status_natural_heal processing)
|
||||
static DBMap* map_msg_db=NULL;
|
||||
|
||||
static int map_users=0;
|
||||
@ -4063,7 +4063,7 @@ int do_init(int argc, char *argv[])
|
||||
add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer");
|
||||
add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
|
||||
add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
|
||||
|
||||
|
||||
map_do_init_msg();
|
||||
do_init_atcommand();
|
||||
do_init_battle();
|
||||
|
@ -9415,7 +9415,10 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
|
||||
//Save char.
|
||||
last_save_id = sd->bl.id;
|
||||
save_flag = 2;
|
||||
|
||||
#ifdef VIP_ENABLE
|
||||
if(sd->vip.enabled) //check if we're still vip
|
||||
chrif_req_login_operation(1, sd->status.name, 6, 0, 1, 0);
|
||||
#endif
|
||||
chrif_save(sd,0);
|
||||
break;
|
||||
}
|
||||
|
17
src/map/pc.h
17
src/map/pc.h
@ -123,10 +123,17 @@ struct s_autobonus {
|
||||
};
|
||||
|
||||
struct skill_cooldown_entry {
|
||||
unsigned short skill_id;
|
||||
int timer;
|
||||
unsigned short skill_id;
|
||||
int timer;
|
||||
};
|
||||
|
||||
#ifdef VIP_ENABLE
|
||||
struct vip_info {
|
||||
unsigned int enabled : 1;
|
||||
time_t time;
|
||||
};
|
||||
#endif
|
||||
|
||||
enum npc_timeout_type {
|
||||
NPCT_INPUT = 0,
|
||||
NPCT_MENU = 1,
|
||||
@ -553,12 +560,8 @@ struct map_session_data {
|
||||
|
||||
int storage_size; // Holds player storage size (VIP system).
|
||||
#ifdef VIP_ENABLE
|
||||
struct {
|
||||
unsigned int enabled : 1;
|
||||
time_t time;
|
||||
} vip;
|
||||
struct vip_info vip;
|
||||
#endif
|
||||
|
||||
//Timed bonus 'bonus_script' struct [Cydh]
|
||||
struct s_script {
|
||||
struct script_code *script;
|
||||
|
@ -199,7 +199,7 @@ int unit_check_start_teleport_timer(struct block_list *sbl)
|
||||
case BL_PET : max_dist = AREA_SIZE; break;
|
||||
case BL_MER : max_dist = MAX_MER_DISTANCE; break;
|
||||
}
|
||||
// If there is a master and it's a valid type
|
||||
// If there is a master and it's a valid type
|
||||
if(msd && (msd->bl.type&BL_PC) && max_dist){ ///TODO the bl.type is an hotfix please dig it to remove it
|
||||
int *msd_tid = unit_get_masterteleport_timer(sbl);
|
||||
if(msd_tid == NULL) return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user