Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-22-2014, 10:54 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,604
Default

Once this pull request gets committed, this will be possible without Perl DBI. There is a plugin, as mentioned, called plugin::GetTimeLeft(), I have re-written this plugin along with NatedogEZ to return time from Years downwards (includes months and weeks). The syntax for $client->GetGlobalTime() is $client->GetGlobalTime("qglobal_name", character_id, npc_id, zone_id); NatedogEZ and I did not default character_id, npc_id, and zone_id to 0, so you must specify 0 if you don't want it to search for specific NPCs or zones. Along with this commit comes $client->GetGlobal() which has the exact same syntax, $client->GetGlobal("qglobal_name", character_id, npc_id, zone_id); This will return the value of a quest global based on NPC or Client, as it is for mobs. This will allow you to do such things as check your target's quest global using $client->GetTarget()->GetGlobal(); if you meet the correct conditions. I apologize for rambling.

Here's the plugin, to use it do the following: $client->Message(Color #, plugin::GlobalTime($client->GetGlobalTime("qglobal_name", character_id, npc_id, zone_id)));
Code:
sub GlobalTime {
    my $time = $_[0];
    my $currentTime = time;
    my $difference = ($time - $currentTime);
    my ($years, $months, $weeks, $days, $hours, $minutes, $seconds) = 0;
 
    if ($difference <= 0) {
        return 0;
    }
    
    if ($difference > 31556926) {
        $years = int($difference / 31556926);
    }
    if ($difference > 2628000) {
        $months = int($difference / 2628000) % 12;
    }
    if ($difference > 604800) {
        $weeks = int($difference / 604800) % 4;
    }
    if ($difference > 86400) {
        $days = int($difference / 86400) % 7;
    }
    if ($difference > 3600) {
        $hours = int($difference / 3600) % 24;
    }
    if ($difference > 60) {
        $minutes = int($difference / 60) % 60;
    }
    $seconds = ($difference % 60);
    $ys = $years != 1 ? "Years":"Year";
    $mos = $months != 1 ? "Months":"Month";
    $ws = $weeks != 1 ? "Weeks":"Week";
    $ds = $days != 1 ? "Days":"Day";
    $hs = $hours != 1 ? "Hours":"Hour";
    $ms = $minutes != 1 ? "Minutes":"Minute";
    $ss = $seconds != 1 ? "Seconds":"Second";
    
    return "You have $years $ys, $months $mos, $weeks $ws, $days $ds, $hours $hs, $minutes $ms, and $seconds $ss remaining";
}
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 12:13 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3