library Sample initializer init requires ShopSystem
/*
In this example, we will be making shop which is both a two-level and a three-level shop.
Here you will be familiarized to the method of registering main shops and linking items to the
system. We will also make another shop which sells directly what the second level of the other
shop sells. We will also make a return to upper category dummy item. This was made so that you'll have a better grasp on how to use the system.
Theoretically, you can create an infinite-level shop using the ShopSystem.
*/
private function create takes nothing returns nothing
call Shops.register('I03Y')
call Shops.addItemLink('I03Y', 'I040') // Hero Abilities Shop
call Shops.addItemLink('I03Y', 'I03X') // Scrolls Shop
// Now it's time to register those two items too
call Shops.register('I040') //Hero Abilities Shop
call Shops.register('I03X') //Scrolls Shop
/*----------------------------------------------------------------------------------------------------------------*/
// Now we will register items to I03X first since we will no longer have any category below Scrolls Shop
call Shops.addItemLink('I03X', 'pgma') //Potion of Mana
call Shops.addItemLink('I03X', 'pghe') //Potion of Health
call Shops.addItemLink('I03X', 'tint') //Tome of Intelligence +5
call Shops.addItemLink('I03X', 'tdex') //Tome of Agility +5
call Shops.addItemLink('I03X', 'tstr') //Tome of Strength +5
call Shops.addItemLink('I03X', 'manh') //Manual of Health
call Shops.addItemLink('I03X', 'ankh') //Ankh of Reincarnation
call Shops.addItemLink('I03X', 'rwiz') //Sobi Mask
call Shops.addItemLink('I03X', 'gcel') //Gloves of Haste
call Shops.addItemLink('I03X', 'bspd') //Boots of Speed
call Shops.addItemLink('I03X', 'ward') //Warsong Battle Drums
/*----------------------------------------------------------------------------------------------------------------*/
// Now we setup another set of links with the Hero Abilities Shop category
call Shops.addItemLink('I040', 'I03W') //Attack Abilities Pack 1
call Shops.addItemLink('I040', 'I03R') //Attack Abilities Pack 2
call Shops.addItemLink('I040', 'I034') //Aura Abilities
call Shops.addItemLink('I040', 'I03M') //Auto Cast Abilities
call Shops.addItemLink('I040', 'I03N') //Defensive Abilities
call Shops.addItemLink('I040', 'I03O') //Summon Abilities
call Shops.addItemLink('I040', 'I03P') //Passive Abilities
call Shops.addItemLink('I040', 'I03Q') //Support Abilities
call Shops.register('I03W') //Attack Abilities Pack 1
call Shops.register('I03R') //Attack Abilities Pack 2
call Shops.register('I034') //Aura Abilities
call Shops.register('I03M') //Auto Cast Abilities
call Shops.register('I03N') //Defensive Abilities
call Shops.register('I03O') //Summon Abilities
call Shops.register('I03P') //Passive Abilities
call Shops.register('I03Q') //Support Abilities
/*----------------------------------------------------------------------------------------------------------------*/
// Now we link items to the Attack Abilities Pack 1 Category
call Shops.addItemLink('I03W', 'I011') //Blizzard
call Shops.addItemLink('I03W', 'I014') //Breath of Fire
call Shops.addItemLink('I03W', 'I027') //Carrion Swarm
call Shops.addItemLink('I03W', 'I028') //Chain Lightning
call Shops.addItemLink('I03W', 'I01L') //Death Coil
call Shops.addItemLink('I03W', 'I00I') //Entangling Roots
call Shops.addItemLink('I03W', 'I023') //Fan of Knives
call Shops.addItemLink('I03W', 'I02U') //Fire Ball
call Shops.addItemLink('I03W', 'I005') //Flame Strike
call Shops.addItemLink('I03W', 'I00H') //Impale >Full<
// Now we link items to the Attack Abilities Pack 2 Category
call Shops.addItemLink('I03R', 'I01D') //Rain of Fire
call Shops.addItemLink('I03R', 'I00X') //Shadow Strike
call Shops.addItemLink('I03R', 'I02H') //ShockWave
call Shops.addItemLink('I03R', 'I01X') //Storm Bolt
call Shops.addItemLink('I03R', 'I00V') //Thunder Clap
call Shops.addItemLink('I03R', 'I02F') //War Stomp
call Shops.addItemLink('I03R', 'I00Y') //Mind Burn
call Shops.addItemLink('I03R', 'I00C') //Cluster Rockets
call Shops.addItemLink('I03R', 'I006') //Frost Nova
call Shops.addItemLink('I03R', 'I021') //Forked Lightning >Full<
// Now we link items to the Aura Abilities Category
call Shops.addItemLink('I034', 'I013') //Brilliance
call Shops.addItemLink('I034', 'I01E') //Devotion
call Shops.addItemLink('I034', 'I00K') //Endurance
call Shops.addItemLink('I034', 'I039') //Melee
call Shops.addItemLink('I034', 'I037') //True Shot
call Shops.addItemLink('I034', 'I00P') //Unholy
call Shops.addItemLink('I034', 'I018') //Vampiric >3 slots left<
// Now we link items to the Auto Cast Abilities Category
call Shops.addItemLink('I03M', 'I012') //Black Arrow
call Shops.addItemLink('I03M', 'I00G') //Carrion Beetles
call Shops.addItemLink('I03M', 'I006') //Frost Armor
call Shops.addItemLink('I03M', 'I00D') //Frost Arrows
call Shops.addItemLink('I03M', 'I02G') //Searing Arrows >5 slots left<
// Now we link items to the Defensive Abilities Category
call Shops.addItemLink('I03N', 'I01M') //Death Pact
call Shops.addItemLink('I03N', 'I014') //Divine Shield
call Shops.addItemLink('I03N', 'I01G') //Drunken haze
call Shops.addItemLink('I03N', 'I01Z') //Hex
call Shops.addItemLink('I03N', 'I000') //Howl of Terror
call Shops.addItemLink('I03N', 'I01Q') //Life Drain
call Shops.addItemLink('I03N', 'I01C') //Mana Sield
call Shops.addItemLink('I03N', 'I01A') //Mirror Image
call Shops.addItemLink('I03N', 'I01Y') //Mana Drain
call Shops.addItemLink('I03W', 'I01V') //Mana Burn >Full<
// Now we link items to the Summon Abilities Category
call Shops.addItemLink('I03O', 'I003') //Feral Spirit
call Shops.addItemLink('I03O', 'I007') //Force of Nature
call Shops.addItemLink('I03O', 'I01P') //Lava Spawn
call Shops.addItemLink('I03O', 'I02C') //Serpent Wards
call Shops.addItemLink('I03O', 'I016') //Summon Bear
call Shops.addItemLink('I03O', 'I02D') //Summon Hawk
call Shops.addItemLink('I03O', 'I00E') //Summon KillBeast
call Shops.addItemLink('I03O', 'I00N') //Summon Water Elemental >2 slots left<
// Now we link items to the Passive Abilities Category
call Shops.addItemLink('I03P', 'I035') //Barrage
call Shops.addItemLink('I03P', 'I01W') //Bash
call Shops.addItemLink('I03P', 'I025') //Cleave
call Shops.addItemLink('I03P', 'I026') //Critical Strike
call Shops.addItemLink('I03P', 'I00S') //Detect Invisible
call Shops.addItemLink('I03P', 'I01N') //Drunken Brawler
call Shops.addItemLink('I03P', 'I02E') //Evasion
call Shops.addItemLink('I03P', 'I00J') //Incinerate
call Shops.addItemLink('I03P', 'I01J') //Spiked Carapace >1 slots left<
// Now we link items to the Support Abilities Category
call Shops.addItemLink('I03Q', 'I019') //Banish
call Shops.addItemLink('I03Q', 'I038') //Get Smart
call Shops.addItemLink('I03Q', 'I002') //Healing Spray
call Shops.addItemLink('I03Q', 'I02J') //Healing Wave
call Shops.addItemLink('I03Q', 'I001') //Holy Light
call Shops.addItemLink('I03Q', 'I03V') //Wind Walk
call Shops.addItemLink('I03Q', 'I03T') //Agility Bonus
call Shops.addItemLink('I03Q', 'I00M') //Intelligence Bonus
call Shops.addItemLink('I03Q', 'I03S') //Strength Bonus >1 slot left<
/*----------------------------------------------------------------------------------------------------------------*/
// Now we will create a return to upper category button for the Attack Abilities Pack 1 Category
call Shops.duplicate('I040', 'I03U')
// the .duplicate method automatically registers the new item so no need to call .register
// Upper Category Dummy
call Shops.addItemLink('I03W', 'I03U')
call Shops.addItemLink('I03R', 'I03U')
call Shops.addItemLink('I034', 'I03U')
call Shops.addItemLink('I03M', 'I03U')
call Shops.addItemLink('I03N', 'I03U')
call Shops.addItemLink('I03O', 'I03U')
call Shops.addItemLink('I03P', 'I03U')
call Shops.addItemLink('I03Q', 'I03U')
endfunction
private function init takes nothing returns nothing
call TimerStart(CreateTimer(), 2.00, false, function create)
endfunction
endlibrary