AlexxD 123 Posted May 1, 2015 Share Posted May 1, 2015 Hi Dev's, for three days untill now I've worked to do some options in gamesource for CONFIG's files from server, to make my job for server easier! Now, first option: First new option in config is players max status over CONFIG: 1. In cmd_general.cpp, after extern int g_server_id; add: extern int gPlayerMaxStatus; extern int gPlayerMaxHT; extern int gPlayerMaxIQ; extern int gPlayerMaxST; extern int gPlayerMaxDX; 2. Also in cmd_general.cpp search ACMD(do_stat) and after idx = POINT_IQ; add: if (ch->GetRealPoint(idx) >= gPlayerMaxStatus) checking = true; switch (idx) { case POINT_HT: if ((ch->GetRealPoint(idx) < gPlayerMaxHT)) checking = false; else checking = true; case POINT_IQ: if (ch->GetRealPoint(idx) < gPlayerMaxIQ) checking = false; else checking = true; case POINT_ST: if (ch->GetRealPoint(idx) < gPlayerMaxST) checking = false; else checking = true; case POINT_DX: if (ch->GetRealPoint(idx) < gPlayerMaxDX) checking = false; else checking = true; } if(checking==true) return; 3. Well done, pro metiners. Now in cmd_gm.cpp after DropEvent_RefineBox_SetValue(const std::string& name, int value); add: extern int gPlayerMaxStatus; extern int gPlayerMaxHT; extern int gPlayerMaxIQ; extern int gPlayerMaxST; extern int gPlayerMaxDX; 4. Also in cmd_gm.cpp search ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Cannot set stat under initial stat.")); and you'll see something, a little bit down: if (nPoint > change it with: if (nPoint > gPlayerMaxStatus) { nChangeAmount -= nPoint - gPlayerMaxStatus; nPoint = gPlayerMaxStatus; } 5. Good. Now in config.cpp we'll need to insert our variables, to be read by rest of files! After int gPlayerMaxLevel add: int gPlayerMaxStatus = 90; int gPlayerMaxHT = 32767; int gPlayerMaxIQ = 32767; int gPlayerMaxST = 32767; int gPlayerMaxDX = 32767; 6. After, search TOKEN ("block_char_creation") and after it add: TOKEN("max_status") { str_to_number(gPlayerMaxStatus, value_string); gPlayerMaxStatus = MINMAX(1, gPlayerMaxStatus, 32767); if(gPlayerMaxHT==32767) gPlayerMaxHT = gPlayerMaxStatus; if(gPlayerMaxIQ==32767) gPlayerMaxIQ = gPlayerMaxStatus; if(gPlayerMaxST==32767) gPlayerMaxST = gPlayerMaxStatus; if(gPlayerMaxDX==32767) gPlayerMaxDX = gPlayerMaxStatus; fprintf(stderr, "PLAYER_MAX_STATUS: %dn", gPlayerMaxStatus); } TOKEN("max_ht") { str_to_number(gPlayerMaxHT, value_string); gPlayerMaxHT = MINMAX(1, gPlayerMaxHT, 32767); fprintf(stderr, "PLAYER_MAX_HT: %dn", gPlayerMaxHT); } TOKEN("max_iq") { str_to_number(gPlayerMaxIQ, value_string); gPlayerMaxIQ = MINMAX(1, gPlayerMaxIQ, 32767); fprintf(stderr, "PLAYER_MAX_IQ: %dn", gPlayerMaxIQ); } TOKEN("max_st") { str_to_number(gPlayerMaxST, value_string); gPlayerMaxST = MINMAX(1, gPlayerMaxST, 32767); fprintf(stderr, "PLAYER_MAX_ST: %dn", gPlayerMaxST); } TOKEN("max_dx") { str_to_number(gPlayerMaxDX, value_string); gPlayerMaxDX = MINMAX(1, gPlayerMaxDX, 32767); fprintf(stderr, "PLAYER_MAX_DX: %dn", gPlayerMaxDX); } 7. The last thing we need to do, is that we'll need to put extern's variables in config.h. Search extern int gPlayerMaxLevel; and add after it: extern int gPlayerMaxStatus; extern int gPLayerMaxHT; extern int gPLayerMaxIQ; extern int gPLayerMaxST; extern int gPLayerMaxDX; 8. Well done. Warning. Once you do that, you'll need to put in CONFIG's files from game99 and channels that: max_status: (from 0 to 32767) max_ht: (from 0 to 32767) max_iq: (from 0 to 32767) max_st: (from 0 to 32767) max_dx: (from 0 to 32767) 9. After that, if you do like me, you need to change POINT_VT, IQ, ST and DX from some files, to read it from CONFIG. In cmd_gm.cpp search case POINT_HT : // and change from case POINT_HT untill POINT_DX with: case POINT_HT : // 체력 if (nPoint + ch->GetPoint(POINT_HT) > gPlayerMaxHT) { nPoint = gPlayerMaxHT - ch->GetPoint(POINT_HT); } break; case POINT_IQ : // 지능 if (nPoint + ch->GetPoint(POINT_IQ) > gPlayerMaxIQ) { nPoint = gPlayerMaxIQ - ch->GetPoint(POINT_IQ); } break; case POINT_ST : // 근력 if (nPoint + ch->GetPoint(POINT_ST) > gPlayerMaxST) { nPoint = gPlayerMaxST - ch->GetPoint(POINT_ST); } break; case POINT_DX : // 민첩 if (nPoint + ch->GetPoint(POINT_DX) > gPlayerMaxDX) { nPoint = gPlayerMaxDX - ch->GetPoint(POINT_DX); } break; 10. There you go. Enjoy. You're done! 4 "Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch" Link to comment Share on other sites More sharing options...
ImBacK 8 Posted May 3, 2015 Share Posted May 3, 2015 Good job Link to comment Share on other sites More sharing options...
Futi 6 Posted May 3, 2015 Share Posted May 3, 2015 Nice From Vanilla Sourcecode Link to comment Share on other sites More sharing options...
alin2894 14 Posted May 3, 2015 Share Posted May 3, 2015 Nice From Vanilla Sourcecode YEEEEESSSSSSSSSSSSS Link to comment Share on other sites More sharing options...
Finch 16 Posted May 9, 2015 Share Posted May 9, 2015 thank you Link to comment Share on other sites More sharing options...
DeeJaYSooN 1 Posted May 23, 2015 Share Posted May 23, 2015 (edited) error https://metin2.download/picture/20bQDE64CNc8Ei4yOd2qb2nHPltm6m7Q/.png https://metin2.download/picture/gWBBtIqTwfy124my6SL1E9sr74r23khI/.png help me Edited August 30, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Alina 234 Posted May 23, 2015 Share Posted May 23, 2015 Nice From Vanilla Sourcecode whew then vanilla must've made a little bit of a mess Let's play a little scenario. Here's what you'd do to have a bug in your CONFIG: MAX_HT: 32767 MAX_STATUS: 100 In this case, when the gamefile reads your max-status, it'll do the following statement: if(gPlayerMaxHT==32767) gPlayerMaxHT = gPlayerMaxStatus; So what happened to our max_ht of 32767? Yep, it's now 100. Though I guess no one will use 32767 I think it still counts as a bug. Also I don't know why the variable isn't short int.. since.. well.. 32767 is the max length of short int. So it'd make more sense to chose short int Link to comment Share on other sites More sharing options...
AlexxD 123 Posted May 26, 2015 Author Share Posted May 26, 2015 Nice From Vanilla Sourcecode whew then vanilla must've made a little bit of a mess Let's play a little scenario. Here's what you'd do to have a bug in your CONFIG: MAX_HT: 32767 MAX_STATUS: 100 In this case, when the gamefile reads your max-status, it'll do the following statement: if(gPlayerMaxHT==32767) gPlayerMaxHT = gPlayerMaxStatus; So what happened to our max_ht of 32767? Yep, it's now 100. Though I guess no one will use 32767 I think it still counts as a bug. Also I don't know why the variable isn't short int.. since.. well.. 32767 is the max length of short int. So it'd make more sense to chose short int You're right but I don't know why're you talking at third person.. Whatever, there's some people who loves Pokemon Metin2 and if they want int then they can use max value of it, not short int but if they want this they'll gonna change that 32767 with the max value of int, from config.cpp and cmd_general.cpp if I'm don't wrong. :/ I don't tested it with different value, i put them to not 'bug' the server. In some servers I saw 90 VIT, 95 INT, 90 STR, 90 DEX. And it's from gamefiles, not with another adds. "Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch" Link to comment Share on other sites More sharing options...
Alina 234 Posted May 27, 2015 Share Posted May 27, 2015 I talked at third person to give an example from the perspective of a normal user and.. well, nevermind. then why not at first use short int? If they want to raise the value above 32767 (which in normal cases doesn't happen) they'd also just change the datatype. Generally using int takes more memory and isn't the way you'd write your programs. If you don't need more, then just don't waste your resources on that 2 Link to comment Share on other sites More sharing options...
Former Staff flygun 304 Posted May 27, 2015 Former Staff Share Posted May 27, 2015 why didn't you just make it like this PLAYER_MAX_STATUS // in the config no one will set the HT 100 and IQ 95 O.o <--- for example sorry for my bad english Link to comment Share on other sites More sharing options...
AlexxD 123 Posted June 5, 2015 Author Share Posted June 5, 2015 why didn't you just make it like this PLAYER_MAX_STATUS // in the config no one will set the HT 100 and IQ 95 O.o <--- for example sorry for my bad english Yes but for those who wants diferite values like HT 3000 and VT 2000, with MAX_STATUS = 4000.. I talked at third person to give an example from the perspective of a normal user and.. well, nevermind. then why not at first use short int? If they want to raise the value above 32767 (which in normal cases doesn't happen) they'd also just change the datatype. Generally using int takes more memory and isn't the way you'd write your programs. If you don't need more, then just don't waste your resources on that You can use short int when you use values begin from 0 to 32767. the value of int is big, what you saying is true, but for those who wants extremely values on them servers, can use int value. "Don't be a scammer. Don't be a hacker. Don't be a motherfucker. Karma is a bitch" Link to comment Share on other sites More sharing options...
Miyamoto Musashi 0 Posted January 5, 2017 Share Posted January 5, 2017 (edited) On 23/05/2015 at 6:30 PM, DeeJaYSooN said: error https://metin2.download/picture/20bQDE64CNc8Ei4yOd2qb2nHPltm6m7Q/.png https://metin2.download/picture/gWBBtIqTwfy124my6SL1E9sr74r23khI/.png help me The error says that you did not declare the "checking", to solve your problem you must add the "bool checking = false;" below ACMD(do_stat) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); Like this: ACMD(do_stat) { char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); bool checking = false; Edited September 3, 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