Advertisement
Emistry

[RO] Guild Potion Invest

Sep 10th, 2018
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. // https://rathena.org/board/topic/115640-custom-guild-pot-npc/
  2.  
  3.  
  4. - script guild_potion_invest_main -1,{
  5.  
  6. function func_GuildPotHealRate {
  7. .@total_invest = getarg(0, 0);
  8. if (.@total_invest >= 1000000000) return 20;
  9. else if (.@total_invest > 600000000) return 12;
  10. else if (.@total_invest > 400000000) return 8;
  11. else if (.@total_invest > 200000000) return 4;
  12. else if (.@total_invest > 100000000) return 2;
  13. else return 1;
  14. }
  15.  
  16. OnInit:
  17. .item_id = 512;
  18. setitemscript .item_id, "{ doevent \"guild_potion_invest_main::OnConsume\"; }", 0;
  19. end;
  20.  
  21. OnConsume:
  22. .@gid = getcharid(2);
  23. if (.@gid) {
  24. .@heal_rate = func_GuildPotHealRate(getd("$gid_pot_invest_"+.@gid));
  25. percentheal .@heal_rate, .@heal_rate;
  26. }
  27. end;
  28.  
  29. OnTalk:
  30. .@gid = getcharid(2);
  31. if (.@gid) {
  32. .@total_invest = getd("$gid_pot_invest_"+.@gid);
  33. mes "Current Investment: " + F_InsertComma(.@total_invest) + "z";
  34. mes "Guild Potion Heal Rate: " + func_GuildPotHealRate(.@total_invest);
  35. if (.@total_invest < 1000000000) {
  36. mes " ";
  37. mes "Do you wish to invest in your guild?";
  38. if (select("Yes", "Cancel") == 1) {
  39. mes "Input Zeny.";
  40. input .@zeny, 0, Zeny;
  41. if (select("Confirm", "Cancel") == 1) {
  42. Zeny -= .@zeny;
  43. setd("$gid_pot_invest_"+.@gid, getd("$gid_pot_invest_"+.@gid) + .@zeny);
  44. .@total_invest = getd("$gid_pot_invest_"+.@gid);
  45.  
  46. mes "You have invested " + F_InsertComma(.@zeny) + " zeny";
  47. mes "Guild Potion Heal Rate: " + func_GuildPotHealRate(.@total_invest);
  48. }
  49. }
  50. }
  51. }
  52. end;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement