Jump to content
×
×
  • Create New...

Destroy Item System


Recommended Posts

  • Premium

M2 Download Center

Download Here ( Internal )

Spoiler

172349ca41d0cbf2.jpg.f5dc73dc76bb02c873e


 

Spoiler

 

Serverside - C++

[*]packet.h: search for

HEADER_CG_ITEM_DROP2            = 20,
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
HEADER_CG_ITEM_DESTROY            = 21,
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]packet.h: search for 
typedef struct command_item_drop2
{
    [...]
} TPacketCGItemDrop2;
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
typedef struct command_item_destroy
{
    BYTE        header;
    TItemPos    Cell;
} TPacketCGItemDestroy;
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]packet_info.cpp: search for 
Set(HEADER_CG_ITEM_DROP2, sizeof(TPacketCGItemDrop2), "ItemDrop2", true);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
Set(HEADER_CG_ITEM_DESTROY, sizeof(TPacketCGItemDestroy), "ItemDestroy", true);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]input_main.cpp: search for  
void CInputMain::ItemDrop2(LPCHARACTER ch, const char * data)
{
    [...]
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
void CInputMain::ItemDestroy(LPCHARACTER ch, const char * data)
{
    struct command_item_destroy * pinfo = (struct command_item_destroy *) data;
    if (ch)
        ch->DestroyItem(pinfo->Cell);
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]input_main.cpp: search for 
        case HEADER_CG_ITEM_DROP2:
            [...]
        break;
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
        case HEADER_CG_ITEM_DESTROY:
            if (!ch->IsObserverMode())
                ItemDestroy(ch, c_pData);
        break;
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]char_item.cpp: search for 
bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
bool CHARACTER::DestroyItem(TItemPos Cell)
{
    LPITEM item = NULL;
    if (!CanHandleItem())
    {
        if (NULL != DragonSoul_RefineWindow_GetOpener())
            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°*È*âÀ» ¿¬ »óÅ¿¡¼*´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù."));
        return false;
    }
    if (IsDead())
        return false;
    if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell)))
        return false;
    if (item->IsExchanging())
        return false;
    if (true == item->isLocked())
        return false;
    if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
        return false;
    if (item->GetCount() <= 0)
        return false;
    SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 255);
    ITEM_MANAGER::instance().RemoveItem(item);
    ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Du hast %s zerstoert."), item->GetName());
    return true;
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 above it.

[*]char.h: search for 
bool            DropItem(TItemPos Cell,  BYTE bCount=0);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
bool            DestroyItem(TItemPos Cell);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 above it.

[*]input.h: search for 
void        ItemDrop2(LPCHARACTER ch, const char * data);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
void        ItemDestroy(LPCHARACTER ch, const char * data);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.
 
Clientside - C++

[*]packet.h: search for 
HEADER_CG_ITEM_DROP2                        = 20,
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
HEADER_CG_ITEM_DESTROY                        = 21,
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 ein.

[*]packet.h: search for 
typedef struct command_item_drop2
{
    [...]
} TPacketCGItemDrop2;
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
typedef struct command_item_destroy
{
    BYTE        header;
    TItemPos    pos;
} TPacketCGItemDestroy;
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]PythonNetworkStreamPhaseGameItem.cpp: search for 
bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count)
{
    [...]
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
bool CPythonNetworkStream::SendItemDestroyPacket(TItemPos pos)
{
    if (!__CanActMainInstance())
        return true;
    TPacketCGItemDestroy itemDestroyPacket;
    itemDestroyPacket.header = HEADER_CG_ITEM_DESTROY;
    itemDestroyPacket.pos = pos;
    if (!Send(sizeof(itemDestroyPacket), &itemDestroyPacket))
    {
        Tracen("SendItemDestroyPacket Error");
        return false;
    }
    return SendSequence();
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]PythonNetworkStreamModule.cpp: search for 
PyObject* netSendItemDropPacket(PyObject* poSelf, PyObject* poArgs)
{
    [...]
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
PyObject* netSendItemDestroyPacket(PyObject* poSelf, PyObject* poArgs)
{
    TItemPos Cell;
    
    if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
        return Py_BuildException();
    CPythonNetworkStream& rkNetStream = CPythonNetworkStream::Instance();
    rkNetStream.SendItemDestroyPacket(Cell);
    return Py_BuildNone();
}
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]PythonNetworkStreamModule.cpp: search for 
{ "SendItemDropPacketNew",                netSendItemDropPacketNew,                METH_VARARGS },
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
{ "SendItemDestroyPacket",                netSendItemDestroyPacket,                METH_VARARGS },
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.

[*]PythonNetworkStream.h: search for 
bool SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
bool SendItemDestroyPacket(TItemPos pos);
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 under it.
Clientside - Python

[*]uiCommon.py: search for 
class QuestionDialog(ui.ScriptWindow):
    [...]
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
class QuestionDialogItem(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.__CreateDialog()
    def __del__(self):
        ui.ScriptWindow.__del__(self)
    def __CreateDialog(self):
        pyScrLoader = ui.PythonScriptLoader()
        pyScrLoader.LoadScriptFile(self, "uiscript/questiondialogitem.py")
        self.board = self.GetChild("board")
        self.textLine = self.GetChild("message")
        self.acceptButton = self.GetChild("accept")
        self.destroyButton = self.GetChild("destroy")
        self.cancelButton = self.GetChild("cancel")
    def Open(self):
        self.SetCenterPosition()
        self.SetTop()
        self.Show()
    def Close(self):
        self.Hide()
    def SetWidth(self, width):
        height = self.GetHeight()
        self.SetSize(width, height)
        self.board.SetSize(width, height)
        self.SetCenterPosition()
        self.UpdateRect()
    def SAFE_SetAcceptEvent(self, event):
        self.acceptButton.SAFE_SetEvent(event)
    def SAFE_SetCancelEvent(self, event):
        self.cancelButton.SAFE_SetEvent(event)
    def SetAcceptEvent(self, event):
        self.acceptButton.SetEvent(event)
    def SetDestroyEvent(self, event):
        self.destroyButton.SetEvent(event)
    def SetCancelEvent(self, event):
        self.cancelButton.SetEvent(event)
    def SetText(self, text):
        self.textLine.SetText(text)
    def SetAcceptText(self, text):
        self.acceptButton.SetText(text)
    def SetCancelText(self, text):
        self.cancelButton.SetText(text)
    def OnPressEscapeKey(self):
        self.Close()
        return TRUE
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

 under it.
[*]uiScript/questiondialogitem.py: download it & pack it in your pack/uiscript.
[*]game.py: search in definition __DropItem for the first 
itemDropQuestionDialog = uiCommon.QuestionDialog()
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & replace it with 
itemDropQuestionDialog = uiCommon.QuestionDialogItem()
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

[*]game.py: a few lines under it you can find 
itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
 & paste 
itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

under it.
[*]game.py: search for 
    def RequestDropItem(self, answer):
        [...]
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
  & paste 
    def RequestDestroyItem(self, answer):
        if not self.itemDropQuestionDialog:
            return
        if answer:
            dropType = self.itemDropQuestionDialog.dropType
            dropNumber = self.itemDropQuestionDialog.dropNumber
            if player.SLOT_TYPE_INVENTORY == dropType:
                if dropNumber == player.ITEM_MONEY:
                    return
                else:
                    self.__SendDestroyItemPacket(dropNumber)
    
        self.itemDropQuestionDialog.Close()
        self.itemDropQuestionDialog = None
        constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

 under it.
[*]game.py: search for 
    def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
        [...]
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==
& paste 
    def __SendDestroyItemPacket(self, itemVNum, itemInvenType = player.INVENTORY):
        if uiPrivateShopBuilder.IsBuildingPrivateShop():
            chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
            return
        net.SendItemDestroyPacket(itemVNum)
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

 under it.
[*]locale/xx/locale_interface.txt: add there somewhere 
DESTROY    Destroy
data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

 


 

 

 

  • Metin2 Dev 34
  • Love 92
  • Love 2
  • Good 20
  • Scream 1
  • Confused 1
  • Cry 1
  • Not Good 1
  • Dislove 1
Link to comment
Share on other sites

  • 3 months later...
  • Moon

Hey,

it all works good. but i want to add a little clarification to the non experienced.

Pasting in the wrong def will get you frustrated so,make sure to paste it in following def:

Spoiler

def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):

below: 

Spoiler

if player.SLOT_TYPE_INVENTORY == attachedType:

 

[*]game.py: a few lines under it you can find 
itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
 & paste 
itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))

 

Regards.

 

  • Love 1
Link to comment
Share on other sites

Hi

i have this error when i try to drop a item

0220 12:54:51383 ::   File "game.py", line 1396, in OnMouseLeftButtonUp

0220 12:54:51383 ::   File "game.py", line 1433, in __PutItem

0220 12:54:51383 ::   File "game.py", line 1508, in __DropItem

0220 12:54:51383 :: AttributeError
0220 12:54:51383 :: :
0220 12:54:51383 :: 'module' object has no attribute 'QuestionDialogItem'
0220 12:54:51383 ::

 

  • Love 1
Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
2 hours ago, ladcatalin said:

