diff options
author | panikon <panikon@zoho.com> | 2014-05-06 21:14:46 -0300 |
---|---|---|
committer | panikon <panikon@zoho.com> | 2014-05-06 21:14:46 -0300 |
commit | 9a425c11b61fb6f4e299013c7d8d9841129b8f45 (patch) | |
tree | b8e8bc56c6e51679c23fe2de0e268f49b29f7288 /src/char/int_guild.c | |
parent | 9cf6b362a0d5e2f52c017d747c0fa8f69a1a273f (diff) | |
download | hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.gz hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.bz2 hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.tar.xz hercules-9a425c11b61fb6f4e299013c7d8d9841129b8f45.zip |
Bug fixes and other changes
#Fixed issue where a corrupted map cache would lead to a crash
*Moved Big-endian compatibility functions to common/utils.h
#Fixed issue 8162
*http://hercules.ws/board/tracker/issue-8162-loadnpc-doesnt-trigger-oninit-of-duplicate-npcs/
*Added options to npc_parse_duplicate
#Fixed issue 8169
*http://hercules.ws/board/tracker/issue-8169-script-command-guildskill-skill-idlevel-not-working-as-intended/
*Changed *guildskill behavior, now it behaves exactly as depicted in the documentation
*Updated *guildskill documentation
#Added missing GBI types to mapif_parse_GuildBasicInfoChange now it's possible to change guild exp, lv, skill point and skill information
#GeoIP revamp
*GeoIP module was partially rewritten
*Added several data checks to prevent corruption and crashes
*Updated GeoIP database
*See https://github.com/maxmind/geoip-api-c/blob/master/libGeoIP/GeoIP.c for more information
#Added packetver checks regarding NST_MARKET
*Now *tradertype warns if user is trying to use this feature with older clients
Diffstat (limited to 'src/char/int_guild.c')
-rw-r--r-- | src/char/int_guild.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 28b803027..d8556f023 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -1421,29 +1421,61 @@ int mapif_parse_GuildMessage(int fd,int guild_id,int account_id,char *mes,int le return mapif_guild_message(guild_id,account_id,mes,len, fd); } -// Modification of the guild +/** + * Changes basic guild information + * The types are available in mmo.h::guild_basic_info + **/ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len) { struct guild *g; - short value = *((const int16 *)data); + struct guild_skill gd_skill; + short value; g = inter_guild_fromsql(guild_id); - if(g==NULL) + + if( g == NULL ) return 0; switch(type) { + case GBI_EXP: + value = *((const int16 *)data); + if( g->exp+value < 0 ) + return 0; + g->exp += value; + guild_calcinfo(g); + break; + case GBI_GUILDLV: + value = *((const int16 *)data); if (value > 0 && g->guild_lv + value <= MAX_GUILDLEVEL) { g->guild_lv += value; g->skill_point += value; } else if (value < 0 && g->guild_lv + value >= 1) g->guild_lv += value; - mapif_guild_info(-1,g); - g->save_flag |= GS_LEVEL; - return 0; - default: - ShowError("int_guild: GuildBasicInfoChange: Unknown type %d\n",type); break; + + case GBI_SKILLPOINT: + value = *((const int16 *)data); + if( g->skill_point+value < 0 ) + return 0; + g->skill_point += value; + break; + + case GBI_SKILLLV: + gd_skill = *((const struct guild_skill*)data); + memcpy(&(g->skill[(gd_skill.id - GD_SKILLBASE)]), &gd_skill, sizeof(gd_skill)); + if( !guild_calcinfo(g) ) + mapif_guild_info(-1,g); + g->save_flag |= GS_SKILL; + mapif_guild_skillupack(g->guild_id, gd_skill.id, 0); + break; + + default: + ShowError("int_guild: GuildBasicInfoChange: Unknown type %d, see mmo.h::guild_basic_info for more information\n",type); + return 0; } - mapif_guild_basicinfochanged(guild_id,type,data,len); + mapif_guild_info(-1,g); + g->save_flag |= GS_LEVEL; + // Information is already sent in mapif_guild_info + //mapif_guild_basicinfochanged(guild_id,type,data,len); return 0; } |