EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   global_player.pl or lua (https://www.eqemulator.org/forums/showthread.php?t=41138)

atomic 02-05-2017 06:56 PM

global_player.pl or lua
 
has anyone got the default global/global_player.pl or lua file for akka's install. i tried adding
sub EVENT_LEVEL_UP {
if($ulevel <= 69) {
$client->AddAAPoints(2);
quest::scribespells($ulevel);
quest::traindiscs($ulevel);
}
}
but messed it up

you can add this feature for me if you like :)

atomic 02-05-2017 08:48 PM

my global_players.pl is but on leveling it does not add spells or the 2 aa's as i wanted. NOT sure if this was my .lua file or .pl originally and that maybe why its not working.

Code:

function event_enter_zone(e)
        local qglobals = eq.get_qglobals(e.self);
        if(e.self:GetLevel() >= 15 and qglobals['Wayfarer'] == nil) then
                local zoneid = eq.get_zone_id();
                if(e.self:GetStartZone() ~= zoneid and (zoneid == 1 or zoneid == 2 or zoneid == 3 or zoneid == 8 or zoneid == 9
                or zoneid == 10 or zoneid == 19 or zoneid == 22 or zoneid == 23 or zoneid == 24 or zoneid == 29 or zoneid == 30
                or zoneid == 34 or zoneid == 35 or zoneid == 40 or zoneid == 41 or zoneid == 42 or zoneid == 45 or zoneid == 49
                or zoneid == 52 or zoneid == 54 or zoneid == 55 or zoneid == 60 or zoneid == 61 or zoneid == 62 or zoneid == 67
                or zoneid == 68 or zoneid == 75 or zoneid == 82 or zoneid == 106 or zoneid == 155 or zoneid == 202 or zoneid == 382
                or zoneid == 383 or zoneid == 392 or zoneid == 393 or zoneid == 408)) then
                        e.self:Message(15,
                                "A mysterious voice whispers to you, \'If you can feel me in your thoughts, know this -- "
                                .. "something is changing in the world and I reckon you should be a part of it. I do not know much, but I do know "
                                .. "that in every home city and the wilds there are agents of an organization called the Wayfarers Brotherhood. They "
                                .. "are looking for recruits . . . If you can hear this message, you are one of the chosen. Rush to your home city, or "
                                .. "search the West Karanas and Rathe Mountains for a contact if you have been exiled from your home for your deeds, "
                                .. "and find out more. Adventure awaits you, my friend.\'");
                end
        end
end

function event_combine_success(e)
        if (e.recipe_id == 10904 or e.recipe_id == 10905 or e.recipe_id == 10906 or e.recipe_id == 10907) then
                e.self:Message(1,
                "The gem resonates with power as the shards placed within glow unlocking some of the stone's power. "
                .. "You were successful in assembling most of the stone but there are four slots left to fill, "
                .. "where could those four pieces be?"
                );
        elseif(e.recipe_id == 10903 or e.recipe_id == 10346 or e.recipe_id == 10334) then
                local reward = { };
                reward["melee"] =  { ["10903"] = 67665, ["10346"] = 67660, ["10334"] = 67653 };
                reward["hybrid"] = { ["10903"] = 67666, ["10346"] = 67661, ["10334"] = 67654 };
                reward["priest"] = { ["10903"] = 67667, ["10346"] = 67662, ["10334"] = 67655 };
                reward["caster"] = { ["10903"] = 67668, ["10346"] = 67663, ["10334"] = 67656 };

                local ctype = eq.ClassType(e.self:GetClass());
                e.self:SummonItem(reward[ctype][tostring(e.recipe_id)]);
                e.self:SummonItem(67704);
                e.self:Message(1, "Success");
        --cleric 1.5
        elseif(e.recipe_id == 19460) then
                e.self:AddAAPoints(5);
                e.self:Ding();
                e.self:Message(15,'You have gained 5 ability points!');
                eq.set_global("cleric_epic","7",5,"F");
        --rogue 1.5
        elseif(e.recipe_id == 13402 or e.recipe_id == 13403 or e.recipe_id == 13404 or e.recipe_id == 13405) then
                e.self:Message(15,"The piece of the metal orb fuses together with the blue diamonds under the intense heat of the forge. As it does, a flurry of images flash through your mind... A ranger and his bear side by side, stoic and unafraid, in a war-torn forest. A bitter tattooed woman with bluish skin wallowing in misery in a waterfront tavern. An endless barrage of crashing thunder and lightning illuminating a crimson brick ampitheater. Two halflings locked in a battle of wits using a checkered board. The images then fade from your mind");
        --ranger 1.5 tree
        elseif(e.recipe_id ==13412) then
                eq.set_global("ranger_epic","3",5,"F");
                if(eq.get_zone_short_name()=="jaggedpine") then
                        e.self:Message(15,"The seed grows rapidly the moment you push it beneath the soil. It appears at first as a mere shoot, but within moments grows into a stout sapling and then into a gigantic tree. The tree is one you've never seen before. It is the coloration and thick bark of a redwood with the thick bole indicative of the species. The tree is, however, far too short and has spindly branches sprouting from it with beautiful flowers that you would expect on a dogwood. You take all of this in at a glance. It takes you a moment longer to realize that the tree is moving.");                       
                        eq.spawn2(181222, 0, 0, e.self:GetX()+3,e.self:GetY()+3,e.self:GetZ(),0);
                else
                        e.self:Message(15,"The soil conditions prohibit the seed from taking hold");
                        e.self:SummonItem(72091);
                        e.self:SummonItem(62621);
                        e.self:SummonItem(62622);
                        e.self:SummonItem(62844);
                end
        --ranger 1.5 final
        elseif(e.recipe_id ==13413) then
                e.self:AddAAPoints(5);
                e.self:Ding();
                e.self:Message(15,'You have gained 5 ability points!');
                eq.set_global("ranger_epic","5",5,"F");
        end
end

function event_command(e)
        return eq.DispatchCommands(e);
end

--[[ the main key is the ID of the AA
--  the first set is the age required in seconds
--  the second is if to ignore the age and grant anyways live test server style
--  the third is enabled
--]]
vet_aa = {
    [481]  = { 31536000, true, true}, -- Lesson of the Devote 1 yr
    [482]  = { 63072000, true, true}, -- Infusion of the Faithful 2 yr
    [483]  = { 94608000, true, true}, -- Chaotic Jester 3 yr
    [484]  = {126144000, true, true}, -- Expedient Recovery 4 yr
    [485]  = {157680000, true, true}, -- Steadfast Servant 5 yr
    [486]  = {189216000, true, true}, -- Staunch Recovery 6 yr
    [487]  = {220752000, true, true}, -- Intensity of the Resolute 7 yr
    [511]  = {252288000, true, true}, -- Throne of Heroes 8 yr
    [2000] = {283824000, true, true}, -- Armor of Experience 9 yr
    [8081] = {315360000, true, true}, -- Summon Resupply Agent 10 yr
    [8130] = {346896000, true, true}, -- Summon Clockwork Banker 11 yr
    [453]  = {378432000, true, true}, -- Summon Permutation Peddler 12 yr
    [182]  = {409968000, true, true}, -- Summon Personal Tribute Master 13 yr
    [600]  = {441504000, true, true}, -- Blessing of the Devoted 14 yr
}

function event_connect(e)
    local age = e.self:GetAccountAge();
    for aa, v in pairs(vet_aa) do
        if v[3] and (v[2] or age >= v[1]) then
            e.self:GrantAlternateAdvancementAbility(aa, 1)
        end
    end
end

function event_level_up(e)
        if($ulevel <= 69) {
        $client->AddAAPoints(2);
                quest::scribespells($ulevel);
                quest::traindiscs($ulevel);
        }
        local free_skills =  {0,1,2,3,4,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,36,37,38,39,41,42,43,44,45,46,47,49,51,52,54,67,70,71,72,73,74,76};

  for k,v in ipairs(free_skills) do
    if ( e.self:MaxSkill(v) > 0 and e.self:GetRawSkill(v) < 1 and e.self:CanHaveSkill(v) ) then
      e.self:SetSkill(v, 1);
    end
     
  end
end

--[[
0  /*13855*/ Skill1HBlunt = 0,
1  /*13856*/ Skill1HSlashing,
2  /*13857*/ Skill2HBlunt,
3  /*13858*/ Skill2HSlashing,
4  /*13859*/ SkillAbjuration,
5  /*13861*/ SkillAlteration,
6  /*13862*/ SkillApplyPoison, X
7  /*13863*/ SkillArchery, X
8  /*13864*/ SkillBackstab,
9  /*13866*/ SkillBindWound,
10 /*13867*/ SkillBash,
11 /*13871*/ SkillBlock,
12 /*13872*/ SkillBrassInstruments,
13 /*13874*/ SkillChanneling,
14 /*13875*/ SkillConjuration,
15 /*13876*/ SkillDefense,
16 /*13877*/ SkillDisarm,
17 /*13878*/ SkillDisarmTraps,
18 /*13879*/ SkillDivination,
19 /*13880*/ SkillDodge,
20 /*13881*/ SkillDoubleAttack,
21 /*13882*/ SkillDragonPunch,
21 /*13924*/ SkillTailRake = SkillDragonPunch, // Iksar Monk equivilent
22 /*13883*/ SkillDualWield,
23 /*13884*/ SkillEagleStrike,
24 /*13885*/ SkillEvocation,
25 /*13886*/ SkillFeignDeath,
26 /*13888*/ SkillFlyingKick,
27 /*13889*/ SkillForage, X
28 /*13890*/ SkillHandtoHand,
29 /*13891*/ SkillHide,
30 /*13893*/ SkillKick,
31 /*13894*/ SkillMeditate,
32 /*13895*/ SkillMend,
33 /*13896*/ SkillOffense,
34 /*13897*/ SkillParry,
35 /*13899*/ SkillPickLock, X
36 /*13900*/ Skill1HPiercing,        // Changed in RoF2(05-10-2013)
37 /*13903*/ SkillRiposte,
38 /*13904*/ SkillRoundKick,
39 /*13905*/ SkillSafeFall,
40 /*13906*/ SkillSenseHeading, X
41 /*13908*/ SkillSinging,
42 /*13909*/ SkillSneak,
43 /*13910*/ SkillSpecializeAbjure,      // No idea why they truncated this one..especially when there are longer ones...
44 /*13911*/ SkillSpecializeAlteration,
45 /*13912*/ SkillSpecializeConjuration,
46 /*13913*/ SkillSpecializeDivination,
47 /*13914*/ SkillSpecializeEvocation,
48 /*13915*/ SkillPickPockets, X
49 /*13916*/ SkillStringedInstruments,
50 /*13917*/ SkillSwimming, X
51 /*13919*/ SkillThrowing,
52 /*13920*/ SkillTigerClaw,
53 /*13921*/ SkillTracking, X
54 /*13923*/ SkillWindInstruments,
55 /*13854*/ SkillFishing, X
56 /*13853*/ SkillMakePoison, X
57 /*13852*/ SkillTinkering, X
58 /*13851*/ SkillResearch, X
59 /*13850*/ SkillAlchemy, X
60 /*13865*/ SkillBaking, X
61 /*13918*/ SkillTailoring, X
62 /*13907*/ SkillSenseTraps, X
63 /*13870*/ SkillBlacksmithing, X
64 /*13887*/ SkillFletching, X
65 /*13873*/ SkillBrewing, X
66 /*13860*/ SkillAlcoholTolerance, X
67 /*13868*/ SkillBegging,
68 /*13892*/ SkillJewelryMaking, X
69 /*13901*/ SkillPottery, X
70 /*13898*/ SkillPercussionInstruments,
71 /*13922*/ SkillIntimidation,
72 /*13869*/ SkillBerserking,
73 /*13902*/ SkillTaunt,
74 /*05837*/ SkillFrenzy,
75 /*03670*/  SkillRemoveTraps,  X
76 /*13049*/  SkillTripleAttack,
]]--


atomic 02-11-2017 12:16 AM

i may not have been clear.

What i've learned since posting this. I'm using global_player.lua

Quote:

function event_level_up(e)
local free_skills = {0,1,2,3,4,5,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,28,29,30,31,32,33,34,36,37,38,39 ,41,42,43,44,45,46,47,49,51,52,54,67,70,71,72,73,7 4,76};

