Advertisement
Guest User

Untitled

a guest
Apr 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.44 KB | None | 0 0
  1. # Default-actions.pl
  2. #
  3. # Default actions to perform if the user performs particular actions on an NPC.
  4.  
  5. sub defaultSay{
  6.   my $handled = plugin::nullzero(shift);
  7.   my $name = plugin::assocName();
  8.   my $text = plugin::val('$text');
  9.   my $mname = plugin::fixNPCName();
  10.   my $faction = plugin::val('$faction');
  11.   my $zonesn = plugin::val('$zonesn');
  12.   my $npc = plugin::val('$npc');
  13.   my $zoneln = plugin::cityName();
  14.  
  15.   if (!$handled)
  16.   {
  17.     if ($mname=~/^Soulbinder\w/)
  18.     {
  19.       if($text=~/^hail/i)
  20.       {
  21.         quest::say("Greetings, ${name}. When a hero of our world is slain, their soul returns to the place it was last bound and the body is reincarnated. As a member of the Order of Eternity, it is my duty to [bind your soul] to this location if that is your wish.");
  22.         quest::doanim(29);
  23.  
  24.         $handled = 1;
  25.       }
  26.       elsif (($text=~/bind my soul/i) || ($text=~/bind your soul/i))
  27.       {
  28.         quest::say("Binding your soul. You will return here when you die.");
  29.         quest::doanim(42);
  30.         quest::selfcast(2049);
  31.  
  32.         $handled = 1;
  33.       }
  34.     }
  35.     elsif ($mname=~/^Guard\w/)
  36.     {
  37.       if ($faction > 5)
  38.       {
  39.         quest::me("$mname glowers at you dubiously.");
  40.  
  41.         $handled = 1;
  42.       }
  43.       else
  44.       {
  45.         quest::say("Hail, $name! Pardon me. I am on duty, keeping $zoneln safe.");
  46.  
  47.         $handled = 1;
  48.       }
  49.     }
  50.     elsif (($mname=~/^Merchant\w/) || ($mname=~/^Innkeep/) || ($mname=~/^Barkeep/))
  51.     {
  52.       if($text=~/^Hail/i)
  53.       {
  54.         quest::say("Welcome, $name! Why don't you browse through my selection of fine goods and pick out some things you like?");
  55.  
  56.         $handled = 1;
  57.       }
  58.     }
  59.   }
  60.  
  61.   if (($text=~/test money/i) && (plugin::val('$status') > 20))
  62.   {
  63.     quest::givecash(99, 99, 99, 99);
  64.   }
  65. }
  66.  
  67. sub defaultItem
  68. {
  69.   plugin::returnUnusedItems();
  70. }
  71.  
  72. sub defaultDeath
  73. {
  74.   my $handled = plugin::nullzero(shift);
  75.   my $mname = plugin::val('$mname');
  76.   my $zonesn = plugin::val('$zonesn');
  77.  
  78.   if (!$handled)
  79.   {
  80.     if ($mname =~ /^(an\_)?orc(\_.+|)$/i) # Everything from 'orc' to 'an_orc_flibberty_gibbet', but not 'orchard_master', etc.
  81.     {
  82.       # Orc death
  83.      
  84.       quest::say(
  85.         (($zonesn =~ /(g|l)faydark/) || ($zonesn eq 'crushbone')) ? plugin::random('You shall have all the Crushbone Orcs on your tail for my death!!') :
  86.         "DEBUG: $zonesn orc death!");
  87.  
  88.       $handled = 1;
  89.     }
  90.     elsif ($mname =~ /^(a\_)?gnoll(\_.+|)$/i) # Everything from 'gnoll' to 'a_gnoll_flibberty_gibbet', but not 'gnollish', etc.
  91.     {
  92.       # Gnoll death
  93.      
  94.       quest::say(
  95.         ($zonesn =~ /^qey/i) ? plugin::random('DEBUG: Blackburrow gnoll death!!') :
  96.         "DEBUG: $zonesn (Non-Blackburrow) gnoll death!");
  97.       $handled = 1;
  98.     }
  99.     elsif ($mname =~ /^Guard/i)
  100.     {
  101.       # Guard death
  102.      
  103.       my $city = plugin::cityName();
  104.      
  105.       quest::say( ($city eq 'Kelethin') ? 'Kelethin guard death!' :
  106.                   ($city eq 'Felwithe') ? 'Felwithe guard death!' :
  107.                   "DEBUG: $city guard death!" );
  108.  
  109.       $handled = 1;
  110.     }
  111.   }
  112. }
  113.  
  114. sub defaultSlay
  115. {
  116.   my $handled = plugin::nullzero(shift);
  117.   my $mname = plugin::val('$mname');
  118.   my $zonesn = plugin::val('$zonesn');
  119.  
  120.   if (!$handled)
  121.   {
  122.     if ($mname =~ /^Guard/i)
  123.     {
  124.       # Guard kills
  125.      
  126.       # 25% chance for flavor text
  127.       if (int(rand(4)) == 0)
  128.       {
  129.         my $city = plugin::cityName();
  130.      
  131.         quest::say(
  132.           ($city eq 'Kelethin') ? 'For the protection of all Feir\'dal, there shall be no mercy for your kind.' :
  133.           ($city eq 'Felwithe') ? 'Another one bites the dust.' :
  134.           "$city is a little bit safer now." );
  135.       }
  136.  
  137.       $handled = 1;
  138.     }
  139.   }
  140. }
  141.  
  142. sub defaultCombat()
  143. {
  144.   my $combat_state = plugin::val('$combat_state');
  145.   my $zonesn = plugin::val('$zonesn');
  146.   my $mname = plugin::val('$mname');
  147.  
  148.   if ($combat_state == 1)
  149.   {
  150.     if ($zonesn =~ /^((l|g)faydark|crushbone)$/)
  151.     {
  152.       if ($mname =~ /^(an\_)?orc(\_.+|)$/i) # Everything from 'orc' to 'an_orc_flibberty_gibbet', but not 'orchard_master', etc.
  153.       {
  154.       }
  155.     }
  156.    }
  157.   }
  158.  
  159.   return;
  160.  
  161.   # Sample code to work from
  162.   my $random_result = int(rand(100));
  163.     if(($combat_state == 1) &&($random_result<=50)){
  164.     quest::say("Death!!  Death to all who oppose the Crushbone orcs!!");
  165.    }else{
  166.    quest::say("You've ruined your lands. You'll not ruin mine!");
  167.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement