Jump to content

Read Custom.conf + New Mod: Hardcore mode


Ninja

Recommended Posts


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

8/21: Sup all! hope you like my releases :)

Note: No 3ceam patches for now. Please convert them by manually looking at the whole patch file.

changelog:

8/15 original script [no patch file]

8/16

revised the whole thing.

+added common/custom.c ~ to separate custom code from the whole rAthena code

+added common/custom.h ~ made a header file so all codes from custom.c can be ported to other *.c's when modding

+this release comes with a Guild Mod: Max/Min Member modification but you can still use it as a framework

+added patch file for Guild Mod

+fixed a file read closing after 1 iteration of reading custom.conf

+EDP+SL mod enable/disable option

+added patch file for EDP+SL mod

8/17

added the read custom conf framework

added the SL + EDP Mod

added the Guild Mod

8/21

added the Hardcore Mode mod

credits to Lighta for methods of improvements :)

My MODS:

[0] Read Custom Conf Framework

Description: This is a prerequisite to all of my mods. allows reading of conf/custom.conf upon runtime.

download: custom framework.zip

Instructions:

1. copy "custom.conf" to /conf folder

2. copy "custom.h" and "custom.c" to /src/common folder

3. apply patch: custom framework.patch

[1]EDP+SL MOD

Description: A Mod for enabling/disabling EDP+SL via conf/custom.conf

download: sl + edp.patch

download: additional.patch

Instructions:

1. install [0] Read Custom Conf Framework

2. apply patch: sl + edp.patch

3. apply patch: additional.patch

4. adjust settings in conf/custom.conf

screenshots:

post-7005-0-97967000-1345112091_thumb.pngpost-7005-0-30486200-1345112097_thumb.jpg

[2]GUILD MOD:

Description: A Mod for adjusting Min/Max/GuildExtension Guild options via conf/custom.conf

download: guild mod.patch

Instructions:

1. install [0] Read Custom Conf Framework

2. apply patch: guild mod.patch

3. adjust settings in conf/custom.conf

screenshots:

post-7005-0-16037200-1345016498_thumb.jpgpost-7005-0-22377200-1345016523_thumb.jpg

post-7005-0-41203100-1345016548_thumb.jpgpost-7005-0-28671200-1345016552_thumb.jpg

post-7005-0-51800300-1345016556_thumb.jpg

[3]HARDCORE MODE:

Description: A Mod similar to the Diablo's HARDCORE Mode mechanics. In this Mod, you will be teleported to a certain

pvp map if you die, you'll get [HC] tag in your name if you choose to be a hardcore char, @hardcoreon/@hardcoreoff commands,

and script functions f_hardcoreon/f_hardcoreoff. Settings are inside custom.conf.

Side Note: I'd really appreciate if someone can redo the scripting of the NPC's >_< I admit that I really suck at it.

by the way, I used scripting for the new atcommand so you really need it.

download: hardcore_mode.patch

download: hardcore_mode.txt

Instructions:

1. install [0] Read Custom Conf Framework

2. copy hardcore_mode.txt to npc/custom

3. add this line to scripts_custom.conf

npc: npc/custom/hardcore_mode.txt

4. apply patch: hardcode_mode.patch

5. modify your sql database by running these commands:

alter table `char` add hardcore int not NULL default 0 after robe
alter table `char` add old_name varchar(30) not NULL default 'none' after hardcore;

screenshots:

post-7005-0-00560300-1345555835_thumb.jpg

post-7005-0-79046100-1345555679_thumb.jpgpost-7005-0-35885100-1345555683_thumb.jpg

post-7005-0-09300200-1345555687_thumb.jpgpost-7005-0-57053100-1345555696_thumb.jpg

post-7005-0-64708400-1345555707_thumb.jpgpost-7005-0-36276500-1345555719_thumb.jpg

post-7005-0-73383900-1345555728_thumb.jpgpost-7005-0-41143700-1345555735_thumb.jpg

Edited by jezznar
  • Upvote 4
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Quite hard to follow you jezznar, a diff would really help.

If you're on windows and using tortoise svn : right click on folder and chose create patch; it will create a unified diff with you change.

If you're on linux : "svn diff > mypatch.diff" it will create again an unified diff name mypatch.diff

Beside that :

MAX_GUILD is usually defined to 76, more specifically to 16+6*10, using something superior is more likely to create out of bound array and crash. (Much more delicate imo) and there some check in guild.c that you didn't take care of :

if(g->max_member > MAX_GUILD)
{
	ShowError("guild_recv_info: Received guild with %d members, but MAX_GUILD is only %d. Extra guild-members have been lost!\n", g->max_member, MAX_GUILD);
	g->max_member = MAX_GUILD;
}

So in short in think you need to review your release.

Still a nice mod tought thx =)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Hi Lighta,

thanks! I think I missed that part regarding guild.c when I searched the whole code about which stuff uses MAX_GUILD. thanks man. I'll add that the whole Guild Mod is really just an example and just a reply to another thread.. I just tried to create a general one so other's may use it if ever. :) and oh, i didnt know that SVNTORTOISE is able to create diff's automatically~ I'll do that tomorrow because I left my Laptop at the office. Well, Guess I'm gonna have to put another Warning message in the custom.conf file then.

