• 0
melv0

Give Reward use unique_id

Question

Posted (edited)

 

somebody can help to change this script to use unique_id
This is the part for config how to setting reward options
 

// -----------------------------------------------------------
//  Reward options.
// -----------------------------------------------------------
//  [1] Enable rewards.
//  [2] Mail all rewards.
//      - If not set, players receive items in their inventory.
//      - Only ONE item can be sent via mail, plus Zeny.
//      - Note that offline players do NOT receive rewards.
//  [4] Only reward Guild Masters.
//      - If not set, all guild members are rewarded.
//      - If mailing is enabled (option 2), offline Guild Masters WILL receive rewards.
//  [8] Duplicate IP check.
//      - Members in a guild with the same IP address are not rewarded.
//      - If Guild Masters is enabled (option 4), this feature is not used.
// -----------------------------------------------------------

	// Combine values as needed (e.g. 1|8 = 1+8 = 9).
	set .Options, 1|8;

	// Rewards per castle.
	// -- when given directly: <itemID>,<amount>{,<itemID>,<amount>,...}
	// -- via mail (option 2): <itemID>,<amount>,<Zeny>
	setarray .Reward[0],31509,1,12103,1,16770,1,6380,15,31510,1;

This is the part for give the reward :
 

OnReward:
	set [email protected]$, ((.Options&4)?"position = 0":"online = 1");
	if (.Options&2) set [email protected]$,gettimestr("%B %d, %Y",21);
	freeloop(1);
	for(set [email protected],0; [email protected]<30; set [email protected],[email protected]+1)
		if (getarg(0)&(1<<[email protected])) {
			set [email protected], getcastledata(.Castles$[[email protected]],1);
			if ([email protected]) continue;
			set [email protected], query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"[email protected]+"' AND "[email protected]$,[email protected],[email protected]);
			for(set [email protected],0; [email protected]<[email protected]; set [email protected],[email protected]+1) {
				if ((.Options&8) && !(.Options&4)) {
					set [email protected]$, replacestr(getcharip([email protected][[email protected]]),".","a");
					if (getd("[email protected]_"[email protected]+"_"[email protected]$)) continue;
					setd "[email protected]_"[email protected]+"_"[email protected]$,1;
				}
				if (.Options&2) {
					query_sql("INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) VALUES ("+
					          "'no-reply',"[email protected][[email protected]]+",'** Siege Reward: "+getcastlename(.Castles$[[email protected]])+" **',"+
					          "'Brave one,% % Congratulations!% Your guild has successfully occupied% territory in the War of Emperium on% "[email protected]$+".% % % % % [ Your reward is attached. ]',"+
					          .Reward[0]+","+.Reward[1]+",0,"+.Reward[2]+",UNIX_TIMESTAMP(NOW()))");
					if (!getd("[email protected]_"[email protected][[email protected]]) && isloggedin([email protected][[email protected]],[email protected][[email protected]])) {
						setd "[email protected]_"[email protected][[email protected]],1;
						message rid2name([email protected][[email protected]]),"You've got mail! Please re-login to update your mailing list.";
					}
				} else if (isloggedin([email protected][[email protected]])) {
					for(set [email protected],0; [email protected]<getarraysize(.Reward); set [email protected],[email protected]+2)
						getitem .Reward[[email protected]], .Reward[[email protected]+1], [email protected][[email protected]];
					message rid2name([email protected][[email protected]]),"You have been rewarded for conquering "+getcastlename(.Castles$[[email protected]])+".";
				}
			}
		}
	if (.Options&2) query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
	return;

this script form woe_controller.txt

thanks 

Edited by melv0

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

got a PM for this

something isn't right about this script

set .@size, query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@gid+"' AND "+.@sql$,.@aid,.@cid);

this part should use *getguildmember script command

	query_sql("INSERT INTO `mail` (send_name,dest_id,title,message,nameid,amount,identify,zeny,time) VALUES ("+
	          "'no-reply',"+.@cid[.@j]+",'** Siege Reward: "+getcastlename(.Castles$[.@i])+" **',"+
	          "'Brave one,% % Congratulations!% Your guild has successfully occupied% territory in the War of Emperium on% "+.@str$+".% % % % % [ Your reward is attached. ]',"+
	          .Reward[0]+","+.Reward[1]+",0,"+.Reward[2]+",UNIX_TIMESTAMP(NOW()))");

and this part should use *mail script command

not to mention this script doesn't support woe:te

 

I'm sorry but this script is too outdated for me to fix,
it was working fine during the time of the creation, but now this script considered outdated

 

perhaps, simple script like this is the best
https://rathena.org/board/topic/110929-woe-reward-script/?do=findComment&comment=357542
then I could write it off easily

 

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
-	script	WoE Reward	FAKE_NPC,{
OnAgitEnd: callsub S_AgitEnd, 0, 20;
OnAgitEnd2: callsub S_AgitEnd, 20, 30;
S_AgitEnd:
	.@start = getarg(0);
	.@end = getarg(1);
	for ( .@i = .@start; .@i < .@end; ++.@i ) {
		.@guild_id = getcastledata( .castle$[.@i], CD_GUILD_ID );
		if ( .@guild_id ) {
			deletearray .@unique_id;
			getguildmember .@guild_id, 1;
			getguildmember .@guild_id, 2;
			for ( .@j = 0; .@j < [email protected]; ++.@j ) {
				if ( isloggedin( [email protected][.@j], [email protected][.@j] ) ) {
					attachrid [email protected][.@j];
					if ( inarray( .@unique_id, get_unique_id() ) == -1 ) {
						dispbottom "Reward given for conquered "+ getcastlename(.castle$[.@i]) +"("+ .castle$[.@i] +")";
						getitem 31509, 1;
						getitem 12103, 1;
						getitem 16770, 1;
						getitem 6380, 15;
						getitem 31510, 1;
						.@unique_id[ getarraysize(.@unique_id) ] = get_unique_id();
					}
				}
			}
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	end;
}

somehow I was expecting him to post a reply, but he edit the 1st post instead, so I bump

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, AnnieRuru said:
-	script	WoE Reward	FAKE_NPC,{
OnAgitEnd: callsub S_AgitEnd, 0, 20;
OnAgitEnd2: callsub S_AgitEnd, 20, 30;
S_AgitEnd:
	.@start = getarg(0);
	.@end = getarg(1);
	for ( .@i = .@start; .@i < .@end; ++.@i ) {
		.@guild_id = getcastledata( .castle$[.@i], CD_GUILD_ID );
		if ( .@guild_id ) {
			deletearray .@unique_id;
			getguildmember .@guild_id, 1;
			getguildmember .@guild_id, 2;
			for ( .@j = 0; .@j < [email protected]; ++.@j ) {
				if ( isloggedin( [email protected][.@j], [email protected][.@j] ) ) {
					attachrid [email protected][.@j];
					if ( inarray( .@unique_id, get_unique_id() ) == -1 ) {
						dispbottom "Reward given for conquered "+ getcastlename(.castle$[.@i]) +"("+ .castle$[.@i] +")";
						getitem 31509, 1;
						getitem 12103, 1;
						getitem 16770, 1;
						getitem 6380, 15;
						getitem 31510, 1;
						.@unique_id[ getarraysize(.@unique_id) ] = get_unique_id();
					}
				}
			}
		}
	}
	end;
OnInit:
	setarray .castle$[0],
		"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
		"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
		"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
		"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
		"arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
		"schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
	end;
}

somehow I was expecting him to post a reply, but he edit the 1st post instead, so I bump

Thanks annie ill try it, and give the feedback

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...