Jump to content

Emistry

Forum Moderator
  • Posts

    10017
  • Joined

  • Days Won

    407

Posts posted by Emistry

  1. .@size = query_sql( "SELECT `gm_name`,`nameid`,`amount`,`refine`,`reward_time`,`claim_name`,`claim_time`,`note`,`card1`,`card2`,`card3`,`card4` FROM `ero_gm_reward` WHERE `status` = 0 AND `format_name` = '"+escape_sql(strcharinfo(0))+"'",.@gm_name$,.@nameid,.@amount,.@refine,.@reward_time$,.@claim_name$,.@claim_time$,.@note$,.@card1,.@card2,.@card3,.@card4 );
    if (checkweight2(.@nameid,.@amount)) {
    	query_sql( "UPDATE `ero_gm_reward` SET `status` = 1,`claim_time` = NOW() WHERE `status` = 0 AND `format_name` = '"+escape_sql(strcharinfo(0))+"'");
    	for (.@i = 0; .@i < .@size; .@i++) {
    		getitem2 .@nameid[.@i],.@amount[.@i],1,.@refine[.@i],0,.@card1[.@i],.@card2[.@i],.@card3[.@i],.@card4[.@i];
    		mes "Claimed Reward # "+ getitemname(.@nameid[.@i]);
    	}
    	mes "claimed "+.@size+" items.";
    }
    else {
    	mes "You cant retrieve the rewards.";
    }
    close;

     

  2. //===== rAthena Script =======================================
    //= Free Script
    //===== By: ==================================================
    //= Sader1992
    //= https://rathena.org/board/profile/30766-sader1992/
    //= Email [email protected]
    //===== Compatible With: =====================================
    //= rAthena Project
    //= ==========================================================
    //= @aitem this command allows you to check how many of the item in the server
    //= command @aitem2 allows you to check also who have the items
    //= @aitem is fast, but @aitem2 will take some time to finish
    //= the time depend on how big your database is!
    //= ==========================================================
    //= you should wait until the command is done , do not logout/talk to npc/ anything until you get the results!
    //= ==========================================================
    //= '@AnalyzeItem' return the count of the item in the server.
    //= '@AnalyzeItem2' return the count of the item and the lst of who have it in the server (take more time).
    //= USAGE:
    //= @AnalyzeItem <ITEM_ID>
    //= @AnalyzeItem2 <ITEM_ID>
    //= OR
    //= @AItem <ITEM_ID>
    //= @AItem2 <ITEM_ID>
    //= Wait until you get the results in your chat
    //= to add more tables (like other storages) check the array .@tables$ and .@id$
    //= F_GET_REAL_OWNER_NAME(<"string table">,<id>) get the name for id
    //============================================================
    function	script	F_GET_REAL_OWNER_NAME	{
    	.@table$ = getarg(0);
    	.@id = getarg(1);
    	.@n$ = "";
    	if(.@table$ != "account_id" && .@table$ != "char_id"){
    		if(.@table$ != "id"){
    			return "(Mails):";
    		}else{
    			return "(Guilds):";
    		}
    	}
    	.@acc = .@id;
    	if(.@table$ == "char_id"){
    		query_sql("SELECT `account_id` FROM `char` WHERE `char_id` = '" + .@id + "'",.@acc);
    	}
    	query_sql("SELECT `group_id`,`userid` FROM `login` WHERE `account_id` = '" + .@acc + "'",.@g,.@name$);
    	if(.@g >= 1){
    		.@n$ = "[ Player ] ";
    	}
    	if(.@g >= 80){
    		.@n$ = "[ Staff ] ";
    	}
    	.@name1$ = .@n$ + .@name$;
    	return .@name1$;
    }
    
    
    prontera,155,181,5	script	Sample	757,{
    	input .@item_id;
    	.@owner_name = select("Continue", "Get Real Owner Name") - 1;
    	setarray .@tables$,"cart_inventory","guild_storage","inventory","storage",  "mail_attachments";
    	setarray .@id$,		"char_id",		"guild_id",		"char_id",	"account_id","id";
    	mes "Searching for item '" + getitemname(.@item_id) + "'",0x9FFFB5;
    	mes "Analyze Tables",0x9FFFB5;
    	for(.@i=0;.@i<getarraysize(.@tables$);.@i++){
    		query_sql("SELECT `amount`,`" + .@id$[.@i] + "` FROM `" + .@tables$[.@i] + "` WHERE nameid = '"+ .@item_id +"'", .@count,.@id);
    		
    		for(.@n=0;.@n<getarraysize(.@count);.@n++){
    			.@allcounts += .@count[.@n];
    			if(.@owner_name){
    				.@n$ = F_GET_REAL_OWNER_NAME(.@id$[.@i],.@id[.@n]);
    				.@ndx = inarray(.@name_list$,.@n$);
    				if(.@ndx == -1){
    					.@ndx = getarraysize(.@name_list$);
    					.@name_list$[.@ndx] = .@n$;
    				}
    				.@count_list[.@ndx] += .@count[.@n];
    				sleep2 2;
    			}
    		}
    		sleep2 5;
    		deletearray .@count[0],getarraysize(.@count);
    	}
    	if(.@owner_name){
    		mes "==================================",0x9FFFB5;
    		mes "Extended List:",0x9FFFB5;
    		if(getarraysize(.@name_list$) > 20){
    			for(.@i=0;.@i<getarraysize(.@name_list$);.@i += 3){
    				mes "" + .@name_list$[.@i] + " - (" + .@count_list[.@i] + ")" + "    " + "(" + .@name_list$[.@i+1] + "): (" + .@count_list[.@i+1] + ")" + "    " + "(" + .@name_list$[.@i+2] + "): (" + .@count_list[.@i+2] + ")",0x9FFFB5;
    			}
    		}else{
    			for(.@i=0;.@i<getarraysize(.@name_list$);.@i++){
    				mes "" + .@name_list$[.@i] + " - (" + .@count_list[.@i] + ")";
    			}
    		}
    		
    		mes "==================================",0x9FFFB5;
    	}
    	mes "Analyze Done.",0x9FFFB5;
    	mes "(" + .@allcounts + ")" + getitemname(.@item_id) + ".",0x9FFFB5;
    	close;
    }

     

    • Upvote 1
  3. -	script	sample	-1,{
    	OnInit:
    		setarray .map$, 
    			"prtg_cas01", "prtg_cas02", "prtg_cas03", "prtg_cas04", "prtg_cas05", 
    			"payg_cas01", "payg_cas02", "payg_cas03", "payg_cas04", "payg_cas05", 
    			"gefg_cas01", "gefg_cas02", "gefg_cas03", "gefg_cas04", "gefg_cas05", 
    			"aldeg_cas01", "aldeg_cas02", "aldeg_cas03", "aldeg_cas04", "aldeg_cas05", 
    			"arug_cas01", "arug_cas02", "arug_cas03", "arug_cas04", "arug_cas05", 
    			"schg_cas01", "schg_cas02", "schg_cas03", "schg_cas04", "schg_cas05";
    		
    		.@size = getarraysize(.map$);
    		for (.@i = 0; .@i < .@size; .@i++)
    			setmapflag .map$[.@i], mf_loadevent;
    		end;
    		
    	OnPCLoadMapEvent:
    		if (inarray(.map$, strcharinfo(3)) != -1) {
    			if (isequippedcnt(5001, 5002, 5003) >= 1) {
    				mes "You have equipped with restricted items. Please remove them.";
    				close2;
    				warp "SavePoint", 0, 0;
    			}
    		}
    		end;
    }

    try

  4. actually, you can also consider another alternative like this

    	.size = getarraysize(.itemid);
    	for (.@i = 0; .@i < .size; .@i++)
    		.total_chance += .itemchance[.@i];
    .@rate = rand(.total_chance);
    for (.@i = 0; .@i < .size; .@i++) {
    	.@total_itemchance += .itemchance[.@i];
    	if (.@rate < .@total_itemchance) {
    		getitem .itemid[.@i], 1;
    		end;
    	}
    }

    this would greatly reduce your array size, and probably perform slightly better

  5. you could try something like this.

    initialize all the character as specific character, then search and replace them randomly.

    if (abcde$ == "")
    	abcde$ = "____"; // initialize with a dummy character
    
    if (compare(abcde$, "_")) {
    	.@length = getstrlen(abcde$);
    	do {
    		.@index = rand(.@length);
    	} while (charat(abcde$, .@index) != "_")); // search for it
    	setchar(abcde$, .word$[.@index], .@index); // replace it
    }
    message strcharinfo(0), "Letter's Collected : "+ abcde$;

     

  6. conf\log_athena.conf

    // Enable Logs? (Note 3)
    ...
    ...
    // 0x00000010 - (S) Log NPC transactions (buy/sell)
    ...
    ...
    enable_logs: 0x00000010

    load the NPC

    prontera,155,181,5	script	Sample	757,{
    	.@sql$ = "SELECT `nameid`, SUM(`amount`) AS `total` FROM `picklog` WHERE `type` = 'S' AND `amount` > 0 GROUP BY `nameid` ORDER BY `total` DESC LIMIT 10";
    	.@count = query_sql(.@sql$, .@nameid, .@total);
    	mes "Items:";
    	for (.@i = 0; .@i < .@count; .@i++)
    		mes getitemname(.@nameid[.@i])+" - "+F_InsertComma(.@total[.@i]);
    	close;
    }

     

    however there is no way telling how much NPC have earned or lost from the transaction since it's not log.

    • Upvote 1
  7. prontera,155,181,5	script	Sample	757,{
    	mes "Give me Red Potion.";
    	if (select("Enter", "Cancel") == 1) {
    		if (!countitem(501)) {
    			mes "You dont have it.";
    		}
    		else {
    			TIME_LEFT = gettimetick(2) + (3 * 3600);
    			addtimer (3 * 3600 * 1000), strnpcinfo(3)+"::OnExpire";
    			warp "prt_fild01", 0, 0;
    		}
    	}
    	close;
    	
    	OnPCLoginEvent:
    		.@time_left = TIME_LEFT - gettimetick(2);
    		if (.@time_left > 0) {
    			addtimer (.@time_left * 1000), strnpcinfo(3)+"::OnExpire";
    		}
    		end;
    	
    	OnExpire:
    		TIME_LEFT = 0;
    		warp "prontera", 155, 181;
    		end;
    }

     

    • Like 1
×
×
  • Create New...