Jump to content
  • 0

Give Reward use unique_id


LearningRO

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

 

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 .@sql$, ((.Options&4)?"position = 0":"online = 1");
	if (.Options&2) set .@str$,gettimestr("%B %d, %Y",21);
	freeloop(1);
	for(set .@i,0; .@i<30; set .@i,.@i+1)
		if (getarg(0)&(1<<.@i)) {
			set .@gid, getcastledata(.Castles$[.@i],1);
			if (!.@gid) continue;
			set .@size, query_sql("SELECT account_id,char_id FROM `guild_member` WHERE guild_id = '"+.@gid+"' AND "+.@sql$,.@aid,.@cid);
			for(set .@j,0; .@j<.@size; set .@j,.@j+1) {
				if ((.Options&8) && !(.Options&4)) {
					set .@ip$, replacestr(getcharip(.@aid[.@j]),".","a");
					if (getd(".@ip_"+.@i+"_"+.@ip$)) continue;
					setd ".@ip_"+.@i+"_"+.@ip$,1;
				}
				if (.Options&2) {
					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()))");
					if (!getd(".@str_"+.@cid[.@j]) && isloggedin(.@aid[.@j],.@cid[.@j])) {
						setd ".@str_"+.@cid[.@j],1;
						message rid2name(.@aid[.@j]),"You've got mail! Please re-login to update your mailing list.";
					}
				} else if (isloggedin(.@aid[.@j])) {
					for(set .@k,0; .@k<getarraysize(.Reward); set .@k,.@k+2)
						getitem .Reward[.@k], .Reward[.@k+1], .@aid[.@j];
					message rid2name(.@aid[.@j]),"You have been rewarded for conquering "+getcastlename(.Castles$[.@i])+".";
				}
			}
		}
	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
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

-	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 < $@guildmembercount; ++.@j ) {
				if ( isloggedin( $@guildmemberaid[.@j], $@guildmembercid[.@j] ) ) {
					attachrid $@guildmemberaid[.@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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

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 < $@guildmembercount; ++.@j ) {
				if ( isloggedin( $@guildmemberaid[.@j], $@guildmembercid[.@j] ) ) {
					attachrid $@guildmemberaid[.@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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  103
  • Topics Per Day:  0.03
  • Content Count:  323
  • Reputation:   4
  • Joined:  12/09/13
  • Last Seen:  

On 3/18/2019 at 2:52 PM, 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 < $@guildmembercount; ++.@j ) {
				if ( isloggedin( $@guildmemberaid[.@j], $@guildmembercid[.@j] ) ) {
					attachrid $@guildmemberaid[.@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

Hi I don't know it this is okay, but can someone convert this to Hercules script? thanks!

Link to comment
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.

×
×
  • Create New...