Jump to content

Hide Gold Line over Config


Recommended Posts

Hello M2dev i have search a way to hide the Gold Line over Source and i have write this System i hope anybody can use it.

TUT.

Client Source

Spoiler

PythonSystem.h

Search:

void                            SetShowSalesTextFlag(int iFlag);

ADD :

bool                            IsShowMoneyText();
void                            SetShowMoneyTextFlag(int iFlag);

Search :

bool            bShowSalesText;

ADD :

bool            bShowMoneyText;

PythonSystem.cpp

Search :

void CPythonSystem::SetShowSalesTextFlag(int iFlag)
{
    m_Config.bShowSalesText = iFlag == 1 ? true : false;
}

ADD :

bool CPythonSystem::IsShowMoneyText()
{
    return m_Config.bShowMoneyText;
}

void CPythonSystem::SetShowMoneyTextFlag(int iFlag)
{
    m_Config.bShowMoneyText = iFlag == 1 ? true : false;
}

Search :

else if (!stricmp(command, "SHOW_SALESTEXT"))
m_Config.bShowSalesText = atoi(value) == 1 ? true : false;

ADD :

else if (!stricmp(command, "SHOW_MONEY_TEXT"))
m_Config.bShowMoneyText = atoi(value) == 1 ? true : false;

Search :

if (m_Config.bShowSalesText == 0)
fprintf(fp, "SHOW_SALESTEXT        %d\n", m_Config.bShowSalesText);

ADD :

if (m_Config.bShowMoneyText == 0)
fprintf(fp, "SHOW_MONEY_TEXT    %d\n", m_Config.bShowMoneyText);

Search :

m_Config.bShowSalesText        = true;

ADD :

m_Config.bShowMoneyText        = true;

PythonSystemModule.cpp

Search :

PyObject * systemIsShowSalesText(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("i", CPythonSystem::Instance().IsShowSalesText());
}

ADD :

PyObject * systemIsShowMoneyText(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("i", CPythonSystem::Instance().IsShowMoneyText());
}

Search :

{ "IsShowSalesText",            systemIsShowSalesText,            METH_VARARGS },

ADD :

{ "SetShowMoneyTextFlag",        systemSetMoneyTextFlag,            METH_VARARGS},
{ "IsShowMoneyText",            systemIsShowMoneyText,            METH_VARARGS},

Search :

PyObject * systemSetShowSalesTextFlag(PyObject * poSelf, PyObject * poArgs)
{
    int iFlag;
    if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
        return Py_BuildException();

    CPythonSystem::Instance().SetShowSalesTextFlag(iFlag);

    return Py_BuildNone();
}

ADD :

PyObject * systemSetMoneyTextFlag(PyObject * poSelf, PyObject * poArgs)
{
    int iFlag;
    if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
        return Py_BuildException();

    CPythonSystem::Instance().SetShowMoneyTextFlag(iFlag);

    return Py_BuildNone();
}

 

Client pack @ root/uiGameOption.py

Spoiler

 

NOTE PLEASE SET THE TABS RIGHT !

Search :

self.showsalesTextButtonList.append(GetObject("salestext_on_button"))
self.showsalesTextButtonList.append(GetObject("salestext_off_button"))

ADD :

self.showyangTextButtonList.append(GetObject("yang_on_button"))
self.showyangTextButtonList.append(GetObject("yang_off_button"))

Search :

self.showsalesTextButtonList[0].SAFE_SetEvent(self.__OnClickSalesTextOnButton)
self.showsalesTextButtonList[1].SAFE_SetEvent(self.__OnClickSalesTextOffButton)        

ADD :

self.showyangTextButtonList[0].SAFE_SetEvent(self.__OnClickMoneyTextOnButton)
self.showyangTextButtonList[1].SAFE_SetEvent(self.__OnClickMoneyTextOffButton)

Search :

def __OnClickSalesTextOffButton(self):
        systemSetting.SetShowSalesTextFlag(FALSE)
        self.RefreshShowSalesText()        

ADD :

    def __OnClickMoneyTextOnButton(self):
        systemSetting.SetShowMoneyTextFlag(TRUE)
        self.RefrehMoneySalesText()
        #game.OnPickMoney()

    def __OnClickMoneyTextOffButton(self):
        systemSetting.SetShowMoneyTextFlag(FALSE)
        self.RefrehMoneySalesText()

Open Game.py

Search :

def OnPickMoney(self, money):

Change to :

    def OnPickMoney(self, money):
        if systemSetting.IsShowMoneyText() == True:
            chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))

 

Client Pack @ uiscript/gameoptiondialog.py

Spoiler

import uiScriptLocale

ROOT_PATH = "d:/ymir work/ui/public/"

TEMPORARY_X = +13
BUTTON_TEMPORARY_X = 5
PVP_X = -10

LINE_LABEL_X     = 30
LINE_DATA_X     = 90
LINE_STEP    = 0
SMALL_BUTTON_WIDTH     = 45
MIDDLE_BUTTON_WIDTH     = 65

window = {
    "name" : "GameOptionDialog",
    "style" : ("movable", "float",),

    "x" : 0,
    "y" : 0,

    "width" : 300,
    "height" : 25*11+8+25,

    "children" :
    (
        {
            "name" : "board",
            "type" : "board",

            "x" : 0,
            "y" : 0,

            "width" : 300,
            "height" : 25*11+8+25,

            "children" :
            (
                ## Title
                {
                    "name" : "titlebar",
                    "type" : "titlebar",
                    "style" : ("attach",),

                    "x" : 8,
                    "y" : 8,

                    "width" : 284,
                    "color" : "gray",

                    "children" :
                    (
                        { "name":"titlename", "type":"text", "x":0, "y":3,
                        "text" : uiScriptLocale.GAMEOPTION_TITLE,
                        "horizontal_align":"center", "text_horizontal_align":"center" },
                    ),
                },

                ## À̸§»ö
                {
                    "name" : "name_color",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 40+2,

                    "text" : uiScriptLocale.OPTION_NAME_COLOR,
                },
                {
                    "name" : "name_color_normal",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*0,
                    "y" : 40,

                    "text" : uiScriptLocale.OPTION_NAME_COLOR_NORMAL,

                    "default_image" : ROOT_PATH + "Middle_Button_01.sub",
                    "over_image" : ROOT_PATH + "Middle_Button_02.sub",
                    "down_image" : ROOT_PATH + "Middle_Button_03.sub",
                },
                {
                    "name" : "name_color_empire",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*1,
                    "y" : 40,

                    "text" : uiScriptLocale.OPTION_NAME_COLOR_EMPIRE,

                    "default_image" : ROOT_PATH + "Middle_Button_01.sub",
                    "over_image" : ROOT_PATH + "Middle_Button_02.sub",
                    "down_image" : ROOT_PATH + "Middle_Button_03.sub",
                },

                ## Ÿ°Ùâ
                {
                    "name" : "target_board",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 65+2,

                    "text" : uiScriptLocale.OPTION_TARGET_BOARD,
                },
                {
                    "name" : "target_board_no_view",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*0,
                    "y" : 65,

                    "text" : uiScriptLocale.OPTION_TARGET_BOARD_NO_VIEW,

                    "default_image" : ROOT_PATH + "Middle_Button_01.sub",
                    "over_image" : ROOT_PATH + "Middle_Button_02.sub",
                    "down_image" : ROOT_PATH + "Middle_Button_03.sub",
                },
                {
                    "name" : "target_board_view",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*1,
                    "y" : 65,

                    "text" : uiScriptLocale.OPTION_TARGET_BOARD_VIEW,

                    "default_image" : ROOT_PATH + "Middle_Button_01.sub",
                    "over_image" : ROOT_PATH + "Middle_Button_02.sub",
                    "down_image" : ROOT_PATH + "Middle_Button_03.sub",
                },

                
                ## PvP Mode
                {
                    "name" : "pvp_mode",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 90+2,

                    "text" : uiScriptLocale.OPTION_PVPMODE,
                },
                {
                    "name" : "pvp_peace",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+SMALL_BUTTON_WIDTH*0,
                    "y" : 90,

                    "text" : uiScriptLocale.OPTION_PVPMODE_PEACE,
                    "tooltip_text" : uiScriptLocale.OPTION_PVPMODE_PEACE_TOOLTIP,

                    "default_image" : ROOT_PATH + "small_Button_01.sub",
                    "over_image" : ROOT_PATH + "small_Button_02.sub",
                    "down_image" : ROOT_PATH + "small_Button_03.sub",
                },
                {
                    "name" : "pvp_revenge",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+SMALL_BUTTON_WIDTH*1,
                    "y" : 90,

                    "text" : uiScriptLocale.OPTION_PVPMODE_REVENGE,
                    "tooltip_text" : uiScriptLocale.OPTION_PVPMODE_REVENGE_TOOLTIP,

                    "default_image" : ROOT_PATH + "small_Button_01.sub",
                    "over_image" : ROOT_PATH + "small_Button_02.sub",
                    "down_image" : ROOT_PATH + "small_Button_03.sub",
                },
                {
                    "name" : "pvp_guild",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+SMALL_BUTTON_WIDTH*2,
                    "y" : 90,

                    "text" : uiScriptLocale.OPTION_PVPMODE_GUILD,
                    "tooltip_text" : uiScriptLocale.OPTION_PVPMODE_GUILD_TOOLTIP,

                    "default_image" : ROOT_PATH + "small_Button_01.sub",
                    "over_image" : ROOT_PATH + "small_Button_02.sub",
                    "down_image" : ROOT_PATH + "small_Button_03.sub",
                },
                {
                    "name" : "pvp_free",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+SMALL_BUTTON_WIDTH*3,
                    "y" : 90,

                    "text" : uiScriptLocale.OPTION_PVPMODE_FREE,
                    "tooltip_text" : uiScriptLocale.OPTION_PVPMODE_FREE_TOOLTIP,

                    "default_image" : ROOT_PATH + "small_Button_01.sub",
                    "over_image" : ROOT_PATH + "small_Button_02.sub",
                    "down_image" : ROOT_PATH + "small_Button_03.sub",
                },

                ## Block
                {
                    "name" : "block",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 115+2,

                    "text" : uiScriptLocale.OPTION_BLOCK,
                },
                {
                    "name" : "block_exchange_button",
                    "type" : "toggle_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*0,
                    "y" : 115,

                    "text" : uiScriptLocale.OPTION_BLOCK_EXCHANGE,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "block_party_button",
                    "type" : "toggle_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*1,
                    "y" : 115,

                    "text" : uiScriptLocale.OPTION_BLOCK_PARTY,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "block_guild_button",
                    "type" : "toggle_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*2,
                    "y" : 115,

                    "text" : uiScriptLocale.OPTION_BLOCK_GUILD,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "block_whisper_button",
                    "type" : "toggle_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*0,
                    "y" : 140,

                    "text" : uiScriptLocale.OPTION_BLOCK_WHISPER,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "block_friend_button",
                    "type" : "toggle_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*1,
                    "y" : 140,

                    "text" : uiScriptLocale.OPTION_BLOCK_FRIEND,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "block_party_request_button",
                    "type" : "toggle_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*2,
                    "y" : 140,

                    "text" : uiScriptLocale.OPTION_BLOCK_PARTY_REQUEST,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },

                ## Chat
                {
                    "name" : "chat",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 165+2,

                    "text" : uiScriptLocale.OPTION_VIEW_CHAT,
                },
                {
                    "name" : "view_chat_on_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X,
                    "y" : 165,

                    "text" : uiScriptLocale.OPTION_VIEW_CHAT_ON,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "view_chat_off_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
                    "y" : 165,

                    "text" : uiScriptLocale.OPTION_VIEW_CHAT_OFF,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },

                ## Always Show Name
                {
                    "name" : "always_show_name",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 190+2,

                    "text" : uiScriptLocale.OPTION_ALWAYS_SHOW_NAME,
                },
                {
                    "name" : "always_show_name_on_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X,
                    "y" : 190,

                    "text" : uiScriptLocale.OPTION_ALWAYS_SHOW_NAME_ON,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "always_show_name_off_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
                    "y" : 190,

                    "text" : uiScriptLocale.OPTION_ALWAYS_SHOW_NAME_OFF,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },

                ## Effect On/Off
                {
                    "name" : "effect_on_off",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 215+2,

                    "text" : uiScriptLocale.OPTION_EFFECT,
                },
                {
                    "name" : "show_damage_on_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X,
                    "y" : 215,

                    "text" : uiScriptLocale.OPTION_VIEW_CHAT_ON,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "show_damage_off_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
                    "y" : 215,

                    "text" : uiScriptLocale.OPTION_VIEW_CHAT_OFF,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },

                ## ÆǸŹ®±¸
                {
                    "name" : "salestext_on_off",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 240+2,

                    "text" : uiScriptLocale.OPTION_SALESTEXT,
                },
                {
                    "name" : "salestext_on_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X,
                    "y" : 240,

                    "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_ON,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "salestext_off_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
                    "y" : 240,

                    "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_OFF,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                ## ÆǸŹ®±¸
                {
                    "name" : "gold_on_off",
                    "type" : "text",

                    "x" : LINE_LABEL_X,
                    "y" : 265+2,

                    "text" : "Money Text",
                },
                {
                    "name" : "yang_on_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X,
                    "y" : 240,

                    "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_ON,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "yang_off_button",
                    "type" : "radio_button",

                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
                    "y" : 240,

                    "text" : uiScriptLocale.OPTION_SALESTEXT_VIEW_OFF,

                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
            ),
        },
    ),
}

 

VenTus :)

  • Love 2
Link to comment
Share on other sites

  • Honorable Member

Thanks.

I think better way if the flag is active do not call the python method in game.py
PythonNetworkStreamPhaseGame.cpp
Replace this:

		if (POINT_GOLD == PointChange.Type)
		{
			if (PointChange.amount > 0)
			{
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnPickMoney", Py_BuildValue("(i)", (int)PointChange.amount));
			}
		}

 

With this:

		if (POINT_GOLD == PointChange.Type)
		{
			if (PointChange.amount > 0 && CPythonSystem::Instance().IsShowMoneyText())
			{
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnPickMoney", Py_BuildValue("(i)", (int)PointChange.amount));
			}
		}

 

 

Edited by xP3NG3Rx
stupid code tag!!!
Link to comment
Share on other sites

  • Honorable Member

Do you know what are you talking about or I do not understand you?

The chenking of the flag of the block in python now, but if you put the checking into c++ is similar and faster a little bit(s)

I mean this:

if systemSetting.IsShowMoneyText() == True:

Same with this c++ code before the binary calls the python method:

CPythonSystem::Instance().IsShowMoneyText()
  • Love 1
Link to comment
Share on other sites

Why use cpp? You can simply do something like that

    def OnPickMoney(self, money):
        if constInfo.YANG_DROP == 1:
            chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFFFFD700" + localeInfo.GAME_PICK_MONEY % (money))
        else:
            return        

Link to comment
Share on other sites

2 hours ago, xP3NG3Rx said:

Because it store the option what you set and keep it the last option in every client start.
So if you disable it, and close the client itt will be disabled unti you don't enable it again an so on, better and sexier :D

You can still use python to reset the value of YANG_DROP everytime you login. :P but you're right using cpp is "sexier" :D.

Link to comment
Share on other sites

  • 7 months later...
  • 2 weeks later...

Can you give "uiscript" in the form of adding - changing?
In this way, the game isn't open

here is orginal files

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

This is the hidden content, please

 

uiGameOption.py(line:89) __Load_BindObject

OptionDialog.__Load_BindObject - <type 'exceptions.AttributeError'>:'OptionDialog' object has no attribute 'showyangTextButtonList'

0304 02:23:16529 :: ============================================================================================================
0304 02:23:16529 :: Abort!!!!

  • Metin2 Dev 3
  • Eyes 2
  • Good 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 9 months later...

Announcements



×
×
  • Create New...

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.