Page 1 of 1

Lua modifications My server uses

Posted: Sun Dec 28, 2014 2:47 pm
by tagban
I decided that I wanted to share these. While they aren't fantastic, pretty, or amazing, I believe in sharing everything I do to help other servers if they want these types of features:
---------------------------------------------------
@ Commands
---------------------------------------------------
Example Shop for AF Gear/etc. (This can be used/modified to support ANY items in game, any price you set it to, and you can set permissions higher if you wanted to. This is our BLM one (we have one for each job)

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: BLM Gear Purchase AF1/AF3
-- auth: <Unknown> :: Modded by Tagban
-- desc: Opens Shop for AF1, AF+1 gear. 
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "iiii"
};
function onTrigger(player)
	
stock = {
11991,6000, -- Wizard's Torque
17423,6000, -- Casting Wand
14092,10000, -- Wizard's Sabots
13964,10000, -- Wizard's Gloves
14217,10000, -- Wizard's Tonban
12641,10000, -- Wizard's Coat
13856,10000, -- Wizard's Petasos
15355,10000, -- Wizard's Sabots+1
14893,10000, -- Wizard's Gloves+1
15564,10000, -- Wizard's Tonban+1
14476,10000, -- Wizard's Coat+1
15228,10000, -- Wizard's Petasos+1
15090,30000, -- Sorcerer's Coat
15105,30000, -- Sorcerer's Gloves
15075,30000, -- Sorcerer's Petas
15135,30000, -- Sorcerer's Sabots
15120,30000, -- Soercer's Tonban
15874,30000, -- Sorcerer's Belt


	}
 
showShop(player, STATIC, stock);
end
--------------
Once again, one more example of our shops, this is for NIN Tools:

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: tools.lua
-- auth: Tagban
-- desc: Ninja Tools Shop Command
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "iiii"
};
function onTrigger(player)
	player:PrintToPlayer("All the ninja Tools you need for your adventure!");
stock = {
		5869, 500, -- Chonofuda
		5312, 500, -- Hiraishin
		5867, 500, -- Inoshishinofuda
		5864, 500, -- Jinko
		5315, 500, -- Jusatsu
		5863, 500, -- Kabenro
		5316, 500, -- Kaginawa
		5310, 500, -- Kawahori-Ogi
		5318, 500, -- Kodoku
		5311, 500, -- Makibishi
		5313, 500, -- Mizu-Deppo
		5866, 500, -- Mokukin
		5865, 500, -- Ryuno
		5317, 500, -- Sairui-Ran
		5417, 500, -- Sanjaku-Tenugui
		5314, 500, -- Shihei
		5868, 500, -- Shikanofuda
		5319, 500, -- Shinobi-Tabi
		5734, 500, -- Soshi
		5309, 500, -- Tsurara
		5308, 500, -- Uchitake
		
	}
 
showShop(player, STATIC, stock);
end
----------------------
Modified @zone command (adds ability to BLOCK specific zones
Modded by Demolish for me.
-----------------------

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: zone
-- auth: <Unknown> :: Modded by atom0s.
-- desc: Teleports a player to the given zone.
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "s"
};

---------------------------------------------------------------------------------------------------
-- desc: List of zones with their auto-translated group and message id.
-- note: The format is as follows: groupId, messageId, zoneId
---------------------------------------------------------------------------------------------------
local zone_list =
{
    { 0x14, 0xA9, 1 }, -- Phanauet Channel
    { 0x14, 0xAA, 2 }, -- Carpenters' Landing
    { 0x14, 0x84, 3 }, -- Manaclipper
    { 0x14, 0x85, 4 }, -- Bibiki Bay
    { 0x14, 0x8A, 5 }, -- Uleguerand Range
    { 0x14, 0x8B, 6 }, -- Bearclaw Pinnacle
    { 0x14, 0x86, 7 }, -- Attohwa Chasm
    { 0x14, 0x87, 8 }, -- Boneyard Gully
    { 0x14, 0x88, 9 }, -- Pso'Xja
    { 0x14, 0x89, 10 }, -- The Shrouded Maw
    { 0x14, 0x8C, 11 }, -- Oldton Movalpolos
    { 0x14, 0x8D, 12 }, -- Newton Movalpolos
    { 0x14, 0x8E, 13 }, -- Mine Shaft #2716
    { 0x14, 0xDC, 13 }, -- Mine Shaft #2716
    { 0x14, 0xAB, 14 }, -- Hall of Transference
    { 0x14, 0x9B, 16 }, -- Promyvion - Holla
    { 0x14, 0x9A, 16 }, -- Promyvion - Holla
    { 0x14, 0x9C, 17 }, -- Spire of Holla
    { 0x14, 0x9E, 18 }, -- Promyvion - Dem
    { 0x14, 0x9D, 18 }, -- Promyvion - Dem
    { 0x14, 0x9F, 19 }, -- Spire of Dem
    { 0x14, 0xA0, 20 }, -- Promyvion - Mea
    { 0x14, 0xA1, 20 }, -- Promyvion - Mea
    { 0x14, 0xA2, 21 }, -- Spire of Mea
    { 0x14, 0xA3, 22 }, -- Promyvion - Vahzl
    { 0x14, 0xA4, 22 }, -- Promyvion - Vahzl
    { 0x14, 0xA5, 22 }, -- Promyvion - Vahzl
    { 0x14, 0xA6, 22 }, -- Promyvion - Vahzl
    { 0x14, 0xA7, 23 }, -- Spire of Vahzl
    { 0x14, 0xA8, 23 }, -- Spire of Vahzl
    { 0x14, 0x90, 24 }, -- Lufaise Meadows
    { 0x14, 0x91, 25 }, -- Misareaux Coast
    { 0x14, 0x8F, 26 }, -- Tavnazian Safehold
    { 0x14, 0x93, 27 }, -- Phomiuna Aqueducts
    { 0x14, 0x94, 28 }, -- Sacrarium
    { 0x14, 0x96, 29 }, -- Riverne - Site #B01
    { 0x14, 0x95, 29 }, -- Riverne - Site #B01
    { 0x14, 0x98, 30 }, -- Riverne - Site #A01
    { 0x14, 0x97, 30 }, -- Riverne - Site #A01
    { 0x14, 0x99, 31 }, -- Monarch Linn
    { 0x14, 0x92, 32 }, -- Sealion's Den
    { 0x14, 0xAC, 33 }, -- Al'Taieu
    { 0x14, 0xAD, 34 }, -- Grand Palace of Hu'Xzoi
    { 0x14, 0xAE, 35 }, -- The Garden of Ru'Hmet
    { 0x14, 0xB0, 36 }, -- Empyreal Paradox
    { 0x14, 0xB1, 37 }, -- Temenos
    { 0x14, 0xB2, 38 }, -- Apollyon
    { 0x14, 0xB4, 39 }, -- Dynamis - Valkurm
    { 0x14, 0xB5, 40 }, -- Dynamis - Buburimu
    { 0x14, 0xB6, 41 }, -- Dynamis - Qufim
    { 0x14, 0xB7, 42 }, -- Dynamis - Tavnazia
    { 0x14, 0xAF, 43 }, -- Diorama Abdhaljs-Ghelsba
    { 0x14, 0xB8, 44 }, -- Abdhaljs Isle-Purgonorgo
    { 0x14, 0xB9, 46 }, -- Open sea route to Al Zahbi
    { 0x14, 0xBA, 47 }, -- Open sea route to Mhaura
    { 0x14, 0xBB, 48 }, -- Al Zahbi
    { 0x14, 0xDB, 50 }, -- Aht Urhgan Whitegate
    { 0x14, 0xBC, 50 }, -- Aht Urhgan Whitegate
    { 0x14, 0xBD, 51 }, -- Wajaom Woodlands
    { 0x14, 0xBE, 52 }, -- Bhaflau Thickets
    { 0x14, 0xBF, 53 }, -- Nashmau
    { 0x14, 0xC0, 54 }, -- Arrapago Reef
    { 0x14, 0xC1, 55 }, -- Ilrusi Atoll
    { 0x14, 0xC2, 56 }, -- Periqia
    { 0x14, 0xC3, 57 }, -- Talacca Cove
    { 0x14, 0xC4, 58 }, -- Silver Sea route to Nashmau
    { 0x14, 0xC5, 59 }, -- Silver Sea route to Al Zahbi
    { 0x14, 0xC6, 60 }, -- The Ashu Talif
    { 0x14, 0xC7, 61 }, -- Mount Zhayolm
    { 0x14, 0xC8, 62 }, -- Halvung
    { 0x14, 0xC9, 63 }, -- Lebros Cavern
    { 0x14, 0xCA, 64 }, -- Navukgo Execution Chamber
    { 0x14, 0xCB, 65 }, -- Mamook
    { 0x14, 0xCC, 66 }, -- Mamool Ja Training Grounds
    { 0x14, 0xCD, 67 }, -- Jade Sepulcher
    { 0x14, 0xCE, 68 }, -- Aydeewa Subterrane
    { 0x14, 0xCF, 69 }, -- Leujaoam Sanctum
    { 0x27, 0x0F, 70 }, -- Chocobo Circuit
    { 0x27, 0x10, 71 }, -- The Colosseum
    { 0x14, 0xDD, 72 }, -- Alzadaal Undersea Ruins
    { 0x14, 0xDE, 73 }, -- Zhayolm Remnants
    { 0x14, 0xDF, 74 }, -- Arrapago Remnants
    { 0x14, 0xE0, 75 }, -- Bhaflau Remnants
    { 0x14, 0xE1, 76 }, -- Silver Sea Remnants
    { 0x14, 0xE2, 77 }, -- Nyzul Isle
    { 0x14, 0xDA, 78 }, -- Hazhalm Testing Grounds
    { 0x14, 0xD0, 79 }, -- Caedarva Mire
    { 0x27, 0x11, 80 }, -- Southern San d'Oria [S]
    { 0x27, 0x13, 81 }, -- East Ronfaure [S]
    { 0x27, 0x15, 82 }, -- Jugner Forest [S]
    { 0x27, 0x23, 83 }, -- Vunkerl Inlet [S]
    { 0x27, 0x17, 84 }, -- Batallia Downs [S]
    { 0x27, 0x3E, 85 }, -- La Vaule [S]
    { 0x27, 0x40, 85 }, -- La Vaule [S]
    { 0x27, 0x19, 86 }, -- Everbloom Hollow
    { 0x27, 0x1C, 87 }, -- Bastok Markets [S]
    { 0x27, 0x1E, 88 }, -- North Gustaberg [S]
    { 0x27, 0x20, 89 }, -- Grauberg [S]
    { 0x27, 0x25, 90 }, -- Pashhow Marshlands [S]
    { 0x27, 0x27, 91 }, -- Rolanberry Fields [S]
    { 0x27, 0x42, 92 }, -- Beadeaux [S]
    { 0x27, 0x22, 93 }, -- Ruhotz Silvermines
    { 0x27, 0x2B, 94 }, -- Windurst Waters [S]
    { 0x27, 0x2D, 95 }, -- West Sarutabaruta [S]
    { 0x27, 0x2F, 96 }, -- Fort Karugo-Narugo [S]
    { 0x27, 0x32, 97 }, -- Meriphataud Mountains [S]
    { 0x27, 0x34, 98 }, -- Sauromugue Champaign [S]
    { 0x27, 0x44, 99 }, -- Castle Oztroja [S]
    { 0x14, 0x11, 100 }, -- West Ronfaure
    { 0x14, 0x0F, 101 }, -- East Ronfaure
    { 0x14, 0x51, 102 }, -- La Theine Plateau
    { 0x14, 0x60, 103 }, -- Valkurm Dunes
    { 0x14, 0x01, 104 }, -- Jugner Forest
    { 0x14, 0x02, 105 }, -- Batallia Downs
    { 0x14, 0x64, 106 }, -- North Gustaberg
    { 0x14, 0x63, 107 }, -- South Gustaberg
    { 0x14, 0x69, 108 }, -- Konschtat Highlands
    { 0x14, 0x2B, 109 }, -- Pashhow Marshlands
    { 0x14, 0x07, 110 }, -- Rolanberry Fields
    { 0x14, 0x24, 111 }, -- Beaucedine Glacier
    { 0x14, 0x4D, 112 }, -- Xarcabard
    { 0x14, 0x3D, 113 }, -- Cape Teriggan
    { 0x14, 0x3E, 114 }, -- Eastern Altepa Desert
    { 0x14, 0x18, 115 }, -- West Sarutabaruta
    { 0x14, 0x27, 116 }, -- East Sarutabaruta
    { 0x14, 0x17, 117 }, -- Tahrongi Canyon
    { 0x14, 0x16, 118 }, -- Buburimu Peninsula
    { 0x14, 0x20, 119 }, -- Meriphataud Mountains
    { 0x14, 0x2E, 120 }, -- Sauromugue Champaign
    { 0x14, 0x3F, 121 }, -- The Sanctuary of Zi'Tah
    { 0x14, 0x7D, 122 }, -- Ro'Maeve
    { 0x14, 0x7C, 122 }, -- Ro'Maeve
    { 0x14, 0x40, 123 }, -- Yuhtunga Jungle
    { 0x14, 0x41, 124 }, -- Yhoator Jungle
    { 0x14, 0x42, 125 }, -- Western Altepa Desert
    { 0x14, 0x08, 126 }, -- Qufim Island
    { 0x14, 0x0A, 127 }, -- Behemoth's Dominion
    { 0x14, 0x43, 128 }, -- Valley of Sorrows
    { 0x27, 0x31, 129 }, -- Ghoyu's Reverie
    { 0x14, 0x6F, 130 }, -- Ru'Aun Gardens
    { 0x14, 0x82, 134 }, -- Dynamis - Beaucedine
    { 0x14, 0x83, 135 }, -- Dynamis - Xarcabard
    { 0x27, 0x46, 136 }, -- Beaucedine Glacier [S]
    { 0x27, 0x48, 137 }, -- Xarcabard [S]
    { 0x14, 0x65, 139 }, -- Horlais Peak
    { 0x14, 0x6C, 140 }, -- Ghelsba Outpost
    { 0x14, 0x1F, 141 }, -- Fort Ghelsba
    { 0x14, 0x5E, 142 }, -- Yughott Grotto
    { 0x14, 0x66, 143 }, -- Palborough Mines
    { 0x14, 0x1A, 144 }, -- Waughroon Shrine
    { 0x14, 0x21, 145 }, -- Giddeus
    { 0x14, 0x19, 146 }, -- Balga's Dais
    { 0x14, 0x2A, 147 }, -- Beadeaux
    { 0x14, 0x28, 148 }, -- Qulun Dome
    { 0x14, 0x68, 149 }, -- Davoi
    { 0x14, 0x6D, 150 }, -- Monastic Cavern
    { 0x14, 0x23, 151 }, -- Castle Oztroja
    { 0x14, 0x04, 152 }, -- Altar Room
    { 0x14, 0x44, 153 }, -- The Boyahda Tree
    { 0x14, 0x37, 154 }, -- Dragon's Aery
    { 0x14, 0x0C, 157 }, -- Middle Delkfutt's Tower
    { 0x14, 0x0B, 158 }, -- Upper Delkfutt's Tower
    { 0x14, 0x36, 159 }, -- Temple of Uggalepih
    { 0x14, 0x35, 160 }, -- Den of Rancor
    { 0x14, 0x26, 161 }, -- Castle Zvahl Baileys
    { 0x14, 0x25, 161 }, -- Castle Zvahl Baileys
    { 0x14, 0x50, 162 }, -- Castle Zvahl Keep
    { 0x14, 0x4F, 162 }, -- Castle Zvahl Keep
    { 0x14, 0x39, 163 }, -- Sacrificial Chamber
    { 0x27, 0x36, 164 }, -- Garlaige Citadel [S]
    { 0x14, 0x5D, 165 }, -- Throne Room
    { 0x14, 0x2D, 166 }, -- Ranguemont Pass
    { 0x14, 0x32, 167 }, -- Bostaunieux Oubliette
    { 0x14, 0x3B, 168 }, -- Chamber of Oracles
    { 0x14, 0x1D, 169 }, -- Toraimarai Canal
    { 0x14, 0x5C, 170 }, -- Full Moon Fountain
    { 0x27, 0x29, 171 }, -- Crawlers' Nest [S]
    { 0x14, 0x61, 172 }, -- Zeruhn Mines
    { 0x14, 0x5B, 173 }, -- Korroloka Tunnel
    { 0x14, 0x5A, 174 }, -- Kuftal Tunnel
    { 0x27, 0x1A, 175 }, -- The Eldieme Necropolis [S]
    { 0x14, 0x59, 176 }, -- Sea Serpent Grotto
    { 0x14, 0x71, 177 }, -- Ve'Lugannon Palace
    { 0x14, 0x70, 177 }, -- Ve'Lugannon Palace
    { 0x14, 0x72, 178 }, -- The Shrine of Ru'Avitau
    { 0x14, 0xB3, 179 }, -- Stellar Fulcrum
    { 0x14, 0x73, 180 }, -- La'Loff Amphitheater
    { 0x14, 0x74, 181 }, -- The Celestial Nexus
    { 0x14, 0x0D, 184 }, -- Lower Delkfutt's Tower
    { 0x14, 0x7E, 185 }, -- Dynamis - San d'Oria
    { 0x14, 0x7F, 186 }, -- Dynamis - Bastok
    { 0x14, 0x80, 187 }, -- Dynamis - Windurst
    { 0x14, 0x81, 188 }, -- Dynamis - Jeuno
    { 0x14, 0x6E, 190 }, -- King Ranperre's Tomb
    { 0x14, 0x62, 191 }, -- Dangruf Wadi
    { 0x14, 0x1C, 192 }, -- Inner Horutoto Ruins
    { 0x14, 0x03, 193 }, -- Ordelle's Caves
    { 0x14, 0x1B, 194 }, -- Outer Horutoto Ruins
    { 0x14, 0x6A, 195 }, -- The Eldieme Necropolis
    { 0x14, 0x67, 196 }, -- Gusgen Mines
    { 0x14, 0x2C, 197 }, -- Crawlers' Nest
    { 0x14, 0x15, 198 }, -- Maze of Shakhrami
    { 0x14, 0x14, 200 }, -- Garlaige Citadel
    { 0x14, 0x77, 201 }, -- Cloister of Gales
    { 0x14, 0x75, 202 }, -- Cloister of Storms
    { 0x14, 0x7A, 203 }, -- Cloister of Frost
    { 0x14, 0x4A, 204 }, -- Fei'Yin
    { 0x14, 0x58, 205 }, -- Ifrit's Cauldron
    { 0x14, 0x6B, 206 }, -- Qu'Bia Arena
    { 0x14, 0x78, 207 }, -- Cloister of Flames
    { 0x14, 0x57, 208 }, -- Quicksand Caves
    { 0x14, 0x76, 209 }, -- Cloister of Tremors
    { 0x14, 0x79, 211 }, -- Cloister of Tides
    { 0x14, 0x34, 212 }, -- Gustav Tunnel
    { 0x14, 0x33, 213 }, -- Labyrinth of Onzozo
    { 0x14, 0x4C, 230 }, -- Southern San d'Oria
    { 0x14, 0x30, 231 }, -- Northern San d'Oria
    { 0x14, 0x52, 232 }, -- Port San d'Oria
    { 0x14, 0x22, 233 }, -- Chateau d'Oraguille
    { 0x14, 0x46, 234 }, -- Bastok Mines
    { 0x14, 0x56, 235 }, -- Bastok Markets
    { 0x14, 0x3C, 236 }, -- Port Bastok
    { 0x14, 0x2F, 237 }, -- Metalworks
    { 0x14, 0x3A, 238 }, -- Windurst Waters
    { 0x14, 0x54, 239 }, -- Windurst Walls
    { 0x14, 0x45, 240 }, -- Port Windurst
    { 0x14, 0x38, 241 }, -- Windurst Woods
    { 0x14, 0x55, 242 }, -- Heavens Tower
    { 0x14, 0x13, 243 }, -- Ru'Lude Gardens
    { 0x14, 0x4E, 244 }, -- Upper Jeuno
    { 0x14, 0x0E, 245 }, -- Lower Jeuno
    { 0x14, 0x06, 246 }, -- Port Jeuno
    { 0x14, 0x31, 247 }, -- Rabao
    { 0x14, 0x5F, 248 }, -- Selbina
    { 0x14, 0x1E, 249 }, -- Mhaura
    { 0x14, 0x29, 250 }, -- Kazham
    { 0x14, 0x7B, 251 }, -- Hall of the Gods
    { 0x14, 0x09, 252 }, -- Norg
    { 0x27, 0x4C, 256 }, -- Western Adoulin
    { 0x27, 0x4D, 257 }, -- Eastern Adoulin
    { 0x27, 0x4E, 259 }, -- Rala Waterways [U]
    { 0x27, 0x4F, 260 }, -- Yahse Hunting Grounds
    { 0x27, 0x50, 261 }, -- Ceizak Battlegrounds
    { 0x27, 0x51, 262 }, -- Foret de Hennetiel
    { 0x27, 0x56, 264 }, -- Yorcia Weald [U]
    { 0x27, 0x52, 265 }, -- Morimar Basalt Fields
    { 0x27, 0x57, 266 }, -- Marjami Ravine
    { 0x27, 0x5C, 267 }, -- Kamihr Drifts
    { 0x27, 0x53, 268 }, -- Sih Gates
    { 0x27, 0x54, 269 }, -- Moh Gates
    { 0x27, 0x55, 271 }, -- Cirdas Caverns [U]
    { 0x27, 0x58, 272 }, -- Dho Gates
    { 0x27, 0x5D, 273 }, -- Woh Gates
    { 0x27, 0x12, 275 }, -- Outer Ra'Kaznar [U]
    { 0x27, 0x5A, 280 }, -- Mog Garden
    { 0x27, 0x59, 284 }, -- Celennia Memorial Library
    { 0x27, 0x5B, 285 }, -- Feretory
};
-- Blocked zones includes Abyssea, Adoulin, and ALL instances
-- Can be modded for any set of zones.
local blockedZones = {
    55,56,60,63,66,69,73,74,75,76,77,86,93,129,183,15,45,132,215,216,217,218,253,254,255,256,257,258,259,260,261,262,263,264,264,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285
}
---------------------------------------------------------------------------------------------------
-- func: onTrigger
-- desc: Called when this command is invoked.
---------------------------------------------------------------------------------------------------
function onTrigger(player, zoneId)
    local word  = "";
    local i     = 0;
    local zone  = zoneId;
    local blocked = false;
    
    -- Ensure a zone was given..
    if (zoneId == nil) then
        player:PrintToPlayer("You must enter a zone id.");
        return;
    end
    
    for _, v in ipairs(blockedZones) do
        if(tonumber(zoneId) == v) then
            player:PrintToPlayer(string.format("You cannot enter this zone!"));
            blocked = true;
            return;
        end
    end

    -- Was the zone auto-translated..
    if (string.sub(zoneId, 1, 2) == '\253\02' and string.byte(zoneId, 5) ~= nil and string.byte(zoneId, 6) == 0xFD) then
        -- Pull the group and message id from the translated string..
        local groupId = string.byte(zoneId, 4);
        local messageId = string.byte(zoneId, 5);
    
        -- Attempt to lookup this zone..
        for k, v in pairs(zone_list) do
            if (v[1] == groupId and v[2] == messageId) then
                for _, id in ipairs(blockedZones) do
                    if (v[3] == id) then
                        player:PrintToPlayer(string.format("You cannot enter this zone!"));
                        blocked = true;
                        return;
                    end
                end
                if(not blocked) then
                    player:setPos(0, 0, 0, 0, v[3]);
                end;
                return;
            end
        end
    
        -- Zone was not found, allow the user to know..
        player:PrintToPlayer('Unknown zone, could not teleport.');
        return;
    end
    
    if(not blocked) then
        player:setPos(0, 0, 0, 0, zoneId);
    end
end
-----------
@regen - Adds regen/refresh effect that players get when logging into the server each day, this is for use after death, and allows our players to solo things easier. Settings can be modified easily to suit your desired level of regen/refresh/TP Regain
--------------

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: regen/refresh server wide. 
-- auth: <Unknown> :: Modded by Tagban
-- desc: Sets the players position to specific location (can be added to later).
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "iiii"
};
function onTrigger(player) -- Eventually needs modified based on level.. TBD!
	player:addStatusEffect(EFFECT_REFRESH,25,0,0);
        player:addStatusEffect(EFFECT_REGEN,28,0,0);
	player:addStatusEffect(EFFECT_REGAIN,15,1,0);
end
-------------------
Modified player.lua *scripts\globals\player.lua
This modification actually adds the regen/refresh/regain status on login of the server.
------

Code: Select all

-----------------------------------
--
--
--
-----------------------------------

require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/globals/quests");
require("scripts/globals/settings");
require("scripts/globals/shop");
require("scripts/globals/status");
require("scripts/globals/titles");
require("scripts/globals/gear_sets");

-----------------------------------
-- onGameIn
-----------------------------------

function onGameIn(player, firstlogin)
    if (firstlogin) then
        CharCreate(player);
	player:addAllSpells();
	player:capAllSkills();
    end;
	
	checkForGearSet(player);

    if (player:getVar("GodMode") == 1) then
        -- Add bonus effects to the player..
        player:addStatusEffect(EFFECT_MAX_HP_BOOST,1000,0,0);
        player:addStatusEffect(EFFECT_MAX_MP_BOOST,1000,0,0);
        player:addStatusEffect(EFFECT_SENTINEL,100,0,0);
        player:addStatusEffect(EFFECT_MIGHTY_STRIKES,1,0,0);
        player:addStatusEffect(EFFECT_HUNDRED_FISTS,1,0,0);
        player:addStatusEffect(EFFECT_CHAINSPELL,1,0,0);
        player:addStatusEffect(EFFECT_PERFECT_DODGE,1,0,0);		
        player:addStatusEffect(EFFECT_INVINCIBLE,1,0,0);				
        player:addStatusEffect(EFFECT_MANAFONT,1,0,0);
        player:addStatusEffect(EFFECT_REGAIN,100,1,0);
        player:addStatusEffect(EFFECT_REFRESH,99,0,0);
        player:addStatusEffect(EFFECT_REGEN,99,0,0);
        
        -- Add bonus mods to the player..
        player:addMod(MOD_RACC,5000);
        player:addMod(MOD_RATT,5000);
        player:addMod(MOD_ACC,5000);
        player:addMod(MOD_ATT,5000);
        player:addMod(MOD_MATT,5000);
        player:addMod(MOD_MACC,5000);
        player:addMod(MOD_RDEF,5000);
        player:addMod(MOD_DEF,5000);
        player:addMod(MOD_MDEF,5000);
        
        -- Heal the player from the new buffs..
        player:addHP( 50000 );
        player:setMP( 50000 );
    else
        player:addStatusEffect(EFFECT_REFRESH,28,0,0);
        player:addStatusEffect(EFFECT_REGEN,25,0,0);
	player:addStatusEffect(EFFECT_REGAIN,15,1,0);
	player:PrintToPlayer( "TP/HP/MP are being restored, if you die use @regen to re-activate!" );
    end
    
    if (player:getVar("GMHidden") == 1) then
        player:setGMHidden(true);
    end
end;

-----------------------------------
-- CharCreate
-----------------------------------

function CharCreate(player)

	local race = player:getRace();
	local body = nil;
	local leg = nil;
	local hand = nil;
	local feet = nil;

	-- ADD RACE SPECIFIC STARTGEAR
	switch(race) : caseof
	{
		-- HUME MALE
 		[1]	= function (x)
	 		body = 0x3157;
	 		hand = 0x31D2;
	 		leg = 0x3253;
			feet = 0x32CD;
  		end,

		-- HUME FEMALE
  		[2]	= function (x)
	  		body = 0x3158;
	  		hand = 0x31D8;
	  		leg = 0x3254;
	  		feet = 0x32D2;
  		end,

		-- ELVAAN MALE
  		[3]	= function (x)
	  		body = 0x3159;
	  		hand = 0x31D3;
	  		leg = 0x3255;
	  		feet = 0x32CE;
  		end,

		-- ELVAAN FEMALE
  		[4]	= function (x)
			body = 0x315A;
			hand = 0x31D7;
			leg = 0x3259;
			feet = 0x32D3;
  		end,

		-- TARU MALE
  		[5]	= function (x)
			body = 0x315B;
			hand = 0x31D4;
			leg = 0x3256;
			feet = 0x32CF;
  		end,

		-- TARU FEMALE
  		[6]	= function (x)
			body = 0x315B;
			hand = 0x31D4;
			leg = 0x3256;
			feet = 0x32CF;
  		end,

		-- MITHRA
  		[7]	= function (x)
			body = 0x315C;
			hand = 0x31D5;
			leg = 0x3257;
			feet = 0x32D0;
  		end,

		-- GALKA
  		[8]	= function (x)
			body = 0x315D;
			hand = 0x31D6;
			leg = 0x3258;
			feet = 0x32D1;
  		end,

  		default = function (x) end,
	}

	-- Add starting gear
	if not(player:hasItem(body)) then
		player:addItem(body);
		player:equipItem(body);
	end

	if not(player:hasItem(hand)) then
		player:addItem(hand);
		player:equipItem(hand);
	end

	if not(player:hasItem(leg)) then
		player:addItem(leg);
		player:equipItem(leg);
	end

	if not(player:hasItem(feet)) then
		player:addItem(feet);
		player:equipItem(feet);
	end

	-- ADD JOB SPECIFIC STARTGEAR
	switch(player:getMainJob()) : caseof
	{
		-- WARRIOR JOB
		[0x01]= function (x)
			if not(player:hasItem(0x4096)) then
				player:addItem(0x4096);
			end
		end,

		-- MONK JOB
		[0x02]= function (x)
			if not(player:hasItem(0x3380)) then
	 			player:addItem(0x3380);
	 		end
		end,

		-- WHITE MAGE
		[0x03]= function(x)
			if not(player:hasItem(0x42AC)) then
				player:addItem(0x42AC);
			end

			if not(player:hasItem(0x1200)) then
			player:addItem(0x1200);
			end
		end,

 		-- BLACK MAGE
		[0x04] = function(x)

			if not(player:hasItem(0x42D0)) then
				player:addItem(0x42D0);
			end

			if not(player:hasItem(0x11FF)) then
				player:addItem(0x11FF);
			end
		end,

 		-- RED MAGE
	 	[0x05]= function (x)
			if not(player:hasItem(0x4062)) then
				player:addItem(0x4062);
			end
			if not(player:hasItem(0x11FE)) then
				player:addItem(0x11FE);
			end
 		end,

 		-- THIEF
		[0x06]= function (x)
			if not(player:hasItem(0x4063)) then
				player:addItem(0x4063);
			end
 		end,

 		default = function (x) end,
	}

	-- ADD NATION SPECIFIC STARTGEAR
 	switch (player:getNation()) : caseof
	{
 		-- SANDY CITIZEN
		[0] = function (x)
			if ((race == 3) or (race == 4))
				then player:addItem(0x34B7);
			end;
			player:addKeyItem(MAP_OF_THE_SAN_DORIA_AREA);
		end,

 		-- BASTOK CITIZEN
		[1] = function (x)
			if (((race == 1) or (race == 2) or (race == 8)))
				then player:addItem(0x34B9);
			end;
			player:addKeyItem(MAP_OF_THE_BASTOK_AREA);
		end,

 		-- WINDY CITIZEN
	 	[2] = function(x)
			if (((race == 5) or (race == 6) or (race == 7)))
				then player:addItem(0x34B8);
			end;
			player:addKeyItem(MAP_OF_THE_WINDURST_AREA);
 		end,

		default = function (x) end,
	}

   ----- settings.lua Perks -----
   if (ADVANCED_JOB_LEVEL == 0) then
      for i = 6,22 do
         player:unlockJob(i);
      end
   end

   if (SUBJOB_QUEST_LEVEL == 0) then
      player:unlockJob(0);
   end

   if (ALL_MAPS == 1) then -- Does not include SoA maps
      for i=385,447 do
         player:addKeyItem(i);
      end
      for i=1856,1903 do
         player:addKeyItem(i);
      end
   end

   if (INITIAL_LEVEL_CAP ~= 50) then
      player:levelCap(INITIAL_LEVEL_CAP)
   end

   if (START_INVENTORY > 30) then
      player:changeContainerSize(0,(START_INVENTORY - 30))
      player:changeContainerSize(5,(START_INVENTORY - 30))
   end

   if (UNLOCK_OUTPOST_WARPS >= 1) then
      player:addNationTeleport(0,2097120);
      player:addNationTeleport(1,2097120);
      player:addNationTeleport(2,2097120);
      if (UNLOCK_OUTPOST_WARPS == 2) then -- Tu'Lia and Tavnazia
         player:addNationTeleport(0,10485760);
         player:addNationTeleport(1,10485760);
         player:addNationTeleport(2,10485760);
      end
   end
   ----- End settings.lua Perks -----

	-- SET START GIL
   --[[For some intermittent reason m_ZoneList ends up empty on characters, which is
   possibly also why they lose key items.  When that happens, CharCreate will be run and
   they end up losing their gil to the code below.  Added a conditional to hopefully
   prevent that until the bug is fixed.  Used the if instead of addGil to prevent abuse
   on servers with very high values of START_GIL, I guess.]]
   if (player:getGil() < START_GIL) then
      player:setGil(START_GIL);
   end

	-- ADD ADVENTURER COUPON
	player:addItem(0x218);

	--SET TITLE
	player:addTitle(NEW_ADVENTURER);

	-- Needs Moghouse Intro
	player:setVar("MoghouseExplication",1);

end;

function onPlayerLevelUp(player)
	player:capAllSkills();
end

function onPlayerLevelDown(player)
end
Hope these help make your server a little more fun! I will add more later. :)

Re: Lua modifications My server uses

Posted: Sun Dec 28, 2014 2:52 pm
by tagban
Auction House Anywhere Script
@ah -- ah.lua under scripts/commands folder

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: ah/auction
-- auth: <Unknown> :: Modded by Tagban
-- desc: Pops Auction House dialog anywhere in world. 
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "iiii"
};
function onTrigger(player)
	player:sendMenu(3);
end
----------------------
Go to specific location: (@gmisland -- Hidden island in Jugner)
You can get exact POS's by using @pos and changing the existing numbers in this to whatever you want. We also use this command for telport to Aspi, Fafnir, and KB.

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: gmisland
-- auth: <Unknown> :: Modded by Tagban
-- desc: Sets the players position to secret island... muahahaha
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "iiii"
};
function onTrigger(player, x, y, z, zone)
            player:setPos('0', '0', '443', '59', '104');
end
-----------------
Chocobo Anywhere... @chocobo
-----------------------

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: @chocobo
-- auth: <Unknown> :: Modded by Tagban
-- desc: Adds Chocobo 
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "s"
};


function onTrigger(player)
   player:addStatusEffect(EFFECT_CHOCOBO, 1, 0, 99999);   
   player:messagePublic(280, player, EFFECT_CHOCOBO, EFFECT_CHOCOBO);
end;
-------------
@nm -- Spawns a bunch of NM's in their spawnpoint locations. This can be easily modified to spawn ANYTHING you want, Although I have yet to get the Pirates on the ship to work with it.. But everything else works!
-----------------

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: @nm -- Spawns a ton of NMs at once 
-- auth: <Unknown> :: Modded by Tagban
-- desc: Allows GM's to trigger NMs that are commonly requested. Add more if you tell me!
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 1,
    parameters = "iiii"
};
function onTrigger(player)
    	SpawnMob('17297441'); -- KB
	SpawnMob('17408018'); -- Fafnir
	SpawnMob('17301538'); -- Aspi
	SpawnMob('17301537'); -- Adamantoise
	SpawnMob('17387866'); -- Morbol
	SpawnMob('17498522'); -- Chary
	SpawnMob('17268851'); -- Deadly Dodo
	SpawnMob('16806215'); -- Xolotl
	SpawnMob('17231971'); -- Nue
    	SpawnMob('17404333'); -- Voluptuous Vivian
	SpawnMob('17645755'); -- Ungur
	SpawnMob('17649731'); -- LoO
	SpawnMob('17199438'); -- VE
	SpawnMob('17228242'); -- Simurgh
	SpawnMob('17244539'); -- Cactrot
	SpawnMob('16806227'); -- Tiamat
	SpawnMob('17461307'); -- Sewer Syrup
	SpawnMob('17555890'); -- Vrtra
	SpawnMob('17596720'); -- Serket
	SpawnMob('16797969'); -- Jormungand
end

Re: Lua modifications My server uses

Posted: Mon Dec 29, 2014 3:03 am
by tagban
FIREWORKS SHOP

Code: Select all

---------------------------------------------------------------------------------------------------
-- func: Fireworks!
-- auth: Tagban
-- desc: FREAKING FIREWORKS!
---------------------------------------------------------------------------------------------------

cmdprops =
{
    permission = 0,
    parameters = "iiii"
};
function onTrigger(player)
	
stock = {
	4186, 100, -- Airborne
	5441, 100, -- Angelwing
	4216, 100, -- Brilliant Snow
	4167, 100, -- Cracker
	4250, 100, -- Crackler
	5361, 100, -- Datechochin
	5883, 100, -- Falling Star
	4251, 100, -- Festive Fan
	5725, 100, -- Goshikitenge
	4184, 100, -- Kongou Inaho
	4183, 100, -- Konron Hassen
	4169, 100, -- Little Comet
	5882, 100, -- Marine Bliss
	4185, 100, -- Meifu Goma
	5360, 100, -- Muteppo
	4256, 100, -- Ouka Ranman
	4257, 100, -- Papillion
	5769, 100, -- Popper (Congrats!)
	4215, 100, -- Popstar
	5881, 100, -- Shisai Kaboku
	4217, 100, -- Sparkling Hand
	4253, 100, -- Spirit Masque
	4252, 100, -- Summer Fan
	4168, 100, -- Twinkle Shower
	}
 
showShop(player, STATIC, stock);
end

Re: Lua modifications My server uses

Posted: Mon Dec 29, 2014 9:26 am
by Delaide
Thanks, I like some. Question though, do I need to change any other code, or just make the lua (ah.lua, chocobo.lua, etc) in the darkstar\scripts\commands and it is ready? Then just type @ah, @chocobo, etc, and good to go?

Re: Lua modifications My server uses

Posted: Mon Dec 29, 2014 12:06 pm
by tagban
These are all ready as is. Nothing in here needs modifications to the server code. :)

Re: Lua modifications My server uses

Posted: Mon Dec 29, 2014 3:54 pm
by kjLotus
Delaide wrote:Thanks, I like some. Question though, do I need to change any other code, or just make the lua (ah.lua, chocobo.lua, etc) in the darkstar\scripts\commands and it is ready? Then just type @ah, @chocobo, etc, and good to go?
yeah, you don't even need to restart the server or anything - any time you type @<something> it searches the commands directory for a file named with the command you typed - nothing else special is done

Re: Lua modifications My server uses

Posted: Fri Jan 09, 2015 10:41 am
by Delaide
Tagban, I requested a pull on the customized @commands, except the af one. I noticed I was just adding your commands. I copied them exactly so they have your authorship. I just wanted to test git, see how to do it, and to add in the ah and chocobo so I don't have to keep making separately.

I also didn't add in your customization, but thinking of a way to possibly add the player.lua change you suggested above with a settings toggle, so people can do it if they want, but it will be disabled by default.

If you have an idea on how to create a "check settings.lua for regen on login" and if they do not change to 1, then they won't get it. Once I can figure that out, or if you can figure that out, I can add to another pull request.

Re: Lua modifications My server uses

Posted: Fri Jan 09, 2015 10:52 am
by tagban
Iirc the settings check is done in the code itself is easily doable but at the time I was doing these I was trying not to modify any core code. Now I've started tweaking things and am starting to contribute a little more. ;)

Re: Lua modifications My server uses

Posted: Fri Jan 09, 2015 11:01 am
by Delaide
Yeah, that is why I am doing a test run with your @commands. To see if I can get the git stuff right. Then, I want to do some stuff with BLU, like try to change learning spells from level based to skill based, like retail uses.