Active Member Draveniou1 715 Posted January 1, 2023 Active Member Share Posted January 1, 2023 (edited) https://en-wiki.metin2.gameforge.com/index.php/Blood_Pill -Items Blood Pill- Fixed the Blood Pill item Use by right clicking the item When a Blood Pill is used you will notice a minus sign (-) to the left side of your character's screen . Clicking that takes one point from the stat you choose and you can add it to another stat later . #1 Bug If you have x94 stat and hit 4 pills and spend 4 stat at the end when you add another stat then the stat doubles from 90 to 160 #2 Bug In some serverfiles it stat can be as high as -90 -80 -70 -30 -10 1) OPEN: cmd_general.cpp 2) Search: ACMD(do_stat_minus) 3) Change with: ACMD(do_stat_minus) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) return; if (ch->IsPolymorphed()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑 중에는 능력을 올릴 수 없습니다.")); return; } if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0) return; if (!strcmp(arg1, "st")) { if (ch->GetRealPoint(POINT_ST) <= JobInitialPoints[ch->GetJob()].st) return; BYTE stpoints = 0; stpoints = POINT_ST; ch->SetRealPoint(stpoints, ch->GetRealPoint(stpoints) - 1); ch->SetPoint(stpoints, ch->GetPoint(stpoints) - 1); ch->ComputePoints(); ch->PointChange(stpoints, 0); } else if (!strcmp(arg1, "dx")) { if (ch->GetRealPoint(POINT_DX) <= JobInitialPoints[ch->GetJob()].dx) return; BYTE dxpoints = 0; dxpoints = POINT_DX; ch->SetRealPoint(dxpoints, ch->GetRealPoint(dxpoints) - 1); ch->SetPoint(dxpoints, ch->GetPoint(dxpoints) - 1); ch->ComputePoints(); ch->PointChange(dxpoints, 0); } else if (!strcmp(arg1, "ht")) { if (ch->GetRealPoint(POINT_HT) <= JobInitialPoints[ch->GetJob()].ht) return; BYTE htpoints = 0; htpoints = POINT_HT; ch->SetRealPoint(htpoints, ch->GetRealPoint(htpoints) - 1); ch->SetPoint(htpoints, ch->GetPoint(htpoints) - 1); ch->ComputePoints(); ch->PointChange(htpoints, 0); ch->PointChange(POINT_MAX_SP, 0); } else if (!strcmp(arg1, "iq")) { if (ch->GetRealPoint(POINT_IQ) <= JobInitialPoints[ch->GetJob()].iq) return; BYTE iqpoints = 0; iqpoints = POINT_IQ; ch->SetRealPoint(iqpoints, ch->GetRealPoint(iqpoints) - 1); ch->SetPoint(iqpoints, ch->GetPoint(iqpoints) - 1); ch->ComputePoints(); ch->PointChange(iqpoints, 0); ch->PointChange(POINT_MAX_HP, 0); } else return; ch->PointChange(POINT_STAT, + 1); ch->PointChange(POINT_STAT_RESET_COUNT, - 1); ch->ComputePoints(); } Edited January 1, 2023 by Draveniou1 4 1 2 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 715 Posted January 2, 2023 Author Active Member Share Posted January 2, 2023 I tried it today on my server with 500/1k players online it works great guys No problem found my friends If you notice any problem tell me, although I think it 100% solves the problem of the items 1 Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7174 Posted January 2, 2023 Honorable Member Share Posted January 2, 2023 From the default code, only POINT_MAX_SP and POINT_MAX_SP are swapped. The rest is the same. Am I missing something? Small refactory: (using a table I can shorten far more) ACMD(do_stat_minus) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) return; if (ch->IsPolymorphed()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µÐ°© Áß¿¡´Â ´É·ÂÀ» ¿Ã¸± ¼ö ¾ø½À´Ï´Ù.")); return; } if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0) return; auto pointId = POINT_NONE; if (!strcmp(arg1, "st")) { pointId = POINT_ST; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].st) return; } else if (!strcmp(arg1, "dx")) { pointId = POINT_DX; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].dx) return; } else if (!strcmp(arg1, "ht")) { pointId = POINT_HT; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].ht) return; } else if (!strcmp(arg1, "iq")) { pointId = POINT_IQ; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].iq) return; } else return; if (pointId == POINT_NONE) return; ch->SetRealPoint(pointId, ch->GetRealPoint(pointId) - 1); ch->SetPoint(pointId, ch->GetPoint(pointId) - 1); ch->ComputePoints(); ch->PointChange(pointId, 0); if (pointId == POINT_IQ) // HT? ch->PointChange(POINT_MAX_HP, 0); else if (pointId == POINT_HT) // IQ? ch->PointChange(POINT_MAX_SP, 0); ch->PointChange(POINT_STAT, +1); ch->PointChange(POINT_STAT_RESET_COUNT, -1); ch->ComputePoints(); } 3 1 Check out my GitHub Link to comment Share on other sites More sharing options...
Active Member Draveniou1 715 Posted January 2, 2023 Author Active Member Share Posted January 2, 2023 21 minutes ago, martysama0134 said: From the default code, only POINT_MAX_SP and POINT_MAX_SP are swapped. The rest is the same. Am I missing something? Small refactory: (using a table I can shorten far more) ACMD(do_stat_minus) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) return; if (ch->IsPolymorphed()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µÐ°© Áß¿¡´Â ´É·ÂÀ» ¿Ã¸± ¼ö ¾ø½À´Ï´Ù.")); return; } if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0) return; auto pointId = POINT_NONE; if (!strcmp(arg1, "st")) { pointId = POINT_ST; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].st) return; } else if (!strcmp(arg1, "dx")) { pointId = POINT_DX; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].dx) return; } else if (!strcmp(arg1, "ht")) { pointId = POINT_HT; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].ht) return; } else if (!strcmp(arg1, "iq")) { pointId = POINT_IQ; if (ch->GetRealPoint(pointId) <= JobInitialPoints[ch->GetJob()].iq) return; } else return; if (pointId == POINT_NONE) return; ch->SetRealPoint(pointId, ch->GetRealPoint(pointId) - 1); ch->SetPoint(pointId, ch->GetPoint(pointId) - 1); ch->ComputePoints(); ch->PointChange(pointId, 0); if (pointId == POINT_IQ) // HT? ch->PointChange(POINT_MAX_HP, 0); else if (pointId == POINT_HT) // IQ? ch->PointChange(POINT_MAX_SP, 0); ch->PointChange(POINT_STAT, +1); ch->PointChange(POINT_STAT_RESET_COUNT, -1); ch->ComputePoints(); } Let's try this too I think you need "BYTE" because it returns NULL if I'm not mistaken I'm not 100% sure but I think we need BYTE in this case 1 Link to comment Share on other sites More sharing options...
Active Member Draveniou1 715 Posted January 5, 2023 Author Active Member Share Posted January 5, 2023 (edited) I changed the code The Code is 100% fixed and works perfectly Idea by @ martysama0134 thanks you friends, It helped me to make the code even better than before ACMD(do_stat_minus) { char arg1[256], arg2[256]; two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2)); int vlaxc = 1; str_to_number(vlaxc, arg2); if (!*arg1 || vlaxc <= 0) return; if (ch->IsPolymorphed()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑 중에는 능력을 올릴 수 없습니다.")); return; } if (ch->GetPoint(POINT_STAT_RESET_COUNT) <= 0) return; BYTE idx = 0; if (!strcmp(arg1, "st")) { if (ch->GetRealPoint(POINT_ST) <= JobInitialPoints[ch->GetJob()].st) { return; } idx = POINT_ST; } else if (!strcmp(arg1, "dx")) { if (ch->GetRealPoint(POINT_DX) <= JobInitialPoints[ch->GetJob()].dx) { return; } idx = POINT_DX; } else if (!strcmp(arg1, "ht")) { if (ch->GetRealPoint(POINT_HT) <= JobInitialPoints[ch->GetJob()].ht) { return; } idx = POINT_HT; } else if (!strcmp(arg1, "iq")) { if (ch->GetRealPoint(POINT_IQ) <= JobInitialPoints[ch->GetJob()].iq) { return; } idx = POINT_IQ; } else return; if (idx == 0) return; if (vlaxc > ch->GetPoint(POINT_STAT_RESET_COUNT)) vlaxc = ch->GetPoint(POINT_STAT_RESET_COUNT); if (ch->GetRealPoint(idx) - vlaxc > MAX_STAT) vlaxc = MAX_STAT + ch->GetRealPoint(idx); ch->SetRealPoint(idx, ch->GetRealPoint(idx) - vlaxc); ch->SetPoint(idx, ch->GetPoint(idx) - vlaxc); ch->ComputePoints(); ch->PointChange(idx, 0); if (idx == POINT_IQ) ch->PointChange(POINT_MAX_HP, 0); else if (idx == POINT_HT) ch->PointChange(POINT_MAX_SP, 0); ch->PointChange(POINT_STAT, + vlaxc); ch->PointChange(POINT_STAT_RESET_COUNT, - vlaxc); ch->ComputePoints(); } Edited January 5, 2023 by Draveniou1 1 Link to comment Share on other sites More sharing options...
Recommended Posts