Bitte melden Sie sich an, um dieses Bild zu sehen.
Serverside - C++
C: packet.h
C: input_main.cpp
- //search for:
- void CInputMain::ItemDrop2(LPCHARACTER ch, const char * data)
- {
- [...]
- }
- //paste this code under it:
- void CInputMain::ItemDestroy(LPCHARACTER ch, const char * data)
- {
- struct command_item_destroy * pinfo = (struct command_item_destroy *) data;
- if (ch)
- ch->DestroyItem(pinfo->Cell);
- }
- //search for:
- case HEADER_CG_ITEM_DROP2:
- [...]
- break;
- //paste this code under it:
- case HEADER_CG_ITEM_DESTROY:
- if (!ch->IsObserverMode())
- ItemDestroy(ch, c_pData);
- break;
C: char_item.cpp
- //search for:
- bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)
- //replace this code above it:
- 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;
- }
Clientside - C++
C: packet.h
C: PythonNetworkStreamPhaseGameItem.cpp
- //search for:
- bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count)
- {
- [...]
- }
- //paste this under it:
- 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();
- }
C: PythonNetworkStreamModule.cpp
- //search for:
- PyObject* netSendItemDropPacket(PyObject* poSelf, PyObject* poArgs)
- {
- [...]
- }
- //paste this code under it:
- 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();
- }
- //search for:
- { "SendItemDropPacketNew", netSendItemDropPacketNew, METH_VARARGS },
- //paste this code under it:
- { "SendItemDestroyPacket", netSendItemDestroyPacket, METH_VARARGS },
Clientside - Python
Python: uiCommon.py
- #search for:
- class QuestionDialog(ui.ScriptWindow):
- [...]
- #paste this code under it:
- 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
Python: game.py
- #search in def __DropItem(..) for THE FIRST:
- itemDropQuestionDialog = uiCommon.QuestionDialog()
- #replace it with this code:
- itemDropQuestionDialog = uiCommon.QuestionDialogItem()
- #a few lines under it you can find:
- itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
- #paste this code under it:
- itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
- #search for:
- def RequestDropItem(self, answer):
- [...]
- #paste this under it:
- 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)
- #search for:
- def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
- [...]
- #paste this under it:
- 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)