[RELEASE] Item zerstören 'neuer Dropdialog' (Python, C++)

10/22/2015 13:06 Mr. 'Avenue™#1
Screenshot
[Only registered and activated users can see links. Click Here To Register...]

Serverside - C++
  • packet.h: sucht nach
    Code:
    HEADER_CG_ITEM_DROP2			= 20,
    & fügt darunter
    Code:
    HEADER_CG_ITEM_DESTROY			= 21,
    ein.
  • packet.h: sucht nach
    Code:
    typedef struct command_item_drop2
    {
    	[...]
    } TPacketCGItemDrop2;
    & fügt darunter
    Code:
    typedef struct command_item_destroy
    {
    	BYTE		header;
    	TItemPos	Cell;
    } TPacketCGItemDestroy;
    ein.
  • packet_info.cpp: sucht nach
    Code:
    Set(HEADER_CG_ITEM_DROP2, sizeof(TPacketCGItemDrop2), "ItemDrop2", true);
    & fügt darunter
    Code:
    Set(HEADER_CG_ITEM_DESTROY, sizeof(TPacketCGItemDestroy), "ItemDestroy", true);
    ein.
  • input_main.cpp: sucht nach
    Code:
    void CInputMain::ItemDrop2(LPCHARACTER ch, const char * data)
    {
    	[...]
    }
    & fügt darunter
    Code:
    void CInputMain::ItemDestroy(LPCHARACTER ch, const char * data)
    {
    	struct command_item_destroy * pinfo = (struct command_item_destroy *) data;
    
    	if (ch)
    		ch->DestroyItem(pinfo->Cell);
    }
    ein.
  • input_main.cpp: sucht nach
    Code:
    		case HEADER_CG_ITEM_DROP2:
    			[...]
    		break;
    & fügt darunter
    Code:
    		case HEADER_CG_ITEM_DESTROY:
    			if (!ch->IsObserverMode())
    				ItemDestroy(ch, c_pData);
    		break;
    ein.
  • char_item.cpp: Sucht nach
    Code:
    bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)
    & fügt darüber
    Code:
    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;
    }
    ein.
  • char.h: sucht nach
    Code:
    bool			DropItem(TItemPos Cell,  BYTE bCount=0);
    & fügt darüber
    Code:
    bool			DestroyItem(TItemPos Cell);
    ein.
  • input.h: sucht nach
    Code:
    void		ItemDrop2(LPCHARACTER ch, const char * data);
    & fügt darunter
    Code:
    void		ItemDestroy(LPCHARACTER ch, const char * data);
    ein.



Clientside - C++
  • packet.h: sucht nach
    Code:
    HEADER_CG_ITEM_DROP2                        = 20,
    & fügt darunter
    Code:
    HEADER_CG_ITEM_DESTROY						= 21,
    ein.
  • packet.h: sucht nach
    Code:
    typedef struct command_item_drop2
    {
        [...]
    } TPacketCGItemDrop2;
    & fügt darunter
    Code:
    typedef struct command_item_destroy
    {
    	BYTE		header;
    	TItemPos	pos;
    } TPacketCGItemDestroy;
    ein.
  • PythonNetworkStreamPhaseGameItem.cpp: sucht nach
    Code:
    bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count)
    {
    	[...]
    }
    & fügt darunter
    Code:
    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();
    }
    ein.
  • PythonNetworkStreamModule.cpp: sucht nach
    Code:
    PyObject* netSendItemDropPacket(PyObject* poSelf, PyObject* poArgs)
    {
    	[...]
    }
    & fügt darunter
    Code:
    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();
    }
    ein.
  • PythonNetworkStreamModule.cpp: sucht nach
    Code:
    { "SendItemDropPacketNew",				netSendItemDropPacketNew,				METH_VARARGS },
    & fügt darunter
    Code:
    { "SendItemDestroyPacket",				netSendItemDestroyPacket,				METH_VARARGS },
    ein.
  • PythonNetworkStream.h: sucht nach
    Code:
    bool SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count);
    & fügt darunter
    Code:
    bool SendItemDestroyPacket(TItemPos pos);
    ein.

Clientside - Python
  • uiCommon.py: sucht nach
    Code:
    class QuestionDialog(ui.ScriptWindow):
    	[...]
    & fügt darunter
    Code:
    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
    ein.
  • uiScript/questiondialogitem.py: aus dem Anhang herunterladen, einfügen & packen.
  • game.py: sucht in der definition __DropItem nach dem ersten
    Code:
    itemDropQuestionDialog = uiCommon.QuestionDialog()
    & ersetzt es durch
    Code:
    itemDropQuestionDialog = uiCommon.QuestionDialogItem()
  • game.py: ein paar Zeilen da drunter findet ihr
    Code:
    itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
    & fügt darunter
    Code:
    itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
    ein.
  • game.py: sucht nach
    Code:
    	def RequestDropItem(self, answer):
    		[...]
    & fügt darunter
    Code:
    	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)
    ein.
  • game.py: sucht nach
    Code:
    	def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
    		[...]
    & fügt darunter
    Code:
    	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)
    ein.
  • locale/xx/locale_interface.txt: fügt dort irgendwo
    Code:
    DESTROY	Zerstören
    ein.

