Advertisement
Guest User

Rebirth System - OldEmulator Version

a guest
Apr 15th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. ---------------------------------------------------------
  2. -- By Dastgir Pojee -----
  3. -- Version 1.1 -----
  4. ---------------------------------------------------------
  5.  
  6. veil.gat,106,125,5 script Sistema de Resets 866,{
  7. function checkItem; // check if player have all item required
  8. function colorItemrequired; // color the text. Red : not enough item, green otherwise
  9. function deleteItem; // delete all items required
  10. function displayItemneed; // display all items need at start
  11. function getItemReward; // give the items reward
  12. function weightreq; // check if your current weight is highter than weight high novice
  13.  
  14. mes "^11E6D0[Rebirth System]^000000";
  15. mes "Em que posso ajudar?";
  16. switch( select( "^777777~ Ranking", "~ Resetar", "~ Infos", "~ Cancelar^000000" ) ) {
  17. case 1:
  18. query_sql "SELECT `name`,`num_rebirth` FROM `rebirth_system` ORDER BY `num_rebirth` DESC LIMIT "+.list,@name$,@num_rebirth;
  19. if(getarraysize(@name$)==0){mes "^F20808 Nenhum registro encontrado ^000000"; close;}
  20. next;
  21. mes "^0814F2[Nome do Char]^000000 - ^B308F2[Resets]^000000";
  22. for (set .i,0; .i < getarraysize(@name$); set .i,.i+1){
  23. mes (.@i+1) +".) ^0814F2["+ @name$[.@i] +"]^000000 - ^B308F2["+ @num_rebirth[.@i] +"]^000000";
  24. }
  25. deletearray @name$[0],.list; deletearray @num_rebirth[0],.list;
  26. close;
  27. case 2:
  28. set .@eac,eaclass();
  29. if( NextJobExp || NextBaseExp || !( .@eac&(.job_rebirth) ) || !Upper ) {
  30. mes "Você precisa estar no Level/Job Máximo para resetar.";
  31. close;
  32. }
  33.  
  34. mes "Itens Necessários :";
  35. displayItemneed();
  36. next;
  37. mes "^11E6D0[Rebirth System]^000000";
  38. weightreq();
  39. checkItem();
  40. deleteItem();
  41. break;
  42. case 3:
  43. switch(.reset_opt){
  44. case 1:
  45. mes "O seu Level de Base e Job serão resetados, assim como seus atributos e skills.";
  46. break;
  47. case 2:
  48. mes "Your BaseLevel,JobLevel And SkillPoints will be Reset.";
  49. break;
  50. case 3:
  51. mes "You will be Changed to BaseLevel 1 with JobLevel and Skills/Stats Unaffected, For Rebirth, you will need some items.";
  52. break;
  53. case 4:
  54. mes "You will be Changed to JobLevel 1 with BaseLevel and Skills/Stats Unaffected";
  55. break;
  56.  
  57. }
  58. mes "Você precisará de alguns itens para resetar..";
  59. close;
  60. case 4:
  61. mes "Até.";
  62. close;
  63. }
  64. set num_rebirth,num_rebirth+1;
  65. resetlvl(.reset_opt);
  66. getItemReward();
  67. query_sql "INSERT INTO `rebirth_system` (`char_id`,`name`,`num_rebirth`) VALUES ("+getcharid(0)+",'"+strcharinfo(0)+"',"+num_rebirth+") ON DUPLICATE KEY UPDATE `num_rebirth`="+num_rebirth+"";
  68. mes "You have taken Rebirth.";
  69. announce "[ Sistema de Resets ] : "+ strcharinfo(0) +" resetou pela "+ num_rebirth +" vez !", 0;
  70. close;
  71.  
  72.  
  73.  
  74. function checkItem {
  75. for (set .@i,0 ; .@i < .size_item; set .@i,.@i+2 ){
  76. if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] ) {
  77. mes "Você não tem a quantidade necessária ^E6DB11"+ getitemname( .item_req[.@i] ) +"^000000. ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] ) +"]^000000";
  78. close;
  79. }
  80. }
  81. return;
  82. }
  83.  
  84. function colorItemrequired {
  85. if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] ) return "^ff0000";
  86. return "^00ff00";
  87. }
  88.  
  89. function deleteItem {
  90. for (set .@i,0 ; .@i < .size_item; set .@i,.@i+2 ){
  91. delitem .item_req[.@i], ( .item_req[ .@i+1 ] );
  92. }
  93. return;
  94. }
  95.  
  96. function displayItemneed {
  97. for (set .@i,0 ; .@i < .size_item; set .@i,.@i+2 ){
  98. mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] ) +" "+ getitemname( .item_req[.@i] );
  99. }
  100. return;
  101. }
  102.  
  103. function getItemReward {
  104. for (set .@i,0 ; .@i < .size_reward; set .@i,.@i+3 ){
  105. if (rand(1,10000) <= .reward[.@i+2]){
  106. getitem .reward[.@i], .reward[ .@i+1 ];
  107. }
  108. }
  109. return;
  110. }
  111.  
  112. function weightreq {
  113. if ( Weight > 20000 ) {
  114. mes "Você está com muito peso. Seu peso será muito grande após resetar.";
  115. close;
  116. }
  117. return;
  118. }
  119.  
  120. OnInit:
  121. // item required <item ID>, <number>
  122. setarray .item_req, 501, 5,
  123. 502, 2,
  124. 503, 3;
  125. set .size_item,getarraysize( .item_req );
  126.  
  127. // rewards <item ID>, <quantity>,<chance(10000=100%)>
  128. // recalculates the chance and gives the next reward if chance is met.
  129. setarray .reward, 504, 1, 10000,
  130. 501, 5, 10000;
  131. set .size_reward,getarraysize( .reward );
  132.  
  133. set .list,10; //Show Top x in Ranking
  134.  
  135. set .job_rebirth,EAJL_2; //EAJL_THIRD = Third Job, EAJL_2 = Second Job, (EAJL_2&EAJL_THIRD) = Second and Third job can rebirth.
  136. //More Options [EAJL_2_1,EAJL_2_2,EAJL_UPPER,EAJL_BABY]
  137. set .reset_opt,1; //(1=Reset Base and JobLevel to 1(0 skill points and all stats to 1),2=Reset Base and JobLevel to 1(SkillPoint=0, While Skills and stats are not affected),3=Reset BaseLevel to 1, 4=Reset Job Level to 1)
  138.  
  139. query_sql "CREATE TABLE IF NOT EXISTS `rebirth_system` ( `char_id` int(11) unsigned NOT NULL default '0', `name` varchar(24) NOT NULL DEFAULT 'NULL', `num_rebirth` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`char_id`)) ENGINE=MyISAM";
  140. end;
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement