Active Member Mind Rapist 187 Posted July 23, 2016 Active Member Share Posted July 23, 2016 Hi devs, can someone explain me how the alignment system works on the database? For example I have a player with 1257 alignment on the database and in-game the alignment is 108. How can I convert the database alignment to the in-game alignment? For example I want to do this while I'm getting information from the player.player table: Spoiler if (player.alignment > 3999 && player.alignment < 8001) { alignmentlabel.Text = "Good"; } Can someone explain me this logic please? How 1257 = 108? Thanks in advance Link to comment Share on other sites More sharing options...
VegaS 1086 Posted July 23, 2016 Share Posted July 23, 2016 [File: /Src/server/game/src/char.cpp] //1.) Search: addPacket.sAlignment = m_iAlignment / 10; //2.) Replace with: addPacket.sAlignment = m_iAlignment; //1.) Search: pack.sAlignment = m_iAlignment / 10; //2.) Replace with: pack.sAlignment = m_iAlignment; [File: /Src/server/game/src/char_battle.cpp] //1.) Search: void CHARACTER::UpdateAlignment(int iAmount) { bool bShow = false; if (m_iAlignment == m_iRealAlignment) bShow = true; int i = m_iAlignment / 10; m_iRealAlignment = MINMAX(-200000, m_iRealAlignment + iAmount, 200000); if (bShow) { m_iAlignment = m_iRealAlignment; if (i != m_iAlignment / 10) UpdatePacket(); } } //2.) Replace with: void CHARACTER::UpdateAlignment(int iAmount) { bool bShow = false; if (m_iAlignment == m_iRealAlignment) bShow = true; int i = m_iAlignment; m_iRealAlignment = MINMAX(-20000, m_iRealAlignment + iAmount, 20000); if (bShow) { m_iAlignment = m_iRealAlignment; if (i != m_iAlignment) UpdatePacket(); } } Now you'll get the real values, for example if your align in the game is 17214 in the database will show 17214 work good, before to make that he show multiplied by *10 equals with 172 140 in database. Now this is a check what you want: if (GetRealAlignment() > 3999 && GetRealAlignment() < 8001) { ChatPacket(CHAT_TYPE_INFO, "<Debug> Alignment loaded: %u", GetRealAlignment()); } 1 Link to comment Share on other sites More sharing options...
Active Member Mind Rapist 187 Posted July 23, 2016 Author Active Member Share Posted July 23, 2016 Omg thank you so much @VegaS you are awesome Link to comment Share on other sites More sharing options...
VegaS 1086 Posted July 23, 2016 Share Posted July 23, 2016 (edited) Ohh and i forgot this: [File: /Src/server/game/src/questlua_pc.cpp] //1.) Search: int pc_get_real_alignment(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRealAlignment()/10); return 1; } int pc_get_alignment(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetAlignment()/10); return 1; } int pc_change_alignment(lua_State * L) { int alignment = (int)(lua_tonumber(L, 1)*10); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); ch->UpdateAlignment(alignment); return 0; } //2.) Replace with: int pc_get_real_alignment(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetRealAlignment()); return 1; } int pc_get_alignment(lua_State* L) { lua_pushnumber(L, CQuestManager::instance().GetCurrentCharacterPtr()->GetAlignment()); return 1; } int pc_change_alignment(lua_State * L) { int alignment = (int)(lua_tonumber(L, 1)); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); ch->UpdateAlignment(alignment); return 0; } Edited July 23, 2016 by VegaS questlua_pc.cpp 1 Link to comment Share on other sites More sharing options...
Active Member Mind Rapist 187 Posted July 23, 2016 Author Active Member Share Posted July 23, 2016 20 minutes ago, VegaS said: m_iRealAlignment = MINMAX(-200000, m_iRealAlignment + iAmount, 200000); Btw in this line did you mean -200.000, m_iRealAlignment + iAmount; 200.000 or -20.000, m_iRealAlignment + iAmount; 20.000 Link to comment Share on other sites More sharing options...
VegaS 1086 Posted July 23, 2016 Share Posted July 23, 2016 2 minutes ago, Mind Rapist said: Btw in this line did you mean -200.000, m_iRealAlignment + iAmount; 200.000 or -20.000, m_iRealAlignment + iAmount; 20.000 Oh ya ya , i forgot, sorry again. m_iRealAlignment = MINMAX(-200000, m_iRealAlignment + iAmount, 200000); Replace with: m_iRealAlignment = MINMAX(-20000, m_iRealAlignment + iAmount, 20000); Haste makes waste, haha. xD 1 Link to comment Share on other sites More sharing options...
Active Member Mind Rapist 187 Posted July 23, 2016 Author Active Member Share Posted July 23, 2016 Thanks again Link to comment Share on other sites More sharing options...
ds_aim 241 Posted July 23, 2016 Share Posted July 23, 2016 (edited) Align 890 it means 89 ingame . Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
VegaS 1086 Posted July 23, 2016 Share Posted July 23, 2016 (edited) 2 hours ago, ds_aim said: Align 890 it means 89 ingame . 2 hours ago, VegaS said: Now you'll get the real values, for example if your align in the game is 17214 in the database will show 17214 work good, before to make that he show multiplied by *10 equals with 172 140 in database. Already i say that noob, next time read carefully the information and code..so please stop to make spam xD Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now