yuhsing

Untitled

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