View Single Post
  #2  
Old 07-26-2007, 09:09 AM
Striat
Sarnak
 
Join Date: Aug 2006
Posts: 60
Default

You could write it this way using your syntax to fix it:

*NOTE -- I've omitted sub EVENT_SAY for thread length reasons

Code:
sub EVENT_ITEM {
if ($itemcount{16290}) {
if ($class == 'Shaman') {
	quest::summonitem(9829); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Ranger') { 
	quest::summonitem(9820); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(9805); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}

if ($itemcount{16291}) {
if ($class == 'Shaman') {
	quest::summonitem(15773); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}

if ($class == 'Ranger') {
	quest::summonitem(15764); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(15474); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
if ($itemcount{16292}) {
if ($class == 'Shaman') {
	quest::summonitem(11518); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Ranger') {
	quest::summonitem(11446);
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(11431); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
if ($itemcount{16293})  {
if ($class == 'Shaman') {
	quest::summonitem(11273); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Ranger') {
	quest::summonitem(11180); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(11140); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
if ($itemcount{16294})  {
if ($class == 'Shaman') {
	quest::summonitem(13569); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Ranger') { 
	quest::summonitem(12666); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(12597); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
if ($itemcount{16295})  {
if ($class == 'Shaman') {
	quest::summonitem(16801); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Ranger') {
	quest::summonitem(16775); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(16711); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
if ($itemcount{16296})  {
if ($class == 'Shaman') {
	quest::summonitem(20077); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Ranger') {
	quest::summonitem(19837); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Rogue') {
	quest::summonitem(19442); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
if ($itemcount{16347})  {
if ($class == 'Monk') {
	quest::summonitem(9808); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Beastlord') {
	quest::summonitem(9823); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Druid') {
	quest::summonitem(9832); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
if ($class == 'Berserker') {
	quest::summonitem(55505); 
	quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
	}
}
}
While that would work, I strongly recommend the following script:

Code:
sub EVENT_ITEM {
if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16290 => 1)) {
    my %rewards = (
      "Shaman" => 9829, "Ranger" => 9820, "Rogue" => 9805
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	plugin::return_items(\%itemcount); 
    	quest::say("I did not ask for this from you, $name.");
	}
	}
}
  if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16291 => 1)) {
    my %rewards = (
      "Shaman" => 15773, "Ranger" => 15764, "Rogue" => 15474
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	plugin::return_items(\%itemcount); 
    	quest::say("I did not ask for this from you, $name.");
	}
  	}
}

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16292 => 1)) {
    my %rewards = (
      "Shaman" => 11518, "Ranger" => 11446, "Rogue" => 11431
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	plugin::return_items(\%itemcount); 
    	quest::say("I did not ask for this from you, $name.");
	}
	}
  }

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16293 => 1)) {
    my %rewards = (
      "Shaman" => 11273, "Ranger" => 11180, "Rogue" => 11140
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	quest::summonitem(16293);
    	quest::say("I did not ask for this from you, $name.");
	}
	}
  }
if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16294 => 1)) {
    my %rewards = (
      "Shaman" => 13569, "Ranger" => 12666, "Rogue" => 12597
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	quest::summonitem(16294);
    	quest::say("I did not ask for this from you, $name.");
	}
	}
  }

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16295 => 1)) {
    my %rewards = (
      "Shaman" => 16801, "Ranger" => 16775, "Rogue" => 16711
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	quest::summonitem(16295);
    	quest::say("I did not ask for this from you, $name.");
	}
	}
  }

if ($class == 'Shaman' || $class == 'Ranger' || $class == 'Rogue') {
  if (plugin::check_handin(\%itemcount, 16296 => 1)) {
    my %rewards = (
      "Shaman" => 20077, "Ranger" => 19837, "Rogue" => 19442
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
	quest::summonitem(16296);
    	quest::say("I did not ask for this from you, $name.");
	}
	}
  }

if ($class == 'Monk' || $class == 'Beastlord' || $class == 'Druid' || $class == 'Berserker') {
  if (plugin::check_handin(\%itemcount, 16347 => 1)) {
    my %rewards = (
      "Monk" => 9808, "Beastlord" => 9823, "Druid" => 9832, "Berserker" => 55505
    );

    if(defined($rewards{$class})) {
      quest::summonitem($rewards{$class});
      quest::emote("summons a great armor from the pattern and hands it to you. 'Here you go $name.'");
    }
	else {
    	quest::say("I did not ask for this from you, $name.");
	quest::summonitem(16347);
	}
	}
  }
	plugin::return_items(\%itemcount); 
}
Now, you could still do some clean up with this script and make the return_items at the end a little prettier. However, it does its job: Accepts turn ins from the appropriate class only. Otherwise, items are returned. Furthermore, inappropriate items are returned everytime.
Reply With Quote