|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Plugins & Mods Completed plugins for public use as well as modifications. |
|
|
|
01-14-2015, 08:05 PM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,595
|
|
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..
|
|
|
|
|
|
|
01-14-2015, 10:16 PM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Not to put down your work, but I doubt many people are going to use those plugins. The main point to plugins is to simplify something that may be complex and could be used in multiple scripts.
The majority of those plugins are 1 liners and at least some of them do not simplify anything at all. Here is an example:
Code:
sub ColorMessage {
plugin::val('client')->Message($_[0], $_[1]);
}
Writing this:
Code:
plugin::ColorMessage(315, "Hi");
Is not any less work than writing this (in fact, it is more characters to write the plugin version):
Code:
$client->Message(315, "Hi");
Also, some will not work properly such as this one (what is this supposed to do?):
Code:
sub ClientEmote {
$_[0]->Message(315, plugin::GetNPCName() . " $_[0]");
}
It is good to include a usage and explanation with them, which makes it easier to see how to use them and what they are actually for.
Keep in mind that all plugins get loaded into every script, so I don't recommend adding a lot of them if they are not providing something fairly useful or that will be very commonly used in lots of scripts.
It is great to share things you think will be useful with the community. Some of those plugins may come in handy, but it depends on what use they provide that isn't already available with little to no extra work. Since there aren't comments explaining them, it is hard to tell.
I hope you do not take offense to this response, as it is not meant as an attack in any way.
Last edited by trevius; 01-14-2015 at 11:34 PM..
|
|
|
|
01-14-2015, 11:46 PM
|
Administrator
|
|
Join Date: May 2013
Location: United States
Posts: 1,595
|
|
I just released this as a grouping, some of these plugins were just used one time (or were requested) and never used again, such as plugin::ColorMessage, that was just a request by Drakiyth and was a one-time use. I actually never used the plugin::ClientEmote, didn't realize it was broken, the second $_[0] is supposed to be $_[1].
Last edited by Kingly_Krab; 01-14-2015 at 11:51 PM..
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 09:22 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|