Als erstes fangen wir mal im Server src an
Code
- packet.h:
- Suche:
- HEADER_CG_ITEM_DROP2 = 20,
- Danach:
- HEADER_CG_ITEM_DESTROY = 21,
- Suche:
- typedef struct command_item_drop2
- Nach der Funktion:
- typedef struct command_item_destroy
- {
- BYTE header;
- TItemPos Cell;
- } TPacketCGItemDestroy;
- packet_info.cpp:
- Suche:
- Set(HEADER_CG_ITEM_DROP2, sizeof(TPacketCGItemDrop2), "ItemDrop2", true);
- Danach:
- Set(HEADER_CG_ITEM_DESTROY, sizeof(TPacketCGItemDestroy), "ItemDestroy", true);
- input_main.cpp
- Suche:
- void CInputMain::ItemDrop2(LPCHARACTER ch, const char * data)
- Nach der Funktion:
- void CInputMain::ItemDestroy(LPCHARACTER ch, const char * data)
- {
- struct command_item_destroy * pinfo = (struct command_item_destroy *) data;
- if (ch)
- ch->DestroyItem(pinfo->Cell);
- }
- Suche:
- case HEADER_CG_ITEM_DROP2:
- [...]
- break;
- Danach:
- case HEADER_CG_ITEM_DESTROY:
- if (!ch->IsObserverMode())
- ItemDestroy(ch, c_pData);
- break;
- char_item.cpp
- Suche:
- bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount)
- Davor:
- 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;
- }
- char.h
- Suche:
- bool DropItem(TItemPos Cell, BYTE bCount=0);
- Davor:
- bool DestroyItem(TItemPos Cell);
- input.h
- Suche:
- void ItemDrop2(LPCHARACTER ch, const char * data);
- Danach:
- void ItemDestroy(LPCHARACTER ch, const char * data);
Nun zum Client Src
Code
- packet.h
- Suche:
- HEADER_CG_ITEM_DROP2 = 20,
- Danach:
- HEADER_CG_ITEM_DESTROY = 21,
- Suche:
- typedef struct command_item_drop2
- Nach der Funktion:
- typedef struct command_item_destroy
- {
- BYTE header;
- TItemPos pos;
- } TPacketCGItemDestroy;
- PythonNetworkStreamPhaseGameItem.cpp
- Suche:
- bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count)
- Nach der Funktion:
- 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();
- }
- PythonNetworkStreamModule.cpp
- Suche:
- PyObject* netSendItemDropPacket(PyObject* poSelf, PyObject* poArgs)
- Nach der Funktion:
- 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();
- }
- Suche:
- { "SendItemDropPacketNew", netSendItemDropPacketNew, METH_VARARGS },
- Danach:
- { "SendItemDestroyPacket", netSendItemDestroyPacket, METH_VARARGS },
- PythonNetworkStream.h
- Suche:
- bool SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count);
- Danach:
- bool SendItemDestroyPacket(TItemPos pos);
Und nun zum Python teil
Python
- root.epk/eix
- uicommon.py
- Suche:
- class QuestionDialog(ui.ScriptWindow):
- Nach der Funktion:
- 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
- game.py
- Suche:
- itemDropQuestionDialog = uiCommon.QuestionDialog()
- Ersetzen:
- itemDropQuestionDialog = uiCommon.QuestionDialogItem()
- Suche:
- itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
- Danach:
- itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
- Suche:
- def RequestDropItem(self, answer):
- Nach der Funktion:
- 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)
- Suche:
- def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
- Nach der Funktion:
- 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)
- Locale_xx.epk/eix
- locale_interface.txt:
- Am ende hinzufügen:
- DESTROY Destroy
- uiscripts.epk/eix
- Neue datei erstellen:
- questiondialogitem.py
- Und folgenden code rein machen:
- 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" : "accept",
- "type" : "button",
- "x" : -60,
- "y" : 63,
- "width" : 61,
- "height" : 21,
- "horizontal_align" : "center",
- "text" : uiScriptLocale.YES,
- "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" : "destroy",
- "type" : "button",
- "x" : 0,
- "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",
- },
- ),
- },
- ),
- }
Hoffe ihr könnt was mit anfangen bei fehler die ihr bekommt gerne bescheid geben oder bugs werde euch dort dann helfen!
Bitte melden Sie sich an, um diesen Link zu sehen.
Euer Noci