After i destroy any item, my inventory is 'blocked'... I cant move any itemes, or equip..i cant do nothing with my inventory. 

The problem is about client side (@python).... 

So.. we will wait for fix :D@.Avenue™ help ? :D

Link to comment
Share on other sites

3 hours ago, galet said:

The only problem is that you can delete everything, including unique item and this is dangerous so you must create a check with flags :/

Sorry, but this "dropdialog" is used for destroy any items. If u set this to destroy just items which can be sold in shop or dropped, this system will be useless.

We need this for destroy any items from inventory...

  • Love 2
Link to comment
Share on other sites

3 hours ago, galet said:

The only problem is that you can delete everything, including unique item and this is dangerous so you must create a check with flags :/

Example:

	LPITEM item ; 
	if (IS_SET (item ->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_PKDROP | ITEM_ANTIFLAG_SELL))
		return ;

 

enum EItemAntiFlag { 
	ITEM_ANTIFLAG_FEMALE	 = ( 1 << 0 ), 
	ITEM_ANTIFLAG_MALE		 = ( 1 << 1 ), 
	ITEM_ANTIFLAG_WARRIOR	 = ( 1 << 2 ), 
	ITEM_ANTIFLAG_ASSASSIN	 = ( 1 << 3 ), 
	ITEM_ANTIFLAG_SURA		 = ( 1 << 4 ), 
	ITEM_ANTIFLAG_SHAMAN	 = ( 1 << 5 ), 
	ITEM_ANTIFLAG_GET		 = ( 1 << 6 ), 
	ITEM_ANTIFLAG_DROP		 = ( 1 << 7 ), 
	ITEM_ANTIFLAG_SELL		 = ( 1 << 8 ), 
	ITEM_ANTIFLAG_EMPIRE_A	 = ( 1 << 9 ), 
	ITEM_ANTIFLAG_EMPIRE_B	 = ( 1 << 10 ), 
	ITEM_ANTIFLAG_EMPIRE_C	 = ( 1 << 11 ), 
	ITEM_ANTIFLAG_SAVE		 = ( 1 << 12 ), 
	ITEM_ANTIFLAG_GIVE		 = ( 1 << 13 ), 
	ITEM_ANTIFLAG_PKDROP	 = ( 1 << 14 ),  
	ITEM_ANTIFLAG_STACK		 = ( 1 << 15 ), 
	ITEM_ANTIFLAG_MYSHOP	 = ( 1 << 16 ), 
	ITEM_ANTIFLAG_SAFEBOX	 = ( 1 << 17 ), 
}; 
                                                      

 

  • Love 3
Link to comment
Share on other sites

Or you can make it much easier xD @galet

	int pVnumTable[] = {50011, 50012, 50013, 50014, 50015, 50016, 50017, 50018, 50019, 50020, 50021, 50022, 50023};
	
	const char* pDestroyMessage = {"<Destroy> You can't delete item [%s] !"};
	
	for (int i = 0; i < _countof(pVnumTable); i++){
		if (pVnumTable[i] == item->GetVnum())
		{
			ChatPacket(CHAT_TYPE_INFO, pDestroyMessage, item->GetName());
			return false;
		}
	}

 

  • Love 1
Link to comment
Share on other sites

Sorry...but.. where i should add this?

 

1 hour ago, VegaS said:

Example:

	LPITEM item ; 
	if (IS_SET (item ->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_PKDROP | ITEM_ANTIFLAG_SELL))
		return ;

 

enum EItemAntiFlag { 
	ITEM_ANTIFLAG_FEMALE	 = ( 1 << 0 ), 
	ITEM_ANTIFLAG_MALE		 = ( 1 << 1 ), 
	ITEM_ANTIFLAG_WARRIOR	 = ( 1 << 2 ), 
	ITEM_ANTIFLAG_ASSASSIN	 = ( 1 << 3 ), 
	ITEM_ANTIFLAG_SURA		 = ( 1 << 4 ), 
	ITEM_ANTIFLAG_SHAMAN	 = ( 1 << 5 ), 
	ITEM_ANTIFLAG_GET		 = ( 1 << 6 ), 
	ITEM_ANTIFLAG_DROP		 = ( 1 << 7 ), 
	ITEM_ANTIFLAG_SELL		 = ( 1 << 8 ), 
	ITEM_ANTIFLAG_EMPIRE_A	 = ( 1 << 9 ), 
	ITEM_ANTIFLAG_EMPIRE_B	 = ( 1 << 10 ), 
	ITEM_ANTIFLAG_EMPIRE_C	 = ( 1 << 11 ), 
	ITEM_ANTIFLAG_SAVE		 = ( 1 << 12 ), 
	ITEM_ANTIFLAG_GIVE		 = ( 1 << 13 ), 
	ITEM_ANTIFLAG_PKDROP	 = ( 1 << 14 ),  
	ITEM_ANTIFLAG_STACK		 = ( 1 << 15 ), 
	ITEM_ANTIFLAG_MYSHOP	 = ( 1 << 16 ), 
	ITEM_ANTIFLAG_SAFEBOX	 = ( 1 << 17 ), 
}; 
                                                      

 