for k,v in ipairs(free_skills) do
if ( e.self:MaxSkill(v) > 0 and e.self:GetRawSkill(v) < 1 and e.self:CanHaveSkill(v) ) then
e.self:SetSkill(v, 1);
end
end

end
is what part needs editing.
below is one of my player.pl that has the code i need BUT its perl and doesn't work in my lua global file.
Quote:

sub EVENT_LEVEL_UP {
if ($ulevel <= 69) {
quest::scribespells($ulevel);
quest::traindiscs($ulevel);
$client->AddAAPoints(2);
if ($ulevel <= 50) {
$client->Message(15,"A mysterious voice whispers to you, \'You have gained a level and 2 AA points to use when your level 51 or over.\'");
}
else {
$client->Message(15,"A mysterious voice whispers to you, \'You have gained a level and 2 AA points to use.\'");
}
}
}
So my question is do i need to change every player.pl to include this level up code or is their a lua code that does the same?

Maze_EQ 03-02-2017 03:38 PM

Global_player.pl == Global_player.lua

Asylum 03-15-2017 07:45 PM

In my global_player.pl (location: quests/global folder)

Code:

sub AutoTrain {
        if($ulevel <= 60) {
                $client->Message(14,"You have learned new spells and abilities.");
                quest::scribespells($ulevel, $ulevel-1);
                quest::traindiscs($ulevel, $ulevel-1);
        }
        else {
                $client->Message(14,"Further knowledge of spells and abilities must be gathered on your own, $name.");
        }
}


atomic 03-16-2017 01:37 AM

thanks Asylum i'll give that a try.

Jizamuss 06-11-2017 10:39 PM

Maybe try this and if it works please share =)

*for LUA only* Incorporated this in Mister lockout to test with and not have to level repeatedly
if(e.message:findi("hail")) then
e.other:Message(257, "Would you like to know your [" .. eq.say_link("Lockouts",false,"Lockouts") .. "] or fix your [" ..eq.say_link('skills', false, 'skills') .. "] ?")
elseif(e.message:findi("lockouts")) then
instance_requests.DisplayLockouts(e.other, e.other, lockout_globals)
elseif(e.message:findi("skills")) then

-- See the global/global_player.lua for the reference index for these values
local free_skills = {0,1,2,3,4,5,8,9,10,11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,28,29,30,31,32,33,34,36,37,38,39 ,41,42,43,44,45,46,47,49,51,52,54,67,70,71,72,73,7 4,76};
local MaxSkill = {eq.MaxSkill}

for k,v in ipairs(free_skills) do
if ( e.other:MaxSkill(v) > 0 and e.other:GetRawSkill(v) < 300 and e.other:CanHaveSkill(v) ) then
e.other:SetSkill(v, e.other:MaxSkill(v));
end



end
end
end
. I have also been trying to do this. I like the global_player.pl but it would be nice to have a lua version. just cant seem to get the event_level_up to work. I did add this portion onto mister lockout in pok and it updated my skills to max for my level. I have been unable to locate references to Scribe spells and Train Discs except that refer to perl. If someone helped you outside of the forum and you made it work I'd love to see what you ended up using.

atomic 06-12-2017 08:35 AM

Lua Pl
 
Well i am a bit behind now since i overwrote my database by mistake and lost all my changes. So looking at the Karana (x3 XP, Bots, Speed) Scripts and database that i'm trying to use now it seams it was using .pl file and i was using .lua .I wasn't auto learning all skills even though Karana does.

For anyone else thinking of using the previous post 74 has a gap in it when it shouldn't. atleast thats what it looks like to me. Someone else might be able to post if this works.

Cant believe my only backup is 3 months old... So much lost but atleast i have my quests folder so its just database changes.

c0ncrete 02-28-2018 11:02 PM

You probably want to add some logic for specialization (skills 43-47) as shown below, due to the fact that a caster is only ever supposed to go above 50 in one school of spells.

Code:

sub EVENT_LEVEL_UP {

    AutoTrain() if $client->GetGM();
}

