- Katılım
- 19 Şub 2024
- Mesajlar
- 2,290
- Tepkime puanı
- 958
- Puanları
- 113
Bu sistem sayesinde yere sürüklenen eşyaları hızlıca sattırabilir veya sildirebilirsiniz. Metin2 hızlı item sat ve sil sistemini eklemek için aşağıdaki kodları gerekli yerlere yerleştiriniz.
Source
Python
Uiscript packi içerisinde oluşturulacak py
Source

Kod:
Paste2
Create Paste
Followup Paste
QR
Client Source -> Locale_inc.h Ekle
#define WJ_NEW_DROP_DIALOG
Client Source -> Packet.h Arat : HEADER_CG_ITEM_DROP2 altına ekle
#ifdef WJ_NEW_DROP_DIALOG
HEADER_CG_ITEM_DESTROY = 21,
HEADER_CG_ITEM_SELL = 22,
#endif
Tekrar Arat : typedef struct command_item_drop2
Satır sonuna ekle
#ifdef WJ_NEW_DROP_DIALOG
typedef struct command_item_destroy
{
BYTE header;
TItemPos pos;
} TPacketCGItemDestroy;
typedef struct command_item_sell
{
BYTE header;
TItemPos pos;
} TPacketCGItemSell;
#endif
Client Source -> PythonApplicationModule.cpp Arat ;
#ifdef ENABLE_COSTUME_SYSTEM
PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 1);
#else
PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 0);
#endif
Altına ekle
#ifdef WJ_NEW_DROP_DIALOG
PyModule_AddIntConstant(poModule, "WJ_NEW_DROP_DIALOG", 1);
#else
PyModule_AddIntConstant(poModule, "WJ_NEW_DROP_DIALOG", 0);
#endif
Client Source -> PythonNetworkStream.h Arat;
bool SendItemDropPacket(TItemPos pos, DWORD elk); Altına ekle
#ifdef WJ_NEW_DROP_DIALOG
bool SendItemDestroyPacket(TItemPos pos);
bool SendItemSellPacket(TItemPos pos);
#endif
Client Source -> PythonNetworkStreamModule.cpp Arat ;
PyObject* netSendItemDropPacket(PyObject* poSelf, PyObject* poArgs) Satır sonuna ekle
#ifdef WJ_NEW_DROP_DIALOG
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();
}
PyObject* netSendItemSellPacket(PyObject* poSelf, PyObject* poArgs)
{
TItemPos Cell;
if (!PyTuple_GetInteger(poArgs, 0, &Cell.cell))
return Py_BuildException();
CPythonNetworkStream& rkNetStream = CPythonNetworkStream::Instance();
rkNetStream.SendItemSellPacket(Cell);
return Py_BuildNone();
}
#endif
Tekrar Arat ; { "SendItemDropPacketNew", netSendItemDropPacketNew, METH_VARARGS }, altına ekle
#ifdef WJ_NEW_DROP_DIALOG
{ "SendItemDestroyPacket", netSendItemDestroyPacket, METH_VARARGS },
{ "SendItemSellPacket", netSendItemSellPacket, METH_VARARGS },
#endif
Client Source -> PythonNetworkStreamPhaseGameItem.cpp Arat;
bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count) satır sonuna ekle
#ifdef WJ_NEW_DROP_DIALOG
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();
}
bool CPythonNetworkStream::SendItemSellPacket(TItemPos pos)
{
if (!__CanActMainInstance())
return true;
TPacketCGItemSell itemSellPacket;
itemSellPacket.header = HEADER_CG_ITEM_SELL;
itemSellPacket.pos = pos;
if (!Send(sizeof(itemSellPacket), &itemSellPacket))
{
Tracen("SendItemSellPacket Error");
return false;
}
return SendSequence();
}
#endif
-------------------------------------------------------
Server Source -> common/service.h Ekle;
#define WJ_NEW_DROP_DIALOG
Server Source -> game/char.h Arat : DropItem(TItemPos Cell, BYTE bCount=0); Altına ekle
#ifdef WJ_NEW_DROP_DIALOG
bool DestroyItem(TItemPos Cell);
bool SellItem(TItemPos Cell, BYTE bCount=0);
#endif
Server Source -> game/char_item.cpp Arat : bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount) Satır sonuna ekle
#ifdef WJ_NEW_DROP_DIALOG
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;
#ifdef WJ_SOULBINDING_SYSTEM
if (item->IsBind() || item->IsUntilBind())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("BIND_ITEM_NOT_DELETE"));
return false;
}
#endif
if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
return false;
if (item->GetCount() <= 0)
return false;
#ifdef WJ_GROWTH_PET_SYSTEM
if (item->GetVnum() == 55701 || item->GetVnum() == 55702 || item->GetVnum() == 55703 || item->GetVnum() == 55704)
if (GetNewPetSystem()->IsActivePet())
return false;
#endif
SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 1000);
ITEM_MANAGER::instance().RemoveItem(item);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEM_DESTROY_SUCCES"), item->GetName());
return true;
}
bool CHARACTER::SellItem(TItemPos Cell, BYTE bCount)
{
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;
#ifdef WJ_SOULBINDING_SYSTEM
if (item->IsBind() || item->IsUntilBind())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("BIND_ITEM_NOT_SELL"));
return false;
}
#endif
if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_SELL))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("THIS_ITEM_NOT_SELL"));
return false;
}
if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true)
return false;
if (item->GetCount() <= 0)
return false;
#ifdef WJ_GROWTH_PET_SYSTEM
if (item->GetVnum() == 55701 || item->GetVnum() == 55702 || item->GetVnum() == 55703 || item->GetVnum() == 55704)
if (GetNewPetSystem()->IsActivePet())
return false;
#endif
DWORD dwPrice;
if (bCount == 0 || bCount > item->GetCount())
bCount = item->GetCount();
dwPrice = item->GetShopBuyPrice();
if (IS_SET(item->GetFlag(), ITEM_FLAG_COUNT_PER_1GOLD))
{
if (dwPrice == 0)
dwPrice = bCount;
else
dwPrice = bCount / dwPrice;
}
else
dwPrice *= bCount;
dwPrice /= 5;
DWORD dwTax = 0;
#ifdef ENABLE_NEWSTUFF
if (g_iTaxes != 0)
dwTax = dwPrice * g_iTaxes/100;
#endif
dwPrice -= dwTax;
const int64_t nTotalMoney = static_cast<int64_t>(GetGold()) + static_cast<int64_t>(dwPrice);
if (GOLD_MAX <= nTotalMoney)
{
sys_err("[OVERFLOW_GOLD] id %u name %s gold %u", GetPlayerID(), GetName(), GetGold());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20억냥이 초과하여 물품을 팔수 없습니다."));
return false;
}
sys_log(0, "SHOP: SELL: %s item name: %s(x%d):%u price: %u", GetName(), item->GetName(), bCount, item->GetID(), dwPrice);
#ifdef ENABLE_NEWSTUFF
if (g_iTaxes > 0)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("판매금액의 %d %% 가 세금으로 나가게됩니다"), g_iTaxes);
#endif
DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), dwPrice);
item->SetCount(item->GetCount() - bCount);
PointChange(POINT_GOLD, dwPrice, false);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ITEM_SELL_SUCCES"), item->GetName());
return true;
}
#endif
Server Source -> game/input.h Arat : ItemDrop2(LPCHARACTER ch, const char * data); Altına ekle
#ifdef WJ_NEW_DROP_DIALOG
void ItemDestroy(LPCHARACTER ch, const char * data);
void ItemSell(LPCHARACTER ch, const char * data);
#endif
Server Source -> game/input_main.cpp Arat : void CInputMain::ItemDrop2(LPCHARACTER ch, const char * data) Satır sonuna ekle
#ifdef WJ_NEW_DROP_DIALOG
void CInputMain::ItemDestroy(LPCHARACTER ch, const char * data)
{
struct command_item_destroy * pinfo = (struct command_item_destroy *) data;
if (ch)
ch->DestroyItem(pinfo->Cell);
}
void CInputMain::ItemSell(LPCHARACTER ch, const char * data)
{
struct command_item_sell * pinfo = (struct command_item_sell *) data;
if (ch)
ch->SellItem(pinfo->Cell);
}
#endif
Yeniden arat
case HEADER_CG_ITEM_DROP2:
if (!ch->IsObserverMode())
ItemDrop2(ch, c_pData);
break;
Altına ekle
#ifdef WJ_NEW_DROP_DIALOG
case HEADER_CG_ITEM_DESTROY:
if (!ch->IsObserverMode())
ItemDestroy(ch, c_pData);
break;
case HEADER_CG_ITEM_SELL:
if (!ch->IsObserverMode())
ItemSell(ch, c_pData);
break;
#endif
Server Source -> game/packet.h Arat : HEADER_CG_ITEM_DROP2 altına ekle
#ifdef WJ_NEW_DROP_DIALOG
HEADER_CG_ITEM_DESTROY = 21,
HEADER_CG_ITEM_SELL = 22,
#endif
Tekrar arat: typedef struct command_item_drop2 satır sonuna ekle
#ifdef WJ_NEW_DROP_DIALOG
typedef struct command_item_destroy
{
BYTE header;
TItemPos Cell;
} TPacketCGItemDestroy;
typedef struct command_item_sell
{
BYTE header;
TItemPos Cell;
} TPacketCGItemSell;
#endif
Server Source -> game/packet_info.cpp Arat ;
Set(HEADER_CG_ITEM_DROP2, sizeof(TPacketCGItemDrop2), "ItemDrop2", false);
Altına ekle
#ifdef WJ_NEW_DROP_DIALOG
Set(HEADER_CG_ITEM_DESTROY, sizeof(TPacketCGItemDestroy), "ItemDestroy", false);
Set(HEADER_CG_ITEM_SELL, sizeof(TPacketCGItemSell), "ItemSell", false);
#endif
[SIZE=6][B]Python 👇[/B][/SIZE]
[CODE]Paste2
Create Paste
Followup Paste
QR
Game.py aratılır def __DropItem(self, attachedType, attachedItemIndex satır içinde tekrar aratılır (aynı işlem 2 kere yapılır)
questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount) ve alttaki ile değiştirilir
if app.WJ_NEW_DROP_DIALOG:
questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP_NEW(dropItemName, attachedItemCount, localeInfo.NumberToMoneyString(player.GetISellItemPrice(attachedItemSlotPos)))
else:
questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
Tekrar aratılır: itemDropQuestionDialog = uiCommon.QuestionDialog() alttaki ile değiştirilir
if app.WJ_NEW_DROP_DIALOG:
itemDropQuestionDialog = uiCommon.QuestionDialogItem()
else:
itemDropQuestionDialog = uiCommon.QuestionDialog()
Aratılır: itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg)) altına eklenir
if app.WJ_NEW_DROP_DIALOG:
itemDropQuestionDialog.SetDestroyEvent(lambda arg=True: self.RequestDestroyItem(arg))
itemDropQuestionDialog.SetSellEvent(lambda arg=True: self.RequestSellItem(arg))
Game.py içinde uygun bir yere eklenir;
if app.WJ_NEW_DROP_DIALOG:
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)
def __SendSellItemPacket(self, itemVNum, itemInvenTyoe = player.INVENTORY):
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
return
net.SendItemSellPacket(itemVNum)
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_QUESTION_DIALOG_STATUS(0)
def RequestSellItem(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.__SendSellItemPacket(dropNumber)
self.itemDropQuestionDialog.Close()
self.itemDropQuestionDialog = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
localeinfo.py içinde aratılır: def NumberToMoneyString(n) : satır sonuna eklenir
if app.WJ_NEW_DROP_DIALOG:
def HOW_MANY_ITEM_DO_YOU_DROP_NEW(dropItemName, dropItemCount, sellItemPrice) :
if dropItemCount > 1 :
return HOW_MANY_ITEM_DO_YOU_DROP_NEW2 % (dropItemName, dropItemCount, sellItemPrice)
else :
return HOW_MANY_ITEM_DO_YOU_DROP_NEW1 % (dropItemName, sellItemPrice)
uicommon.py aratılır : class MoneyInputDialog(ui.ScriptWindow): satır sonuna eklenir
if app.WJ_NEW_DROP_DIALOG:
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/questiondialog_item.py")
self.board = self.GetChild("board")
self.textLine = self.GetChild("message")
self.acceptButton = self.GetChild("drop")
self.destroyButton = self.GetChild("destroy")
self.sellButton = self.GetChild("sell")
self.cancelButton = self.GetChild("cancel")
self.itemPic = self.GetChild("image")
try:
self.itemPic.LoadImage(item.GetIconImageFileName())
except:
dbg.TraceError("AttachMetinDialog.Open.LoadImage - Failed to find item data")
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 SetSellEvent(self, event):
self.sellButton.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
locale_tr packında locale_game.txt eklenir
HOW_MANY_ITEM_DO_YOU_DROP_NEW1 [ |cff8BBDFF|H|h%s|h|r ] Nesnesi ne yapılsın? (%s)
HOW_MANY_ITEM_DO_YOU_DROP_NEW2 [ |cff8BBDFF|H|h%s|h|r |cffBCE55C|H|hx%d|h|r ] Nesneleri ne yapılsın? (%s)
[SIZE=6][B]Uiscript packi içine oluşturacağınız py dosyası 👇[/B][/SIZE]
[CODE]Paste2
Create Paste
Followup Paste
QR
import uiScriptLocale
window = {
"name" : "QuestionDialog",
"style" : ("movable", "float",),
"x" : SCREEN_WIDTH/2 - 125,
"y" : SCREEN_HEIGHT/2 - 52,
"width" : 360,
"height" : 105 + 50,
"children" :
(
{
"name" : "board",
"type" : "board",
"x" : 0,
"y" : 0,
"width" : 360,
"height" : 150,
"children" :
(
{
"name" : "image",
"type" : "image",
"x" : 0,
"y" : 10,
"horizontal_align" : "center",
"image" : "d:/ymir work/ui/game/windows/metin_slot_silver.sub",
},
{
"name" : "message",
"type" : "text",
"x" : 0,
"y" : 38 + 50,
"horizontal_align" : "center",
"text" : uiScriptLocale.MESSAGE,
"text_horizontal_align" : "center",
"text_vertical_align" : "center",
},
{
"name" : "drop",
"type" : "button",
"x" : -115,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_DROP,
"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" : -40,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_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" : "sell",
"type" : "button",
"x" : 35,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_SELL,
"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" : 110,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_CLOSE,
"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",
},
),
},
),
}
Python
Kod:
Paste2
Create Paste
Followup Paste
QR
Game.py aratılır def __DropItem(self, attachedType, attachedItemIndex satır içinde tekrar aratılır (aynı işlem 2 kere yapılır)
questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount) ve alttaki ile değiştirilir
if app.WJ_NEW_DROP_DIALOG:
questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP_NEW(dropItemName, attachedItemCount, localeInfo.NumberToMoneyString(player.GetISellItemPrice(attachedItemSlotPos)))
else:
questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
Tekrar aratılır: itemDropQuestionDialog = uiCommon.QuestionDialog() alttaki ile değiştirilir
if app.WJ_NEW_DROP_DIALOG:
itemDropQuestionDialog = uiCommon.QuestionDialogItem()
else:
itemDropQuestionDialog = uiCommon.QuestionDialog()
Aratılır: itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg)) altına eklenir
if app.WJ_NEW_DROP_DIALOG:
itemDropQuestionDialog.SetDestroyEvent(lambda arg=True: self.RequestDestroyItem(arg))
itemDropQuestionDialog.SetSellEvent(lambda arg=True: self.RequestSellItem(arg))
Game.py içinde uygun bir yere eklenir;
if app.WJ_NEW_DROP_DIALOG:
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)
def __SendSellItemPacket(self, itemVNum, itemInvenTyoe = player.INVENTORY):
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
return
net.SendItemSellPacket(itemVNum)
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_QUESTION_DIALOG_STATUS(0)
def RequestSellItem(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.__SendSellItemPacket(dropNumber)
self.itemDropQuestionDialog.Close()
self.itemDropQuestionDialog = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
localeinfo.py içinde aratılır: def NumberToMoneyString(n) : satır sonuna eklenir
if app.WJ_NEW_DROP_DIALOG:
def HOW_MANY_ITEM_DO_YOU_DROP_NEW(dropItemName, dropItemCount, sellItemPrice) :
if dropItemCount > 1 :
return HOW_MANY_ITEM_DO_YOU_DROP_NEW2 % (dropItemName, dropItemCount, sellItemPrice)
else :
return HOW_MANY_ITEM_DO_YOU_DROP_NEW1 % (dropItemName, sellItemPrice)
uicommon.py aratılır : class MoneyInputDialog(ui.ScriptWindow): satır sonuna eklenir
if app.WJ_NEW_DROP_DIALOG:
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/questiondialog_item.py")
self.board = self.GetChild("board")
self.textLine = self.GetChild("message")
self.acceptButton = self.GetChild("drop")
self.destroyButton = self.GetChild("destroy")
self.sellButton = self.GetChild("sell")
self.cancelButton = self.GetChild("cancel")
self.itemPic = self.GetChild("image")
try:
self.itemPic.LoadImage(item.GetIconImageFileName())
except:
dbg.TraceError("AttachMetinDialog.Open.LoadImage - Failed to find item data")
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 SetSellEvent(self, event):
self.sellButton.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
locale_tr packında locale_game.txt eklenir
HOW_MANY_ITEM_DO_YOU_DROP_NEW1 [ |cff8BBDFF|H|h%s|h|r ] Nesnesi ne yapılsın? (%s)
HOW_MANY_ITEM_DO_YOU_DROP_NEW2 [ |cff8BBDFF|H|h%s|h|r |cffBCE55C|H|hx%d|h|r ] Nesneleri ne yapılsın? (%s)
Uiscript packi içerisinde oluşturulacak py
Kod:
Paste2
Create Paste
Followup Paste
QR
import uiScriptLocale
window = {
"name" : "QuestionDialog",
"style" : ("movable", "float",),
"x" : SCREEN_WIDTH/2 - 125,
"y" : SCREEN_HEIGHT/2 - 52,
"width" : 360,
"height" : 105 + 50,
"children" :
(
{
"name" : "board",
"type" : "board",
"x" : 0,
"y" : 0,
"width" : 360,
"height" : 150,
"children" :
(
{
"name" : "image",
"type" : "image",
"x" : 0,
"y" : 10,
"horizontal_align" : "center",
"image" : "d:/ymir work/ui/game/windows/metin_slot_silver.sub",
},
{
"name" : "message",
"type" : "text",
"x" : 0,
"y" : 38 + 50,
"horizontal_align" : "center",
"text" : uiScriptLocale.MESSAGE,
"text_horizontal_align" : "center",
"text_vertical_align" : "center",
},
{
"name" : "drop",
"type" : "button",
"x" : -115,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_DROP,
"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" : -40,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_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" : "sell",
"type" : "button",
"x" : 35,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_SELL,
"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" : 110,
"y" : 63 + 50,
"width" : 61,
"height" : 21,
"horizontal_align" : "center",
"text" : uiScriptLocale.NEW_DROP_DIALOG_CLOSE,
"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",
},
),
},
),
}
questiondialog_item.py / uiscript
Metin2 Yazılım - Geliştirme kategorisindeki içeriklerimizi indirebilmeniz için yorum ve beğeni bırakmanız gerekmektedir.