Jump to content

daromski02

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by daromski02

  1. //===== EinherjarRO Scripts ================================== 
    //= Daily Rewards
    //===== By: ================================================== 
    //= Stolao
    //===== Current Version: ===================================== 
    //= 1.84
    //===== Compatible With: ===================================== 
    //= rAthena SVN
    //===== Description: ========================================= 
    //= A reward system for players who play more frequently
    //===== Todo: ================================================
    //= Maybe make .MinWait an array mins,days,weeks,months,years;
    //= Make Logging out then it continue count
    //= Make a Overweight easy collect
    //= Remove use of sleep2
    //= Suggestions?
    //===== Additional Comments: =================================
    //= For Older See Old Versions
    //= 1.7A No Rewards for Autotraders option added
    //= 1.7B Tabulation Cleanup
    //= 1.7C Added custom item binding mode [Secretdataz]
    //= 1.7D Added cutin for next day option + command
    //= 1.7E Added IP Check
    //= 1.7F Moved .Rest Message to after .MinWait Check
    //= 1.80 Added MacAddress check for those using Gepard Shield (disabled by default)
    //= 1.81 Fixed Typo in .MacCheck
    //= 1.82 Moved .Rest Check before rewards check to prevent bug
    //= 1.83 Added strnpcinfo(3) for bindatcomands
    //= 1.84 Rephrased some conf settings
    //= 1.85 Fixed Capilazation
    //= 1.86 Small Tabulation Tweaks
    //===== Contact Info: ========================================
    //= [Stolao] 
    //= Email: [email protected]
    //============================================================
    -	script	LOGIN	-1,{
    OnWhisperGlobal:
    OnLoginCmnd:
    OnPCLoginEvent:
    	if(.IPCheck){
    		query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@LastIp$);
    		query_sql("SELECT account_id FROM `login` WHERE last_ip = '"+.@LastIp$+"'", .@AccountId);
    		if(getarraysize(.@AccountId) > .IPCheck){
    			message strcharinfo(0),"[Daily Rewards]: Rewards are limited to "+.IPCheck+" per IP sorry.";
    			end;
    		}
    	}
    	if(.MacCheck){
    		query_sql("SELECT last_unique_id FROM `login` WHERE account_id = "+getcharid(3)+"", .@last_unique_id$);
    		query_sql("SELECT account_id FROM `login` WHERE last_unique_id = '"+.@last_unique_id$+"'", .@AccountId2);
    		if(getarraysize(.@AccountId2) > .MacCheck){
    			message strcharinfo(0),"[Daily Rewards]: Rewards are limited to "+.MacCheck+" per computer sorry.";
    			end;
    		}
    	}
    	.@i = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
    	if(.@i >= (#LastDailyReward + .MinWait) && .Rest){
    		message strcharinfo(0),"[Daily Rewards]: To collect reward you must remain logged in for "+ .Rest +" minutes";
    		sleep2 1000 + .Rest * 60000;
    	}
    	if(.@i >= (#LastDailyReward + .MinWait)){
    		if(checkvending() & 2 && .Mode & 64){
    			message strcharinfo(0),"[Daily Rewards]: Venders cannot recive rewards.";
    			end;
    		}
    		if(.@i < #LastDailyReward + .MaxWait)
    			#DRewardCon += 1;
    		else	#DRewardCon = 1;
    		if(#DRewardCon >= getarraysize(.Rewards$)){
    			if(.Reset)
    				#DRewardCon = 1;
    			else	.@g = getarraysize(.Rewards$)-1;
    		} else	.@g = #DRewardCon;
    		explode(.@XT$,.Rewards$[.@g],",");
    		for(.@x = 0; .@x < getarraysize(.@XT$); .@x++)
    			.@TT[.@x] = atoi(.@XT$[.@x]);
    		if(.Mode & 1 && .@TT[4] > 0){
    			for(.@x = 4; .@x <= getarraysize(.@TT) - 1 ; .@x += 2){
    				.@itms[getarraysize(.@itms)] = .@TT[.@x];
    				.@qnts[getarraysize(.@qnts)] = .@TT[.@x + 1];
    			}
    			if(checkweight2(.@itms,.@qnts)){
    				for(.@x = 0; .@x < getarraysize(.@itms) && .@x < getarraysize(.@qnts); .@x++){
    					if(.Mode & 32)
    						getitembound  .@itms[.@x], .@qnts[.@x], .Bound_Mode;
    					else	getitem  .@itms[.@x], .@qnts[.@x];
    				}
    			} else {
    				message strcharinfo(0),"[Daily Rewards]: You can not carry the prizes, please use storage and relog.";
    				if(#DRewardCon) #DRewardCon -= 1;
    				end;
    			}
    		}
    		if(.Mode & 16)
    			cutin .Cutins$[#DRewardCon],4;
    		if(.Mode & 2){
    			if(.@TT[0]){
    				zeny += .@TT[0];
    				message strcharinfo(0),"[Daily Rewards]: Recieved "+ .@TT[0] +"z";
    			}
    			if(.@TT[1]){
    				setd getd(.Points$[0]),getd(.Points$[0]) + .@TT[1];
    				message strcharinfo(0),"[Daily Rewards]: Recieved "+ .@TT[1] +" "+.Points$[1];
    			}
    		}
    		if(.Mode & 4 && (.@TT[3] || .@TT[4]))
    			getexp .@TT[3], .@TT[4];
    		if(.Mode & 8){
    			for(.@x = 0; .@x < getarraysize(.BuffInfo); .@x += 4){
    				if(#DRewardCon % .BuffInfo[.@x + 1] == 0)
    					sc_start .BuffInfo[.@x], .BuffInfo[.@x + 2] * 60000, .BuffInfo[.@x + 3];
    			}
    		}
    		message strcharinfo(0),"[Daily Rewards]: You have collected your daily reward, for "+callfunc("F_InsertPlural",#DRewardCon,"day")+" in a row.";
    		#LastDailyReward = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2) - .Rest;
    		end;
    	}
    OnNextCmnd:
    	if(!.@i) .@i = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2) - .Rest;
    	.@days = (#LastDailyReward + .MinWait - .@i)/60/24;
    	.@hours = ((#LastDailyReward + .MinWait - .@i)/60)%24;
    	.@mins = (#LastDailyReward + .MinWait - .@i)%60;
    	message strcharinfo(0),"[Daily Rewards]: You have "+ ((.@days) ? .@days +" Days " : "") +""+ ((.@hours) ? .@hours +" Hours " : "") +""+ ((.@mins) ? .@mins +" Minutes " : "") +"till your next reward.";
    	if(.Mode & 128){
    		if(#DRewardCon + 1 >= getarraysize(.Rewards$)){
    			if(.Reset)	.@DRewardCon = 1;
    			else	.@g = getarraysize(.Rewards$)-1;
    		} else	.@g = #DRewardCon + 1;
    		cutin .Cutins$[.@g],4;
    	}
    	end;
    
    OnAtcommand:
    		if(#DRewardCon + 1 >= getarraysize(.Rewards$)){
    			if(.Reset)	.@DRewardCon = 1;
    			else	.@g = getarraysize(.Rewards$)-1;
    		} else	.@g = #DRewardCon + 0;
    		cutin .Cutins$[.@g],4;
    	end;
    OnInit:
    	// Basic Settings
    	//   1: Item | 2: Points | 4: Exp  
    	//   8: Gain Buffs Every X Consecutive Days logged in
    	//   16: Show Cutins | 32: Bound Items
    	//   64: No Rewards ffor Autotraders
    	//   128: Show Next Day Cutin
    	//     (a bit value, e.g. 3 = Items & Points from Multi)
    	.Mode = 1|2|16|64;
    
    	// Number of times same IP can recive rewards
    	//   0 = unlimited
    	.IPCheck = 0;
    
    	// Number of times same Computer (MacAdress) can recive rewards
    	//   0 = unlimited
    	.MacCheck = 0;
    
    	// Item Binding Mode
    	//	 Bound_Account : Account Bound item
    	//	 Bound_Guild   : Guild Bound item
    	//	 Bound_Party   : Party Bound item
    	//	 Bound_Char    : Character Bound item
    	.Bound_Mode = Bound_Account;
    	
    	// To disable the command '@loginreward' comment the next lines
    	// * Needs extra commands for typos
    	//bindatcmd("relog",strnpcinfo(3)+"::OnLoginCmnd",0,99);
    	//bindatcmd("checkcash",strnpcinfo(3)+"::OnAtcommand" + "Cashpoint = "+#CASHPOINTS+" Cash Points.",0,99);
    	bindatcmd("rewardtime",strnpcinfo(3)+"::OnNextCmnd",0,99);
    	bindatcmd("nextreward",strnpcinfo(3)+"::OnAtcommand",0,99);
    
    	// Minimum minutes between collecting daily reward
    	//   Day: 22*60 - 24*60
    	//   Week: 10080
    	.MinWait = 1440;
    	//.MinWait = 1;
    
    	// Minutes before losing the consecutive reward
    	//   Day: 48*60 - 50*60
    	//   Week: 20160
    	.MaxWait = 2880;
    	//.MaxWait = 2;
    
    	// What to do upon reaching last day defined
    	//   [0] Repeat last day
    	//   [1] Restart at 1
    	.Reset = 1;
    
    	// Number of mins after logging before collecting prize
    	.Rest = 2;
    
    	// Point Type
    	//   [0] Points earned
    	//   [1] Point name in mes
    	setarray .Points$,"#KAFRAPOINTS","K-Points";
    
    	// Consecutive Days Buff
    	// Each buff contains 4 variables (32 Total Max)
    	// <Type>,<Days>,<Duration>,<Rate>, // Buff 1
    	// <Type>,<Days>,<Duration>,<Rate>, // Buff 2
    	//   ...;
    	//
    	//  Example: 188,7,45,3
    	//    -Every 7th consecutive day logged in Player gains +3 Str for 45 mins
    	//
    	//  Type is 188, which references which SC_ to use, SC_INCSTR in this example
    	//     -For a full list of SC_ visit the db/const.txt
    	//  Days is days buff is applied, in this example 7, so every 7th day, 14,21,28....
    	//  Duration is buff duration is Minuits, in this example 45 mins
    	//  Rate is buff strength, in this example player gains 3 Str
    	//setarray .BuffInfo	,260,2,360,1	// Life Insurance for 360 Mins Every 2nd Day
    				//,198,3,120,10	// +10% Hp for 120 Mins Every 3th Day
    				//,196,5,120,25	// +25 Flee for 120 Mins Every 5th Day
    				//,257,7,240,50;	// +50% Exp for 240 Mins Every 7th Day
    
    	// Daily Prize items (max 128 days):
    	//   "<Zeny>|<Points>|<BaseExp>|<JobExp>|<itemID-1>|<amount-1>|<itemID-2>|<amount-2>...etc", // Day 1
    	//   "<Zeny>|<Points>|<BaseExp>|<JobExp>|<itemID-1>|<amount-1>|<itemID-2>|<amount-2>...etc"  // Day 2
    	//   ...;
    	// Total length of any days string must be 255 or shorter
    	// * If players login longer than the last set
    	//   day, they will keep getting the last prize.
    	setarray .Rewards$[1],
    		"0,0,0,0,12211,5",			// Day 1: Kafra Card x5
    		"0,0,0,0,12208,1",			// Day 2: Battle Manual 50% x1
    		"0,0,0,0,7060,30",			// Day 3: Kafra Teleport ticket x30
    		"0,0,0,0,12210,1",			// Day 4: Bubble Gum x1
    		"0,0,0,0,12215,15",			// Day 5: Blessing scroll lv10 x15
    		"0,0,0,0,7621,2",			// Day 6: Token of Siegfried x2
    		"0,0,0,0,670,1",			// Day 7: Bag of Coins x1
    		"0,0,0,0,12214,2",			// Day 8: Convex Mirror x2
    		"0,0,0,0,12103,1",			// Day 9: Bloody Branch x1
    		"0,0,0,0,12216,15",			// Day 10: Increase Agi lv10 x15
    		"0,0,0,0,12211,20",			// Day 11: Kafra Card x20
    		"0,0,0,0,14533,1",			// Day 12: Battle Manual 100% x1
    		"0,0,0,0,7622,15",			// Day 13: Hairstyle Coupon x15
    		"0,0,0,0,616,1",			// Day 14: Old Card Album x1
    		"0,0,0,0,6320,5",			// Day 15: Premium Reset Stone x5
    		"0,0,0,0,7776,2",			// Day 16: Gym Pass x2
    		"0,0,0,0,7621,5",			// Day 17: Token of Siegfried x5
    		"0,0,0,0,12210,2",			// Day 18: Bubble Gum x2
    		"0,0,0,0,12103,2",			// Day 19: Bloody Branch x2
    		"0,0,0,0,12214,5",			// Day 20: Convex Mirror x5
    		"0,0,0,0,7829,100",			// Day 21: Valor Badge x100
    		"0,0,0,0,7621,10",			// Day 22: Token of Siegfried x10
    		"0,0,0,0,616,1",			// Day 23: Old Card Album x1
    		"0,0,0,0,7776,3",			// Day 24: Gym Pass x3
    		"0,0,0,0,12210,5",			// Day 25: Bubble Gum x5
    		"0,0,0,0,670,10",			// Day 26: Bag of Coins x10
    		"0,0,0,0,7829,200",			// Day 27: Valor Badge x200
    		"0,0,0,0,12246,1";			// Day 28: Mystical Card Album x1
    		
    		
    
    
    	// Cutin Array
    	//	Shows a cuting for each date
    	//	
    	setarray .Cutins$[1],
    			"day_01",
    			"day_02",
    			"day_03",
    			"day_04",
    			"day_05",
    			"day_06",
    			"day_07",
    			"day_08",
    			"day_09",
    			"day_10",
    			"day_11",
    			"day_12",
    			"day_13",
    			"day_14",
    			"day_15",
    			"day_16",
    			"day_17",
    			"day_18",
    			"day_19",
    			"day_20",
    			"day_21",
    			"day_22",
    			"day_23",
    			"day_24",
    			"day_25",
    			"day_26",
    			"day_27",
    			"day_28";
    			
    end;
    }

     

    3B22LkF.jpg

     

     

    currently im at day 11, and im getting wait to 28 days before claiming my next reward to day 12. Help..

     

     

×
×
  • Create New...