Jump to content

UdvAtt108

Member
  • Posts

    30
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by UdvAtt108

  1. Here you are: Send whisper message (DM) from quest - Programming & Scripts - Metin2Dev | M2Dev
  2. Hello. I saw a similar question earlier on this forum, and since it's not a big task, I quickly made this snippet. It doesn't require much explanation, you can send a whisper message from a guest using a function. Let's see: I. Open the "game/src/questlua_pc.cpp" and you have to look for the following function:: int pc_set_skill_level(lua_State* L) { ... } II. and after that whole function lines add the following function lines: int pc_send_whisper(lua_State* L) { LPCHARACTER lpCH = CQuestManager::instance().GetCurrentCharacterPtr(); int iArgIndex = 1; const char * c_szSenderName = "System"; if (lua_gettop(L) > 1) { if(!lua_isstring(L, iArgIndex)) { sys_err("QUEST : wrong argument"); lua_pushboolean(L, false); return 1; } c_szSenderName = lua_tostring(L, iArgIndex); if (strlen(c_szSenderName) == 0) { sys_err("QUEST : empty argument"); lua_pushboolean(L, false); return 1; } iArgIndex++; } if (!lua_isstring(L, iArgIndex)) { sys_err("QUEST : wrong argument"); lua_pushboolean(L, false); return 1; } const char * c_szMessage = lua_tostring(L, iArgIndex); const size_t c_size = (c_szMessage) ? strlen(c_szMessage) : 0; if (c_size == 0) { sys_err("QUEST : empty argument"); lua_pushboolean(L, false); return 1; } LPDESC lpDesc; if (!(lpDesc = lpCH->GetDesc())) { lua_pushboolean(L, false); return 1; } TPacketGCWhisper lPack; lPack.bHeader = HEADER_GC_WHISPER; lPack.wSize = sizeof(TPacketGCWhisper) + c_size; lPack.bType = WHISPER_TYPE_NORMAL; strlcpy(lPack.szNameFrom, c_szSenderName, sizeof(lPack.szNameFrom)); TEMP_BUFFER lTmpBuf; lTmpBuf.write(&lPack, sizeof(lPack)); lTmpBuf.write(c_szMessage, c_size); lpDesc->Packet(lTmpBuf.read_peek(), lTmpBuf.size()); lua_pushboolean(L, true); return 1; } III. and now, look for the following line in the "RegisterPCFunctionTable" function: { "set_skill_level", pc_set_skill_level }, IV. and before that line add the following line: { "send_whisper", pc_send_whisper }, We are done now ! Important: You have to check your own whisper packet structure, because mine and yours can be different maybe. Don't forget to add this new quest function name to the quest function list file! (If you have one, that is.) - pc.send_whisper Usage example: (The default whisper target is always the current selected player by the quest system.) -- To send message by default sender name as "System": pc.send_whisper("Hi there! :)") -- To send message by a given sender name: pc.send_whisper("Biologist", "Biolog cooldown is done, you can submit next item.") -- To check the success of send: if pc.send_whisper("Hi there! :)") then -- The whisper message has been sent successfully. else -- Failed to send the whisper message. end
  3. Thank you for this source release, works perfectly. Upgrade the sound engine in Metin? I dont think its needed. "Miles" is old, yes, but up to date and does his job perfectly in this old game source and plays that minimal amount of music/effect. And with this source release (what i want to thank in this case too) u can make it and your client binary safer then before. For example, use it staticialy (with codec providers).
  4. Hi! I dont wanna waste the words, here you are: Step I. I. Open the "EffectLib/EffectManager.h" and look for the following lines: int CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation); int CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation); void CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID); II. and replace those lines with the following lines: int CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere = false); int CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere = false); void CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID, bool bSkipSphere = false); Step II. I. Open the "EffectLib/EffectManager.cpp" and look for the following line: int CEffectManager::CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation) II. and replace that line with the following line: int CEffectManager::CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere) III. and now, you have to look for the folowing line: return CreateEffect(dwID, c_rv3Position, c_rv3Rotation); IV. and replace that line with the following line: return CreateEffect(dwID, c_rv3Position, c_rv3Rotation, bSkipSphere); V. and now, you have to look for the folowing line: int CEffectManager::CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation) VI. and replace that line with the following line: int CEffectManager::CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere) VII. and now, you have to look for the folowing line: CreateEffectInstance(iInstanceIndex, dwID); VIII. and replace that line with the following line: CreateEffectInstance(iInstanceIndex, dwID, bSkipSphere); IV. and now, you have to look for the folowing line: void CEffectManager::CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID) X. and replace that line with the following line: void CEffectManager::CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID, bool bSkipSphere) XI. and now, you have to look for the folowing line: pEffectInstance->SetEffectDataPointer(pEffect); XII. and replace that line with the following line: pEffectInstance->SetEffectDataPointer(pEffect, bSkipSphere); Step III. I. Open the "EffectLib/EffectInstance.h" and look for the following line: void SetEffectDataPointer(CEffectData * pEffectData); II. and replace that line with the following line: void SetEffectDataPointer(CEffectData * pEffectData, bool bSkipSphere = false); Step IV. I. Open the "EffectLib/EffectInstance.cpp" and look for the following line: void CEffectInstance::SetEffectDataPointer(CEffectData * pEffectData) II. and replace that line with the following line: void CEffectInstance::SetEffectDataPointer(CEffectData * pEffectData, bool bSkipSphere) III. and now, you have to look for the folowing line: if (m_fBoundingSphereRadius > 0.0f) IV. and replace that line with the following line: if (!bSkipSphere && m_fBoundingSphereRadius > 0.0f) We are done now ! You can use the effects without bounding, like the following (in your situation): CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/battleroyale/battley_01.mse", true); CEffectManager::Instance().CreateEffect("d:/ymir work/effect/battleroyale/battley_01.mse", PixelPosition, v3Rotation, iSize, true); HAVE A GOOD LUCK!
  5. Hi all. I would like to share this little modification with this community. This idea came from a queastion what i saw today, u can see and read about it at dropitem effect. By this modification u can attach filtered effect to drop item on the ground. U can easy filter an item by item's vnum, item type and subtype then give different effect to the items. With this method for example you can seperate items by rarity, but the border is the starry sky. Let's see: Step I. I. Open the "UserInterface/PythonItem.h" and look for the following line: typedef struct SGroundItemInstance II. and before that line add the following lines: enum EDropItemEffects { DROP_ITEM_EFFECT_NORMAL, DROP_ITEM_EFFECT_RARE, DROP_ITEM_EFFECT_EPIC, DROP_ITEM_EFFECT_LEGENARY, DROP_ITEM_EFFECT_NUM, }; III. and now, you have to look for the folowing line: DWORD __Pick(const POINT& c_rkPtMouse); IV. and before that line add the following lines: void __RegisterEffect(int iIndex, const char* szFile); int __AttachEffect(DWORD dwVnum, BYTE byType, BYTE bySubType); V. last one in this step, look for the following line: DWORD m_dwDropItemEffectID; VI. and replace that line with the following line: DWORD m_dwDropItemEffectID[DROP_ITEM_EFFECT_NUM]; Step II. I. Open the "UserInterface/PythonItem.cpp" and look for the following lines: // attaching effect CEffectManager & rem =CEffectManager::Instance(); pGroundItemInstance->dwEffectInstanceIndex = rem.CreateEffect(m_dwDropItemEffectID, D3DXVECTOR3(x, -y, z), D3DXVECTOR3(0,0,0)); II. and replace those lines with the following lines: // attaching effect DWORD dwEffectIndex = __AttachEffect(dwVirtualNumber, pItemData->GetType(), pItemData->GetSubType()); if(dwEffectIndex < DROP_ITEM_EFFECT_NUM && dwEffectIndex >= 0) { dwEffectIndex = m_dwDropItemEffectID[dwEffectIndex]; if(dwEffectIndex != 0) { CEffectManager & rem =CEffectManager::Instance(); pGroundItemInstance->dwEffectInstanceIndex = rem.CreateEffect(dwEffectIndex, D3DXVECTOR3(x, -y, z), D3DXVECTOR3(0,0,0)); } } III. and now, you have to look for the folowing function: void CPythonItem::Create() IV. and replace that whole function with the following: void CPythonItem::Create() { //Default __RegisterEffect(DROP_ITEM_EFFECT_NORMAL, "d:/ymir work/effect/etc/dropitem/dropitem.mse"); //Rare __RegisterEffect(DROP_ITEM_EFFECT_RARE, "d:/ymir work/effect/etc/dropitem/dropitem_rare.mse"); //Epic __RegisterEffect(DROP_ITEM_EFFECT_EPIC, "d:/ymir work/effect/etc/dropitem/dropitem_epic.mse"); //Epic __RegisterEffect(DROP_ITEM_EFFECT_LEGENARY, "d:/ymir work/effect/etc/dropitem/dropitem_legendary.mse"); } V. and now, you have to look for the folowing line: m_dwPickedItemID = INVALID_ID; VI. and after that line add the following lines: memset(m_dwDropItemEffectID, 0, sizeof(m_dwDropItemEffectID)); VII. last one in this step, look for the following lines: CPythonItem::~CPythonItem() { assert(m_GroundItemInstanceMap.empty()); } VIII. and after that lines add the following lines: void CPythonItem::__RegisterEffect(int iIndex, const char* szFile) { if(iIndex >= DROP_ITEM_EFFECT_NUM || iIndex < 0) { TraceError("CPythonItem::__RegisterEffect - Invalid index: %d - %s", iIndex, szFile); return; } CEffectManager::Instance().RegisterEffect2(szFile, &m_dwDropItemEffectID[iIndex]); } int CPythonItem::__AttachEffect(DWORD dwVnum, BYTE byType, BYTE bySubType) { //Examples: //Determine the effect by item VNUM switch(dwVnum) { //Rare - These are the rare item vnums case 101: case 2001: return DROP_ITEM_EFFECT_RARE; //Epic - These are the epic item vnums case 3025: case 3229: return DROP_ITEM_EFFECT_EPIC; } //Determine the effect by item type/subtype switch(byType) { //Epic - This is the epic item type case CItemData::ITEM_TYPE_ARMOR: return DROP_ITEM_EFFECT_EPIC; //Filter by the material item type case CItemData::ITEM_TYPE_MATERIAL: { switch(bySubType) { //Epic - This is the epic item subtype case CItemData::MATERIAL_LEATHER: return DROP_ITEM_EFFECT_EPIC; //Legendary - This is the legendary item subtype case CItemData::MATERIAL_JEWEL: return DROP_ITEM_EFFECT_LEGENARY; } //Rare - All other ITEM_TYPE_MATERIAL type items return DROP_ITEM_EFFECT_RARE; //Default } } return DROP_ITEM_EFFECT_NORMAL; //Default } We are done now ! Important: In the "int CPythonItem::__AttachEffect" function you can see some example, that is not the final code, you have to config it like you want it to work! And you have to create those effect files what you register in the "void CPythonItem::Create()" function! You can add more effect separation by extending the "Step I. - II. - EDropItemEffects" enum. Preview:
  6. Hi, as far as i see, the problem at ChatPacket format argument, it comes from LC_TEXT, the memory address what comes from Vegas's LC_TEXT modificated function is empty, freed region or something is not correct inside that function, and the vsnprintf cant acces to that correctly. I dont know that multilanguage system, but it is a possible point to the problem location. I dont know the full history of this problem, but it is my tip in first look. Have a good luck.
  7. Because it doesn't matter whether you import the required module in upper or lower case.
  8. In this situation there is the concret information to solve this problem: The "mouseModule" does not found in the current executed script, in "uiAttachMetin.py" file. So you have to import that module, you can do it like the following: You have to add following line at begining of "uiAttachMetin.py" file. import mouseModule if that existsthere, you have to make sure the mouseModule.py file is in the root folder.
  9. Hi. As far as i see, the problem can be in the lootingsystem.py uiscript. this issue is one of the possible reasons, and comming from ui element's flag, when you add the 'attach' word to 'style' tag. If you have that 'attach' word in any of button's 'style' tag, remove it. But for sure, you can paste the lootingsystem.py's content here too.
  10. A variable (CDropItemGroup* pkGroup) is declared twice, but it is not needed. Replace it: { bNew = false; CDropItemGroup* pkGroup = it->second; } To this: { bNew = false; pkGroup = it->second; }
  11. First of all, in all of our name, thank you. If u agree me to correct something little. Inside the entity.cpp modification there is a misstaken, (not in all source!!!). Inside this function: void CEntity::SetObserverMode(bool bFlag) This change is problematic, because (in some source) the code calls the Pet character UpdateObserver function earlier then m_bIsObserver variable set to the new flag: if (IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) this; LPCHARACTER chHorse = ch->GetHorse(); if (chHorse) chHorse->SetObserverMode(bFlag); CPetSystem* petSystem = ch->GetPetSystem(); if (petSystem) petSystem->UpdateObserver(); ch->ChatPacket(CHAT_TYPE_COMMAND, "ObserverMode %d", m_bIsObserver ? 1 : 0); } Its is not effective, because (in some source) when in the Pet character UpdateObserver function checks for the current observer mode flag, the following function will returns the last value, not the new value what has been set later: m_pkOwner->IsObserverMode(); So i recommend the following modification for fix this issue: Open PetSystem.cpp At the end of the file add this, or replace it with the old one: void CPetSystem::UpdateObserver(bool bFlag) { if (!m_pkOwner) return; for (TPetActorMap::const_iterator iter = m_petActorMap.begin(); iter != m_petActorMap.end(); ++iter) { const CPetActor* petActor = iter->second; if (petActor == nullptr) continue; const LPCHARACTER petCh = petActor->GetCharacter(); if (petCh) petCh->SetObserverMode(bFlag); } } Open PetSystem.h Add or replace it with the old one after: void DeletePet(CPetActor* petActor); This: void UpdateObserver(bool bFlag); Open entity.cpp Inside this function: void CEntity::SetObserverMode(bool bFlag) Change it like this: if (IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) this; LPCHARACTER chHorse = ch->GetHorse(); if (chHorse) chHorse->SetObserverMode(bFlag); CPetSystem* petSystem = ch->GetPetSystem(); if (petSystem) petSystem->UpdateObserver(bFlag); ch->ChatPacket(CHAT_TYPE_COMMAND, "ObserverMode %d", m_bIsObserver ? 1 : 0); } The problem is there in MountSystem too. Correct me if im wrong. Thanks for it again!
  12. As far as i see, you weren't careful when you set the costume slot numbers. The client's and the server's slot numbers have to be same, so take a look at those informations in your sources. As far as i remember those informations are in GameType.h (Client) and length.h (Server/common). If those informations are corrects, you have to check the python slot configuration in your costume uiscript too.
  13. by that error, the snappy source is a static lib. I can think on two possibility. The first, you dont use correctly or on correct place the pragma linking. Maybe take a try on link the library in the visualstudio. The second chance. There are more subprojects then userinterface project in client source project. You have to make sure which one project does use snappy function imports, and you have to link the snappy static lib into that correct project. As far as i know, the pack manager is in eterbase project, i thing snappy is in eterbase (im on phone, i cant take a look, maybe im wrong) so you have to link the lib into that project.
  14. As far as i see, you want to use some external imported function from a library. You have to link the snappy dynamic/static lib into your project for the fix.
  15. Yes it is possible and it can be good and nice method if u can code it perfectly. . I think there is no problem with this method, its a better, secured and performed way, if u dont want to use the mysql connection on the website.
  16. First of all, It is because of the vps request's reaction is slower then local host's reaction, and the packet header error occours when the phase is switching faster then the last phase header receiving on the current phase. It is a general bug in the source. The pro solution is fix the input processor swiching on a running request (packet).
  17. In short, yes. But you have to modify the pycore source. The easyer way, you can link the python core library as static link library, its the most effective way, better performance and your client will be safer a bit.
  18. In ServerStateChecker.cpp file, end of CServerStateChecker::GetEchoReply function: Replace the following: return; with it: free(ReplyBuffer); Edit: Or you can use fixed static variable as buffer, that is should be better in this case.
  19. There is a nice memory leak, that spammed in every 5 seconds and makes high memory usage few hours later... Please, be carefull when you use memory allocations... Easy to fix it, lets correct it.
  20. First of all, did you check client syserr?! If error log is empty, you have to check the tooltip python source for belt supporting. I think your tooltip source does not support the belt item type or that is not correct to show belt bonuses and etc. If u cant find the problem, maybe share the uitooltip.py file with us.
  21. It does no matter on current situation. If we want a rly secure encrypter, we have to go into c++ source, you can make a rly productive system with cython. But it does not need for a simple autologin system, because the login data (password) is always on player's computer, so in a normal situation that is not touchable by 2nd person to steal it. BUT if someone wants crypt his player's password on their pc, here is a posible way like your work.
  22. Why did you overcomplicate this? There are shorter ways like the following: def xor(data, key): input = str(data) no_of_itr = len(input) output = "" for i in range(no_of_itr): current = input[i] current_key = key[i%len(key)] output += chr(ord(current) ^ ord(current_key)) return output secretkey = "mysecretkey" secretpassword = "mysecretpassword" ciphertext = xor(secretpassword, secretkey) print ciphertext decrypted = xor(ciphertext, secretkey) print decrypted print secretpassword == str(decrypted) Anyway good post.
  23. The easier solution is idle checking to check fast actions. You can make an idle checking for horse/mount summon/unsummon function in server source.
  24. You can do it by source code modification at server side. You can make a quest function (lua) to send a shop open command by a shop id and you can add that function to the target pet's vnum in quest (lua).
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.