Jump to content
×
×
  • Create New...

GUI Bonus Window


Recommended Posts

M2 Download Center

Download Here ( Internal )

Hello Dev Community!

Today I will share You my litlle project what I made, because i saw many things of this problem - it means bonus page, bonus window or as You call it. 
This is my first thread on metin2dev forum. 
I do this 2 years ago nad post on known polish forum - mpcforum.pl. This can be a long topic, sorry in advance but I think it's worth.

Original thread on mpcforum:
http://www.mpcforum.pl/topic/1038647-okno-bonus-by-sanki/

I will share it there, because I think it's good idea for servers. So let's go!

Screen:

Spoiler

zakladkabonussanki.png&key=1202bac43dd0e3030c587cd3dcdca649be3149672eb0a422c19bf7e07a3d1e9a

 

I know... it is in polish language, but You can translate it very fast and simply... Google translator can help You :)

Notice the tabs, spaces, etc. THIS IS THE FIRST BAD thing what You can do wrong.

1. For first... unpack root and uiscript, go to root folder and open game.py, in imports add this:

import uiBonus

under: import uiCharacter

2. Next search in this file: onPressKeyDict[app.DIK_Z]
and add under(this function is for opening and closing this bonus window):

onPressKeyDict[app.DIK_X]            = lambda: self.interface.ToggleBonusWindow()

in this file it's end. You can close this file.
3. Now go to
interfacemodule.py also in root files (in this file will be add very much so You have to be carefoul and check to add all good) and add import like in game.py:
 

import uiBonus

4. Now in this file search:
 

def __init__(self):

and under this:
 

self.wndInventory = None

add this:
 

self.wndBonus = None 

5. Now search this function:
 

def __MakeWindows(self): 

and under:
 

wndInventory = uiInventory.InventoryWindow() 

add this:
 

wndBonus = uiBonus.BonusWindow() 

6. In this same function but a few lines below after this:
 

 self.wndCharacter = wndCharacter 

add this:
 

self.wndBonus = wndBonus

7. Ok. Good. Now search this function:
 

def Close(self):

and after this:
 

if self.wndInventory:

            self.wndInventory.Destroy() 

add this:
 

if self.wndBonus:

            self.wndBonus.Destroy()

7.1 Now again in the same function, a few lines below, we are looking for:

del self.wndInventory

add this:
 

del self.wndBonus

8. Now search another function:
 

 def ShowAllWindows(self):

and under this:
 

self.wndInventory.Show()

add this:
 

self.wndBonus.Show()

9. Now next function or search this:
 

def HideAllWindows(self):

under:
 

if self.wndInventory:
            self.wndInventory.Hide()

add:
 

if self.wndBonus:
            self.wndBonus.Hide()

10. Uff... not far...but now be carefoul! Search function :
 

def ToggleInventoryWindow(self):

and UNDER this function, NOT IN THIS function add new:

 

def ToggleBonusWindow(self):
        if FALSE == player.IsObserverMode():
            if FALSE == self.wndBonus.IsShow():
                self.wndBonus.Show()
                self.wndBonus.SetTop()
            else:
                self.wndBonus.Hide()

11. Ok. Next search:
 

def __HideWindows(self):

and in this after line:
 

self.wndInventory,

add:
 

self.wndBonus,

OK. In this way, we end add window to python files. Now only remain for us to add and pack to root files:  uibonus.py
and add and pack to uiscript files:  bonus.py

 

link for this files:
 

http://speedy.sh/Yn8Jb/zakladka-bonus.rar

scan:

http://img23.imageshack.us/img23/1237/l6n5.png

IF AFTER ADD, SOMETHING DON'T WONT WORKING( turn off client etc.) check client SYSERR!

PS. If problem is in this window bonus, errors will be in the middle of the polish. A reference to the file where to look.

Only one problem for older clients(2010) and oldest, is checking locals "IsARABIC", but the solution is easy... 
There You must only comment three lines(add # in beginning of the line) 38, 39 and 40 in uiBonus.py file. It must be like this:

Spoiler

http://img18.imageshack.us/img18/656/otr4.png

 

 

If I somewhere write something wrong, misspell, translate, spoilers etc or incorrect description(everything write what i learned alone) I  ask for precise, explanation, etc.

I don't translate this files because I don't have time for it... :< 
If anybody translate files to english(show text in window ingame and errors) will be that good and send me this files or give link in thread I will add it to topic.

PS.2. There is a little small bug( resis sura and ninja are reversed), only numbers in uibonus.py( now it is like this: odpninja... bonusid = 61 ... odpsura... bonusid = 60... ) reverse bonusid and it will be good( odpninja... bonusid = 60 ... odpsura.... bonusid = 61 ... ). I think, everyone know what i mean :)
 

Prohibition of copying on other forums, etc. For personal use only.

Kind Regards,
Sanki

  • Metin2 Dev 11
  • Love 6
  • Good 5
  • Think 1
Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...
  • 3 weeks later...
  • 1 month later...
  • 2 months later...
  • 2 years later...
  • 2 years later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.