/*
CREATE TABLE IF NOT EXISTS `rebirth_system` (
`char_id` int(11) NOT NULL default '0',
`name` varchar(24) NOT NULL DEFAULT 'NULL',
`num_rebirth` mediumint(6) NOT NULL default '0',
`master_rebirth` mediumint(6) NOT NULL default '0',
PRIMARY KEY (`char_id`)
) ENGINE=MyISAM;
Those who were using Version 1.0: Please execute this query:
ALTER TABLE `rebirth_system` ADD `master_rebirth` mediumint(6) NOT NULL default '0';
---------------------------------------------------------
-- By Dastgir Pojee -----
-- Version 1.1 -----
---------------------------------------------------------
*/
prontera,150,150,5 script Rebirth System 866,{
mes "^11E6D0[Rebirth System]^000000";
mes strcharinfo(0)+", How may I help you?";
switch( select( "^777777~ Ranking", "~ Rebirth", "~ Information", "~ Cancel^000000" ) ) {
case 1:
next;
mes "^11E6D0[Rebirth System]^000000";
mes "Rankings:";
query_sql "SELECT `name`,`num_rebirth`,`master_rebirth` FROM `rebirth_system` ORDER BY `master_rebirth` DESC, `num_rebirth` DESC LIMIT "+.list,@name$,@num_rebirth,@master_rebirth;
if(getarraysize(@name$)==0){mes "^F20808 No Records Found ^000000"; close;}
mes "Format:";
mes "^0814F2[Character Name]^000000 - ^B308F2[Rebirths]^000000 - ^B303F2[Master_Rebirth]^000000";
for (set .@i,0; .@i < getarraysize(@name$); set .@i,.@i+1){
mes (.@i+1) +".) ^0814F2["+ @name$[.@i] +"]^000000 - ^B308F2["+ @num_rebirth[.@i] +"]^000000 - ^B303F2["+ @master_rebirth[.@i] +"]^000000";
}
deletearray @name$[0],.list; deletearray @num_rebirth[0],.list; deletearray @master_rebirth[0],.list;
close;
case 2:
next;
mes "^11E6D0[Rebirth System]^000000";
if (num_rebirth >= .MasterRebirth){
mes "You can Do Master Rebirth too.";
mes "Master rebirth allows you to earn some more powerful items.";
mes "On doing Master Rebirth, you will lose "+ .MasterRebirth +" Rebirths";
@rebirth_type = select("Do Standard Rebirth:Do Master Rebirth");
next;
mes "^11E6D0[Rebirth System]^000000";
}else{set @rebirth_type,1;}
set .@eac,eaclass();
if( NextJobExp || NextBaseExp || !( .@eac&(.job_rebirth) ) || !Upper ) {
mes "You must be Max BaselLevel/Joblevel to Rebirth.";
close;
}
mes "Items need :";
callfunc("CheckItemNeed",@rebirth_type);
next;
mes "^11E6D0[Rebirth System]^000000";
callfunc("deleteItem",@rebirth_type);
break;
case 3:
next;
mes "^11E6D0[Rebirth System]^000000";
switch(.reset_opt){
case 1:
mes "Your BaseLevel,JobLevel,Skills,StatPoints,Status will be Reset.";
break;
case 2:
mes "Your BaseLevel,JobLevel And SkillPoints will be Reset.";
break;
case 3:
mes "You will be Changed to BaseLevel 1 with JobLevel and Skills/Status Unaffected, For Rebirth, you will need some items.";
break;
case 4:
mes "You will be Changed to JobLevel 1 with BaseLevel and Skills/Status Unaffected";
break;
}
mes "For Rebirth, you may need some items.";
mes "Upon Reaching "+ .MasterRebirth +" Rebirths, you can do Master Rebirth";
mes "Master Rebirth Allows you to earn some powerful items.";
close;
case 4:
mes "Bye.";
close;
}
if (@rebirth_type==1){num_rebirth = num_rebirth+11;}
else{master_rebirth = master_rebirth+1; num_rebirth = num_rebirth - .MasterRebirth; }
callfunc("resetlvl",.reset_opt);
if (.reset_ss&1){resetstatus;}
if (.reset_ss&2){resetskill;}
query_sql "INSERT INTO `rebirth_system` (`char_id`,`name`,`num_rebirth`,`master_rebirth`) VALUES ("+getcharid(0)+",'"+strcharinfo(0)+"',"+num_rebirth+","+master_rebirth+") ON DUPLICATE KEY UPDATE `num_rebirth`="+num_rebirth+", `master_rebirth`="+master_rebirth+" ";
callfunc("getItemReward",@rebirth_type);
mes "^11E6D0[Rebirth System]^000000";
mes "You have taken Rebirth.";
if (@rebirth_type==1){
announce "[ Rebirth system ] : "+ strcharinfo(0) +" rebirth for the "+ num_rebirth +" time !", 0;
}else{
announce "[ Rebirth system ] : "+ strcharinfo(0) +" has done Master rebirth for "+ master_rebirth +" time !", 0;
}
close;
OnInit:
// item required <item ID>, <number> , <1=NormalRebirth,2=MasterRebirth,3=ForBorthRebirths>
setarray .item_req, 501, 5, 3,
502, 2, 3,
503, 3, 3;
set .size_item, getarraysize( .item_req );
// rewards <item ID>, <quantity>,<chance(10000=100%)>,<1=NormalRebirth,2=MasterRebirth,3=PriceForBothRebirths>
// recalculates the chance and gives the next reward if chance is met.
setarray .reward, 504, 1, 10000, 1,
7227, 5, 10000, 2,
502, 5, 10000, 3,
601, 1, 10, 3;
set .size_reward, getarraysize( .reward );
set .list, 10; //Show Top x in Ranking
set .job_rebirth, EAJL_THIRD; //EAJL_THIRD = Third Job, EAJL_2 = Second Job, (EAJL_2&EAJL_THIRD) = Second and Third job can rebirth.
//More Options [EAJL_2_1,EAJL_2_2,EAJL_UPPER,EAJL_BABY]
set .reset_opt, 3; //(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)
set .reset_ss, 3; //(1=Reset Status, 2=Reset Skills, 3 = Reset Status and Skills)
set .MasterRebirth, 10; //Number of rebirths require to do Master Rebirth
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',`master_rebirth` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`char_id`)) ENGINE=MyISAM";
end;
}
function script deleteItem {
for (set .@i,0; .@i < .size_item; set .@i,.@i+3 ){
if ( !( getarg(0)&(.item_req[.@i+2]) ) ){continue;}
delitem .item_req[.@i], ( .item_req[ .@i+1 ] );
}
return;
}
function script CheckItemNeed {
if ( Weight > 20000 ) {
mes "You must reduce your weight to 2000 to do Rebirth.";
close;
}
.@error = 0;
for (set .@i,0; .@i < .size_item; set .@i,.@i+3 ){
if ( !( getarg(0)&(.item_req[.@i+2]) ) ){continue;}
if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] ) {
mes "You Require [^ff0000"+countitem( .item_req[.@i] )+" / "+ .item_req[.@i+1] +"^000000] ^E6DB11"+getitemname( .item_req[.@i] )+"^000000";
.@error = 1;
}else{
mes "You Require [^00ff00"+countitem( .item_req[.@i] )+" / "+ .item_req[.@i+1] +"^000000] ^E6DB11"+getitemname( .item_req[.@i] )+"^000000";
}
}
if (.@error){close;}
return;
}
function script getItemReward {
for (set .@i,0; .@i < .size_item; set .@i,.@i+4 ){
if ( !( getarg(0)&( .reward[.@i+3] ) ) ) {continue;}
if (rand(1,10000) <= .reward[.@i+2]){
mes "You Got "+.reward[.@i+1]+" "+getitemname(.reward[.@i])+" ";
getitem .reward[.@i], .reward[ .@i+1 ];
}
}
next;
return;
}