Add @fullstrip

Fix 0x07f5 pointing to wrong function
Safecheck some string in clif
This commit is contained in:
lighta 2013-11-19 13:21:18 -05:00
parent 7e9e4b066e
commit c9532369cb
6 changed files with 93 additions and 54 deletions

View File

@ -290,6 +290,7 @@ groups: (
channel_admin: true
can_trade_bounded: true
item_unconditional: false
/* all_permission: true */
}
}
)

View File

@ -366,7 +366,8 @@
347: | Lv:%d/%d | Job: %s
//You may ommit 2 last %d, then you won't see players coords, just map name
348: | Location: %s %d %d
// @fullstrip
349: Please enter a player name (usage: @fullstrip <char name/ID>).
// @duel (part 1)
350: Duel: You can't use @invite. You aren't a duelist.
351: Duel: The limit of players has been reached.

View File

@ -1451,7 +1451,7 @@ packet_ver: 25
//0x07f4,3
//2009-10-27aRagexeRE
0x07f5,6,gmreqaccname,2
0x07f5,6,gmfullstrip,2
0x07f6,14
//2009-11-03aRagexeRE

View File

@ -5228,7 +5228,7 @@ ACMD_FUNC(storeall)
nullpo_retr(-1, sd);
if (sd->state.storage_flag != 1)
{ //Open storage.
{ //Open storage.
if( storage_storageopen(sd) == 1 ) {
clif_displaymessage(fd, msg_txt(sd,1161)); // You currently cannot open your storage.
return -1;
@ -9212,6 +9212,29 @@ ACMD_FUNC(vip) {
}
#endif
ACMD_FUNC(fullstrip) {
int i;
TBL_PC *tsd;
nullpo_retr(-1,sd);
if (!message || !*message) {
clif_displaymessage(fd, msg_txt(sd,349)); // Please enter a player name (usage: @fullstrip/@warpto/@goto <char name/ID>).
return -1;
}
if((tsd=map_nick2sd((char *)message)) == NULL && (tsd=map_id2sd(atoi(message))) == NULL){
clif_displaymessage(fd, msg_txt(sd,3)); // Character not found.
return -1;
}
for( i = 0; i < EQI_MAX; i++ ) {
if( tsd->equip_index[ i ] >= 0 )
pc_unequipitem( tsd , tsd->equip_index[ i ] , 2 );
}
return 0;
}
#include "../custom/atcommand.inc"
/**
@ -9497,6 +9520,7 @@ void atcommand_basecommands(void) {
#ifdef VIP_ENABLE
ACMD_DEF(vip),
#endif
ACMD_DEF(fullstrip),
};
AtCommandInfo* atcommand;
int i;

View File

@ -9642,7 +9642,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if( map[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) )
{
char output[128];
sprintf(output, "[ Kill Steal Protection Disable. KS is allowed in this map ]");
safesnprintf(output,sizeof(output),"[ Kill Steal Protection Disable. KS is allowed in this map ]");
clif_broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF);
}
@ -10026,7 +10026,7 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd)
map_name = (char*)RFIFOP(fd,info->pos[0]);
map_name[MAP_NAME_LENGTH_EXT-1]='\0';
sprintf(command, "%cmapmove %s %d %d", atcommand_symbol, map_name,
safesnprintf(command,sizeof(command),"%cmapmove %s %d %d", atcommand_symbol, map_name,
RFIFOW(fd,info->pos[1]), //x
RFIFOW(fd,info->pos[2])); //y
is_atcommand(fd, sd, command, 1);
@ -10337,11 +10337,11 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
for( i = 0; i < NUM_WHISPER_VAR; ++i ) {
sprintf(output, "@whispervar%d$", i);
safesnprintf(output,sizeof(output),"@whispervar%d$", i);
set_var(sd,output,(char *) split_data[i]);
}
sprintf(output, "%s::OnWhisperGlobal", npc->exname);
safesnprintf(output,sizeof(output),"%s::OnWhisperGlobal", npc->exname);
npc_event(sd,output,0); // Calls the NPC label
return;
@ -10390,7 +10390,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
// if player is autotrading
if (dstsd->state.autotrade == 1) {
char output[256];
sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
safesnprintf(output,sizeof(output),"%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
clif_wis_message(fd, wisp_server_name, output, strlen(output) + 1);
return;
}
@ -10424,7 +10424,7 @@ void clif_parse_Broadcast(int fd, struct map_session_data* sd) {
// as the length varies depending on the command used, just block unreasonably long strings
mes_len_check(msg, len, CHAT_SIZE_MAX);
sprintf(command, "%ckami %s", atcommand_symbol, msg);
safesnprintf(command,sizeof(command),"%ckami %s", atcommand_symbol, msg);
is_atcommand(fd, sd, command, 1);
}
@ -11662,9 +11662,9 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd) {
char cmd[15];
if( RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]) )
sprintf(cmd,"%cresetskill",atcommand_symbol);
safesnprintf(cmd,sizeof(cmd),"%cresetskill",atcommand_symbol);
else
sprintf(cmd,"%cresetstat",atcommand_symbol);
safesnprintf(cmd,sizeof(cmd),"%cresetstat",atcommand_symbol);
is_atcommand(fd, sd, cmd, 1);
}
@ -11683,7 +11683,7 @@ void clif_parse_LocalBroadcast(int fd, struct map_session_data* sd)
// as the length varies depending on the command used, just block unreasonably long strings
mes_len_check(msg, len, CHAT_SIZE_MAX);
sprintf(command, "%clkami %s", atcommand_symbol, msg);
safesnprintf(command,sizeof(command),"%clkami %s", atcommand_symbol, msg);
is_atcommand(fd, sd, command, 1);
}
@ -12830,7 +12830,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
case BL_PC:
{
char command[NAME_LENGTH+6];
sprintf(command, "%ckick %s", atcommand_symbol, status_get_name(target));
safesnprintf(command,sizeof(command),"%ckick %s", atcommand_symbol, status_get_name(target));
is_atcommand(fd, sd, command, 1);
}
break;
@ -12845,7 +12845,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
clif_GM_kickack(sd, 0);
return;
}
sprintf(command, "/kick %s (%d)", status_get_name(target), status_get_class(target));
safesnprintf(command,sizeof(command),"/kick %s (%d)", status_get_name(target), status_get_class(target));
log_atcommand(sd, command);
status_percent_damage(&sd->bl, target, 100, 0, true); // can invalidate 'target'
}
@ -12873,7 +12873,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
/// 00ce
void clif_parse_GMKickAll(int fd, struct map_session_data* sd) {
char cmd[15];
sprintf(cmd,"%ckickall",atcommand_symbol);
safesnprintf(cmd,sizeof(cmd),"%ckickall",atcommand_symbol);
is_atcommand(fd, sd, cmd, 1);
}
@ -12893,7 +12893,7 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd)
player_name = (char*)RFIFOP(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
player_name[NAME_LENGTH-1] = '\0';
sprintf(command, "%cjumpto %s", atcommand_symbol, player_name);
safesnprintf(command,sizeof(command),"%cjumpto %s", atcommand_symbol, player_name);
is_atcommand(fd, sd, command, 1);
}
@ -12909,7 +12909,7 @@ void clif_parse_GMRemove2(int fd, struct map_session_data* sd)
account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
if( (pl_sd = map_id2sd(account_id)) != NULL ) {
char command[NAME_LENGTH+8];
sprintf(command, "%cjumpto %s", atcommand_symbol, pl_sd->status.name);
safesnprintf(command,sizeof(command),"%cjumpto %s", atcommand_symbol, pl_sd->status.name);
is_atcommand(fd, sd, command, 1);
}
}
@ -12930,7 +12930,7 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd)
player_name = (char*)RFIFOP(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
player_name[NAME_LENGTH-1] = '\0';
sprintf(command, "%crecall %s", atcommand_symbol, player_name);
safesnprintf(command,sizeof(command),"%crecall %s", atcommand_symbol, player_name);
is_atcommand(fd, sd, command, 1);
}
@ -12946,7 +12946,7 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd)
account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
if( (pl_sd = map_id2sd(account_id)) != NULL ) {
char command[NAME_LENGTH+8];
sprintf(command, "%crecall %s", atcommand_symbol, pl_sd->status.name);
safesnprintf(command,sizeof(command),"%crecall %s", atcommand_symbol, pl_sd->status.name);
is_atcommand(fd, sd, command, 1);
}
}
@ -12966,7 +12966,7 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
// FIXME: Should look for item first, then for monster.
// FIXME: /monster takes mob_db Sprite_Name as argument
if( mobdb_searchname(monster_item_name) ) {
snprintf(command, sizeof(command)-1, "%cmonster %s", atcommand_symbol, monster_item_name);
safesnprintf(command, sizeof(command)-1, "%cmonster %s", atcommand_symbol, monster_item_name);
is_atcommand(fd, sd, command, 1);
return;
}
@ -12974,7 +12974,7 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
// FIXME: Equips are supposed to be unidentified.
if( itemdb_searchname(monster_item_name) ) {
snprintf(command, sizeof(command)-1, "%citem %s", atcommand_symbol, monster_item_name);
safesnprintf(command, sizeof(command)-1, "%citem %s", atcommand_symbol, monster_item_name);
is_atcommand(fd, sd, command, 1);
return;
}
@ -12989,8 +12989,7 @@ void clif_parse_GMHide(int fd, struct map_session_data *sd) {
char cmd[6];
//int eff_st = RFIFOL(packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
sprintf(cmd,"%chide",atcommand_symbol);
safesnprintf(cmd,sizeof(cmd),"%chide",atcommand_symbol);
is_atcommand(fd, sd, cmd, 1);
}
@ -13025,7 +13024,7 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
if( dstsd == NULL )
return;
sprintf(command, "%cmute %d %s", atcommand_symbol, value, dstsd->status.name);
safesnprintf(command,sizeof(command),"%cmute %d %s", atcommand_symbol, value, dstsd->status.name);
is_atcommand(fd, sd, command, 1);
}
@ -13039,7 +13038,7 @@ void clif_parse_GMRc(int fd, struct map_session_data* sd)
char *name = (char*)RFIFOP(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
name[NAME_LENGTH-1] = '\0';
sprintf(command, "%cmute %d %s", atcommand_symbol, 60, name);
safesnprintf(command,sizeof(command),"%cmute %d %s", atcommand_symbol, 60, name);
is_atcommand(fd, sd, command, 1);
}
@ -13062,10 +13061,13 @@ void clif_account_name(struct map_session_data* sd, int account_id, const char*
/// 01df <account id>.L
void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd)
{
char command[30];
int account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
//TODO: find out if this works for any player or only for authorized GMs
clif_account_name(sd, account_id, ""); // insert account name here >_<
//tmp get all display
safesnprintf(command,sizeof(command),"%caccinfo %d", atcommand_symbol, account_id);
is_atcommand(fd, sd, command, 1);
//clif_account_name(sd, account_id, ""); //! TODO request to login-serv
}
@ -13080,7 +13082,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd)
int x,y,type;
struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
if( pc_has_permission(sd, PC_PERM_USE_CHANGEMAPTYPE) )
if(! pc_has_permission(sd, PC_PERM_USE_CHANGEMAPTYPE) )
return;
x = RFIFOW(fd,info->pos[0]);
@ -14109,7 +14111,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd)
if( md->full ) {// TODO: is this official?
char output[100];
sprintf(output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
safesnprintf(output,sizeof(output),"Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
clif_disp_onlyself(sd, output, strlen(output));
}
}
@ -17002,6 +17004,13 @@ void clif_display_pinfo(struct map_session_data *sd, int cmdtype) {
}
}
void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) {
char cmd[30];
int t_aid = RFIFOL(fd,2);
safesnprintf(cmd,sizeof(cmd),"%cfullstrip %d",atcommand_symbol,t_aid);
is_atcommand(fd, sd, cmd, 1);
}
#ifdef DUMP_UNKNOWN_PACKET
void DumpUnknow(int fd,TBL_PC *sd,int cmd,int packet_len){
const char* packet_txt = "save/packet.txt";
@ -17547,6 +17556,7 @@ void packetdb_readdb(void)
{clif_parse_GMRc,"rc"},
{clif_parse_GMRecall2,"recall2"},
{clif_parse_GMRemove2,"remove2"},
{clif_parse_GMFullStrip,"gmfullstrip"},
{clif_parse_NoviceDoriDori,"sndoridori"},
{clif_parse_NoviceExplosionSpirits,"snexplosionspirits"},

View File

@ -14,7 +14,7 @@ bool pc_group_has_permission(int group_id, int permission);
bool pc_group_should_log_commands(int group_id);
const char* pc_group_id2name(int group_id);
int pc_group_id2level(int group_id);
void pc_group_pc_load(struct map_session_data *);
void pc_group_pc_load(struct map_session_data *sd);
void do_init_pc_groups(void);
void do_final_pc_groups(void);
@ -22,30 +22,32 @@ void pc_groups_reload(void);
enum e_pc_permission {
PC_PERM_NONE = 0,
PC_PERM_TRADE = 0x000001,
PC_PERM_PARTY = 0x000002,
PC_PERM_ALL_SKILL = 0x000004,
PC_PERM_USE_ALL_EQUIPMENT = 0x000008,
PC_PERM_SKILL_UNCONDITIONAL = 0x000010,
PC_PERM_JOIN_ALL_CHAT = 0x000020,
PC_PERM_NO_CHAT_KICK = 0x000040,
PC_PERM_HIDE_SESSION = 0x000080,
PC_PERM_WHO_DISPLAY_AID = 0x000100,
PC_PERM_RECEIVE_HACK_INFO = 0x000200,
PC_PERM_WARP_ANYWHERE = 0x000400,
PC_PERM_VIEW_HPMETER = 0x000800,
PC_PERM_VIEW_EQUIPMENT = 0x001000,
PC_PERM_USE_CHECK = 0x002000,
PC_PERM_USE_CHANGEMAPTYPE = 0x004000,
PC_PERM_USE_ALL_COMMANDS = 0x008000,
PC_PERM_RECEIVE_REQUESTS = 0x010000,
PC_PERM_SHOW_BOSS = 0x020000,
PC_PERM_DISABLE_PVM = 0x040000,
PC_PERM_DISABLE_PVP = 0x080000,
PC_PERM_DISABLE_CMD_DEAD = 0x100000,
PC_PERM_CHANNEL_ADMIN = 0x200000,
PC_PERM_TRADE_BOUNDED = 0x400000,
PC_PERM_ITEM_UNCONDITIONAL = 0x800000,
PC_PERM_TRADE = 0x00000001,
PC_PERM_PARTY = 0x00000002,
PC_PERM_ALL_SKILL = 0x00000004,
PC_PERM_USE_ALL_EQUIPMENT = 0x00000008,
PC_PERM_SKILL_UNCONDITIONAL = 0x00000010,
PC_PERM_JOIN_ALL_CHAT = 0x00000020,
PC_PERM_NO_CHAT_KICK = 0x00000040,
PC_PERM_HIDE_SESSION = 0x00000080,
PC_PERM_WHO_DISPLAY_AID = 0x00000100,
PC_PERM_RECEIVE_HACK_INFO = 0x00000200,
PC_PERM_WARP_ANYWHERE = 0x00000400,
PC_PERM_VIEW_HPMETER = 0x00000800,
PC_PERM_VIEW_EQUIPMENT = 0x00001000,
PC_PERM_USE_CHECK = 0x00002000,
PC_PERM_USE_CHANGEMAPTYPE = 0x00004000,
PC_PERM_USE_ALL_COMMANDS = 0x00008000,
PC_PERM_RECEIVE_REQUESTS = 0x00010000,
PC_PERM_SHOW_BOSS = 0x00020000,
PC_PERM_DISABLE_PVM = 0x00040000,
PC_PERM_DISABLE_PVP = 0x00080000,
PC_PERM_DISABLE_CMD_DEAD = 0x00100000,
PC_PERM_CHANNEL_ADMIN = 0x00200000,
PC_PERM_TRADE_BOUNDED = 0x00400000,
PC_PERM_ITEM_UNCONDITIONAL = 0x00800000,
//.. add other here
PC_PERM_ALLPERMISSION = 0xFFFFFFFF,
};
static const struct {
@ -76,6 +78,7 @@ static const struct {
{ "channel_admin", PC_PERM_CHANNEL_ADMIN },
{ "can_trade_bounded", PC_PERM_TRADE_BOUNDED },
{ "item_unconditional", PC_PERM_ITEM_UNCONDITIONAL },
{ "all_permission", PC_PERM_ALLPERMISSION },
};
#endif // _PC_GROUPS_H_