Hi. 74 Posted December 2, 2018 Share Posted December 2, 2018 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hello, What make this? Extend time for some items, what items you want, i make for costume body & hair. (1.1)Open char_item.cpp and search : case USE_TIME_CHARGE_FIX: (1.2)After this case put this: #ifdef EXTEND_TIME_COSTUME case USE_EXTEND_TIME: { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging() || item2->IsEquipped()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this item when you exchange or when your object is equipped.")); return false; } if (item2->GetType() != ITEM_COSTUME || (item2->GetSubType() != COSTUME_BODY && item2->GetSubType() != COSTUME_HAIR)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't use this item for this object.")); return false; } item2->SetSocket(0, item2->GetSocket(0) + item->GetValue(0)); item->SetCount(item->GetCount() - 1); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Extended time was added!")); } break; #endif (2.1) Go in DB in ProteReader.cpp and search: static string arSub3[] = { (2.2) At the end of this list we add: "USE_EXTEND_TIME", (3.1) Go in common, open item_length.h and search: enum EUseSubTypes (3.2) In this enum going the last line and put this: USE_EXTEND_TIME, (4.1) Binary, in GameLib -> ItemData.h and search : enum EUseSubTypes (4.2)In this enum going the last line and put this: USE_EXTEND_TIME, (5.1) Userinterface, in PythonItemModule.cpp and search: PyModule_AddIntConstant(poModule, "USE_SPECIAL", CItemData::USE_SPECIAL); (5.2) After this line put this: PyModule_AddIntConstant(poModule, "USE_EXTEND_TIME", CItemData::USE_EXTEND_TIME); Done with game/binary source. (1.1) Open root, in uiinventory.py and search: def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos): (1.2) On this def put this: dstItemVnum = player.GetItemIndex(dstItemSlotPos) if dstItemVnum != 0: item.SelectItem(srcItemVID) srcItemType = item.GetItemType() srcItemSubType = item.GetItemSubType() item.SelectItem(dstItemVnum) if srcItemType == item.ITEM_TYPE_USE and srcItemSubType == item.USE_EXTEND_TIME and item.GetItemType() == item.ITEM_TYPE_COSTUME and (item.GetItemSubType() == item.COSTUME_TYPE_BODY or item.GetItemSubType() == item.COSTUME_TYPE_HAIR): self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos) P.S: If you want Window Dialog make this: Spoiler Skip Step (1.2) , and make this step: dstItemVnum = player.GetItemIndex(dstItemSlotPos) if dstItemVnum != 0: item.SelectItem(srcItemVID) srcItemType = item.GetItemType() srcItemSubType = item.GetItemSubType() item.SelectItem(dstItemVnum) if srcItemType == item.ITEM_TYPE_USE and srcItemSubType == item.USE_EXTEND_TIME and item.GetItemType() == item.ITEM_TYPE_COSTUME and (item.GetItemSubType() == item.COSTUME_TYPE_BODY or item.GetItemSubType() == item.COSTUME_TYPE_HAIR): self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText("Vrei sa adaugi timp pe acest obiect?") self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.ExtendTime)) self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open() self.questionDialog.src = srcItemSlotPos self.questionDialog.dst = dstItemSlotPos But you need to put before this: def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos): This: def ExtendTime(self): self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst) self.OnCloseQuestionDialog() (1.3) Search: def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos): (1.4) On this def put this: if srcItemVNum != 0: item.SelectItem(srcItemVNum) if item.GetItemType() == item.ITEM_TYPE_USE and item.GetItemSubType() == item.USE_EXTEND_TIME: return True (1.5) Search: def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos): (1.6) On this def put this: dstItemVnum = player.GetItemIndex(dstSlotPos) if dstItemVnum != 0: item.SelectItem(srcItemVNum) srcItemType = item.GetItemType() srcItemSubType = item.GetItemSubType() item.SelectItem(dstItemVnum) if srcItemType == item.ITEM_TYPE_USE and srcItemSubType == item.USE_EXTEND_TIME and item.GetItemType() == item.ITEM_TYPE_COSTUME and (item.GetItemSubType() == item.COSTUME_TYPE_BODY or item.GetItemSubType() == item.COSTUME_TYPE_HAIR): return True Done. How to do item: You make a new item with type ITEM_USE and subtype USE_EXTEND_TIME and you put time you want on your item in Value0 (in seconds). Whit this methor you just make a new item for diferent times. About define EXTEND_TIME_COSTUME, you can remove it or you can add it in service.h (I use this define, you can use another). I don't think a screen or a video is needed. 21 7 17 Link to comment Share on other sites More sharing options...
Syriza 235 Posted December 2, 2018 Share Posted December 2, 2018 Hey, first of all thank you for your post. As far as i understood, this new item increases the time for a certain item is this correct? Link to comment Share on other sites More sharing options...
Hi. 74 Posted December 2, 2018 Author Share Posted December 2, 2018 Yes 2 hours ago, Syriza said: Hey, first of all thank you for your post. As far as i understood, this new item increases the time for a certain item is this correct? Link to comment Share on other sites More sharing options...
Recommended Posts