Advertisement
Deozaan

applynoobperks.lua

Oct 13th, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.48 KB | None | 0 0
  1. --------------------------------------------
  2. -- func: applynoobperks
  3. -- desc: Applies settings for new characters
  4. --           as found in settings.lua
  5. --------------------------------------------
  6.  
  7. require("scripts/globals/settings");
  8.  
  9. cmdprops =
  10. {
  11.     permission = 1,
  12.     parameters = "s" -- s = string, i = int
  13. };
  14.  
  15. function onTrigger(player, p1)
  16.     local target;
  17.    
  18.     if (p1 ~= nil) then
  19.         target = GetPlayerByName(p1);
  20.         if (target == nil) then
  21.             player:PrintToPlayer(string.format("Player named '%s' not found!", p1));
  22.             return;
  23.         end
  24.        
  25.         player:PrintToPlayer(string.format("Applying noob perks to '%s'.", p1));
  26.     else
  27.          target = player
  28.     end
  29.  
  30.     target.PrintToPlayer("Noob perks have been applied to you.")
  31.  
  32.     ----- settings.lua Perks -----
  33.     if (ADVANCED_JOB_LEVEL == 0) then
  34.        for i = 6,22 do
  35.           target:unlockJob(i);
  36.        end
  37.     end
  38.  
  39.     if (SUBJOB_QUEST_LEVEL == 0) then
  40.        target:unlockJob(0);
  41.     end
  42.  
  43.     if (ALL_MAPS == 1) then
  44.        for i=385,447 do
  45.           target:addKeyItem(i);
  46.        end
  47.        for i=1856,1917 do
  48.           target:addKeyItem(i);
  49.        end
  50.        for i=2302,2305 do
  51.           target:addKeyItem(i);
  52.        end
  53.        for i=2307,2309 do
  54.           target:addKeyItem(i);
  55.        end
  56.     end
  57.  
  58.     if (INITIAL_LEVEL_CAP ~= 50) then
  59.        target:levelCap(INITIAL_LEVEL_CAP)
  60.     end
  61.  
  62.     if (START_INVENTORY > 30) then
  63.        target:changeContainerSize(0,(START_INVENTORY - 30))
  64.        target:changeContainerSize(5,(START_INVENTORY - 30))
  65.     end
  66.  
  67.     if (UNLOCK_OUTPOST_WARPS >= 1) then
  68.        target:addNationTeleport(0,2097120);
  69.        target:addNationTeleport(1,2097120);
  70.        target:addNationTeleport(2,2097120);
  71.        if (UNLOCK_OUTPOST_WARPS == 2) then -- Tu'Lia and Tavnazia
  72.           target:addNationTeleport(0,10485760);
  73.           target:addNationTeleport(1,10485760);
  74.           target:addNationTeleport(2,10485760);
  75.        end
  76.     end
  77.     ----- End settings.lua Perks -----
  78.    
  79.     -- SET START GIL
  80.     --[[For some intermittent reason m_ZoneList ends up empty on characters, which is
  81.     possibly also why they lose key items.  When that happens, CharCreate will be run and
  82.     they end up losing their gil to the code below.  Added a conditional to hopefully
  83.     prevent that until the bug is fixed.  Used the if instead of addGil to prevent abuse
  84.     on servers with very high values of START_GIL, I guess.]]
  85.     if (target:getGil() < START_GIL) then
  86.        target:setGil(START_GIL);
  87.     end
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement