local shopWindow
local shopButton
local shopTabBar
local addonsPanel
local itemsPanel
local premiumPanel
local mountsPanel
local acceptWindow
function init()
shopWindow = g_ui.displayUI('shop')
shopWindow:hide()
shopTabBar = shopWindow:getChildById('shopTabBar')
shopTabBar:setContentWidget(shopWindow:getChildById('shopTabContent'))
addonsPanel = g_ui.loadUI('tms')
shopTabBar:addTab(tr('Items'), addonsPanel, '/modules/game_shop/images/shoptabs/tmcase')
mountsPanel = g_ui.loadUI('eggs')
shopTabBar:addTab(tr('Poke Eggs'), mountsPanel, '/modules/game_shop/images/shoptabs/eggs')
premiumPanel = g_ui.loadUI('premium')
shopTabBar:addTab(tr('Premium'), premiumPanel, '/modules/game_shop/images/shoptabs/premium')
shopButton = modules.client_topmenu.addRightGameToggleButton('Shop', tr('PokeArli Shop'), '/modules/game_shop/images/shop', toggle,true)
end
function terminate()
shopWindow:destroy()
shopButton:destroy()
end
function toggle()
if shopWindow:isVisible() then
hide()
else
show()
end
end
function show()
shopWindow:show()
shopWindow:raise()
shopWindow:focus()
end
function hide()
shopWindow:hide()
if acceptWindow then
acceptWindow:destroy()
acceptWindow = nil
end
end
function addTab(name, panel, icon)
shopTabBar:addTab(name, panel, icon)
end
function addButton(name, func, icon)
shopTabBar:addButton(name, func, icon)
end
-- Buy functions:
function carbos()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy carbos')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function hpup()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy hpup')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function iron()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy iron')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function protein()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy protein')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function calcium()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy calcium')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function premium3()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy premium3')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function premium2()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy premium2')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function premium1()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy premium1')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
-- Addons
function tm03reflect()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-AttackT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm06toxic()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-DefenseT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm11bubblebeam()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-HellfireT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm07zapcannon()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-ReturnT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm12watergun()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-PoisonT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm13icebeam()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-ExperienceT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm14blizzard()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#X-ElementalT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm15hyperbeam()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#Y-RegenerationT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm18raindance()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#Y-CureT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm19gigadrain()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('#Y-WingT2#')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm21megadrain()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy megadrain')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm22solarbeam()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy solarbeam')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm24dragonbreath()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy dragonbreath')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm25thunder()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy thunder')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm26earthquake()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy earthquake')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm29psychic()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy psychic')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm33icepunch()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy icepunch')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm38fireblast()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy fireblast')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm41thunderpunch()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy thunderpunch')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm48firepunch()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy firepunch')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end
function tm44rest()
if acceptWindow then
return true
end
local acceptFunc = function()
g_game.talk('!shopbuy rest')
acceptWindow:destroy()
acceptWindow = nil
end
local cancelFunc = function() acceptWindow:destroy() acceptWindow = nil end
acceptWindow = displayGeneralBox(tr('Accept transaction'), tr("Do you really want to buy this item?"),
{ { text=tr('Yes'), callback=acceptFunc },
{ text=tr('No'), callback=cancelFunc },
anchor=AnchorHorizontalCenter }, acceptFunc, cancelFunc)
return true
end