viewing paste Unknown #12723 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
-   shop    tax_Shop    -1,909:100
 
 
prontera,155,181,5  script  Sample#taxshop  757,{
function getGuildLeader;
 
set .@Guild,getGuildLeader();
if( select( "Open Shop",( .@Guild >= 0 )?"Collect Tax : ^0055FF"++" Zeny^000000":"" ) == 1 ){
    mes "A Total of "+.TaxRate+"% Tax will be transfer to "+getarraysize( .CastleMap$ )+" Castle Guild equally.";
    callshop "tax_Shop",1;
    npcshopattach "tax_Shop";
    end;
}else{
    mes "Gained total of "+getd( "$GuildTax_"+.@Guild )+" Zeny.";
    mes "Tax is shared equally among "+getarraysize( .CastleMap$ )+" Castle Guild.";
    if( select("Collect:Cancel") == 1 ){
        set Zeny,Zeny + getd( "$GuildTax_"+.@Guild );
        setd( "$GuildTax_"+.@Guild ),0;
        mes "Tax Collected.";
    }
}
close;
 
function    getGuildLeader  {
// Check Player is Guild Master or not.
for( set .@i,0; .@i < getarraysize( .CastleMap$ ); set .@i,.@i + 1 )
    if( getcharid(0) == getguildmasterid( getcastledata( .CastleMap$[.@i],1 ) ) )
        retuurn .@i;
return -1;
}
 
OnBuyItem:
    set .@TotalCost,0;
    // Calculate Total Cost
    for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1)
        for(set .@j,0; .@j < getarraysize( .Items ); set .@j,.@j+1)
            if( .Items[.@j] == @bought_nameid[.@i] )
            set .@TotalCost,.@TotalCost + ( .Costs[.@j] * @bought_quantity[.@i] );
    if( Zeny >= .@TotalCost ){
        // Deduct Zeny + Gain Items.
        set Zeny,Zeny - .@TotalCost;
        for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1)
            getitem @bought_nameid[.@i],@bought_quantity[.@i];
            
        // Assign Tax Amount equally to other Guilds.
        for( set .@i,0; .@i < getarraysize( .CastleMap$ ); set .@i,.@i + 1 )
            setd( "$GuildTax_"+.@i ),getd( "$GuildTax_"+.@i ) + ( (( .@TotalCost * .TaxRate ) / 100 ) / getarraysize( .CastleMap$ ) );
            
        // Notification on Total Tax Received by Guild.
        message strcharinfo(0),"Total Tax Received by Guild : "+(( .@TotalCost * .TaxRate ) / 100 )+" Zeny";
    }else{
        mes "You dont have enough Zeny...";
    }
    close;
 
 
OnInit:
// Castle Map Name
setarray .CastleMap$,"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05";
// Tax Gained upon purchasing
set .TaxRate,10;
// Item List + Cost
setarray .Items[0],607,608,512;
setarray .Costs[0],100,200,300;
 
npcshopitem "tax_Shop",512,1000;
npcshopdelitem "tax_Shop",512;
for(set .@i,0; .@i < getarraysize( .Items ); set .@i,.@i+1)
    npcshopadditem "tax_Shop",.Items[.@i],.Costs[.@i];
end;
 
}
 
Viewed 744 times, submitted by Guest.