Implemented ZC_BAN_LIST3 packet (#8632)
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
parent
fca803220b
commit
ca86ac12c8
@ -527,6 +527,7 @@ CREATE TABLE IF NOT EXISTS `guild_expulsion` (
|
||||
`account_id` int(11) unsigned NOT NULL default '0',
|
||||
`name` varchar(24) NOT NULL default '',
|
||||
`mes` varchar(40) NOT NULL default '',
|
||||
`char_id` int(11) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`guild_id`,`name`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
1
sql-files/upgrades/upgrade_20240914.sql
Normal file
1
sql-files/upgrades/upgrade_20240914.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `guild_expulsion` ADD COLUMN `char_id` int(11) unsigned NOT NULL default '0';
|
@ -2425,7 +2425,7 @@ bool char_checkdb(void){
|
||||
return false;
|
||||
}
|
||||
//checking guild_expulsion_db
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `guild_id`,`account_id`,`name`,`mes` FROM `%s` LIMIT 1;", schema_config.guild_expulsion_db) ){
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `guild_id`,`account_id`,`name`,`mes`,`char_id` FROM `%s` LIMIT 1;", schema_config.guild_expulsion_db) ){
|
||||
Sql_ShowDebug(sql_handle);
|
||||
return false;
|
||||
}
|
||||
|
@ -308,8 +308,8 @@ int inter_guild_tosql( mmo_guild &g, int flag ){
|
||||
|
||||
Sql_EscapeStringLen(sql_handle, esc_name, e->name, strnlen(e->name, NAME_LENGTH));
|
||||
Sql_EscapeStringLen(sql_handle, esc_mes, e->mes, strnlen(e->mes, sizeof(e->mes)));
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`name`,`mes`) "
|
||||
"VALUES ('%d','%d','%s','%s')", schema_config.guild_expulsion_db, g.guild_id, e->account_id, esc_name, esc_mes) )
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "REPLACE INTO `%s` (`guild_id`,`account_id`,`name`,`mes`,`char_id`) "
|
||||
"VALUES ('%u','%u','%s','%s','%u')", schema_config.guild_expulsion_db, g.guild_id, e->account_id, esc_name, esc_mes, e->char_id) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
}
|
||||
}
|
||||
@ -487,7 +487,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
|
||||
}
|
||||
|
||||
//printf("- Read guild_expulsion %d from sql \n",guild_id);
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `account_id`,`name`,`mes` FROM `%s` WHERE `guild_id`='%d'", schema_config.guild_expulsion_db, guild_id) )
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `account_id`,`name`,`mes`,`char_id` FROM `%s` WHERE `guild_id`='%d'", schema_config.guild_expulsion_db, guild_id) )
|
||||
{
|
||||
Sql_ShowDebug(sql_handle);
|
||||
return nullptr;
|
||||
@ -499,6 +499,7 @@ std::shared_ptr<CharGuild> inter_guild_fromsql( int32 guild_id ){
|
||||
Sql_GetData(sql_handle, 0, &data, nullptr); e->account_id = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, &len); memcpy(e->name, data, zmin(len, NAME_LENGTH));
|
||||
Sql_GetData(sql_handle, 2, &data, &len); memcpy(e->mes, data, zmin(len, sizeof(e->mes)));
|
||||
Sql_GetData(sql_handle, 3, &data, nullptr); e->char_id = strtoul(data, nullptr, 10);
|
||||
}
|
||||
|
||||
//printf("- Read guild_skill %d from sql \n",guild_id);
|
||||
@ -1343,6 +1344,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, uint32 account_id, uint32 char_
|
||||
}
|
||||
// Save the expulsion entry
|
||||
g->guild.expulsion[j].account_id = account_id;
|
||||
g->guild.expulsion[j].char_id = char_id;
|
||||
safestrncpy(g->guild.expulsion[j].name, g->guild.member[i].name, NAME_LENGTH);
|
||||
safestrncpy(g->guild.expulsion[j].mes, mes, 40);
|
||||
}
|
||||
|
@ -741,6 +741,7 @@ struct guild_expulsion {
|
||||
char name[NAME_LENGTH];
|
||||
char mes[40];
|
||||
uint32 account_id;
|
||||
uint32 char_id;
|
||||
};
|
||||
|
||||
struct guild_skill {
|
||||
|
@ -9123,47 +9123,48 @@ void clif_guild_expulsion( map_session_data& sd, const char* name, uint32 char_i
|
||||
}
|
||||
|
||||
|
||||
/// Guild expulsion list (ZC_BAN_LIST).
|
||||
/// 0163 <packet len>.W { <char name>.24B <account name>.24B <reason>.40B }*
|
||||
/// 0163 <packet len>.W { <char name>.24B <reason>.40B }* (PACKETVER >= 20100803)
|
||||
void clif_guild_expulsionlist(map_session_data* sd)
|
||||
{
|
||||
#if PACKETVER < 20100803
|
||||
const int offset = NAME_LENGTH*2+40;
|
||||
#else
|
||||
const int offset = NAME_LENGTH+40;
|
||||
#endif
|
||||
int fd, i, c = 0;
|
||||
/// Guild expulsion list
|
||||
/// 0163 <packet len>.W { <char name>.24B <account name>.24B <reason>.40B }* (ZC_BAN_LIST)
|
||||
/// 0163 <packet len>.W { <char name>.24B <reason>.40B }* (PACKETVER >= 20100803) (ZC_BAN_LIST)
|
||||
/// 0a87 <packet len>.W { <charid>.L <reason>.40B }* (ZC_BAN_LIST2)
|
||||
/// 0b7c <packet len>.W { <charid>.L <reason>.40B <char name>.24B }* (ZC_BAN_LIST3)
|
||||
static void clif_guild_expulsionlist(map_session_data& sd){
|
||||
|
||||
nullpo_retv(sd);
|
||||
|
||||
auto &g = sd->guild;
|
||||
auto &g = sd.guild;
|
||||
if (!g)
|
||||
return;
|
||||
|
||||
fd = sd->fd;
|
||||
PACKET_ZC_BAN_LIST* p = reinterpret_cast<PACKET_ZC_BAN_LIST*>( packet_buffer );
|
||||
|
||||
WFIFOHEAD(fd,4 + MAX_GUILDEXPULSION * offset);
|
||||
WFIFOW(fd,0) = 0x163;
|
||||
p->packetType = HEADER_ZC_BAN_LIST;
|
||||
p->packetLen = sizeof(*p);
|
||||
|
||||
for( i = 0; i < MAX_GUILDEXPULSION; i++ )
|
||||
{
|
||||
struct guild_expulsion* e = &g->guild.expulsion[i];
|
||||
for( size_t i = 0, c = 0; i < MAX_GUILDEXPULSION; i++ ){
|
||||
struct guild_expulsion& e = g->guild.expulsion[i];
|
||||
|
||||
if( e->account_id > 0 )
|
||||
{
|
||||
safestrncpy(WFIFOCP(fd,4 + c*offset), e->name, NAME_LENGTH);
|
||||
#if PACKETVER < 20100803
|
||||
memset(WFIFOP(fd,4 + c*offset+24), 0, NAME_LENGTH); // account name (not used for security reasons)
|
||||
memcpy(WFIFOP(fd,4 + c*offset+48), e->mes, 40);
|
||||
#else
|
||||
memcpy(WFIFOP(fd,4 + c*offset+24), e->mes, 40);
|
||||
#endif
|
||||
c++;
|
||||
if( e.account_id == 0 ){
|
||||
continue;
|
||||
}
|
||||
|
||||
PACKET_ZC_BAN_LIST_sub& banned = p->chars[c];
|
||||
|
||||
#if PACKETVER >= 20161019
|
||||
banned.char_id = e.char_id;
|
||||
#elif PACKETVER < 20100803
|
||||
// account name (not used for security reasons)
|
||||
safestrncpy(banned.account_name, "", sizeof(banned.account_name));
|
||||
#endif
|
||||
|
||||
#if PACKETVER >= 20200902 || PACKETVER < 20161019
|
||||
safestrncpy(banned.char_name, e.name, sizeof(banned.char_name));
|
||||
#endif
|
||||
|
||||
safestrncpy(banned.message, e.mes, sizeof(banned.message));
|
||||
p->packetLen += static_cast<decltype(p->packetLen)>(sizeof(banned));
|
||||
c++;
|
||||
}
|
||||
WFIFOW(fd,2) = 4 + c*offset;
|
||||
WFIFOSET(fd,WFIFOW(fd,2));
|
||||
|
||||
clif_send(p,p->packetLen,&sd.bl,SELF);
|
||||
}
|
||||
|
||||
|
||||
@ -14102,7 +14103,7 @@ void clif_parse_GuildRequestInfo(int fd, map_session_data *sd)
|
||||
clif_guild_skillinfo( *sd );
|
||||
break;
|
||||
case 4: // Expulsion list
|
||||
clif_guild_expulsionlist(sd);
|
||||
clif_guild_expulsionlist(*sd);
|
||||
break;
|
||||
default:
|
||||
ShowError("clif: guild request info: unknown type %d\n", type);
|
||||
|
@ -180,7 +180,6 @@
|
||||
packet(0x015f,42);
|
||||
packet(0x0160,-1);
|
||||
parseable_packet(0x0161,-1,clif_parse_GuildChangePositionInfo,2,4);
|
||||
packet(0x0163,-1);
|
||||
packet(0x0164,-1);
|
||||
parseable_packet(0x0165,30,clif_parse_CreateGuild,2,6);
|
||||
packet(0x0166,-1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user