• 0
max65

Modify daily rewards

Question

Posted (edited)

Hello rAthena Community,

Before anything else, here's the script I want to edit.

//===== EinherjarRO Scripts ================================== 
//= Daily Prize, OnPCLoginEvent
//===== By: ================================================== 
//= Stolao
//===== Current Version: ===================================== 
//= 1.59
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: ========================================= 
//= A reward system for players who play more frequently
//===== Comments: ============================================
//= Maybe Make .MinWait an array mins,days,weeks,months,years;
//===== Additional Comments: =================================
//= For Older See Forums
//= 1.51 Changed set [email protected] formula and move lower into script
//= 1.52 Replace all disbottom -> message
//= 1.53 Changed Format to Include minuets instead of just hours
//= 1.54 Made Time till next rewards display dynamic
//= 1.55 Changed a forgotten  .PointType$ -> getd([email protected][1])
//= 1.56 changed [email protected] -> [email protected]$
//= 1.57 Added Atoi where nessisary
//= 1.58 Fixed a swapped [email protected] and [email protected]+1
//= 1.59 Serveral Edit Undocumented to fix
//===== Contact Info: ========================================
//= [Stolao] 
//= Email: [email protected]
//============================================================
-	script	LOGIN	-1,{
OnWhisperGlobal:
OnLoginCmnd:
OnPCLoginEvent:
	if(.Rest){
		set @login, (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
		query_sql("SELECT REPLACE (`last_ip`,'.','_') FROM `login` WHERE `account_id` = "+getcharid(3),@ip$); if((getd("$G_LIP_"[email protected]$)+(60*60*24)) <= @c) setd("$G_LIP_"[email protected]$,@c);
		if(@login > #LastDailyReward + .MaxWait ){
			set #logintimer, 0;
			set @login, 0;
		}
		
		set [email protected], (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + .Rest;
		message strcharinfo(0),"[ Daily Rewards ]: to collect reward you must remain logged in for "+ ( @login - [email protected] ) +" Minuets";
	}
	set [email protected], (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
	if([email protected] - .Rest >= (#LastDailyReward + .MinWait)){
		sleep2 100 + ( .Rest * 60000 ) - ( [email protected] - #logintimer );
		if([email protected] < #LastDailyReward + .MaxWait){	set #DRewardCon, #DRewardCon + 1;
		} else {	set #DRewardCon, 0;	}
		set [email protected], (#DRewardCon > getarraysize(.Rewards$)) ? (getarraysize(.Rewards$)-1) : #DRewardCon;
		explode([email protected]$,.Rewards$[[email protected]],"|");
		for(set [email protected],0; [email protected] < getarraysize([email protected]$); set [email protected],[email protected] + 1){
			set [email protected][[email protected]], atoi([email protected]$[[email protected]]);
		}
		if(.Mode & 1 && [email protected][4]){	//[Note]: I need to figure out a checkweight for all items tired atm lol, for now ill leave it missing
			for(set [email protected],4; [email protected] < getarraysize([email protected]); set [email protected],[email protected] + 2){	getitem  [email protected][[email protected]], [email protected][[email protected]+1];	message strcharinfo(0),"[ Daily Rewards ]: Recived "+  [email protected][[email protected]+1] +" "+ getitemname([email protected][[email protected]]);	}
		}
		if(.Mode & 2){
			if([email protected][0]){	set zeny,zeny + [email protected][0];	message strcharinfo(0),"[ Daily Rewards ]: Recived "+ [email protected][0] +"z";	}
			if([email protected][1]){	setd getd(.Points$[0]),getd(.Points$[0]) + [email protected][1];	message strcharinfo(0),"[ Daily Rewards ]: Recived "+ [email protected][1] +" "+.Points$[1];	}
		}
		if(.Mode & 4 && ([email protected][3] || [email protected][4])) getexp [email protected][3], [email protected][4];
		if(.Mode & 8){
			for(set [email protected],0; [email protected] < getarraysize(.BuffInfo); set [email protected],[email protected] + 4){
				if(#DRewardCon % .BuffInfo[[email protected] + 1] == 0)
					sc_start .BuffInfo[[email protected]], .BuffInfo[[email protected] + 2] * 60000, .BuffInfo[[email protected] + 3];
			}
		}
		message strcharinfo(0),"[ Daily Rewards ]: You have collected your daily reward, for "+#DRewardCon+" day"+((#DRewardCon > 1)?"s":"")+" in a row.";
		cutin .Pic$[[email protected]],4;
		set #LastDailyReward, [email protected];
		set #logintimer, 0;
		set @login, 0;
	} else {
		set [email protected],(#LastDailyReward + .MinWait - [email protected])/60/24;
		set [email protected],((#LastDailyReward + .MinWait - [email protected])/60)%24;
		set [email protected],(#LastDailyReward + .MinWait - [email protected])%60;
		message strcharinfo(0),"[ Daily Rewards ]: You have "+ (([email protected]) ? [email protected] +":Days " : "") +""+ (([email protected]) ? [email protected] +":Hours " : "") +""+ (([email protected]) ? [email protected] +":Minutes " : "") +"till your next reward";
	}
end;
OnPCLogoutEvent:
	if(@login){
		set [email protected], (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
		set #logintimer, [email protected] - @login + #logintimer;
		set @login, 0;
	}
return;
end;
OnInit:
waitingroom ">->Daily Rewards",0;


	//Basic Settings
	//   1: Item | 2: Points | 4: Exp  
	//   8: Gain Buffs Every X Consecutive Days logged in
	//     (a bit value, e.g. 3 = Items & Points from Multi)
	set .Mode,1 + 2 + 4 + 8;

	//To Enable @ Command '@loginreward' unslash next lines
	// * Needs extra commands for typos
	bindatcmd("daily"	,"LOGIN::OnLoginCmnd",0,99);

	//Enable Delay if @afk or @autotrade are available to players
	//  remove // to enable certain command checks
	//bindatcmd("at"	,"LOGIN::OnPCLogoutEvent",0,99);
	//bindatcmd("autotrade"	,"LOGIN::OnPCLogoutEvent",0,99);
	//bindatcmd("AT"	,"LOGIN::OnPCLogoutEvent",0,99);
	//bindatcmd("Autotrade"	,"LOGIN::OnPCLogoutEvent",0,99);
	//bindatcmd("afk"	,"LOGIN::OnPCLogoutEvent",0,99);
	//bindatcmd("AFK"	,"LOGIN::OnPCLogoutEvent",0,99);
	

	//Minimum Minuets Between Collecting Daily Reward
	//   Day: 22*60 - 24*60
	//   Week: 10080
	set .MinWait,24*60;

	//Minuets Before Lose Consecutive Daily Reward
	//   Day: 48*60 - 50*60
	//   Week: 20160
	set .MaxWait,3000;

	//Number of mins after logging before collecting prize
	set .Rest,60;

	//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$,
"0|0|0|0|7059|5", // Day 1: 5 Free Ticket for Kafra Storage
"0|0|0|0|7060|5", // Day 2: 5 Free Ticket for Kafra Transportation
"0|0|0|0|12208|1", // Day 3: 1 Battle Manual
"0|0|0|0|12766|1", // Day 4: 1 JOB Battle Manual
"0|0|0|0|12210|1", // Day 5: 1 Bubble Gum
"0|0|0|0|12211|3", // Day 6: 3 Kafra Card
"0|0|0|0|601|1", // Day 7: ######### 1 Random Box ##########
"0|0|0|0|11503|50", // Day 8: 50 Siege White Potions
"0|0|0|0|11504|20", // Day 9: 20 Siege Blue Potions
"0|0|0|0|12411|1", // Day 10: 1 HE Battle Manual
"0|0|0|0|12016|5", // Day 11: 5 Speed Potion
"0|0|0|0|12216|10", // Day 12: 10 LV10 Agil Scroll
"0|0|0|0|12215|10", // Day 13: 10 LV10 Blessing Scroll
"0|0|0|0|601|1", // Day 14: ######### 1 Random Box ##########
"0|0|0|0|12622|1", // Day 15: 1 Boarding Halter
"0|0|0|0|12214|2", // Day 16: 2 Convex Mirror
"0|0|0|0|12103|1", // Day 17: 1 Bloody Branch
"0|0|0|0|6910|1", // Day 18: 1 Enriched Oridecon
"0|0|0|0|6911|1", // Day 19: 1 Enriched Eluminium
"0|0|0|0|14003|3", // Day 20: 3 Elite Siege Supply Box
"0|0|0|0|601|1", // Day 21: ######### 1 Random Box ##########
"0|0|0|0|6286|1", // Day 22: 1 Gym Pass
"0|0|0|0|12535|1", // Day 23: 1 Yggdrasil Berry
"0|0|0|0|12817|3", // Day 24: 3 Old Card Album
"0|0|0|0|6833|10", // Day 25: 10 Token of Ziegfried
"0|0|0|0|12261|2", // Day 26: 2 Miracle Medicine
"0|0|0|0|601|1", // Day 27: ######### 1 I ♥ Games Hat ##########
"0|0|0|0|601|1"; // Day 28: ######### 1 Random Box ##########
 
setarray .Pic$,
"Daily_00_1", //pic with day1 highlighted
"Daily_01_1", //pic with day2 highlighted
"Daily_02_1", //pic with day3 highlighted
"Daily_03_1", //pic with day4 highlighted
"Daily_04_1", //pic with day5 highlighted
"Daily_05_1", //pic with day6 highlighted
"Daily_06_1", //pic with day7 highlighted
"Daily_07_1", //pic with day8 highlighted
"Daily_08_1", //pic with day8 highlighted
"Daily_09_1", //pic with day8 highlighted
"Daily_10_1", //pic with day8 highlighted
"Daily_11_1", //pic with day8 highlighted
"Daily_12_1", //pic with day8 highlighted
"Daily_13_1", //pic with day8 highlighted
"Daily_14_1", //pic with day8 highlighted
"Daily_15_1", //pic with day8 highlighted
"Daily_16_1", //pic with day8 highlighted
"Daily_17_1", //pic with day8 highlighted
"Daily_18_1", //pic with day8 highlighted
"Daily_19_1", //pic with day8 highlighted
"Daily_20_1", //pic with day8 highlighted
"Daily_21_1", //pic with day8 highlighted
"Daily_22_1", //pic with day8 highlighted
"Daily_23_1", //pic with day8 highlighted
"Daily_24_1", //pic with day8 highlighted
"Daily_25_1", //pic with day8 highlighted
"Daily_26_1", //pic with day8 highlighted
"Daily_27_1"; //pic with day8 highlighted
 
end;
}

Daily_01_n.bmpDaily_01_h.bmpDaily_01_4.bmpDaily_01_3.bmpDaily_01_2.bmpDaily_01_1.bmp

What i would?

This script works perfectly!

I would like to add several months let me explain ^^

-------------------------------------------------

First:

January = Daily_01_1

February= Daily_01_2

March= Daily_01_3

October= Daily_01_h

December= Daily_01_n etc...

I created the other months after ^^

-------------------------------------------------

Second:

-I would like a system where it is easy to add the other months .

-when I restart the server the script doesn't start at the beginning of the month.

-------------------------------------------------

Thank you to all who will help me!

"i can pay for this script"

ps: I am looking for a good writer for my server .we are a team of 4 people and we are looking for 1 scripteur and 1 animator, the server is about 90% finished.

Edited by max65

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Thanks for your answer i will try ^^

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...