viewing paste Unknown #12369 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
/*
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;
*/
aretnorp,257,260,5  script  Rebirth 651,{
function checkItem;         // check if player have all item required
function colorItemrequired; // color the text. Red : not enough item, green otherwise
function deleteItem;        // delete all items required
function displayItemneed;   // display all items need at start
function getItemReward;     // give the items reward
function weightreq;         // check if your current weight is highter than weight high novice
 
    mes "^11E6D0[Rebirth System]^000000";
    mes strcharinfo(0)+", How may I help you?";
    switch( select( "^777777~ Ranking", "~ Rebirth", "~ Information", "~ Cancel^000000" ) ) {
        case 1:
            query_sql "SELECT `name`,`num_rebirth` FROM `rebirth_system` ORDER BY `num_rebirth` DESC LIMIT "+.list,@name$,@num_rebirth;
            if(getarraysize(@name$)==0){mes "^F20808 No Records Found ^000000"; close;}
            mes "Format:";
            mes "^0814F2[Character Name]^000000 - ^B308F2[Rebirths]^000000";
            for (.@i=0; .@i < getarraysize(@name$); .@i++){
                mes (.@i+1) +".) ^0814F2["+ @name$[.@i] +"]^000000 - ^B308F2["+ @num_rebirth[.@i] +"]^000000";
            }
            deletearray @name$[0],.list; deletearray @num_rebirth[0],.list;
            close;
        case 2:
            .@eac = eaclass();
            if( NextJobExp || NextBaseExp || !( .@eac&(.job_rebirth) ) || !Upper ) {
                mes "You must be a Max Level 3rd Job Class to be able to Rebirth.";
                close;
            }
 
            mes "Items need :";
            displayItemneed();
            next;
            mes "^11E6D0[Rebirth System]^000000";
            weightreq();
            checkItem();
            deleteItem();
            break;
        case 3:
            switch(.reset_opt){
                case 1:
                    mes "Your BaseLevel,JobLevel,Skills,StatPoints,Stats 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/Stats Unaffected, For Rebirth, you will need some items.";
                    break;
                case 4:
                    mes "You will be Changed to JobLevel 1 with BaseLevel and Skills/Stats Unaffected";
                    break;
                
            }
            mes "For Rebirth, you may need some items.";
            close;
        case 4:
            mes "Bye.";
            close;
    }
    num_rebirth += 1;
    resetlvl(.reset_opt);
    getItemReward();
    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+"";
    mes "You have taken Rebirth.";
    StatusPoint = 100;
    SkillPoint = 151;
    set BaseLevel 11;
    set JobLevel 10;
    announce "[ Rebirth system ] : "+ strcharinfo(0) +" rebirth for the "+ num_rebirth +" time !", 0;
    close;
 
 
 
function checkItem {
    for (.@i=0 ; .@i < .size_item; .@i += 2 )
        if ( countitem( .item_req[.@i] ) < .item_req[ .@i+1 ] ) {
            mes "You don't have enough ^E6DB11"+ getitemname( .item_req[.@i] ) +"^000000. ^ff0000["+ countitem( .item_req[.@i] ) +"/"+ ( .item_req[ .@i+1 ] ) +"]^000000";
            close;
        }
    return;
}
 
function colorItemrequired {
    if ( countitem( .item_req[ getarg(0) ] ) < .item_req[ getarg(0)+1 ] ) return "^ff0000";
    return "^00ff00";
}
 
function deleteItem {
    for (.@i=0 ; .@i < .size_item; .@i += 2 ){
        delitem .item_req[.@i], ( .item_req[ .@i+1 ] );
    }
    return;
}
 
function displayItemneed {
    for (.@i=0 ; .@i < .size_item; .@i += 2 ){
        mes colorItemrequired( .@i ) +" - x"+ ( .item_req[ .@i+1 ] ) +" "+ getitemname( .item_req[.@i] );
    }
    return;
}
 
function getItemReward {
    for (.@i=0 ; .@i < .size_reward; .@i += 3 ){
    .@rand = rand(1,10000);
        if (.@rand <= .reward[.@i+2]){
            getitem .reward[.@i], .reward[ .@i+1 ];
        }
    }
    return;
}
 
function weightreq {
    if ( Weight > 20000 ) {
        mes "You have too much items on you. Your weight will be too high after rebirth.";
        close;
    }
    return;
}
 
OnInit:
    // item required <item ID>, <number>
    setarray .item_req, 7905, 10,
                        7227, 50,
                        20359, 1;
    .size_item = getarraysize( .item_req );
 
    // rewards <item ID>, <quantity>,<chance(10000=100%)>
    setarray .reward,
                7227, 50, 5000,
                4608, 1, 50,
                4609, 1, 50,
                2541, 1, 10,
                2763, 1, 50,
                2137, 1, 50,
                20038, 1, 50,
                20036, 1, 50,
                20034, 1, 50,
                20032, 1, 50,
                20031, 1, 50,
                20030, 1, 50,
                20029, 1, 50,
                20028, 1, 50,
                20027, 1, 50,
                20026, 1, 50,
                20025, 1, 50,
                20024, 1, 50,
                20023, 1, 50,
                20022, 1, 50,
                20021, 1, 50,
                20020, 1, 50,
                2741, 1, 50, 
                2927, 1, 50,
                2924, 1, 50,
                2928, 1, 50, 
                2997, 1, 50, 
                2923, 1, 50, 
                2926, 1, 50, 
                2925, 1, 50, 
                2737, 1, 30,
                20362, 1, 20,
                20363, 1, 20,
                20364, 1, 20,
                20365, 1, 20,
                20366, 1, 20,
                20367, 1, 20,
                20368, 1, 20,
                20369, 1, 20,
                20370, 1, 20,
                20371, 1, 20,
                20372, 1, 20,
                20373, 1, 20,
                20374, 1, 20,
                20375, 1, 20,
                20376, 1, 20,
                20377, 1, 20,
                20378, 1, 20,
                20379, 1, 20,
                20380, 1, 20,
                20381, 1, 20,
                20382, 1, 20,
                20383, 1, 20,
                20384, 1, 20,
                20385, 1, 20,
                20386, 1, 20,
                20387, 1, 20,
                20388, 1, 20,
                20389, 1, 20,
                20390, 1, 20,
                20391, 1, 20,
                20392, 1, 20,
                20393, 1, 20,
                20394, 1, 20,
                20395, 1, 20,
                20396, 1, 20,
                20397, 1, 20,
                20398, 1, 20,
                20399, 1, 20;
 
 
 
 
    .size_reward = getarraysize( .reward );
    
    .list = 10;     //Show Top x in Ranking
    
    .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]
    .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)
    
    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";
    end;
}
 
 
Viewed 909 times, submitted by karazu.