schan 8 Posted February 11, 2014 (edited) Hi, I need to add something like vending_tax in items_conf but instead of giving tax for all, I'd like to add a separate tax for Guild members and Guild allies. These are the changes I made: srcmapbattle.c line 6490 +{ "vending_tax_ally", &battle_config.vending_tax_ally, 0, 0, 10000, }, srcmapbattle.h line 257 +int vending_tax_ally; confbattleitems_conf.txt +vending_tax_ally: 1200 srcmapvending.c line 162 +//-- Check for Guild/Ally+ if( guild->check_member == 1 || guild->check_alliance == 0 ){+ pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);+ if( battle_config.vending_tax_ally )+ z -= z * (battle_config.vending_tax_ally/10000.);+ pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);+ } else+//-- pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); if( battle_config.vending_tax ) z -= z * (battle_config.vending_tax/10000.); pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd); I'm not sure with what I did but it didn't work as expected. No errors were returned after compiling. Did I miss anything? Thank you! Edited February 11, 2014 by schan Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 15, 2014 spoon feed http://upaste.me/c52f10622f5d13d72 Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 11, 2014 first of all, do you know vending_tax is actually means the vendor has lesser income ? your source mod actually means ... if the buyer is guild member or guild ally, then vendor will be tax by that rate isn't the idea quite conflict ? and to add check guild or allies, it should be {struct guild *g = guild_search( sd->status.guild_id );if ( sd->status.guild_id == vsd->status.guild.id ||g->alliance[0].guild_id == vsd->status.guild.id ||g->alliance[1].guild_id == vsd->status.guild.id ||g->alliance[2].guild_id == vsd->status.guild.id )<is a guild member or ally guild member>;else<false condition>;} Quote Share this post Link to post Share on other sites
0 schan 8 Posted February 12, 2014 (edited) first of all, do you know vending_tax is actually means the vendor has lesser income ? your source mod actually means ... if the buyer is guild member or guild ally, then vendor will be tax by that rate isn't the idea quite conflict ? and to add check guild or allies, it should be {struct guild *g = guild_search( sd->status.guild_id );if ( sd->status.guild_id == vsd->status.guild.id ||g->alliance[0].guild_id == vsd->status.guild.id ||g->alliance[1].guild_id == vsd->status.guild.id ||g->alliance[2].guild_id == vsd->status.guild.id )<is a guild member or ally guild member>;else<false condition>;} I got this error Annie on compiling. vending.c: In function ‘vending_purchasereq’:vending.c:163: warning: implicit declaration of function ‘guild_search’vending.c:163: warning: initialization makes pointer from integer without a castvending.c:165: error: ‘struct mmo_charstatus’ has no member named ‘guild’make[1]: *** [obj_sql/vending.o] Error 1make[1]: Leaving directory `/root/Desktop/trunk/src/map'make: *** [map_sql] Error 2 Edit: I changed guild_search to guild->search and left me with this error vending.c: In function ‘vending_purchasereq’:vending.c:165: error: ‘struct mmo_charstatus’ has no member named ‘guild’make[1]: *** [obj_sql/vending.o] Error 1make[1]: Leaving directory `/root/Desktop/trunk/src/map'make: *** [map_sql] Error 2 Edited February 12, 2014 by schan Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 12, 2014 ACMD(chkally) { struct guild * g = guild->search( sd->status.guild_id ); struct map_session_data * pl_sd = map->nick2sd( message ); if ( !message || !*message ) { clif->message( fd, "empty" ); return false; } else if ( !g ) { clif->message( fd, "you don't have a guild" ); return false; } else if ( !pl_sd ) { clif->message( fd, "the input player is not exist or not online" ); return false; } else { struct guild * pl_g = guild->search( pl_sd->status.guild_id ); int i = 0; if ( !pl_g ) { clif->message( fd, "the input player doesn't have a guild" ); return false; } ARR_FIND( 0, MAX_GUILDALLIANCE, i, pl_sd->status.guild_id == g->alliance[i].guild_id ); if ( sd->status.guild_id == pl_sd->status.guild_id || i < MAX_GUILDALLIANCE ) { clif->message( fd, "that player is your guild member or guild ally" ); return true; } else { clif->message( fd, "that player is not your guild member or ally" ); return true; } }} ACMD_DEF(chkally), Quote Share this post Link to post Share on other sites
0 schan 8 Posted February 13, 2014 ACMD(chkally) { struct guild * g = guild->search( sd->status.guild_id ); struct map_session_data * pl_sd = map->nick2sd( message ); if ( !message || !*message ) { clif->message( fd, "empty" ); return false; } else if ( !g ) { clif->message( fd, "you don't have a guild" ); return false; } else if ( !pl_sd ) { clif->message( fd, "the input player is not exist or not online" ); return false; } else { struct guild * pl_g = guild->search( pl_sd->status.guild_id ); int i = 0; if ( !pl_g ) { clif->message( fd, "the input player doesn't have a guild" ); return false; } ARR_FIND( 0, MAX_GUILDALLIANCE, i, pl_sd->status.guild_id == g->alliance[i].guild_id ); if ( sd->status.guild_id == pl_sd->status.guild_id || i < MAX_GUILDALLIANCE ) { clif->message( fd, "that player is your guild member or guild ally" ); return true; } else { clif->message( fd, "that player is not your guild member or ally" ); return true; } }} ACMD_DEF(chkally), This is what I did: //-- Check for Guild/Ally ACMD_DEF(chkally){ pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); if( battle_config.vending_tax_ally ) z -= z * (battle_config.vending_tax_ally/10000.); pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd); } else//-- pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); if( battle_config.vending_tax ) z -= z * (battle_config.vending_tax/10000.); pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd); Error: vending.c: In function ‘vending_purchasereq’:vending.c:163: warning: implicit declaration of function ‘ACMD_DEF’vending.c:163: error: ‘chkally’ undeclared (first use in this function)vending.c:163: error: (Each undeclared identifier is reported only oncevending.c:163: error: for each function it appears in.)vending.c:163: error: expected ‘;’ before ‘{’ tokenmake[1]: *** [obj_sql/vending.o] Error 1make[1]: Leaving directory `/root/Desktop/trunk/src/map'make: *** [map_sql] Error 2 Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 13, 2014 (edited) hmm ... you are quite supportive in script section but it seems you can't read source code yet ACMD_DEF(chkally),I am actually writing an atcommand inside atcommand.cI wrote that and tested so to make sure my compiler doesn't throw error, and its working in my test server put them inside atcommand.c, and you can type "@chkally AnnieRuru" to check the player is your guild member or guild ally the part that you need to refer, is only just this struct guild * g = guild->search( sd->status.guild_id ); if ( !g ) { clif->message( fd, "you don't have a guild" ); return false; }...................... int i = 0; ARR_FIND( 0, MAX_GUILDALLIANCE, i, pl_sd->status.guild_id == g->alliance[i].guild_id ); if ( sd->status.guild_id == pl_sd->status.guild_id || i < MAX_GUILDALLIANCE ) { clif->message( fd, "that player is your guild member or guild ally" ); return true; } else { clif->message( fd, "that player is not your guild member or ally" ); return true; }.. ... 1 more chance and I'll spoon feed =/ Edited February 13, 2014 by AnnieRuru Quote Share this post Link to post Share on other sites
0 schan 8 Posted February 15, 2014 hmm ... you are quite supportive in script section but it seems you can't read source code yet ACMD_DEF(chkally),I am actually writing an atcommand inside atcommand.cI wrote that and tested so to make sure my compiler doesn't throw error, and its working in my test server put them inside atcommand.c, and you can type "@chkally AnnieRuru" to check the player is your guild member or guild ally the part that you need to refer, is only just this struct guild * g = guild->search( sd->status.guild_id ); if ( !g ) { clif->message( fd, "you don't have a guild" ); return false; }...................... int i = 0; ARR_FIND( 0, MAX_GUILDALLIANCE, i, pl_sd->status.guild_id == g->alliance[i].guild_id ); if ( sd->status.guild_id == pl_sd->status.guild_id || i < MAX_GUILDALLIANCE ) { clif->message( fd, "that player is your guild member or guild ally" ); return true; } else { clif->message( fd, "that player is not your guild member or ally" ); return true; }.. ... 1 more chance and I'll spoon feed =/ No errors after compiling but there is a problem. Tax won't apply and instead, more zennies were added to the seller. Here's what I did: //-- Tax for guild/allies struct guild * g = guild->search( sd->status.guild_id ); ARR_FIND( 0, MAX_GUILDALLIANCE, i, sd->status.guild_id == g->alliance[i].guild_id ); if ( sd->status.guild_id == sd->status.guild_id || i < MAX_GUILDALLIANCE ) { pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); if( battle_config.vending_tax_ally ) z -= z * (battle_config.vending_tax_ally/10000.); pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd); } else {//-- pc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd); if( battle_config.vending_tax ) z -= z * (battle_config.vending_tax/10000.); pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd); } I'm new to this and I'm just trying to learn it now. /sry Quote Share this post Link to post Share on other sites
0 schan 8 Posted February 15, 2014 spoon feed http://upaste.me/c52f10622f5d13d72 It is working now but one slight problem. A 1% tax is being added to vending_tax/vending_tax_ally and I don't know where it's coming from. Workaround I did is to subtract 1% tax in items_conf. Thank you so much AnnieRuru! You've been a great help! and sorry for the spoon feeding. Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 15, 2014 hmm ? how come ? with the patch, I put 0 on vending_tax and vending_tax_allies the vendor gets the full money from the purchase Quote Share this post Link to post Share on other sites
0 schan 8 Posted February 15, 2014 Yeah that's weird. I tried setting tax to 0 and gave the full money too but when I tried setting a tax it always add +1%. Don't mind this. I'll be using the workaround. Thank you for your help Annie! Quote Share this post Link to post Share on other sites
Hi,
I need to add something like vending_tax in items_conf but instead of giving tax for all, I'd like to add a separate tax for Guild members and Guild allies.
These are the changes I made:
srcmapbattle.c
line 6490
srcmapbattle.h
line 257
confbattleitems_conf.txt
srcmapvending.c
line 162
I'm not sure with what I did but it didn't work as expected. No errors were returned after compiling.
Did I miss anything?
Thank you!
Edited by schanShare this post
Link to post
Share on other sites