EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   (TEST) Item Distribution (https://www.eqemulator.org/forums/showthread.php?t=28113)

core 05-05-2009 02:01 PM

(TEST) Item Distribution
 
Ok I made a quest where you hail an NPC and say yes if you like the newbie (test) items. Everything works fine just wondering if there is an easier way to distribut like

quest::summonitem("38105-38125");

Anyways, here is some code it works and the (TEST) items for class specific. Feel free to use and if you know an easier way let me know pls :)

CLASS ITEM's

Warrior 38000-38020
Monk 38021-38041
Rogue 38042-38062
Shadowknight 38063-38083
Paladin 38084-38104
Ranger 38105-38125
Beastlord 38129-38146
Bard 38147-38167
Cleric 38186-38188
Druid 38189-38209
Shaman 38210-38230
Wizard 38231-38251
Magician 38252-38272
Enchanter 38273-38293
Necromancer 38294-38314
Berserker 38315-38332

Code:

#############
#Written By : Michael Csaky
#Quest Name: An Armor Quest for all Classes Newbie Armor (Test)
#Author: Platos Newbie Armor
#################
sub EVENT_SAY
{
  if($text=~/Hail/i)
      {
        quest::say("Hello there $name, I am here to help all New Players equipe a starting armor. Are you in need of armor [Yes]?");
      }
if ($text=~/hail/i)
{
  if ($class eq "Shadowknight")
      {
        quest::say("Well then here is some New Shadowknight Gear to get you started.");
              quest::summonitem("38063");
        quest::summonitem("38064");
        quest::summonitem("38065");
        quest::summonitem("38066");
        quest::summonitem("38067");
        quest::summonitem("38068");
        quest::summonitem("38069");
        quest::summonitem("38070");
        quest::summonitem("38071");
        quest::summonitem("38072");
        quest::summonitem("38073");
        quest::summonitem("38074");
        quest::summonitem("38075");
        quest::summonitem("38076");
        quest::summonitem("38077");
        quest::summonitem("38078");
        quest::summonitem("38079");
        quest::summonitem("38080");
        quest::summonitem("38081");
        quest::summonitem("38082");
        quest::summonitem("38083");
      }
elsif ($class eq "Warrior")
  {
      quest::say("Well then here is some New Warrior Gear to get you started.");
        quest::summonitem("38000");
        quest::summonitem("38001");
        quest::summonitem("38002");
        quest::summonitem("38003");
        quest::summonitem("38004");
        quest::summonitem("38005");
        quest::summonitem("38006");
        quest::summonitem("38007");
        quest::summonitem("38008");
        quest::summonitem("38009");
        quest::summonitem("38010");
        quest::summonitem("38011");
        quest::summonitem("38012");
        quest::summonitem("38013");
        quest::summonitem("38014");
        quest::summonitem("38015");
        quest::summonitem("38016");
        quest::summonitem("38017");
        quest::summonitem("38018");
        quest::summonitem("38019");
        quest::summonitem("38020");
  }
}
}


reddogut 05-08-2009 03:01 PM

I have checked and as far as I can tell there is no support for summoning multiple items with a single quest::summonitem command. Although that would be a useful thing in certain cases.

Shendare 05-08-2009 07:03 PM

I believe Perl supports iterating loops as follows, which would be cleaner.

Code:

if ($class eq 'Warrior')
{
  foreach (38000..38020)
  {
    quest::summonitem($_);
  }
}
elsif ($class eq 'Shadowknight')
{
  foreach (38063..38083)
  {
    quest::summonitem($_);
  }
}

21 items at once, eh? I feel like I've read somewhere that there's a limit to how many items could be stored on a player's cursor, but I don't really remember.

yoman258 05-16-2009 01:10 AM

I believe there is a limit, would there be a way to spawn a bag full of items? Isn't that how it was done on the test server on live? Kind of like the clicky pet focus items servers have, where you summon a bag of stuff... I don't know how plausible this is, but if it could be done it would probably be the best way to go.

Valdaun 10-26-2009 10:14 PM

I thought this was a cool idea for gearing up bots, so here's my much simplified version as requested originally (fully tested on my own server). You do receive all 20 items on your cursor, but this works fine at least on 0.8.0+ and SoF client.

Code:

# Gear summoner for quick and easy bot equipping
#
# This gear is the full set of "Class Slot (Test)" for each class
#
# Utilizes navigation links and whispers for easy NPC interaction


sub EVENT_SAY
{
        # this array holds all the required names and item IDs used later
        my %class_arr = (
                Warrior => { "start" => 38000, "end" => 38020 },
                Monk => { "start" => 38021, "end" => 38042 },
                Rogue => { "start" => 38042, "end" => 38062 },
                Shadowknight => { "start" => 38063, "end" => 38083 },
                Paladin => { "start" => 38084, "end" => 38104 },
                Ranger => { "start" => 38105, "end" => 38125 },
                Beastlord => { "start" => 38126, "end" => 38146 },
                Bard => { "start" => 38147, "end" => 38167 },
                Cleric => { "start" => 38168, "end" => 38188 },
                Druid => { "start" => 38189, "end" => 38209 },
                Shaman => { "start" => 38210, "end" => 38230 },
                Wizard => { "start" => 38231, "end" => 38251 },
                Magician => { "start" => 38252, "end" => 38272 },
                Enchanter => { "start" => 38273, "end" => 38293 },
                Necromancer => { "start" => 38294, "end" => 38314 },
                Berserker => { "start" => 38315, "end" => 38332 } #Uses 2hander, less items
        );

        # misc. variables
        my $class_link = quest::saylink("class");
        my $whisper_color = 315;        #tan
        my $NPCName = $npc->GetCleanName();       

        if($text=~/Hail/i)
        {
            quest::say("Greetings, $name.  Once I was a great Hero like you,
          but now I am relegated to equipping all the new mercenaries that
        seem to be popping up all over.  Simply tell me the [$class_link] of
        mercenary that you wish to equip and I can scounge up some starter equipment.");
        }

        if($text=~/Class/i)
        {
                $client->Message($whisper_color, "$NPCName whispers to you, 'I can
                equip any of the following classes'");

                # print out say links for each of the classes in alpha order
                foreach $class_name (sort keys %class_arr)
                {
                        my $link = quest::saylink($class_name);
                        $client->Message($whisper_color, "$link");
                }
        }

        # for any typed text besides "Hail" or "class", check to see if it was a class
        # name that was said (clicked), and summon the appropriate items on a match
        if($text !~ /Hail/i || $text !~ /class/i)
        {
                foreach $class_name (sort keys %class_arr)
                {
                        if ($text eq $class_name)
                        {
                                $start = $class_arr{$class_name}{"start"};
                                $end = $class_arr{$class_name}{"end"};

                                $client->Message($whisper_color, "$NPCName whispers to you, 'Thanks for shopping
                                        at Bot-Mart!'");

                                # this will dump all 20 items onto the players cursor
                                foreach ($start..$end)
                                {
                                        quest::summonitem($_);
                                }
                        }
                }
        } #end class name checks

}#END of FILE



All times are GMT -4. The time now is 12:01 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.