Jump to content

Recommended Posts

Hi, I wanted to use more race flag than 1 but works only the first.

2492	???	BOSS	MONSTER	MELEE	75		AGGR	0	DEVIL, BOSS	STUN,SLOW,CURSE,TERROR	0	ch_general	0	89	69	60	30	47	73	500000	30	20	29700	44550	1	90	140	130	100	2000	100	0	0	0	0	0	0	0	0	10	10	10	20	20	0	0	0	50	0	0	2	0	0	0	0	10	259	40	260	0	0	0	0	0	0	0	0	0	0	0

 

Link to comment
https://metin2.dev/topic/21316-more-than-1-raceflag/
Share on other sites

19 minut temu, boaspessoal napisał:

Check your protoreader.cpp syntax, perhaps it only allows separating flags by a '|'(in int get_Mob_RaceFlag_Value search for: string* arInputString)

int get_Mob_RaceFlag_Value(string inputString)
{
	string arRaceFlag[] = {"ANIMAL","UNDEAD","DEVIL","HUMAN","ORC","MILGYO","INSECT","FIRE","ICE","DESERT","TREE",
		"ATT_ELEC","ATT_FIRE","ATT_ICE","ATT_WIND","ATT_EARTH","ATT_DARK", "METIN", "BOSS", "DUNG"};

	int retValue = 0;
	string* arInputString = StringSplit(inputString, ",");				//프로토 정보 내용을 단어별로 쪼갠 배열.
	for(int i =0;i<sizeof(arRaceFlag)/sizeof(arRaceFlag[0]);i++) {
		string tempString = arRaceFlag[i];
		for (int j=0; j<30 ; j++)		//최대 30개 단어까지. (하드코딩)
		{
			string tempString2 = arInputString[j];
			if (tempString2.compare(tempString)==0) {				//일치하는지 확인.
				retValue = retValue + pow((float)2,(float)i);
			}
			
			if(tempString2.compare("") == 0)
				break;
		}
	}
	delete []arInputString;
	//cout << "Race Flag : " << raceFlagStr << " -> " << retValue << endl;

	return retValue;
}

idk, doesn't work with ","

Link to comment
https://metin2.dev/topic/21316-more-than-1-raceflag/#findComment-115644
Share on other sites

  • 5 years later...

Use this :


 

#include <vector>
#include <cmath>

int get_Mob_RaceFlag_Value(std::string inputString)
{
#ifdef ENABLE_NUMERIC_FIELD
    if (_IsNumericString(inputString))
        return std::stoi(inputString);
#endif

    std::vector<std::string> arRaceFlag = {"ANIMAL","UNDEAD","DEVIL","HUMAN","ORC","MILGYO","INSECT","FIRE","ICE","DESERT","TREE", "ATT_ELEC","ATT_FIRE","ATT_ICE","ATT_WIND","ATT_EARTH","ATT_DARK", "METIN", "BOSS", "DUNG"};

    int retValue = 0;
    std::vector<std::string> arInputString = StringSplit(inputString, ",");

    for (size_t i = 0; i < arRaceFlag.size(); i++) {
        std::string tempString = arRaceFlag[i];

        for (const auto& tempString2 : arInputString) {
            if (tempString2 == tempString) {
                retValue += (1 << i);
            }
        }
    }

    return retValue;
}

Link to comment
https://metin2.dev/topic/21316-more-than-1-raceflag/#findComment-169844
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.