Jump to content
  • 0

Merge Scripts Capuche.


Like it

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   11
  • Joined:  12/14/16
  • Last Seen:  

Hello. I'm trying together some scripts to make a woe guild points + woe players point.

Here Capuche made a script for the petitioner, who forgot to give some important information. I need to tailor your script for this request, join the scripts, and complete the script with the following things.

On 2013-2-2 at 5:53 AM, Linkin Park said:

This will only add points to the castle that is active on that day? I mean, it should not add points to those guild that owns a castle that is not active during the WoE on that day.

Example

Monday = Kriemhild and Fad

Guild A owns Hohen, the points will be added only to the guild that owns Kriemhild and Fad.

 

On 2013-2-2 at 10:51 AM, Capuche said:

No you didn't specify this I will make an edit... wait

 

Another thing is, like:

  • Would I add 2 points every minute (60 seconds) for each player and his guild to be inside a castle and not die? The player must be moving, to prevent players from entering and hiding standing in a place without movement ...

I researched and found this to do time counting.

OnSec:
	.@player_name$ = strcharinfo(0);
	setarray getd( "."+.@player_name$+"_WoeTimes[getarraysize(."+.@player_name$+"_WoeTimes)]") , getd( "."+.@player_name$+"_WoeTimes[getarraysize(."+.@player_name$+"_WoeTimes)]") + 1; //add 1 second to counter
  • Would I always add points to the player and his guild, not just his guild?

 

  • Display the deaths of each player?

 

  • When changing month save in a different table all points for future queries or backup, avoiding problems. And then convert the total points of the guild woe to total_guild_shop to buy consumables in a total_guild_shop points shop, where only the guild master or players authorized by him could use the points for purchase.

 

  • Merge the scripts.
Spoiler

// alter table guild add column pk_woe_points int(11) default 0 after emblem_data, add index (pk_woe_points);
prontera,155,181,5	script	PK Woe Points	100,{
	.@nb = query_sql( "SELECT name, pk_woe_points from guild order by pk_woe_points desc limit 3", .@guild_name$, .@points ); // top 3
	for ( .@i = 0; .@i < .@nb; .@i++ ) {
		if ( !.@points[.@i] ) break;
		mes ( .@i +1 )+". "+ .@guild_name$[.@i] +" -> "+ .@points[.@i];
	}
	close;

OnPCKillEvent:
	if( agitcheck() && getcharid(2) && compare( .castle$, strcharinfo(3) ) )
		query_sql "update guild set pk_woe_points = pk_woe_points +1 where guild_id = "+ getcharid(2);
	end;
OnInit:
	setarray .@castle_name$, "prtg_cas01", "prtg_cas02"; // etc.. add yours castles
	.castle$ = implode( .@castle_name$, "|" );
	end;
}

/*
CREATE TABLE IF NOT EXISTS `guild_points` (
 `guild_id` int(11) unsigned NOT NULL default '0',
 `guild_name` varchar(255) NOT NULL DEFAULT 'NULL',
 `total_points` int(11) unsigned NOT NULL default '0',
 `woe_points` int(11) unsigned NOT NULL default '0',
 PRIMARY KEY  (`guild_id`)
) ENGINE=MyISAM;
*/

