Management Karbust 4881 Posted May 23, 2018 Management Share Posted May 23, 2018 (edited) On 10/31/2017 at 5:33 PM, metin2-factory said: Small update #2 If you have installed my official like new elemental bonuses. follow the small guide below to view element icon of a target that wears the new rings, like in official. open char.cpp,look for: #ifdef ELEMENT_TARGET replace the entire content of the #ifdef, until the #endif with the following: #ifdef ELEMENT_TARGET p.bElement = 0; BYTE elementBase = 0; DWORD raceFlag; if (m_pkChrTarget) { if (m_pkChrTarget->IsMonster() && (raceFlag = m_pkChrTarget->GetMobTable().dwRaceFlag) >= RACE_FLAG_ATT_ELEC) { for (int i = RACE_FLAG_ATT_ELEC; i > 1; i /= 2) { elementBase++; } DWORD curElementBase = elementBase; const int ELEMENT_BASE_FLAG = pow(2, elementBase); for (int i = RACE_FLAG_ATT_ELEC; i <= RACE_FLAG_ATT_DARK; i *= 2) { curElementBase++; int diff = raceFlag - i; if (abs(diff) < ELEMENT_BASE_FLAG) break; } p.bElement = curElementBase - elementBase; } else if (m_pkChrTarget->IsPC()) { LPITEM pItem = m_pkChrTarget->GetWear(WEAR_RING1); if (pItem) { const int BASE_ELEMENT = APPLY_ATTBONUS_ELEC; for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++) { if (pItem->GetNewAttributeType(i) >= APPLY_ATTBONUS_ELEC && pItem->GetSocket(i) <= APPLY_ATTBONUS_DARK) { p.bElement = pItem->GetNewAttributeType(i) - BASE_ELEMENT + 1; break; } } } } } #endif Compile server and that's it. now, when you select a target that wear a ring with elemental bonuses, an element icon will appear next to the target. I have this error, do you know how to solve it? char.cpp: In member function 'void CHARACTER::SetTarget(LPCHARACTER)': char.cpp:6035:17: error: 'class CItem' has no member named 'GetNewAttributeType' if (pItem->GetNewAttributeType(i) >= APPLY_ATTBONUS_ELEC && pItem->GetSocket(i) <= APPLY_ATTBONUS_DARK) ^ char.cpp:6037:27: error: 'class CItem' has no member named 'GetNewAttributeType' p.bElement = pItem->GetNewAttributeType(i) - BASE_ELEMENT + 1; ^ Makefile:118: recipe for target 'OBJDIR/char.o' failed gmake: *** [OBJDIR/char.o] Error 1 Thanks Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium North 1172 Posted May 23, 2018 Premium Share Posted May 23, 2018 45 minutes ago, charparodar said: I have this error, do you know how to solve it? char.cpp: In member function 'void CHARACTER::SetTarget(LPCHARACTER)': char.cpp:6035:17: error: 'class CItem' has no member named 'GetNewAttributeType' if (pItem->GetNewAttributeType(i) >= APPLY_ATTBONUS_ELEC && pItem->GetSocket(i) <= APPLY_ATTBONUS_DARK) ^ char.cpp:6037:27: error: 'class CItem' has no member named 'GetNewAttributeType' p.bElement = pItem->GetNewAttributeType(i) - BASE_ELEMENT + 1; ^ Makefile:118: recipe for target 'OBJDIR/char.o' failed gmake: *** [OBJDIR/char.o] Error 1 Thanks CItem doesn't have GetNewAttributeType. Maybe in your source is called GetAttributeType, Visual Studio can help you autocomplete this... Just point to CItem and call the right function to return the attribute type. 1 Link to comment Share on other sites More sharing options...
Management Karbust 4881 Posted May 23, 2018 Management Share Posted May 23, 2018 1 hour ago, Fleon said: CItem doesn't have GetNewAttributeType. Maybe in your source is called GetAttributeType, Visual Studio can help you autocomplete this... Just point to CItem and call the right function to return the attribute type. It compiled, but now I can't see any icon when I click on the monster... I added ATT_FIRE: 6091 "¾ß¸¶Ãµ" "BOSS" "MONSTER" "MELEE" 108 "AGGR,BERSERK,STONESKIN,DEATHBLOW,REVIVE" 0 "FIRE,ATT_FIRE" "STUN,SLOW,CURSE,TERROR" 0 "0" 0 133 66 133 33 356 490 1813838 100 1 0 0 422585 256 110 110 100 2000 300 0 0 0 0 5 5 10 15 40 35 40 40 40 40 35 0 0 0 0 4.0 6008 25 None 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Any tip? Thanks Link to comment Share on other sites More sharing options...
LordZiege 279 Posted May 23, 2018 Share Posted May 23, 2018 vor 30 Minuten schrieb charparodar: It compiled, but now I can't see any icon when I click on the monster... I added ATT_FIRE: 6091 "¾ß¸¶Ãµ" "BOSS" "MONSTER" "MELEE" 108 "AGGR,BERSERK,STONESKIN,DEATHBLOW,REVIVE" 0 "FIRE,ATT_FIRE" "STUN,SLOW,CURSE,TERROR" 0 "0" 0 133 66 133 33 356 490 1813838 100 1 0 0 422585 256 110 110 100 2000 300 0 0 0 0 5 5 10 15 40 35 40 40 40 40 35 0 0 0 0 4.0 6008 25 None 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Any tip? Thanks Try with all bonus and look if anyone is working. for me only ATT_ELEC working, all others not. Link to comment Share on other sites More sharing options...
Management Karbust 4881 Posted May 23, 2018 Management Share Posted May 23, 2018 24 minutes ago, LordZiege said: Try with all bonus and look if anyone is working. for me only ATT_ELEC working, all others not. Works but not works... Works with Earth, but with the wrong image, shows me the ELEC icon instead the earth, even thought the raceflag is set to ATT_EARTH... This is the only one that works Link to comment Share on other sites More sharing options...
ManiacRobert 427 Posted May 23, 2018 Share Posted May 23, 2018 (edited) La 31.10.2017 la 15:42, .Elijah a spus: This is the hidden content, please Sign In or Sign Up - Client Side Version. Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal 4 1 1 3 Link to comment Share on other sites More sharing options...
Management Karbust 4881 Posted May 23, 2018 Management Share Posted May 23, 2018 (edited) 6 hours ago, ManiacRobert said: It's already working... I had to change this: enum ERaceFlags { RACE_FLAG_ANIMAL = (1 << 0), RACE_FLAG_UNDEAD = (1 << 1), RACE_FLAG_DEVIL = (1 << 2), RACE_FLAG_HUMAN = (1 << 3), RACE_FLAG_ORC = (1 << 4), RACE_FLAG_MILGYO = (1 << 5), RACE_FLAG_INSECT = (1 << 6), RACE_FLAG_FIRE = (1 << 7), RACE_FLAG_ICE = (1 << 8), RACE_FLAG_DESERT = (1 << 9), RACE_FLAG_TREE = (1 << 10), RACE_FLAG_ELEC = (1 << 11), RACE_FLAG_WIND = (1 << 12), RACE_FLAG_EARTH = (1 << 13), RACE_FLAG_DARK = (1 << 14), RACE_FLAG_ATT_ELEC = (1 << 15), RACE_FLAG_ATT_FIRE = (1 << 16), RACE_FLAG_ATT_ICE = (1 << 17), RACE_FLAG_ATT_WIND = (1 << 18), RACE_FLAG_ATT_EARTH = (1 << 19), RACE_FLAG_ATT_DARK = (1 << 20), }; To: enum ERaceFlags { RACE_FLAG_ANIMAL = (1 << 0), RACE_FLAG_UNDEAD = (1 << 1), RACE_FLAG_DEVIL = (1 << 2), RACE_FLAG_HUMAN = (1 << 3), RACE_FLAG_ORC = (1 << 4), RACE_FLAG_MILGYO = (1 << 5), RACE_FLAG_INSECT = (1 << 6), RACE_FLAG_FIRE = (1 << 7), RACE_FLAG_ICE = (1 << 8), RACE_FLAG_DESERT = (1 << 9), RACE_FLAG_TREE = (1 << 10), RACE_FLAG_ATT_ELEC = (1 << 11), RACE_FLAG_ATT_FIRE = (1 << 12), RACE_FLAG_ATT_ICE = (1 << 13), RACE_FLAG_ATT_WIND = (1 << 14), RACE_FLAG_ATT_EARTH = (1 << 15), RACE_FLAG_ATT_DARK = (1 << 16), }; But, can I use the element bonus like this? #ifdef ELEMENT_NEW_BONUSES else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_ELEC)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ELEC)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_FIRE)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_FIRE)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_ICE)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ICE)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_WIND)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_WIND)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_EARTH)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_EARTH)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_DARK)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_DARK)) / 100; #endif Thanks Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
3bd0 181 Posted May 24, 2018 Share Posted May 24, 2018 (edited) 10 hours ago, charparodar said: It's already working... I had to change this: enum ERaceFlags { RACE_FLAG_ANIMAL = (1 << 0), RACE_FLAG_UNDEAD = (1 << 1), RACE_FLAG_DEVIL = (1 << 2), RACE_FLAG_HUMAN = (1 << 3), RACE_FLAG_ORC = (1 << 4), RACE_FLAG_MILGYO = (1 << 5), RACE_FLAG_INSECT = (1 << 6), RACE_FLAG_FIRE = (1 << 7), RACE_FLAG_ICE = (1 << 8), RACE_FLAG_DESERT = (1 << 9), RACE_FLAG_TREE = (1 << 10), RACE_FLAG_ELEC = (1 << 11), RACE_FLAG_WIND = (1 << 12), RACE_FLAG_EARTH = (1 << 13), RACE_FLAG_DARK = (1 << 14), RACE_FLAG_ATT_ELEC = (1 << 15), RACE_FLAG_ATT_FIRE = (1 << 16), RACE_FLAG_ATT_ICE = (1 << 17), RACE_FLAG_ATT_WIND = (1 << 18), RACE_FLAG_ATT_EARTH = (1 << 19), RACE_FLAG_ATT_DARK = (1 << 20), }; To: enum ERaceFlags { RACE_FLAG_ANIMAL = (1 << 0), RACE_FLAG_UNDEAD = (1 << 1), RACE_FLAG_DEVIL = (1 << 2), RACE_FLAG_HUMAN = (1 << 3), RACE_FLAG_ORC = (1 << 4), RACE_FLAG_MILGYO = (1 << 5), RACE_FLAG_INSECT = (1 << 6), RACE_FLAG_FIRE = (1 << 7), RACE_FLAG_ICE = (1 << 8), RACE_FLAG_DESERT = (1 << 9), RACE_FLAG_TREE = (1 << 10), RACE_FLAG_ATT_ELEC = (1 << 11), RACE_FLAG_ATT_FIRE = (1 << 12), RACE_FLAG_ATT_ICE = (1 << 13), RACE_FLAG_ATT_WIND = (1 << 14), RACE_FLAG_ATT_EARTH = (1 << 15), RACE_FLAG_ATT_DARK = (1 << 16), }; But, can I use the element bonus like this? #ifdef ELEMENT_NEW_BONUSES else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_ELEC)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ELEC)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_FIRE)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_FIRE)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_ICE)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ICE)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_WIND)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_WIND)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_EARTH)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_EARTH)) / 100; else if (pkVictim->IsRaceFlag(RACE_FLAG_ATT_DARK)) iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_DARK)) / 100; #endif Thanks I believe that's how it's in official Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
metin2-factory 1010 Posted May 24, 2018 Author Share Posted May 24, 2018 I Wouldn't recommend on using the client side one. the main reason is code duplication. if you forget to change in either client/server side you have a bug. Link to comment Share on other sites More sharing options...
3bd0 181 Posted May 24, 2018 Share Posted May 24, 2018 29 minutes ago, metin2-factory said: I Wouldn't recommend on using the client side one. the main reason is code duplication. if you forget to change in either client/server side you have a bug. Your mob_proto get created from mob_proto and names that you use serverside, so the bug will inly happens if you updated the server side without the client side, which is dump. Link to comment Share on other sites More sharing options...
Management Karbust 4881 Posted May 24, 2018 Management Share Posted May 24, 2018 4 hours ago, metin2-factory said: I Wouldn't recommend on using the client side one. the main reason is code duplication. if you forget to change in either client/server side you have a bug. I'm using yours and it's working, I just added the wrong piece of code, since I dont have the talismans I was using the code where the element was only displayed when using an item... But also I had to edit my Raceflag enum, had to many entries... Also, can you share the slot management for the talismans please? Thanks Link to comment Share on other sites More sharing options...
[Dev]Medo 4 Posted August 2, 2018 Share Posted August 2, 2018 you sevrersided code didn't work for me so i rewrote it and it's perfectly working now anyway thanks for the release .. looking forward for more of yours <3 1 Link to comment Share on other sites More sharing options...
Contributor MrQuin 6397 Posted August 3, 2018 Contributor Share Posted August 3, 2018 Nnice release My only accounts are here and on M2D, Don't trust anyone else from other shitty sites. Link to comment Share on other sites More sharing options...
sunter 0 Posted January 7, 2019 Share Posted January 7, 2019 (edited) On 10/31/2017 at 5:33 PM, metin2-factory said: Small update #2 If you have installed my official like new elemental bonuses. follow the small guide below to view element icon of a target that wears the new rings, like in official. open char.cpp,look for: #ifdef ELEMENT_TARGET replace the entire content of the #ifdef, until the #endif with the following: #ifdef ELEMENT_TARGET p.bElement = 0; BYTE elementBase = 0; DWORD raceFlag; if (m_pkChrTarget) { if (m_pkChrTarget->IsMonster() && (raceFlag = m_pkChrTarget->GetMobTable().dwRaceFlag) >= RACE_FLAG_ATT_ELEC) { for (int i = RACE_FLAG_ATT_ELEC; i > 1; i /= 2) { elementBase++; } DWORD curElementBase = elementBase; const int ELEMENT_BASE_FLAG = pow(2, elementBase); for (int i = RACE_FLAG_ATT_ELEC; i <= RACE_FLAG_ATT_DARK; i *= 2) { curElementBase++; int diff = raceFlag - i; if (abs(diff) < ELEMENT_BASE_FLAG) break; } p.bElement = curElementBase - elementBase; } else if (m_pkChrTarget->IsPC()) { LPITEM pItem = m_pkChrTarget->GetWear(WEAR_RING1); if (pItem) { const int BASE_ELEMENT = APPLY_ATTBONUS_ELEC; for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++) { if (pItem->GetNewAttributeType(i) >= APPLY_ATTBONUS_ELEC && pItem->GetSocket(i) <= APPLY_ATTBONUS_DARK) { p.bElement = pItem->GetNewAttributeType(i) - BASE_ELEMENT + 1; break; } } } } } #endif Compile server and that's it. now, when you select a target that wear a ring with elemental bonuses, an element icon will appear next to the target. Error Compile char.cpp: In member function 'void CHARACTER::SetTarget(CHARACTER*)': char.cpp:5622: error: call of overloaded 'pow(int, BYTE&)' is ambiguous /usr/include/math.h:210: note: candidates are: double pow(double, double) /usr/include/c++/4.2/cmath:373: note: long double std::pow(long double, int) /usr/include/c++/4.2/cmath:369: note: float std::pow(float, int) /usr/include/c++/4.2/cmath:365: note: double std::pow(double, int) /usr/include/c++/4.2/cmath:361: note: long double std::pow(long double, long double) /usr/include/c++/4.2/cmath:357: note: float std::pow(float, float) Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
OnlyRipper 55 Posted July 8, 2019 Share Posted July 8, 2019 Hello metin2-factory! Could you please reupload ? The content expired. Link to comment Share on other sites More sharing options...
Mandi 2 Posted February 2, 2020 Share Posted February 2, 2020 Does anyone know why when I have more than one race flag (ex: DEVIL, ATT_FIRE) the element isn't showing? If I only have ATT_FIRE on race flag, everything goes fine.. Link to comment Share on other sites More sharing options...
Hik 108 Posted March 25, 2020 Share Posted March 25, 2020 (edited) Unfortunately I don't see anything, I think the problem is the code inserted in char.cpp. EDIT: Now work, it is this part of code that did not allow me to view the image: #self.elementImage.SetPosition(self.GetLeft() - 40, self.GetTop()) Anyone know what I can replace this part with? This is the effect obtained: Edited September 4, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Hik 108 Posted April 8, 2020 Share Posted April 8, 2020 UPDATE: Unfortunately I can't see the icon when the target is a player. As for the errors related to the GetNewAttributeType and GetNewAttributeValue commands, I did so: Open item.h, search: GetLimitValue and add below: BYTE GetNewAttributeType (int i) {return m_pProto? m_pProto-> aApplies [i] .bType: 0;} short GetNewAttributeValue (int i) {return m_pProto? m_pProto-> aApplies [i] .lValue: 0;} Solutions? Link to comment Share on other sites More sharing options...
asterix2 348 Posted May 4, 2020 Share Posted May 4, 2020 hmm, i probally put this code sometimes, and every time finish, didn't show icon at mob. Somebody have idea this problem? Link to comment Share on other sites More sharing options...
asterix2 348 Posted May 4, 2020 Share Posted May 4, 2020 Update.: I tested, and work. this bad: FIRE | ATT_FIRE this correct: ATT_FIRE in mob_proto Link to comment Share on other sites More sharing options...
zoes77 1 Posted May 5, 2020 Share Posted May 5, 2020 You have been received my reaction to this post to see the hidden content Link to comment Share on other sites More sharing options...
hero0909 0 Posted May 6, 2020 Share Posted May 6, 2020 Thanks Link to comment Share on other sites More sharing options...
rares2017 31 Posted October 3, 2021 Share Posted October 3, 2021 How can I make all the elements appear if I have more? Link to comment Share on other sites More sharing options...
Arke 5 Posted December 8, 2021 Share Posted December 8, 2021 (edited) On 2/10/2018 at 2:08 PM, Mali said: but working which serverfiles and sources u use ? Please ! Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Nuzzo 49 Posted March 19, 2023 Share Posted March 19, 2023 On 10/29/2017 at 1:52 PM, JeeX said: First of all nice system, it's looking nice! but i think i found a bug. For Example: if i spawn the monster 7009 - after 2 seconds the element icons is changing from the yellow to the red one (Fire) in my mob_proto: 7009 => ATT_EARTH So why it is changing the elements?.. I have a problem similar to this but it only happens to me when I activate alchemy Link to comment Share on other sites More sharing options...
Recommended Posts