Jump to content

Show long yang value as item price of privateshop


Recommended Posts

Hello,

I'm trying to raise limit of maximum item price at (private)shop, I change:

root/uitooltip.py - def CutMoneyString, int() to long()

root/uiprivateshopbuilder.py - def AcceptInputPrice, int to long

root/uicommon.py - __OnValueUpdate, int to long

root/uipickmoney.py (also for exchange yang) - def OnAccept, int to long

 

At server/client source I changed everything (when I try to buy an item which is showing 0 yang price, system says I dont have too much yang (for ex. 3.000.000.000) and it's correct - when my yang amount is lower of course :) so price is correct via packets, but I think it's problem by showing that price somewhere in python :/

I searched for int() but I didn't find anymore...

 

Maybe some of you did item prices 2kkk+ and can help me?

Regards

Link to comment
Share on other sites

did you change the money in uicommon?

i mean this.

		money = 0
		if text and text.isdigit():
			try:
				money = long(text)
			except ValueError:
				#money = 2110000000
				money = 19999999999 // This is the money of your shop

Yes, as I writed this is OnValueUpdate, I do it this way:

 

def __OnValueUpdate(self):
		ui.EditLine.OnIMEUpdate(self.inputValue)

		text = self.inputValue.GetText()

		money = 0
		if text:
			try:
				money = long(text)
			except ValueError:
				money = 9999999999999

		self.moneyText.SetText(self.moneyHeaderText + localeInfo.NumberToMoneyString(money))

 

@update It's my fault, I missed some shop item price packets and values in client binary.

I don't know how to handle this:

PythonShop.cpp (if I edit it this way I have error -C2665: 'PyTuple_GetInteger' : none of the 4 overloads could convert all the argument types)

 

PyObject * shopAddPrivateShopItemStock(PyObject * poSelf, PyObject * poArgs)
{
    BYTE bItemWindowType;
    if (!PyTuple_GetInteger(poArgs, 0, &bItemWindowType))
        return Py_BuildException();
    WORD wItemSlotIndex;
    if (!PyTuple_GetInteger(poArgs, 1, &wItemSlotIndex))
        return Py_BuildException();
    int iDisplaySlotIndex;
    if (!PyTuple_GetInteger(poArgs, 2, &iDisplaySlotIndex))
        return Py_BuildException();
    long long iPrice;
    if (!PyTuple_GetInteger(poArgs, 3, &iPrice))
        return Py_BuildException();
    CPythonShop::Instance().AddPrivateShopItemStock(TItemPos(bItemWindowType, wItemSlotIndex), iDisplaySlotIndex, iPrice);
    return Py_BuildNone();
}
and how handle PythonNetworkStreamPhaseGame.cpp ???
case SHOP_SUBHEADER_GC_UPDATE_PRICE:
            PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetShopSellingPrice", Py_BuildValue("(i)", *(int *)&vecBuffer[0]));

just change (int *) to (long long *)?

Edited by kodepiko
Link to comment
Share on other sites

At now I have problem only with showing item price via private shop viewing by visitor (when I setup my shop I see correct price 2kkk+), if price extends 2kkk+ it shows 0 yang, but when I try to buy it I need real amount (for ex. 4kkk), so anyone can help me - where I should find this value?

 

I think it's this part: (PythonNetworkStreamPhaseGame.cpp)

 

case SHOP_SUBHEADER_GC_UPDATE_PRICE:
            PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetShopSellingPrice", Py_BuildValue("(i)", *(int *)&vecBuffer[0]));
            break;

but I don't really know how to deal with it to make it long long (I tried change (int *) to (long long *) but no effect

 

I have edited (PythonShop.cpp)

PyObject * shopGetPrivateShopItemPrice(PyObject * poSelf, PyObject * poArgs)
{
    BYTE bItemWindowType;
    if (!PyTuple_GetInteger(poArgs, 0, &bItemWindowType))
        return Py_BuildException();
    WORD wItemSlotIndex;
    if (!PyTuple_GetInteger(poArgs, 1, &wItemSlotIndex))
        return Py_BuildException();
    long long iValue = CPythonShop::Instance().GetPrivateShopItemPrice(TItemPos(bItemWindowType, wItemSlotIndex));
    return PyLong_FromLongLong(iValue);
}
and
PyObject * shopAddPrivateShopItemStock(PyObject * poSelf, PyObject * poArgs)
{
    BYTE bItemWindowType;
    if (!PyTuple_GetInteger(poArgs, 0, &bItemWindowType))
        return Py_BuildException();
    WORD wItemSlotIndex;
    if (!PyTuple_GetInteger(poArgs, 1, &wItemSlotIndex))
        return Py_BuildException();
    int iDisplaySlotIndex;
    if (!PyTuple_GetInteger(poArgs, 2, &iDisplaySlotIndex))
        return Py_BuildException();
    long long iPrice;
    if (!PyTuple_GetLongLong(poArgs, 3, &iPrice))
        return Py_BuildException();
    CPythonShop::Instance().AddPrivateShopItemStock(TItemPos(bItemWindowType, wItemSlotIndex), iDisplaySlotIndex, iPrice);
    return Py_BuildNone();
}
Edited by kodepiko
Link to comment
Share on other sites

I have problem only with showing value at client by python at following cases:

Showing item price (2kkk+) in private shop (It just say 0 yang)

Showing amount of gold (4kkk+) in trade window (It says crazy numbers like 118.244.221 yang above the limit)

 

Can anyone help me where I can find this values at client source?

I think packets are edtied correctly because I still can give someone for ex. 10kkk and he receive this without problem, also as item price it works fine :)

 

client/PythonExchangeModule.cpp (I'm wrong or something? :/)

PyObject * exchangeGetElkFromSelf(PyObject * poSelf, PyObject * poArgs)
{
    return PyLong_FromLongLong(CPythonExchange::Instance().GetElkFromSelf());
}
PyObject * exchangeGetElkFromTarget(PyObject * poSelf, PyObject * poArgs)
{
    return PyLong_FromLongLong(CPythonExchange::Instance().GetElkFromTarget());
}

client/PythonExchange.cpp

void CPythonExchange::SetElkToTarget(long long    elk)
{    
    m_victim.elk = elk;
}
void CPythonExchange::SetElkToSelf(long long elk)
{
    m_self.elk = elk;
}
long long CPythonExchange::GetElkFromTarget()
{
    return m_victim.elk;
}
long long CPythonExchange::GetElkFromSelf()
{
    return m_self.elk;
}
Edited by kodepiko
Link to comment
Share on other sites

  • Honorable Member
case SHOP_SUBHEADER_GC_UPDATE_PRICE:
            PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetShopSellingPrice", Py_BuildValue("(i)", *(int *)&vecBuffer[0]));
            break;

This is not compatible with long long, but you should do this way:

		case SHOP_SUBHEADER_GC_UPDATE_PRICE:
			PyObject *args = PyTuple_New(1);
			PyTuple_SetItem(args, 0, PyLong_FromLongLong(*(long long *)&vecBuffer[0]));
			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetShopSellingPrice", args);

As here, this is not useful with long long:

				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnPickMoney", Py_BuildValue("(i)", (int)PointChange.amount));

Replace with:

				PyObject *args = PyTuple_New(1);
				PyTuple_SetItem(args, 0, PyLong_FromLongLong(PointChange.amount));
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnPickMoney", args);
  • Love 1
Link to comment
Share on other sites

I still have problem with trade window - private shop price is working :) Did I miss something?

PythonExchange.cpp

void CPythonExchange::SetElkToTarget(long long elk)
{    
    m_victim.elk = elk;
}
void CPythonExchange::SetElkToSelf(long long elk)
{
    m_self.elk = elk;
}
long long CPythonExchange::GetElkFromTarget()
{
    return m_victim.elk;
}
long long CPythonExchange::GetElkFromSelf()
{
    return m_self.elk;
}
PythonNetworkStreamModule.cpp
PyObject* netSendExchangeElkAddPacket(PyObject* poSelf, PyObject* poArgs)
{
    long long iElk;
    if (!PyTuple_GetLongLong(poArgs, 0, &iElk))
        return Py_BuildException();
    CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
    rkNetStream.SendExchangeElkAddPacket(iElk);
    return Py_BuildNone();
}
PythonExchangeModule.cpp
PyObject * exchangeGetElkFromSelf(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("L", CPythonExchange::Instance().GetElkFromSelf());
}
PyObject * exchangeGetElkFromTarget(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("L", CPythonExchange::Instance().GetElkFromTarget());
}

No matter I use Py_BuildValue or PyLong_Fromlonglong method, I don't know what I can miss..

Still showing max value of 4kkk+ yang at trade. Of course exchanging more than 4kkk+ is successful, just problem with showing correctly amount of yang in trade window

Edited by kodepiko
Link to comment
Share on other sites

  • Premium

I still have problem with trade window - private shop price is working :) Did I miss something?

PythonExchange.cpp

void CPythonExchange::SetElkToTarget(long long elk)
{    
    m_victim.elk = elk;
}
void CPythonExchange::SetElkToSelf(long long elk)
{
    m_self.elk = elk;
}
long long CPythonExchange::GetElkFromTarget()
{
    return m_victim.elk;
}
long long CPythonExchange::GetElkFromSelf()
{
    return m_self.elk;
}
PythonNetworkStreamModule.cpp
PyObject* netSendExchangeElkAddPacket(PyObject* poSelf, PyObject* poArgs)
{
    long long iElk;
    if (!PyTuple_GetLongLong(poArgs, 0, &iElk))
        return Py_BuildException();
    CPythonNetworkStream& rkNetStream=CPythonNetworkStream::Instance();
    rkNetStream.SendExchangeElkAddPacket(iElk);
    return Py_BuildNone();
}
PythonExchangeModule.cpp
PyObject * exchangeGetElkFromSelf(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("L", CPythonExchange::Instance().GetElkFromSelf());
}
PyObject * exchangeGetElkFromTarget(PyObject * poSelf, PyObject * poArgs)
{
    return Py_BuildValue("L", CPythonExchange::Instance().GetElkFromTarget());
}

Still showing max value of 4kkk+ yang at trade. Of course exchanging more than 4kkk+ is successful, just problem with showing correctly amount of yang in trade window

add me skype t4ump.new

  • Love 1


 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.