Global_Functions.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //============================================================
  2. //===== rAthena Script =======================================
  3. //= Global Functions
  4. //===== Description: =========================================
  5. //= General script functions.
  6. //===== Changelogs: ==========================================
  7. //= 1.0 WoeTETimeStart(X) function check if the woe
  8. // will start in X seconds or less. [Capuche]
  9. //============================================================
  10. // WoeTETimeStart(<seconds>) : return true if the woe te will start in X seconds or less, false otherwise
  11. function script WoeTETimeStart {
  12. .@woe_status = agitcheck3();
  13. .@min_today = gettime(DT_MINUTE);
  14. .@hour_today = gettime(DT_HOUR);
  15. .@day_today = gettime(DT_DAYOFWEEK);
  16. if (getvariableofnpc( getd( ".day_"+ .@day_today ),"woe_TE_contoller" )) {
  17. .@h = getvariableofnpc( getd( ".hour_start_"+ .@hour_today ),"woe_TE_contoller" );
  18. if (.@h > .@hour_today) {
  19. .@time = (60 - .@min_today) *60 + ( .@h - .@hour_today -1 ) *3600;
  20. if (.@time <= getarg(0))
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. function script F_22507 {// ShabbyOldScroll
  27. .@r = rand(1,10);
  28. if (.@r == 1) warp "pay_fild01",141,211;
  29. else if (.@r == 2) warp "payon_in03",99,190;
  30. else if (.@r == 3) warp "pay_dun04",120,116;
  31. else if (.@r == 4) warp "pay_gld",202,186;
  32. else if (.@r == 5) warp "gld_dun01",61,155;
  33. else if (.@r == 6) warp "pay_fild04",348,333;
  34. else if (.@r == 7) warp "payon_in02",17,62;
  35. else if (.@r == 8) warp "payon_in01",144,15;
  36. else if (.@r == 9) warp "pay_fild07",200,186;
  37. else if (.@r == 10) warp "pay_fild10",147,267;
  38. end;
  39. }
  40. // Return a value according to the quests states.
  41. // -1 : One of the quest has a different state
  42. // 0 : All the quests are not started
  43. // 1 : All the quests are started
  44. // 2 : All the quests are completed
  45. function script F_queststatus {
  46. .@type = getarg(0);
  47. .@base = checkquest(getarg(1),.@type);
  48. .@size = getargcount();
  49. for ( .@i = 2; .@i < .@size; ++.@i ) {
  50. if (checkquest(getarg(.@i),.@type) != .@base)
  51. return -1;
  52. }
  53. switch( .@base ) {
  54. case -1:
  55. return 0;
  56. case 0:
  57. case 1:
  58. return 1;
  59. case 2:
  60. return 2;
  61. }
  62. end;
  63. }