Thread: Tomes?
View Single Post
  #9  
Old 05-26-2006, 01:48 PM
ylosh
Sarnak
 
Join Date: Jan 2006
Posts: 39
Default

hollissa - here is the plugin FNW created for class gm's to take tomes and train the players. copy this into a file called guildmasters.pl and place this into your plugins folder.

Code:
    #looks through the items haded in for discipline tomes,
    #processing them as we find them.
    sub try_tome_handins {
    	my $itemcount = shift;
    	my $isclass = shift;
    	my $expectclass = shift;
    	
    	my @tomes = ();
    	foreach my $i(keys %{$itemcount}) {
    		if(quest::isdisctome($i)) {
    			push(@tomes, $i);
    			delete $itemcount->{$i};
    		}
    	}
    	if(@tomes > 0) {
    		if($isclass eq $expectclass) {
    			foreach my $i(@tomes) {
    				quest::traindisc($i);
    			}
    		} else {
    			quest::say('You are not a member of my guild. I will not train you!');
    			foreach my $i(@tomes) {
    				$itemcount->{$i} = 1;
    			}
    		}
    	}
    }
    
    1;
then put these few lines into the sub EVENT_ITEM section of the .pl file for the guildmasters you want to be able take tome handins. replace 'Ranger' with the name of the class being trained. also assumes you have the check_handin/return_items plugin but you can get that from cvs if you don't already.

Code:
   #do all other handins first with plugin, then let it do disciplines
   plugin::try_tome_handins(\%itemcount, $class, 'Ranger');
   plugin::return_items(\%itemcount);
Reply With Quote