Fixed gm_all_skill, bugreport:5239

Removed broken skills from skill tree, so @allskill doesn't give resource errors when gm_all_skill is enabled.
Increased maximum client packet size drop limit (was limiting gm_all_skill unnecessarily since the client doesn't crash with it)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15462 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
shennetsind 2012-01-15 04:50:51 +00:00
parent 848a78d462
commit dad1da6ed2
3 changed files with 50 additions and 23 deletions

View File

@ -8,12 +8,12 @@ debug: no
// How long can a socket stall before closing the connection (in seconds)
stall_time: 60
// Maximum allowed size for clients packets in bytes (default: 20480).
// Maximum allowed size for clients packets in bytes (default: 24576).
// NOTE: To reduce the size of reported packets, lower the values of defines, which
// have been customized, such as MAX_STORAGE, MAX_GUILD_STORAGE or MAX_CART.
// NOTE: Do not modify this setting, unless the client has been modified to support
// larger packets. The client will crash, when it receives larger packets.
socket_max_client_packet: 20480
socket_max_client_packet: 24576
//----- IP Rules Settings -----

View File

@ -208,7 +208,7 @@ int naddr_ = 0; // # of ip addresses
// Maximum packet size in bytes, which the client is able to handle.
// Larger packets cause a buffer overflow and stack corruption.
static size_t socket_max_client_packet = 20480;
static size_t socket_max_client_packet = 24576;
// initial recv buffer size (this will also be the max. size)
// biggest known packet: S 0153 <len>.w <emblem data>.?B -> 24x24 256 color .bmp (0153 + len.w + 1618/1654/1756 bytes)
@ -660,19 +660,20 @@ int WFIFOSET(int fd, size_t len)
return 0;
}
if( !s->flag.server && len > socket_max_client_packet )
{// see declaration of socket_max_client_packet for details
if( !s->flag.server ) {
if( len > socket_max_client_packet ) {// see declaration of socket_max_client_packet for details
ShowError("WFIFOSET: Dropped too large client packet 0x%04x (length=%u, max=%u).\n", WFIFOW(fd,0), len, socket_max_client_packet);
return 0;
}
if( !s->flag.server && s->wdata_size+len > WFIFO_MAX )
{// reached maximum write fifo size
if( s->wdata_size+len > WFIFO_MAX ) {// reached maximum write fifo size
ShowError("WFIFOSET: Maximum write buffer size for client connection %d exceeded, most likely caused by packet 0x%04x (len=%u, ip=%lu.%lu.%lu.%lu).\n", fd, WFIFOW(fd,0), len, CONVIP(s->client_addr));
set_eof(fd);
return 0;
}
}
s->wdata_size += len;
//If the interserver has 200% of its normal size full, flush the data.
if( s->flag.server && s->wdata_size >= 2*FIFOSIZE_SERVERLINK )

View File

@ -1282,10 +1282,31 @@ int pc_calc_skilltree(struct map_session_data *sd)
}
}
if( battle_config.gm_allskill > 0 && pc_isGM(sd) >= battle_config.gm_allskill )
{
for( i = 0; i < MAX_SKILL; i++ )
{
if( battle_config.gm_allskill > 0 && pc_isGM(sd) >= battle_config.gm_allskill ) {
for( i = 0; i < MAX_SKILL; i++ ) {
switch(i) {
/**
* Dummy skills must be added here otherwise they'll be displayed in the,
* skill tree and since they have no icons they'll give resource errors
**/
case AB_DUPLELIGHT_MELEE:
case AB_DUPLELIGHT_MAGIC:
case WL_CHAINLIGHTNING_ATK:
case WL_TETRAVORTEX_FIRE:
case WL_TETRAVORTEX_WATER:
case WL_TETRAVORTEX_WIND:
case WL_TETRAVORTEX_GROUND:
case WL_SUMMON_ATK_FIRE:
case WL_SUMMON_ATK_WIND:
case WL_SUMMON_ATK_WATER:
case WL_SUMMON_ATK_GROUND:
case LG_OVERBRAND_BRANDISH:
case LG_OVERBRAND_PLUSATK:
case ALL_BUYING_STORE:
continue;
default:
break;
}
if( skill_get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL) )
continue; //Only skills you can't have are npc/guild ones
if( skill_get_max(i) > 0 )
@ -5509,12 +5530,17 @@ int pc_allskillup(struct map_session_data *sd)
{ //Get ALL skills except npc/guild ones. [Skotlex]
//and except SG_DEVIL [Komurka] and MO_TRIPLEATTACK and RG_SNATCHER [ultramage]
for(i=0;i<MAX_SKILL;i++){
if(!(skill_get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL)) && i!=SG_DEVIL && i!=MO_TRIPLEATTACK && i!=RG_SNATCHER)
switch( i ) {
case SG_DEVIL:
case MO_TRIPLEATTACK:
case RG_SNATCHER:
continue;
default:
if( !(skill_get_inf2(i)&(INF2_NPC_SKILL|INF2_GUILD_SKILL)) )
sd->status.skill[i].lv=skill_get_max(i);//Nonexistant skills should return a max of 0 anyway.
}
}
else
{
} else {
int inf2;
for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[pc_class2idx(sd->status.class_)][i].id)>0;i++){
inf2 = skill_get_inf2(id);