diff options
author | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-26 19:44:00 +0000 |
---|---|---|
committer | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-26 19:44:00 +0000 |
commit | d73cbd4c778f408ce3e06c57ad6418b99e2b9c51 (patch) | |
tree | 7e0eccf71218102b49424879e1ff6d8bf5ae05af /src/char_sql/int_guild.c | |
parent | 23180e04bdb7a2dfb95da6fb6ab0026fb4ea8b0d (diff) | |
download | hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.tar.gz hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.tar.bz2 hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.tar.xz hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.zip |
updates
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@793 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/int_guild.c')
-rw-r--r-- | src/char_sql/int_guild.c | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c index df3ec4d81..dedabfab7 100644 --- a/src/char_sql/int_guild.c +++ b/src/char_sql/int_guild.c @@ -1235,12 +1235,14 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id, { // Could speed up by manipulating only guild_member struct guild * g= inter_guild_fromsql(guild_id); - int i,alv,c; + int i,alv,c, idx; if(g==NULL||g->guild_id<=0) return 0; g->connect_member=0; + + idx = -1; for(i=0,alv=0,c=0;i<g->max_member;i++){ if( g->member[i].account_id==account_id && @@ -1250,6 +1252,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id, g->member[i].lv=lv; g->member[i].class=class; mapif_guild_memberinfoshort(g,i); + idx = i; } if( g->member[i].account_id>0 ){ alv+=g->member[i].lv; @@ -1260,8 +1263,14 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id, } // •½‹ÏƒŒƒxƒ‹ g->average_lv=alv/c; - - inter_guild_tosql(g,3); // Change guild & guild_member + + sprintf(tmp_sql, "UPDATE `%s` SET `connect_member`=%d,`average_lv`=%d WHERE `guild_id`='%d'", guild_db, g->connect_member, g->average_lv, g->guild_id); + if(mysql_query(&mysql_handle, tmp_sql) ) + printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); + + sprintf(tmp_sql, "UPDATE `%s` SET `online`=%d,`lv`=%d,`class`=%d WHERE `char_id`=%d", guild_member_db, g->member[idx].online, g->member[idx].lv, g->member[idx].class, g->member[idx].char_id); + if(mysql_query(&mysql_handle, tmp_sql) ) + printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); return 0; } @@ -1385,21 +1394,34 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha } switch(type){ case GMI_POSITION: // –ðE - g->member[i].position=*((int *)data); - break; - case GMI_EXP: { // EXP - int exp,oldexp=g->member[i].exp; - exp=g->member[i].exp=*((unsigned int *)data); - g->exp+=(exp-oldexp); - guild_calcinfo(g); // LvƒAƒbƒv”»’f - mapif_guild_basicinfochanged(guild_id,GBI_EXP,&g->exp,4); - }break; + { + g->member[i].position=*((int *)data); + mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + inter_guild_tosql(g,3); // Change guild & guild_member + break; + } + case GMI_EXP: + { // EXP + int exp,oldexp=g->member[i].exp; + exp=g->member[i].exp=*((unsigned int *)data); + g->exp+=(exp-oldexp); + guild_calcinfo(g); // LvƒAƒbƒv”»’f + mapif_guild_basicinfochanged(guild_id,GBI_EXP,&g->exp,4); + mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); + + sprintf(tmp_sql, "UPDATE `%s` SET `guild_lv`=%d,`connect_member`=%d,`max_member`=%d,`average_lv`=%d,`exp`=%d,`next_exp`=%d,`skill_point`=%d WHERE `guild_id`='%d'", guild_db, g->guild_lv, g->connect_member, g->max_member, g->average_lv, g->exp, g->next_exp, g->skill_point, g->guild_id); + if(mysql_query(&mysql_handle, tmp_sql) ) + printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); + + sprintf(tmp_sql, "UPDATE `%s` SET `exp`=%d WHERE `char_id`=%d", guild_member_db, g->member[i].exp, g->member[i].char_id); + if(mysql_query(&mysql_handle, tmp_sql) ) + printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); + break; + } default: - printf("int_guild: GuildMemberInfoChange: Unknown type %d\n",type); - break; + printf("int_guild: GuildMemberInfoChange: Unknown type %d\n",type); + break; } - mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); - inter_guild_tosql(g,3); // Change guild & guild_member return 0; } |