[Only registered and activated users can see links. Click Here To Register...]

10/22/2015 13:12 .J0ker#2
Danke :) jetzt sind 10000 verschiedene wege public auch gut
10/22/2015 13:13 SandMann016#3
Wenigstens einer macht es richtig.
10/27/2015 22:17 naosou#4
When I click destroy, the item gets destroyed, but I cant move nor click in any item in the inventory.
I have to click ESC to be able to move or click.

Syserr:
Code:
1027 21:14:28470 :: Traceback (most recent call last):

1027 21:14:28470 ::   File "ui.py", line 1020, in CallEvent

1027 21:14:28471 ::   File "game.py", line 1444, in <lambda>

1027 21:14:28471 ::   File "game.py", line 1524, in RequestDestroyItem

1027 21:14:28471 :: AttributeError
1027 21:14:28471 :: : 
1027 21:14:28471 :: 'module' object has no attribute 'SET_ITEM_DROP_QUESTION_DIALOG_STATUS'
1027 21:14:28471 ::
10/27/2015 23:35 Mr. 'Avenue™#5
Quote:
Originally Posted by naosou View Post
When I click destroy, the item gets destroyed, but I cant move nor click in any item in the inventory.
I have to click ESC to be able to move or click.

Syserr:
Code:
1027 21:14:28470 :: Traceback (most recent call last):

1027 21:14:28470 ::   File "ui.py", line 1020, in CallEvent

1027 21:14:28471 ::   File "game.py", line 1444, in <lambda>

1027 21:14:28471 ::   File "game.py", line 1524, in RequestDestroyItem

1027 21:14:28471 :: AttributeError
1027 21:14:28471 :: : 
1027 21:14:28471 :: 'module' object has no attribute 'SET_ITEM_DROP_QUESTION_DIALOG_STATUS'
1027 21:14:28471 ::
It have to look like this
[Only registered and activated users can see links. Click Here To Register...]

If you've done everything correctly, it should work.
10/28/2015 01:18 .Xero#6
In meinem Client z.B heißt es nicht:
PHP Code:
constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0
sondern:
PHP Code:
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0
vllt hilft ihm das ja :)
10/28/2015 01:21 naosou#7
Edit:
Quote:
Originally Posted by TheKazudo View Post
In meinem Client z.B heißt es nicht:
PHP Code:
constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0
sondern:
PHP Code:
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0
vllt hilft ihm das ja :)
Thanks it worked.
12/22/2015 11:49 deltous'fabius#8
Bei mir taucht der Dialog einfach nicht auf.
Ich habe alles so eingefügt, bekomme auch keinen error code:
Also Clientside nicht als auch Serverside.
Und ja ich habe beides auch neu kompiliert
12/22/2015 12:05 Mr. 'Avenue™#9
Quote:
Originally Posted by deltous'fabius View Post
Bei mir taucht der Dialog einfach nicht auf.
Ich habe alles so eingefügt, bekomme auch keinen error code:
Also Clientside nicht als auch Serverside.
Und ja ich habe beides auch neu kompiliert
Eigentlich müsste so alles einwandfrei funktionieren. Hast du wirklich alles 1:1? Auch den Anhang heruntergeladen?
12/22/2015 12:42 deltous'fabius#10
Quote:
Originally Posted by Mr. 'Avenue™ View Post
Eigentlich müsste so alles einwandfrei funktionieren. Hast du wirklich alles 1:1? Auch den Anhang heruntergeladen?
ja. sonst kannst du dir das auch gerne über TV anschauen
02/21/2016 16:39 synthou1234#11
Funktioniert nun.

Danke

Lg

Shinµx - Dev
02/21/2016 18:21 Kampfzwerg!#12
kannst du bitte den Link entfernen
der hat hier auf epvp nichts zu suchen.
Danke

schöne grüße

Kampfzwerg
02/22/2016 21:32 Remix v49#13
wieso machst du ein typedef ums struct wenn du es nicht nutzst?
wird mal zeit dass ihr nicht diesen uralten coding style von webzen kopiert ohne nachzudenken

und wieso die pascal naming convention (SendPacket.....)
ist in der game nicht die camel case convention genutzt? (sendPaket...)

no haterino plssss wollte nur helpen
02/28/2016 08:22 qualitygaming17#14
I get dc after clicking destroy, no errors.

Any ideas?
03/02/2016 21:42 NovoLineX#15
Bei mir auch kein Error nix aber der Dialog taucht nicht auf steht nur Ja oder nein ^^