Follow up 02dda56 fix banking request when feature.banking

Fix UB on npc_shop (a || b && c)
Add $@mobid for script command wich will retain GID when creating monsters
This commit is contained in:
lighta
2013-12-03 11:25:01 -05:00
parent 563090b009
commit be4e7978d2
4 changed files with 16 additions and 10 deletions

View File

@@ -844,12 +844,12 @@ int chrif_req_login_operation(int aid, const char* character_name, unsigned shor
int chrif_changesex(struct map_session_data *sd) {
chrif_check(-1);
WFIFOHEAD(char_fd,36);
WFIFOHEAD(char_fd,44);
WFIFOW(char_fd,0) = 0x2b0e;
WFIFOL(char_fd,2) = sd->status.account_id;
safestrncpy((char*)WFIFOP(char_fd,6), sd->status.name, NAME_LENGTH);
WFIFOW(char_fd,30) = 5;
WFIFOSET(char_fd,36);
WFIFOSET(char_fd,44);
clif_displaymessage(sd->fd, msg_txt(sd,408)); //"Need disconnection to perform change-sex request..."
@@ -894,16 +894,14 @@ static void chrif_ack_login_req(int aid, const char* player_name, uint16 type, u
snprintf(action,25,"???");
switch( answer ) {
case 0 : if(battle_config.feature_banking) sprintf(output, msg_txt(sd,424), action, NAME_LENGTH, player_name); else output[0] = '\0'; break; //%s has been asked to %s the player '%.*s'.
case 0 : sprintf(output, msg_txt(sd,424), action, NAME_LENGTH, player_name); break; //%s has been asked to %s the player '%.*s'.
case 1 : sprintf(output, msg_txt(sd,425), NAME_LENGTH, player_name); break;
case 2 : sprintf(output, msg_txt(sd,426), action, NAME_LENGTH, player_name); break;
case 3 : sprintf(output, msg_txt(sd,427), action, NAME_LENGTH, player_name); break;
case 4 : if(battle_config.feature_banking) sprintf(output, msg_txt(sd,424), action, NAME_LENGTH, player_name); else output[0] = '\0'; break;
case 4 : sprintf(output, msg_txt(sd,424), action, NAME_LENGTH, player_name); break;
default: output[0] = '\0'; break;
}
if (output)
clif_displaymessage(sd->fd, output);
clif_displaymessage(sd->fd, output);
}
/*==========================================

View File

@@ -1771,7 +1771,8 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
nullpo_retr(1, sd);
nullpo_retr(1, item_list);
if( ( nd = npc_checknear(sd, map_id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != SHOP && nd->subtype != ITEMSHOP && nd->subtype != POINTSHOP )
if( ( nd = npc_checknear(sd, map_id2bl(sd->npc_shopid)) ) == NULL
|| ( nd->subtype != SHOP && nd->subtype != ITEMSHOP && nd->subtype != POINTSHOP ) )
{
return 1;
}

View File

@@ -1276,7 +1276,8 @@ int pc_reg_received(struct map_session_data *sd)
chrif_skillcooldown_request(sd->status.account_id, sd->status.char_id);
chrif_bsdata_request(sd->status.char_id);
sd->storage_size = MIN_STORAGE; //default to min
chrif_req_login_operation(sd->status.account_id, sd->status.name, 7, 0, 1, 0); //request Bank data
if(battle_config.feature_banking)
chrif_req_login_operation(sd->status.account_id, sd->status.name, 7, 0, 1, 0); //request Bank data
#ifdef VIP_ENABLE
sd->vip.time = 0;
sd->vip.enabled = 0;

View File

@@ -8847,6 +8847,7 @@ BUILDIN_FUNC(guildchangegm)
/*==========================================
* Spawn a monster :
* *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
@mapn,x,y : location
@str : monster name
@class_ : mob_id
@@ -8867,6 +8868,7 @@ BUILDIN_FUNC(monster)
struct map_session_data* sd;
int16 m;
int i;
if (script_hasdata(st, 8)) {
event = script_getstr(st, 8);
@@ -8901,7 +8903,10 @@ BUILDIN_FUNC(monster)
else
m = map_mapname2mapid(mapn);
mob_once_spawn(sd, m, x, y, str, class_, amount, event, size, ai);
for(i=0; i<amount; i++){ //not optimised
int mobid = mob_once_spawn(sd, m, x, y, str, class_, 1, event, size, ai);
mapreg_setreg(reference_uid(add_str("$@mobid"), i),mobid);
}
return SCRIPT_CMD_SUCCESS;
}
/*==========================================
@@ -10884,6 +10889,7 @@ BUILDIN_FUNC(getmapflag)
}
return SCRIPT_CMD_SUCCESS;
}
/* pvp timer handling */
static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
TBL_PC* sd = (TBL_PC*)bl;