EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Help with quest turn in code. (https://www.eqemulator.org/forums/showthread.php?t=39308)

NatedogEZ 02-10-2015 03:40 PM

This may work .. now that I know what you are asking for.

Place all rewards into the correct spot...
Place all possibly turn in items into @item_list...

This will ONLY work if they are single slot items and they match.. (helms give helms.. ect ect...)


Turning in any helm from the list of items will give you your class helm.. ect..

Code:

sub EVENT_ITEM {
        my %rewards = (                  #head arm  bracer hands chest legs  feet
                "Warrior"                => [4515, 4517, 4518, 4519, 4516, 4520, 4521],  #All the cobalt set.. (for testing)
                "Rogue"                        => [2828, 1001, 1002, 1003, 1004, 1005, 1006],
                "Monk"                        => [2444, 1001, 1002, 1003, 1004, 1005, 1006],
                "Berserker"                => [2684, 1001, 1002, 1003, 1004, 1005, 1006],
                "Shadowknight"        => [1819, 1001, 1002, 1003, 1004, 1005, 1006],
                "Paladin"                => [1810, 1001, 1002, 1003, 1004, 1005, 1006],
                "Ranger"                => [2493, 1001, 1002, 1003, 1004, 1005, 1006],
                "Bard"                        => [1846, 1001, 1002, 1003, 1004, 1005, 1006],
                "Beastlord"                => [2562, 1001, 1002, 1003, 1004, 1005, 1006],
                "Cleric"                => [1803, 1001, 1002, 1003, 1004, 1005, 1006],
                "Druid"                        => [2434, 1001, 1002, 1003, 1004, 1005, 1006],
                "Shaman"                => [2665, 1001, 1002, 1003, 1004, 1005, 1006],
                "Wizard"                => [2422, 1001, 1002, 1003, 1004, 1005, 1006],
                "Magician"                => [2278, 1001, 1002, 1003, 1004, 1005, 1006],
                "Enchanter"                => [2561, 1001, 1002, 1003, 1004, 1005, 1006],
                "Necromancer"        => [2381, 1001, 1002, 1003, 1004, 1005, 1006]
        );
        my %reward_type = (
        4                        => 0,  #Head 
        128                => 1,  #Arm
        1536                => 2,  #Bracer
        4096                => 3,  #hands
        131072                => 4,  #chest
        262144                => 5,  #legs
        524288                => 6  #feet
        );

        my @item_list = (1001, 1004, 1008, 1009, 1010, 1011, 1012); #THIS would be ALL items that are turned IN
        my $item_turnin = 0;
        if (grep { $_ == $item1 } @item_list) { $item_turnin = $item1; }
        elsif (grep { $_ == $item2 } @item_list) { $item_turnin = $item2; }
        elsif (grep { $_ == $item3 } @item_list) { $item_turnin = $item3; }
        elsif (grep { $_ == $item4 } @item_list) { $item_turnin = $item4; }

        if($item_turnin > 0) {
                my $slots = $client->GetItemStat($item_turnin, "slots");
                if (plugin::check_handin(\%itemcount, $item_turnin => 1)) {
                        quest::summonitem($rewards{$class}[$reward_type{$slots}]);
                        quest::emote("Works to make a piece of armor from the instructions you provided to him." );
                        quest::say ("Here you go $name.");
                }
        }
       
        plugin::return_items(\%itemcount);
}


ghanja 02-10-2015 03:45 PM

[code]
Code:

Class                        Chest        Legs        Head        Shoulders        Arms        Gloves        Boots        Bracers
Magician                2278        2298        2370        2372                2376        2377        2378        2379
Necromancer                2381        2382        2383        2385                2380        2393        2415        2421
Wizard                        2422        2423        2424        2425                2430        2431        2432        2433
Cleric                        1803        1806        1805        1807                1800        1804        1801        1802
Druid                        2434        2435        2436        2437                2438        2439        2442        2443
Shaman                        2665        2666        2667        2668                2669        2670        2672        2673
Berserker                2684        2685        2686        2687                2717        2718        2730        2820
Monk                        2444        2445        2451        2473                2486        2487        2488        2489
Ranger                        2493        2494        2495        2496                2497        2508        2511        2556
Rogue                        2828        2829        2830        2831                2832        2833        2834        2827
Paladin                        1810        1811        1812        1813                1808        1817        1809        1818
Warrior                        1563        1568        1569        1577                1579        1581        1582        1586
Bard                        1846        1847        1848        1901                1902        1907        1909        2052
Beastlord                2562        2564        2613        2614                2632        2633        2634        2650
Enchanter                2561        2656        2657        2660                2661        2662        2663        2664
Shadowknight        1819        1823        1824        1825                1826        1836        1844        1845

As per your PM. Yeah a hash of arrays would work just as NateDog provided. Populate his script accordingly using what you PM'ed me.

ghanja 02-10-2015 03:48 PM

You could also make the turn in item the key, then if you kept the array elements aligned (as he said you should anyway), you could use the class id (1-16) to choose the applicable element. If item turned in == element contents, then let the player know they already have their item. <shrug> A few methods of attack with this.

utbbop 02-10-2015 03:48 PM

Ok, here are my item numbers as requested...
(There is a large number of these and I am not looking for a hand out so if the task is too daunting to assist with I understand.)
Due to formatting issues with the forum, I have made a google sheet with the information. There are 2 tabs for reference.
https://docs.google.com/spreadsheets...it?usp=sharing

Overall Goal:
Allow someone to turn in a class and slot specific armor piece for a class and slot specific pattern. The ARMOR that is turned in can be for ANY CLASS. The PATTERN that is rewarded should be for the players specific class and should be for the slot that was turned in.

utbbop 02-10-2015 03:51 PM

Quote:

Originally Posted by NatedogEZ (Post 237698)
This may work .. now that I know what you are asking for.

Place all rewards into the correct spot...
Place all possibly turn in items into @item_list...

This will ONLY work if they are single slot items and they match.. (helms give helms.. ect ect...)


Turning in any helm from the list of items will give you your class helm.. ect..

Code:

sub EVENT_ITEM {
        my %rewards = (                  #head arm  bracer hands chest legs  feet
                "Warrior"                => [4515, 4517, 4518, 4519, 4516, 4520, 4521],  #All the cobalt set.. (for testing)
                "Rogue"                        => [2828, 1001, 1002, 1003, 1004, 1005, 1006],
                "Monk"                        => [2444, 1001, 1002, 1003, 1004, 1005, 1006],
                "Berserker"                => [2684, 1001, 1002, 1003, 1004, 1005, 1006],
                "Shadowknight"        => [1819, 1001, 1002, 1003, 1004, 1005, 1006],
                "Paladin"                => [1810, 1001, 1002, 1003, 1004, 1005, 1006],
                "Ranger"                => [2493, 1001, 1002, 1003, 1004, 1005, 1006],
                "Bard"                        => [1846, 1001, 1002, 1003, 1004, 1005, 1006],
                "Beastlord"                => [2562, 1001, 1002, 1003, 1004, 1005, 1006],
                "Cleric"                => [1803, 1001, 1002, 1003, 1004, 1005, 1006],
                "Druid"                        => [2434, 1001, 1002, 1003, 1004, 1005, 1006],
                "Shaman"                => [2665, 1001, 1002, 1003, 1004, 1005, 1006],
                "Wizard"                => [2422, 1001, 1002, 1003, 1004, 1005, 1006],
                "Magician"                => [2278, 1001, 1002, 1003, 1004, 1005, 1006],
                "Enchanter"                => [2561, 1001, 1002, 1003, 1004, 1005, 1006],
                "Necromancer"        => [2381, 1001, 1002, 1003, 1004, 1005, 1006]
        );
        my %reward_type = (
        4                        => 0,  #Head 
        128                => 1,  #Arm
        1536                => 2,  #Bracer
        4096                => 3,  #hands
        131072                => 4,  #chest
        262144                => 5,  #legs
        524288                => 6  #feet
        );

        my @item_list = (1001, 1004, 1008, 1009, 1010, 1011, 1012); #THIS would be ALL items that are turned IN
        my $item_turnin = 0;
        if (grep { $_ == $item1 } @item_list) { $item_turnin = $item1; }
        elsif (grep { $_ == $item2 } @item_list) { $item_turnin = $item2; }
        elsif (grep { $_ == $item3 } @item_list) { $item_turnin = $item3; }
        elsif (grep { $_ == $item4 } @item_list) { $item_turnin = $item4; }

        if($item_turnin > 0) {
                my $slots = $client->GetItemStat($item_turnin, "slots");
                if (plugin::check_handin(\%itemcount, $item_turnin => 1)) {
                        quest::summonitem($rewards{$class}[$reward_type{$slots}]);
                        quest::emote("Works to make a piece of armor from the instructions you provided to him." );
                        quest::say ("Here you go $name.");
                }
        }
       
        plugin::return_items(\%itemcount);
}


Ok, this may work.
I will give it a whirl and let you all know the results.

utbbop 02-10-2015 04:32 PM

Quote:

Originally Posted by utbbop (Post 237702)
Ok, this may work.
I will give it a whirl and let you all know the results.

This appears to be working!

I am going to spend the rest of the evening testing and implementing and will let you all know if I could use more assistance.

As of right now, please hold off on any further assistance as I don't want anyone to waste their time if this does in fact solve all of my issues.

Thanks to EVERYONE for your help.


All times are GMT -4. The time now is 12:03 AM.

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