Thanks! i'm currently studying how to mod rathena. and its pretty hard granting that I suck at coding >_> but comments like yours really help :D

//edit:

next time i'll make sure its refined ^_^

Edited by jezznar
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

No probleme happy it help you =)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  231
  • Reputation:   9
  • Joined:  12/16/11
  • Last Seen:  

There is a error in compiling it said that common/custom_conf.h not fount. Please help.

Thank you very much. How about in 3ceam?

Edited by Cuspid
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

all patches redone.

tested to work on 16625 several times before reposted.

please follow the instructions in a strictly manner.

no 3Ceam patches made(just see the patch themselves and try to convert it to 3Ceam)

released:

Custom.conf Framework

Guild Mod (adjust min/max/guildextension skill)

Disable/Enable SL + EDP

hope you guys enjoy it. if there'd be problems, please post them. thanks.

I'd appreciate good and bad comments.

Edited by jezznar
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

Hi~ jezznar,

I was wondering if it's possible to make mmo.h to read Custom.Conf

,coz I want the PACKETVER in mmo.h to read Custom.Conf setting.

Is it possible to implement?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  63
  • Reputation:   0
  • Joined:  08/05/12
  • Last Seen:  

how can I apply .patch-Files?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

hi Marin, I dont really think it'll be possible since(correct me if I'm wrong) PACKETVER's are only used during compile time and not during runtime.. if you happen to try and take off preprocessors, you're gonna have to do a major change in the whole code. :)

hi kazuya,

download tortoiseSVN. install it. make sure your "trunk" folder is an SVN folder. then right-click on your "trunk" folder and choose tortoiseSVN->apply patch.

Edited by jezznar
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Bump!

New Hardcore Mode Mod up!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  2244
  • Reputation:   182
  • Joined:  11/19/11
  • Last Seen:  

awesome rep

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

thanks Judas! :)

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

custom.c: In function âcustom_config_readâ:
custom.c:37: warning: too few arguments for format

Please help me!

 

// Framework for Custom.conf [Jezznar]
// separate custom codes by putting them here.
#include <stdio.h>
#include <stdlib.h>
#include "showmsg.h"
#include "strlib.h"
#include "custom.h"
#include "showmsg.h"

//put variables being used globally here
int d_max_gmembers=76;
int d_min_gmembers=16;
int d_gdext_adjustment=6;


// put custom codes here
int custom_config_read(const char *cfgName)
{
FILE *fp;
int line_num = 0;
//add more w's if you need more
char line[1024], w1[64], w2[64];

if((fp = fopen(cfgName, "r")) == NULL) {
ShowWarning("Custom configuration file is not found: %s\n", cfgName);
return 1;
}

ShowInfo("Reading the configuration file %s...\n", cfgName);

while(fgets(line, sizeof(line), fp))
{
line_num++;
if ((line[0] == '/' && line[1] == '/') || line[0] == '\n' || line[1] == '\n')
continue;

if(sscanf(line,"%[^:]: %[^:]:%[^:]:%[^\r\n]", w1, w2) != 2) {
/* if you need more paramaters, just add more w's and change "!=2"
to "<=2" to how many w's are present[Jezznar]
*/
ShowWarning("Error syntax of configuration file %s in line %d.\n", cfgName, line_num);
continue;
}

remove_control_chars(w1);
remove_control_chars(w2);
//if there are more parameters just add more

/* put all config fetches here [Jezznar]
if( strcmpi(w1, "<parameter_name_from_custom.conf>") == 0 )
{
d_<parameter_name_from_custom.conf> = atoi(w2);
} else if (condition) {arguments;}
*/
if(strcmpi(w1,"max_gmembers") == 0) {
d_max_gmembers = atoi(w2);
} else if (strcmpi(w1,"min_gmembers") == 0) {
d_min_gmembers = atoi(w2);
} else if (strcmpi(w1,"gd_extadjustment") == 0) {
d_gdext_adjustment = atoi(w2);
}

}

ShowInfo("Done reading %s.\n", cfgName);

fclose(fp);
return 0;
}
Edited by RAWRs
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

I need help,someone?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

not sure but I think it should be :

- if(sscanf(line,"%[^:]: %[^:]:%[^:]:%[^\r\n]", w1, w2) != 2) {
+ if(sscanf(line,"%[^:] :%[^\r\n]", w1, w2) != 2) {

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   8
  • Joined:  01/09/12
  • Last Seen:  

Good job, I personally like that hard core system

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

not sure but I think it should be :

- if(sscanf(line,"%[^:]: %[^:]:%[^:]:%[^\r\n]", w1, w2) != 2) {

+ if(sscanf(line,"%[^:] :%[^\r\n]", w1, w2) != 2) {

 Perfect,my problem solved. Thank You very much! /kis

Link to comment
Share on other sites

  • 6 months later...

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

been a bit of a long time since i've coded. guess i'll be coming back :) and sorry for the ones that I wasnt able to help with.

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   2
  • Joined:  06/09/12
  • Last Seen:  

I have this error: undefined reference to `custom_config read

 

error in this line:

        // read custom.conf framework [Jezznar]
	custom_config_read(CUSTOM_CONF_NAME);
Edited by Terrorsoul
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...