And..After i do this, my problem will be solved?...

Edited by ladcatalin
my fault..
Link to comment
Share on other sites

  • 2 months later...

Hi, I want a little change because someone might accidentally click the Remove button.
I tried to do as gif: a8790a968532eb4289aa991823f20435.gif

But as you can see when you click "Usuń" does not remove the object and does not close the window.
I did this: http://pastebin.com/4afZVsei


 
	sysser:
Traceback (most recent call last):
  File "ui.py", line 1372, in CallEvent
  File "game.py", line 1507, in <lambda>
  File "game.py", line 1541, in RequestDestroyItem
AttributeError: 'QuestionDialogItem2' object has no attribute 'dropType'
	game.py:
	on def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):                itemDropQuestionDialog = uiCommon.QuestionDialogItem()
	...
                itemDropQuestionDialog.SetText(questionText)
                itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
                itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem1(arg))
                itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
                itemDropQuestionDialog.Open()
                itemDropQuestionDialog.dropType = attachedType
                itemDropQuestionDialog.dropNumber = attachedItemSlotPos
                itemDropQuestionDialog.dropCount = attachedItemCount
                self.itemDropQuestionDialog = itemDropQuestionDialog
	                constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
...
	    def RequestDestroyItem1(self, answer):
        if answer:
            dropType = self.itemDropQuestionDialog.dropType
            dropNumber = self.itemDropQuestionDialog.dropNumber
	            itemDropQuestionDialog = uiCommon.QuestionDialogItem2()
            itemDropQuestionDialog.SetText(localeInfo.DESTROY2)
            itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
            itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
            itemDropQuestionDialog.Open()
            self.itemDropQuestionDialog = itemDropQuestionDialog
	            constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
	uicommon.py:
class QuestionDialogItem2(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.__CreateDialog()
	    def __del__(self):
        ui.ScriptWindow.__del__(self)
	    def __CreateDialog(self):
        pyScrLoader = ui.PythonScriptLoader()
        pyScrLoader.LoadScriptFile(self, "uiscript/questiondialogitem2.py")
	        self.board = self.GetChild("board")
        self.textLine = self.GetChild("message")
        self.destroyButton = self.GetChild("destroy")
        self.cancelButton = self.GetChild("cancel")
	    def Open(self):
        self.SetCenterPosition()
        self.SetTop()
        self.Show()
	    def Close(self):
        self.Hide()
	    def SetWidth(self, width):
        height = self.GetHeight()
        self.SetSize(width, height)
        self.board.SetSize(width, height)
        self.SetCenterPosition()
        self.UpdateRect()
	    def SAFE_SetCancelEvent(self, event):
        self.cancelButton.SAFE_SetEvent(event)
	    def SetDestroyEvent(self, event):
        self.destroyButton.SetEvent(event)
	    def SetCancelEvent(self, event):
        self.cancelButton.SetEvent(event)
	    def SetText(self, text):
        self.textLine.SetText(text)
	    def SetCancelText(self, text):
        self.cancelButton.SetText(text)
	    def OnPressEscapeKey(self):
        self.Close()
        return TRUE
	questiondialogitem2.py:
	import uiScriptLocale
	window = {
    "name" : "QuestionDialog",
    "style" : ("movable", "float",),
	    "x" : SCREEN_WIDTH/2 - 125,
    "y" : SCREEN_HEIGHT/2 - 52,
	    "width" : 340,
    "height" : 105,
	    "children" :
    (
        {
            "name" : "board",
            "type" : "board",
	            "x" : 0,
            "y" : 0,
	            "width" : 340,
            "height" : 105,
	            "children" :
            (
                {
                    "name" : "message",
                    "type" : "text",
	                    "x" : 0,
                    "y" : 38,
	                    "horizontal_align" : "center",
                    "text" : uiScriptLocale.MESSAGE,
	                    "text_horizontal_align" : "center",
                    "text_vertical_align" : "center",
                },
                {
                    "name" : "destroy",
                    "type" : "button",
	                    "x" : -60,
                    "y" : 63,
	                    "width" : 61,
                    "height" : 21,
	                    "horizontal_align" : "center",
                    "text" : uiScriptLocale.DESTROY,
	                    "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
                    "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
                    "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
                },
                {
                    "name" : "cancel",
                    "type" : "button",
	                    "x" : 60,
                    "y" : 63,
	                    "width" : 61,
                    "height" : 21,
	                    "horizontal_align" : "center",
                    "text" : uiScriptLocale.NO,
	                    "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
                    "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
                    "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
                },
            ),
        },
    ),
}


Could someone take a look something, advise or something?

  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

Now i can't close the window for button.


only Esc.
sysser:
Traceback (most recent call last):
  File "ui.py", line 1372, in CallEvent
  File "game.py", line 1468, in <lambda>
  File "game.py", line 1510, in RequestDestroyItem1
NameError: global name 'attachedType' is not defined

    def RequestDestroyItem1(self, answer):
        if answer:
            dropType = self.itemDropQuestionDialog.dropType
            dropNumber = self.itemDropQuestionDialog.dropNumber
	            itemDropQuestionDialog = uiCommon.QuestionDialogItem2()
            itemDropQuestionDialog.SetText(localeInfo.DESTROY2)
            itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
            itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
            itemDropQuestionDialog.Open()
            itemDropQuestionDialog.dropType = attachedType
            itemDropQuestionDialog.dropNumber = attachedItemSlotPos
            itemDropQuestionDialog.dropCount = attachedItemCount
            self.itemDropQuestionDialog = itemDropQuestionDialog
	            constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)

b08426fcc0252d6cfd656641712e9b9f.gif

Link to comment
Share on other sites

4 minutes ago, Kronzu said:

Now i can't close the window for button.

  Hide contents

 

only Esc.
sysser:
Traceback (most recent call last):
  File "ui.py", line 1372, in CallEvent
  File "game.py", line 1468, in <lambda>
  File "game.py", line 1510, in RequestDestroyItem1
NameError: global name 'attachedType' is not defined

 

    def RequestDestroyItem1(self, answer):
        if answer:
            dropType = self.itemDropQuestionDialog.dropType
            dropNumber = self.itemDropQuestionDialog.dropNumber
	            itemDropQuestionDialog = uiCommon.QuestionDialogItem2()
            itemDropQuestionDialog.SetText(localeInfo.DESTROY2)
            itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
            itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
            itemDropQuestionDialog.Open()
            itemDropQuestionDialog.dropType = attachedType
            itemDropQuestionDialog.dropNumber = attachedItemSlotPos
            itemDropQuestionDialog.dropCount = attachedItemCount
            self.itemDropQuestionDialog = itemDropQuestionDialog
	            constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)

b08426fcc0252d6cfd656641712e9b9f.gif

 

Use your brain.exe, polish noob..

Ps. You have new character wolfman, but you dont have logical thinking. :(

  • Love 1
Link to comment
Share on other sites

  • 4 weeks later...
On 24/10/2015 at 5:56 AM, .Avenue™ said:

Screenshot
ca41d0cbf2.jpg

 

Help Me Please :c 

i close the sale when i want to throw an item

Sysser: 

1123 00:38:01084 :: Failed to load script file : uiscript/questiondialogitem.py
1123 00:38:01089 :: 
ui.py(line:3803) LoadScriptFile
system.py(line:193) execfile
system.py(line:164) Run
uiscript/questiondialogitem.py(line:68) <module>

LoadScriptFile!!!!!!!!!!!!!! - <type 'exceptions.AttributeError'>:'module' object has no attribute 'DESTROY'

1123 00:38:01089 :: ============================================================================================================
1123 00:38:01089 :: Abort!!!!

Link to comment
Share on other sites

  • 1 month later...

If u can't move or equip items after destroy one, here's the fix:

In this def

def RequestDestroyItem(self, answer):
        if not self.itemDropQuestionDialog:
            return
        if answer:
            dropType = self.itemDropQuestionDialog.dropType
            dropNumber = self.itemDropQuestionDialog.dropNumber
            if player.SLOT_TYPE_INVENTORY == dropType:
                if dropNumber == player.ITEM_MONEY:
                    return
                else:
                    self.__SendDestroyItemPacket(dropNumber)
    
        self.itemDropQuestionDialog.Close()
        self.itemDropQuestionDialog = None
        constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)

Replace the 

constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)

with

constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  • Love 5
Link to comment
Share on other sites

  • 9 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.