sub AutoTrain {

    $client->Message( 15,
            "Your experiences across the realm have infused you with increased"
          . " power and knowledge..." );

    $CanSkill = sub { $client->CanHaveSkill(shift) };
    $MaxSkill = sub { $client->MaxSkill( shift, $class, $ulevel ) };
    $RawSkill = sub { $client->GetRawSkill(shift) };
    $SetSkill = sub { $client->SetSkill( shift, shift ) };

    # set all available skills to maximum for class at current level
    foreach my $skillNum ( 0 .. 42, 48 .. 74 ) {
        next unless $CanSkill->($skillNum);
        my $maxVal = $MaxSkill->($skillNum);
        next unless $maxVal > $RawSkill->($skillNum);
        $SetSkill->( $skillNum, $maxVal );
    }

    # if client is a caster and can specialize
    if ( $CanSkill->(43) ) {

        # get current raw value for all spell-casting spec skills
        my %spec = map { $_ => $RawSkill->($_) } ( 43 .. 47 );

        # if one spell-casting spec skill is above 50,
        # set it to the max value for the client's current level
        # (this skill is deleted from hash and doesn't get calculated again)
        if ( my $main = first { $spec{$_} > 50 } keys %spec ) {
            $SetSkill->( $main, $MaxSkill->($main) );
            delete $spec{$main};
        }

        # set spell-casting spec skills to max value for client's current level
        # all skill levels but the first one that goes over 50 are capped at 50
        foreach my $skillNum ( keys %spec ) {
            next if $spec{$skillNum} == 50;
            my $maxVal = $MaxSkill->($skillNum);
            $SetSkill->( $skillNum, $maxVal > 50 ? 50 : $maxVal );
        }
    }

    # scribe all spells for current level
    quest::scribespells( $ulevel, $ulevel );

    # train all discs for current level
    quest::traindiscs( $ulevel, $ulevel );
}


Andvari 09-29-2018 01:54 AM

Quote:

Originally Posted by c0ncrete (Post 257771)
You probably want to add some logic for specialization (skills 43-47) as shown below, due to the fact that a caster is only ever supposed to go above 50 in one school of spells.

Thanks for this! For those that come here from Google, as I did, here's my translation of this into lua. I've never written so much as a "hello world" in perl, so I did my best to understand what you wrote. I've also never written a "hello world" in lua for that matter; but I skipped straight to this, ha. If anybody wants to optimize this, have at it.

GitHub for syntax highlighting

Code:

function event_level_up(e)

        -- All skills except caster specializations
        local skills = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
                        10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
                        20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
                        30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
                        40, 41, 42,                    48, 49,
                        50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
                        60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
                        70, 71, 72, 73, 74, 75, 76 };

        -- Determine max possible skill and assign it at each level up
        for k,v in ipairs(skills) do
                local max_skill = e.self:MaxSkill(v);
                local raw_skill = e.self:GetRawSkill(v);
                local can_have = e.self:CanHaveSkill(v);
                if ( max_skill > 0 and raw_skill < max_skill and can_have ) then
                        e.self:SetSkill(v, max_skill);
                end
        end

        -- Determine if client is a caster and can specialize
        if ( e.self:CanHaveSkill(43) ) then

                -- Specialization skills
                local special = { 43, 44, 45, 46, 47 };
                -- Create tables of raw skills and max skills
                local raw_skills = {};
                local max_skills = {};
                for k,v in ipairs(special) do
                        raw_skills[k] = e.self:GetRawSkill(v);
                        max_skills[k] = e.self:MaxSkill(v);
                end

                -- Check each specialization and determine what to do
                for k,v in ipairs(special) do
                        if ( raw_skills[k] == 50 ) then
                                -- do nothing
                        elseif ( raw_skills[k] > 50 and raw_skills[k] < max_skills[k] ) then
                                e.self:SetSkill(v, max_skills[k]);
                        elseif ( raw_skills[k] < 50 and raw_skills[k] < max_skills[k] ) then
                                if ( max_skills[k] <= 50 ) then
                                        e.self:SetSkill(v, max_skills[k]);
                                else
                                        e.self:SetSkill(v, 50);
                                end
                        end
                end
        end

        -- Scribe all spells up to current level
        eq.scribe_spells(e.self:GetLevel());

        -- Train all disciplines up to current level
        eq.train_discs(e.self:GetLevel());
end



All times are GMT -4. The time now is 02:31 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.