Card Shark NPC's perl file needs boolean help
A sneak peak at the new Card Shark NPC's script in order to help get it working. I've created a card game within the server and this NPC will reward players with items based on the 4-card "hand" you give to her. It's all described in the comments part of the perl file but here's a brief summary:
Hand in up to 4 cards.
4 cards: If two are of the same rank (see perl for ranks among suits) and two others of another rank (2 pair), reward.
3 cards:If three are of the same rank, reward.
4 cards: If all of the same suit, reward.
4 cards: If all of the same rank, reward.
I'm almost certain the boolean checks are the issue but can't see it, perhaps one of you with fresh eyes on it will see the error.
Code:
#2193 Card Shark Laurel Cain (Rare Item Merchant) in poknowledge, not an actual merchant, all done via perl script
#Quest: Accepts combinations of cards for rare items, cards use icons #896-901 and drop from various mobs in Worlds Apart expansion
#icon #896 card back (for unidentified cards) 7327 (stackable to 20, not lore, all other cards lore)
#icon #897 damaged card back (cannot be identified, useless) 7329
#icon #898 x of Arms (suit): Sword 7342 Axe 7354 Dagger 7357 Mace 7358 Pike* 7401
#icon #899 x of Royals (suit): King 7473 Queen 7474 Prince 7476 Knight 7497 Jester* 7503
#icon #900 x of Claws (suit): Dragon 7504 Bear 7732 Lion 7742 Wolf 7758 Eagle* 7763
#icon #901 x of Skulls (suit): Vampire 7772 Wyvern 7775 Drake 7839 Viper 7844 Goblin* 7845
#common cards* not used in turnins, drop 60% of the time (15% each), damaged card drops 8% of the time, remaining 16 cards drop as an unidentified card 32% of the time
#unidentified cards can be identified by the Card Dealer in poknowledge for 100pp, 2% chance for each to become one of 16 random cards
#Reward combinations (hands):
#2-pairs (11): any two of the same rank different suits plus any two of another rank different suits - 7125, 7261, 7162, 7263, 7264, 7265, 7279, 7278, 26980, 68672, 69447
#3-of-a-kind (8): any three of same rank different suits - 68555, 68556, 68557, 68558, 68559, 68560, 68561, 68562
#flush (2): all four of each suit - 12082, 70652
#4-of-a-kind (1): all four same rank of each suit - 20507
#Rewards are the same rare items that drop with the world stones:
#7261 (face) Heated Drakescale Mask, 7262 (ear) Pyrewood Loop , 7263 (neck) Gold Leaf Pendant, 7264 (shoulders) Mantle of Draconic Regeneration,
#7265 (back) Cloak of Draugr Flesh, 7278 (fingers) Wraith Bone Ring, 7279 (waist) Belt of Blood Magic,
#68555 (waist) Glyphed Ritual Belt, 68556 (waist) Dark Hide Belt, 68557 (shoulders) Mantle of the Rav Lord, 68558 (shoulders) Shawl of Chaotic Energy,
#68559 (neck) Bone Linked Collar, 68560 (neck) Collar of the Rav Lord, 68561 (face) Unadorned Silver Visor, 68562 (face) Veil of Forgotten Heroes,
#70652 (back) Moonshadow Cloak, 12082 (back) Cloak of Combustion, 20507 (range) Blackflame Sphere,
#68672 (fingers) Ruby Ring of Embellishment, 7125 (ear) Earring of Corporeal Essence, 26980 (ear) Earring of Unseen Horrors, 69447 (ear) Hoop of Scales
sub EVENT_SAY {
if ($text=~/hail/i) {
quest::emote("acknowledges your presence with a nod.");
quest::say("What do you want? You have the look of [greed] on your face.");
}
if ($text=~/greed/i) {
quest::say("I'm seeking some very specific [playing cards]. If you can bring me the right set, I may be willing to part with some [trinkets] I've discovered over the years.");
}
if ($text=~/playing cards/i) {
quest::say("Speak with the Card Dealer across the room for more information on where to get them and about the deck organization; I'm waiting on someone WITH cards to arrive.");
}
if ($text=~/trinkets/i) {
quest::say("What card combinations do you possess, swindler? I accept only the following: [two-pairs], [three-of-a-kind], a [flush], and [four-of-a-kind]; and I do not need the common cards.");
}
if ($text=~/two-pairs/i) {
quest::say("Any two of the same rank with different suits plus any two of another rank with different suits; 1 of 11 random rewards.");
}
if ($text=~/three-of-a-kind/i) {
quest::say("Any three of same rank with different suits; 1 of 8 random rewards.");
}
if ($text=~/flush/i) {
quest::say("All four of one suit; 1 of 2 random rewards.");
}
if ($text=~/four-of-a-kind/i) {
quest::say("All four of same rank of each suit; 1 reward.");
}
}
sub EVENT_ITEM {
if (
(
((plugin::check_handin(\%itemcount,7342=>1,7473=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7504=>1,7772=>1)))
&& ((plugin::check_handin(\%itemcount,7354=>1,7474=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7732=>1,7775=>1)))
)
||
(
((plugin::check_handin(\%itemcount,7342=>1,7473=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7504=>1,7772=>1)))
&& ((plugin::check_handin(\%itemcount,7357=>1,7476=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7742=>1,7839=>1)))
)
||
(
((plugin::check_handin(\%itemcount,7342=>1,7473=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7504=>1,7772=>1)))
&& ((plugin::check_handin(\%itemcount,7358=>1,7497=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7758=>1,7844=>1)))
)
||
(
((plugin::check_handin(\%itemcount,7354=>1,7474=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7732=>1,7775=>1)))
&& ((plugin::check_handin(\%itemcount,7357=>1,7476=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7742=>1,7839=>1)))
)
||
(
((plugin::check_handin(\%itemcount,7354=>1,7474=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7732=>1,7775=>1)))
&& ((plugin::check_handin(\%itemcount,7358=>1,7497=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7758=>1,7844=>1)))
)
||
(
((plugin::check_handin(\%itemcount,7357=>1,7476=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7742=>1,7839=>1)))
&& ((plugin::check_handin(\%itemcount,7358=>1,7497=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7758=>1,7844=>1)))
)
) {
quest::emote("deftly shuffles the cards into a small deck and places it in a hidden pocket.");
quest::say("A frequently seen combination, but here is your reward.");
quest::summonitem(quest::ChooseRandom(7125, 7261, 7162, 7263, 7264, 7265, 7279, 7278, 26980, 68672, 69447));
}
elsif (
((plugin::check_handin(\%itemcount,7342=>1,7473=>1,7504=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7473=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7342=>1,7504=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7504=>1,7772=>1)))
|| ((plugin::check_handin(\%itemcount,7354=>1,7474=>1,7732=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7474=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7732=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7474=>1,7732=>1,7775=>1)))
|| ((plugin::check_handin(\%itemcount,7357=>1,7476=>1,7742=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7476=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7742=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7476=>1,7742=>1,7839=>1)))
|| ((plugin::check_handin(\%itemcount,7358=>1,7497=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7497=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7758=>1,7844=>1)) || (plugin::check_handin(\%itemcount,7497=>1,7758=>1,7844=>1)))
) {
quest::emote("deftly shuffles the cards into a small deck and places it in a hidden pocket.");
quest::say("A less common combination, here is your reward.");
quest::summonitem(quest::ChooseRandom(68555, 68556, 68557, 68558, 68559, 68560, 68561, 68562));
}
elsif ((plugin::check_handin(\%itemcount,7342=>1,7354=>1,7357=>1,7358=>1)) || (plugin::check_handin(\%itemcount,7473=>1,7474=>1,7476=>1,7497=>1)) || (plugin::check_handin(\%itemcount,7504=>1,7732=>1,7742=>1,7758=>1)) || (plugin::check_handin(\%itemcount,7772=>1,7775=>1,7839=>1,7844=>1))) {
quest::emote("deftly shuffles the cards into a small deck and places it in a hidden pocket.");
quest::say("A rare combination, all one suit, here is your reward.");
quest::summonitem(quest::ChooseRandom(12082, 70652));
}
elsif ((plugin::check_handin(\%itemcount,7342=>1,7473=>1,7504=>1,7772=>1)) || (plugin::check_handin(\%itemcount,7354=>1,7474=>1,7732=>1,7775=>1)) || (plugin::check_handin(\%itemcount,7357=>1,7476=>1,7742=>1,7839=>1)) || (plugin::check_handin(\%itemcount,7358=>1,7497=>1,7758=>1,7844=>1))) {
quest::emote("deftly shuffles the cards into a small deck and places it in a hidden pocket.");
quest::say("A rare combination, all one rank, here is your reward.");
quest::summonitem(20507);
}
else {
plugin::return_items(\%itemcount);
}
}
|