prontera,160,164,5    script    Guild Points    90,{

// Configurations
// --------------
   function displaypoints;
   .@guild_cID = getcharid(2);
   .@npc$ = "[^7600CC Guild Points ^000000]";
   .@GM = getgmlevel();

L_main:
// Unavailable during WOE
// ----------------------
   if( ( agitcheck() || agitcheck2() ) && !.@GM ) {
       mes .@npc$;
       mes "Hello,",
           "I'm busy there is a WOE now, can you come back later ?.";
       close;
   }

// Main menu
// ---------
   mes .@npc$;
   mes "Hello "+ ( .@GM ? "^FF0000[ GM ] "+ strcharinfo(0) +"^000000," : strcharinfo(0) +"," );
   mes " ";
   mes "What can I do for you ?";
   next;

   switch( select( "^777777~ Top 3 Guild^000000", "^777777~ Last WOE statistics^000000", ( !.@guild_cID ? "" : "^777777~ My Guild Points^000000" ), "^777777~ Leave^000000" ) ) {
       case 1:
       case 2:
           if( !displaypoints( ( @menu -1 ? 0 : 1 ), 1 ) ) {
               mes .@npc$;
               mes " ";
               mes "There is no result sorry.";
               emotion e_swt;
               next;
           }
           break;
       case 3:
           query_sql( "SELECT `total_points` FROM `guild_points` WHERE `guild_id` = '"+ .@guild_cID +"'", .@total_points );
           mes .@npc$;
           mes " ";
           mes "Your guild have "+ .@total_points +" total points.";
           next;
           break;
       case 4:
           mes .@npc$,
               " ",
               "Then Goodbye !";
               close;
   }
   goto L_main;


OnAgitStart:
   initnpctimer;
   .timetick = gettimetick(2) + 1500;    // display an announce every 1500 secs ~ 25 min
   query_sql( "UPDATE `guild_points` SET `woe_points` = '0'" );
   end;

// give points every 30 min
// ------------------------
OnTimer1799000:
   if( gettimetick(2) > .timetick ) {
       .timetick = gettimetick(2) + 1500;
       displaypoints( 0,0 );
   }
   for( .@i = 0; .@i < .size_c; .@i++ ) {
       .@owned_by = getcastledata( .castle$[ .@i ],1 );
       if( .@owned_by )
           callfunc( "gpoints_woe", .@owned_by, 1 );
   }
   initnpctimer;
   end;

OnAgitEnd:
   displaypoints( 0,0 );
   stopnpctimer;
   sleep 5000;
   displaypoints( 1,0 );
   end;


// Display guild point to all / self
// ---------------------------------
function displaypoints {
   if( getarg(0) )
       .@nb = query_sql( "SELECT `guild_name`, `total_points` FROM `guild_points` WHERE `total_points` > 0 ORDER BY `total_points` DESC LIMIT 10", .@guild_name$, .@points );
   else
       .@nb = query_sql( "SELECT `guild_name`, `woe_points` FROM `guild_points` WHERE `woe_points` > 0 ORDER BY `woe_points` DESC LIMIT 10", .@guild_name$, .@points );

   if( !.@nb ) return 0;

   announce ( getarg(0) ? "~~~~~ Guild POINTS ~~~~~" : "~~~~~ Woe POINTS ~~~~~" ), ( getarg(1) ? bc_self : bc_all );
   for( .@i = 0; .@i < .@nb; .@i++ )
       announce .@points[ .@i ] +" points : "+ .@guild_name$[ .@i ], ( getarg(1,0) ? bc_self : bc_all );
   return 1;
}


OnInit:
// Castle list - 1 point for each castle owned
// -------------------------------------------
   setarray .castle$, "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",
                       "nguild_alde",    "nguild_gef",    "nguild_pay",    "nguild_prt",
                       "schg_cas01",    "schg_cas02",    "schg_cas03",    "schg_cas04",    "schg_cas05",
                       "arug_cas01",    "arug_cas02",    "arug_cas03",    "arug_cas04",    "arug_cas05";

   .size_c = getarraysize( .castle$ );
   end;
}

// Update guild_points table
// -------------------------
function    script    gpoints_woe    {
   .@guild_id = getarg(0);

   if( !query_sql( "SELECT `guild_id` FROM `guild_points` WHERE `guild_id` = '"+ .@guild_id +"' ", .@guild_id ) )
       query_sql( "INSERT INTO `guild_points` (`guild_id`, `guild_name`, `total_points`, `woe_points`) VALUE ('"+ .@guild_id +"', '"+ getguildname( .@guild_id ) +"', '0', '0')" );

   .@value = getarg(1);
   query_sql( "UPDATE `guild_points` SET `total_points` = ( total_points + ("+ .@value +") ), `woe_points` = ( woe_points + ("+ .@value +") ) WHERE `guild_id` = '" + .@guild_id + "'" );
   return;
}

 

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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