Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===== rAthena Script =======================================
- //= Card Level Up System
- //===== By: ==================================================
- //= Sehrentos
- //===== Requested By: ========================================
- //= Elysium
- //===== Current Version: =====================================
- //= 1.0
- //===== Compatible With: =====================================
- //= rAthena Project
- //===== Description: =========================================
- //= Card Level Up System.
- //= Give a card to NPC and you will receive x number of exp
- //= to that specific card.
- //===== Additional Comments: =================================
- //= 1.0 Initial script.
- //============================================================
- prontera,158,159,4 script Card Level Up#cluc 4_M_HIGH_WIZARD,{
- disable_items;
- mes "["+ .npc_name$ +"]";
- mes "Lorem card ipsum levelum...";
- menu "Show Exp",L_ShowExp,"Show Cards",L_ShowCards,"Level UP Card",L_LevelUpCard,"Leave",L_Leave;
- close;
- L_Leave:
- clear;
- mes "["+ .npc_name$ +"]";
- mes "Farewell.";
- close;
- L_ShowExp:
- clear;
- mes "["+ .npc_name$ +"]";
- mes "Current card level and experience.";
- .@count = 0;
- // Normal cards
- for(.@i=0; .@i<getarraysize(.normal_card); .@i++) {
- .@level = getd("nclv_"+ .normal_card[.@i]); // nclv_4xxx
- .@exp = getd("ncexp_"+ .normal_card[.@i]); // ncexp_4xxx
- if(.@level > 0) {
- .@count++;
- .@rexp = .normal_exp[.@level]; // Required exp to the next level
- .@percent = 100 * .@exp / .@rexp;
- mes "Card: "+ getitemname(.normal_card[.@i]);
- mes "Level: "+ .@level;
- if(.@level < 3)
- mes "Exp: ["+ .@exp +"/"+ .@rexp +"] "+ .@percent +"%";
- mes " --- ";
- //dispbottom "Card Exp: ["+ .@exp +"/"+ .@rexp +"] "+.@percent+"%";
- }
- }
- // MVP cards
- for(.@i=0; .@i<getarraysize(.mvp_card); .@i++) {
- .@level = getd("nclv_"+ .mvp_card[.@i]); // nclv_4xxx
- .@exp = getd("ncexp_"+ .mvp_card[.@i]); // ncexp_4xxx
- if(.@level > 0) {
- .@count++;
- .@rexp = .mvp_exp[.@level]; // Required exp to the next level
- .@percent = 100 * .@exp / .@rexp;
- mes "Card: "+ getitemname(.mvp_card[.@i]);
- mes "Level: "+ .@level;
- if(.@level < 3)
- mes "Exp: ["+ .@exp +"/"+ .@rexp +"] "+ .@percent +"%";
- mes " --- ";
- //dispbottom "Card Exp: ["+ .@exp +"/"+ .@rexp +"] "+.@percent+"%";
- }
- }
- if(.@count < 1) {
- mes "You don't have any card progress.";
- }
- close;
- L_ShowCards:
- clear;
- mes "["+ .npc_name$ +"]";
- mes "List of available cards.";
- // Normal cards
- for(.@i=0; .@i<getarraysize(.normal_card); .@i++) {
- mes (.@i+1) +". "+ getitemname(.normal_card[.@i]);
- }
- mes " -- MVP -- ";
- // MVP cards
- for(.@i=0; .@i<getarraysize(.mvp_card); .@i++) {
- mes (.@i+1) +". "+ getitemname(.mvp_card[.@i]);
- }
- close;
- L_LevelUpCard:
- clear;
- mes "["+ .npc_name$ +"]";
- mes "Level up a card.";
- .@type = select("Normal:MVP"); // Select type 1=normal
- // Create menu id and name array
- for(.@i=0; .@i<getarraysize(getd((.@type==1?".normal":".mvp")+"_card")); .@i++) {
- if(countitem(getd((.@type==1?".normal":".mvp")+"_card["+ .@i +"]"))) {
- .@menu_id[getarraysize(.@menu_id)] = getd((.@type==1?".normal":".mvp")+"_card["+ .@i +"]");
- .@menu_name$[getarraysize(.@menu_name$)] = getitemname(getd((.@type==1?".normal":".mvp")+"_card["+ .@i +"]"));
- }
- }
- // If no card
- if(getarraysize(.@menu_id) < 1) {
- clear;
- mes "["+ .npc_name$ +"]";
- mes "You don't have any of this type of card.";
- close;
- }
- // Build menu
- .@menu$ = implode(.@menu_name$, ":");
- .@select = select(.@menu$) - 1; // .@menu_name$ start from 0 not from 1
- if (.@select < 0) {
- goto L_Leave;
- }
- .@item_id = .@menu_id[.@select]; // Should be same as .@card_id below
- .@char_card_lv = getd("nclv_" + .@item_id); // nclv_4001
- .@char_card_exp = getd("ncexp_" + .@item_id); // ncexp_4001
- .@index = inarray(getd((.@type==1?".normal":".mvp")+"_card[0]"), .@item_id);
- // If not found
- if (.@index < 0) {
- clear;
- mes "["+ .npc_name$ +"]";
- mes "This card can't be upgraded.";
- close;
- }
- // at max level
- if (.@char_card_lv >= 3) {
- clear;
- mes "["+ .npc_name$ +"]";
- mes "This card is at max level.";
- // Update
- //setd "nclv_"+ .@item_id, 3;
- //setd "ncexp_"+ .@item_id, 0;
- close;
- }
- .@card_id = getd((.@type==1?".normal":".mvp")+"_card["+ .@index +"]");
- .@card_exp = getd((.@type==1?".normal":".mvp")+"_exp["+ .@char_card_lv +"]");
- // If level 0 (First activation)
- if (.@char_card_lv < 1) {
- .@char_card_lv++;
- .@card_exp = getd((.@type==1?".normal":".mvp")+"_exp["+ .@char_card_lv +"]");
- }
- // Gain experience points (100000000 / 10)
- .@char_card_exp = .@char_card_exp + (.@card_exp / 10); // 10% increase
- // Gain level up
- if(.@char_card_exp >= .@card_exp) {
- .@char_card_lv++;
- .@char_card_exp = 0;
- .@card_exp = getd((.@type==1?".normal":".mvp")+"_exp["+ .@char_card_lv +"]");
- }
- // Check if card exist
- if(countitem(.@card_id)) {
- clear;
- mes "["+ .npc_name$ +"]";
- mes "Upgrade: "+ getitemname(.@card_id);
- mes "LV: "+ .@char_card_lv;
- mes "EXP: "+ .@char_card_exp + "/" + .@card_exp;
- delitem .@card_id, 1;
- // Update character variables
- setd "nclv_"+ .@card_id, .@char_card_lv;
- setd "ncexp_"+ .@card_id, .@char_card_exp;
- } else {
- // Card was moved after menu select
- clear;
- mes "["+ .npc_name$ +"]";
- mes "Please try again...";
- }
- close;
- OnInit:
- .npc_name$ = strnpcinfo(1);
- setarray .normal_card[0],4001,4002,4003,4004,4005,4006,4007,4008,4009,4010; // Card item id's
- setarray .mvp_card[0],4121,4123,4128; // Card item id's
- setarray .normal_exp[1],1000000,2000000,3000000; // Exp required per level
- setarray .mvp_exp[1],1000,2000,3000; // Exp required per level
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement