Advertisement
Capuche

50rebirth_add_status_points

May 8th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.23 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Rebirth System
  3. //===== By: ==================================================
  4. //= Capuche
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena SVN
  9. //===== Description: =========================================
  10. //= Base on this request :
  11. //= http://rathena.org/board/topic/82507-rebirth-system-50-rebirths/
  12. //----------------------------------------------------
  13. //= Rebirth the player x50. Give status points for each
  14. //= rebirth, and give Item(s) after x30 rebirth
  15. //============================================================
  16.  
  17. /*
  18. CREATE TABLE IF NOT EXISTS `rebirth_system` (
  19. `account_id` int(11) unsigned NOT NULL default '0',
  20. `name` varchar(255) NOT NULL DEFAULT 'NULL',
  21. `num_rebirth` int(11) unsigned NOT NULL default '0',
  22. `last_ip` varchar(100) NOT NULL default '',
  23. PRIMARY KEY (`account_id`)
  24. ) ENGINE=MyISAM;
  25. */
  26.  
  27. prontera,150,170,5 script Spec 833,{
  28. function checkItem; // check if player have all item required
  29. function colorItemrequired; // color the text. Red : not enough item, green otherwise
  30. function deleteItem; // delete all items required
  31. function displayItemneed; // display all items need at start
  32. function getItemReward; // give the items reward
  33. function weightreq; // check if your current weight is highter than weight high novice
  34.  
  35.  
  36. .@eac = eaclass();
  37. if ( num_rebirth == .reset_max ) {
  38. mes "You can only rebirth x"+ .reset_max +".";
  39. emotion e_gasp;
  40. close;
  41. }
  42. else if( NextJobExp || NextBaseExp || !( .@eac&EAJL_2 ) || !Upper ) {
  43. mes "You must be rebirth max level/max job level.";
  44. close;
  45. }
  46.  
  47. mes "Items need :";
  48. displayItemneed();
  49. next;
  50.  
  51. switch( select( "^777777~ Rebirth", "~ Informations", "~ Good bye^000000" ) ) {
  52. case 1:
  53. weightreq();
  54. checkItem();
  55. deleteItem();
  56. break;
  57. case 2:
  58. mes "You can only rebirth ^ff0000x"+ .reset_max +"^000000. You already rebirth ^ff0000x"+ num_rebirth +"^000000.";
  59. mes "Each rebirth you get ^ff0000"+ .num_status +"^000000 status points and after ^ff0000"+ .change_reward +"^000000 rebirth, you get only some items.";
  60. close;
  61. case 3:
  62. mes "Bye.";
  63. close;
  64. }
  65. num_rebirth += 1;
  66. if ( Upper ) { // just in case the user change the setting...
  67. lastJob = roclass( .@eac&EAJ_UPPERMASK );
  68. jobchange Job_Novice_High;
  69. }
  70. else
  71. jobchange Job_Novice;
  72. resetlvl 1;
  73. if ( num_rebirth < 30 )
  74. StatusPoint = StatusPoint + .num_status * num_rebirth;
  75. else
  76. getItemReward();
  77. query_sql "insert into `rebirth_system` values ( "+ getcharid(3) +", '"+ escape_sql( strcharinfo(0) ) +"', '"+ num_rebirth +"', '"+ getcharip() +"' ) on duplicate key update `num_rebirth` = `num_rebirth` +1";
  78. announce "[ Rebirth system ] : "+ strcharinfo(0) +" rebirth for the "+ num_rebirth +" time !", 0;
  79. close;
  80.  
  81.  
  82.  
  83. function checkItem {
  84. for ( ; .@i < .size_item; .@i += 2 )
  85. if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] + num_rebirth ) {
  86. mes "You don't have enought "+ getitemname( .item_req[.@i] ) +". ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] + num_rebirth ) +"]^000000";
  87. close;
  88. }
  89. if ( num_rebirth >= .change_reward )
  90. if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) ) {
  91. mes "You don't have enought "+ getitemname( .add_item_req[0] ) +". ^ff0000["+ countitem( .add_item_req[0] ) +"/"+ ( .add_item_req[1] + num_rebirth - .change_reward ) +"]^000000";
  92. close;
  93. }
  94. return;
  95. }
  96.  
  97. function colorItemrequired {
  98. if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] + num_rebirth ) return "^ff0000";
  99. return "^00ff00";
  100. }
  101.  
  102. function deleteItem {
  103. for ( ; .@i < .size_item; .@i += 2 )
  104. delitem .item_req[.@i], ( .item_req[ .@i+1 ] + num_rebirth );
  105. if ( num_rebirth >= .change_reward )
  106. delitem .add_item_req[0], ( .add_item_req[1] + num_rebirth - .change_reward );
  107. return;
  108. }
  109.  
  110. function displayItemneed {
  111. for ( ; .@i < .size_item; .@i += 2 )
  112. mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] + num_rebirth ) +" "+ getitemname( .item_req[.@i] );
  113. if ( num_rebirth >= .change_reward ) {
  114. if ( .add_item_req[1] + num_rebirth - .change_reward > countitem( .add_item_req[0] ) )
  115. .@color$ = "^ff0000";
  116. else
  117. .@color$ = "^00ff00";
  118. mes .@color$ +"- x"+ ( .add_item_req[1] + ( num_rebirth - .change_reward ) ) +" "+ getitemname( .add_item_req[0] );
  119. }
  120. return;
  121. }
  122.  
  123. function getItemReward {
  124. for ( ; .@i < .size_reward; .@i += 2 )
  125. getitem .reward[.@i], .reward[ .@i+1 ];
  126. return;
  127. }
  128.  
  129. function weightreq {
  130. if ( Weight > 20000 ) {
  131. mes "You have too much items on you. Your weight will be too high after rebirth.";
  132. close;
  133. }
  134. return;
  135. }
  136.  
  137. OnInit:
  138. .reset_max = 50; // how much reset max
  139. .change_reward = 30; // after 30 rebirth, change reward
  140. .num_status = 300; // + X number of status points
  141.  
  142. // item required <item ID>, <number>
  143. setarray .item_req, 501, 5,
  144. 502, 2,
  145. 503, 3;
  146. .size_item = getarraysize( .item_req );
  147.  
  148. // additionnal items after rebirth >> .change_reward
  149. // <item ID>, <number>
  150. setarray .add_item_req, 601, 1;
  151.  
  152. // rewards <item ID>, <number>
  153. setarray .reward, 504, 1;
  154. .size_reward = getarraysize( .reward );
  155. end;
  156. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement