• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Module] game_shop

margoh

{{ user.title }}
Joined
Apr 1, 2013
Messages
806
Solutions
18
Reaction score
350
Hello, here is the module for shop.
This is how it looks:
dqzuqdgzovrytbyedgivwezkbszbkwoyeoysfkclmwgeodjygqqiqcfyrosxeeosgttfdfytexizyuwyjbuuffhcizbqregiioxv


zjwkaxvivzxlrwujbqzunbucjhvaesickdufmnxkpjkztasudilxhlvmhciqpzhrgoihszdocbjyskcqhdgbkwecrzselptzjcim


I have made only one image for Tabs and one for buttons, if you want more do it yourself.

It's using command, example (in shop.lua):
Code:
function buyAssassin()
  if acceptWindow then
    return true
  end

  local acceptFunc = function()
    g_game.talk('!buyaddon assassin')
    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

Example in addons.otui:
Code:
AddonButton < UIButton
  width: 352
  height: 68

Code:
  AddonButton
    image-source: /modules/game_shop/images/buttonimg/addon_assassin
    anchors.top: parent.top
    anchors.left: parent.left
    @onClick: buyAssassin()

How to add new button?
Copy whole function:
Code:
buyAssassin
Change it's name to ex. buyWizard:
Code:
function buyWizard()
Inside function change:
Code:
g_game.talk('!buyaddon assassin')
To:
Code:
g_game.talk('!buyaddon wizard')
Inside addons.otui copy and paste previous button and change:
Code:
image-source: /link/to/the/image
@onClick: modules.game_shop.buyAssassin()
To your new function name.

Follow this for all the items in the shop.

Download:
MEGA

Cheers!
 
Last edited:
really thanks, is amazing.

It is possible that when you give click on the purchase , exit a confirmation ? "Are you sure you purchase this item ? " options " yes " or "not"
 
You can add the option to display window after click, and there set if pressed Yes then do action, but if you add new button, you will have to make a new otui file for that new button.
I'm not pro xd

But I will try to expand it ;)
 
Just drop it into modules, and then in game_interface/interface.otmod add a line
Code:
    - game_shop
And you are done.
 
How it is not working? Use width: 32, height: 32 or size: 32 32. Look at pic of Shadowsong, it shows that you need to just switch the size of button xd
 
I want test it, but here don't log with the otclient -.- error 10061, do you know what is ?
tfs 1.2 windows 10 64 bits...
 
Use 127.0.0.1 instead of localhost. Had same problem and that worked for me :d
 
By any chance, do you keep that PSD?
Here's a small contribution, for those who would like to use this as a button for purchases, I made it in photoshop. You can add your text, prices in gold / tibia coins, and image to the button on your own:

qjApSFI.png


Looks like this ingame

lRSq1sx.png
 

Similar threads

Back
Top