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;