Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-14-2015, 08:05 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default Custom NPC/Player Plugins.

Here's some custom plugins I've written, just thought some people may be able to use them, some of these may be copies or be like others. I will provide examples if necessary.
Code:
sub Emote {
    plugin::val('client')->Message(315, $_[0]);
}

sub ClientEmote {
    $_[0]->Message(315, plugin::GetNPCName() . " $_[1]");
}

sub Message {
    plugin::val('client')->Message(315, $_[0]);
}

sub ClientMessage {
    $_[0]->Message(315, $_[1]);
}

sub ClientWhisper {
    $_[0]->Message(257, plugin::GetNPCName() . " tells you, '$_[1]'");
}

sub ColorMessage {
    plugin::val('client')->Message($_[0], $_[1]);
}

sub CZMessageByName {
    quest::crosszonemessageplayerbyname(315, $_[0], $_[1]);
}

sub MessageColor {
    my %colorHash = ("Purple" => 257,
    "Dark Orange" => 258,
    "Light Green" => 259,
    "Dark Green" => 260,
    "Cyan" => 262,
    "Indigo" => 263,
    "Light Orange" => 281,
    "Grey" => 291,
    "White" => 307,
    "Beige" => 315,
    "Yellow" => 335);
    return $colorHash{$_[0]};
}

sub Marquee {
    plugin::val('client')->SendMarqueeMessage($_[0], 510, 1, ($_[2] ? 1 : 100), 3000,  $_[1]);
    if($_[3]) {
        plugin::val('client')->Message($_[0], $_[1]);
    }
}

sub ClientMarquee {
    $_[0]->SendMarqueeMessage($_[1], 510, 1, ($_[3] ? 1 : 100), 3000,  $_[2]);
    if($_[4]) {
        $_[0]->Message($_[1], $_[2]);
    }
}

sub GM {
    quest::gmsay($_[0], 335, 1);
}

sub ServerMessage {
    quest::gmsay(plugin::GetNPCName() . " tells the server, '$_[0]'", 335, 1, 0, 0);
}

sub AnnounceMessage {
    quest::gmsay($_[0], 335, 1, 0, 0);
}

sub HasItem {
    foreach my $slot (0..30, 251..340, 2000..2023, 2030..2270, 2500..2501, 2531..2550, 9999) {        
        if (plugin::val('client')->GetItemIDAt($slot) == $_[0]) {
            return 1;
        }
        
        foreach my $augslot (0..4) {
            if (plugin::val('client')->GetAugmentIDAt($slot, $augslot) == $_[0]) {
                return 1;
            }
        }
    }
    return 0;
}

sub DeleteItem {
    foreach my $slot (0..30, 251..340, 9999) {
        if (plugin::val('client')->GetItemIDAt($slot) == $_[0] && plugin::CountItem($_[0]) >= $_[1]) {
            plugin::val('client')->DeleteItemInInventory($slot, $_[1], 1);
            return 1;
        }
    }
    return 0;
}

sub CountItem {
    my $count = 0;
    foreach my $slot (0..29, 251..340, 9999) {
        if (plugin::val('client')->GetItemIDAt($slot) == $_[0]) {
            $count += plugin::val('client')->GetItemAt($slot)->GetCharges();
        }
    }
    return $count;
}

sub IP {
    my $ip = int($_[0]);
    $a = $ip % 256;
    $ip -= $a;
    $ip /= 256;
    
    $b = $ip % 256;
    $ip -= $b;
    $ip /= 256;
    
    $c = $ip % 256;
    $ip -= $c;
    $ip /= 256;
    
    $d = $ip;
    $quad = "$a.$b.$c.$d";
    return $quad;
}

sub GetNPCName {
    return plugin::val('npc')->GetCleanName();
}

sub SetMobLevel {
    plugin::val('npc')->SetLevel(quest::ChooseRandom($_[0]..$_[1]));
}

sub SetMobTexture {
    quest::npctexture(quest::ChooseRandom($_[0]..$_[1]));
}

sub SetMobGender {
    quest::npcgender(quest::ChooseRandom(0..1));
}

sub SetMobColor {
    plugin::val('npc')->WearChange($_, plugin::val('npc')->GetTexture(), plugin::MobColor($_[0], $_[1], $_[2])) for (0..6);
}

sub MobColor {
    return (($_[0] << 16) + ($_[1] << 8) + $_[2]);
}

sub Spawn {
    quest::spawn2($_[0], 0, 0, plugin::val('x'), plugin::val('y'), plugin::val('z'), plugin::val('h'));
}

sub Random {
    return quest::ChooseRandom($_[0]..$_[1]);
}

sub AddLoot {
    plugin::val('npc')->AddItem($_[0], ($_[1] ? $_[1] : 1), 0);
}

sub AddFlag {
    quest::set_zone_flag($_[0]);
}

sub CheckFlag {
    return quest::has_zone_flag($_[0]);
}

sub SetGlobal {
    quest::setglobal($_[0], ($_[1] ? $_[1] : 1), ($_[2] ? $_[2] : 5), ($_[3] ? $_[3] : "F"));
}

sub CheckLevel {
    return (plugin::val('ulevel') < $_[0] || plugin::val('ulevel') > $_[1]) ;
}

return 1;

Last edited by Kingly_Krab; 01-14-2015 at 11:49 PM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

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


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3