Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###################################################################
- ### Global NPC Script ###
- ###################################################################
- ##
- ###################################################################
- sub EVENT_SPAWN{
- #Prevent pets or charmed NPCs from loading the default.pl
- if (!$npc || $npc->GetOwnerID() || $npc->GetSwarmOwner())
- {
- return;
- }
- if($entity_list->GetNPCByNPCTypeID(50) && $npc->GetEntityVariable("Scaled") != 1){ #::: If not flagged as scaled, then scale the NPC
- quest::signalwith(50, 21, 0);
- }
- }
- sub EVENT_KILLED_MERIT {
- #Prevent pets or charmed NPCs from loading the default.pl
- if (!$npc || $npc->GetOwnerID() || $npc->GetSwarmOwner())
- {
- return;
- }
- if ($mlevel <= 19)
- {
- my $concolor = $client->GetLevelCon($mlevel);
- if ($concolor == 4 || $concolor == 13 || $concolor == 15 || $concolor == 18 || $concolor == 20) #If player gained xp - no farming grey's for credits.
- {
- #Adding 1 point/credit to the reborn_credits global
- my $total = $client->GetGlobal("reborn_credits");
- $total += 1;
- $client->SetGlobal("reborn_credits", $total, 5, "F");
- $client->Message(5, "You have gained a Reborn armor credit! You currently have $total.");
- }
- }
- if ($mlevel <= 34 && $mlevel > 19)
- {
- my $concolor = $client->GetLevelCon($mlevel);
- if ($concolor == 4 || $concolor == 13 || $concolor == 15 || $concolor == 18 || $concolor == 20) #If player gained xp - no farming grey's for credits.
- {
- #Adding 1 point/credit to the redeemed_credits global
- my $total = $client->GetGlobal("redeemed_credits");
- $total += 1;
- $client->SetGlobal("redeemed_credits", $total, 5, "F");
- $client->Message(5, "You have gained a Redeemed armor credit! You currently have $total.");
- }
- }
- if ($mlevel <= 49 && $mlevel > 34)
- {
- my $concolor = $client->GetLevelCon($mlevel);
- if ($concolor == 4 || $concolor == 13 || $concolor == 15 || $concolor == 18 || $concolor == 20) #If player gained xp - no farming grey's for credits.
- {
- #Adding 1 point/credit to the ascended_credits global
- my $total = $client->GetGlobal("ascended_credits");
- $total += 1;
- $client->SetGlobal("ascended_credits", $total, 5, "F");
- $client->Message(5, "You have gained an Ascended armor credit! You currently have $total.");
- }
- }
- ## Global plat script - each mob killed automatically gives the player x platinum.
- my $money = 0;
- if ($client->GetLevelCon($mlevel) == 18) { ##CON_LIGHTBLUE
- $money = int($mlevel * ($mlevel / $ulevel));
- }
- elsif ($client->GetLevelCon($mlevel) == 4) { ##CON_BLUE
- $money = int($mlevel * ($mlevel / $ulevel));
- }
- elsif ($client->GetLevelCon($mlevel) == 20) { ##CON_WHITE
- $money = int($mlevel * ($mlevel / $ulevel));
- }
- elsif ($client->GetLevelCon($mlevel) == 15) { ##CON_YELLOW
- $money = int($mlevel * ($mlevel / $ulevel));
- }
- elsif ($client->GetLevelCon($mlevel) == 13) { ##CON_RED
- if (($mlevel - $ulevel) >= 9) { ## Client 9 levels lower than mob - exploiting money drops.
- $money = 0;
- } else {
- $money = int($mlevel * ($mlevel / $ulevel));
- }
- }
- else { ##CON_GREY
- $money = 0;
- }
- my $ingroup = $client->GetGroup();
- if ($ingroup && $money > 0)
- {
- my $groupcount = $ingroup->GroupCount();
- $money /= $groupcount;
- $client->AddMoneyToPP(0, 0, 0, $money, 1);
- $client->Message(315, "You receive " . $money . " Platinum as a reward for killing this NPC.");
- }
- elsif (!$ingroup && $money > 0)
- {
- $client->AddMoneyToPP(0, 0, 0, $money, 1);
- $client->Message(315, "You receive " . $money . " Platinum as a reward for killing this NPC.");
- }
- }
- sub EVENT_DEATH {
- #Prevent pets or charmed NPCs from loading the default.pl
- if (!$npc || $npc->GetOwnerID() || $npc->GetSwarmOwner())
- {
- return;
- }
- #10% Chance of getting a reborn weapon token if mob gave xp.
- if ($mlevel <= 21)
- {
- my $concolor = $client->GetLevelCon($mlevel);
- if ($concolor == 4 || $concolor == 13 || $concolor == 15 || $concolor == 18 || $concolor == 20) {
- my $token = int(rand(99))+1;
- if ($token <= 10) {
- $npc->AddItem(200084, 1); #reborn weapon token
- }
- }
- }
- }
- sub EVENT_COMBAT {
- ## We only want pet's loading this script
- if ($npc->GetOwnerID())
- {
- if ($combat_state == 0) ## end combat - start heal timer
- {
- quest::settimer("pet_heal", 6);
- }
- elsif ($combat_state == 1) ## enter combat - stop heal timer if it is running
- {
- quest::stoptimer("pet_heal");
- }
- }
- }
- sub EVENT_TIMER {
- ## We only want pet's loading this script
- if ($npc->GetOwnerID())
- {
- if ($timer eq "pet_heal")
- {
- $npc->SetHP($npc->GetMaxHP());
- quest::stoptimer("pet_heal");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement