20 Feb, 2013, thebigirish wrote in the 1st comment:
Votes: 0
Okay so this chunk of code controls Mana/Ki/Energy gains, Stat train gains, and Practice session gains. I think I just need some clarification for what some line do exactly, then I should be comfortable to change it?
if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL )
//if the target is a player, and its level is less than immortal level
{
kigain = number_range( 30, 40);
//does this line, set kigain to variable value 30 - 40?
kigain *= get_curr_con(ch) / 5;
//multiplies kigain by the value of characters current con / 5?
kicheck = (ch->skigain * ch->skigain) * 1000;
//clarify this line please? and what number would we be dealing with at this point?

if (kicheck <= ch->exp)
//if kicheck is less or equal to characters exp(powerlevel) then,
{
ch->max_mana += kigain;
//clarify please?i think it sets ch max mana to max mana + kigain value?
ch_printf(ch, "You feel stronger all of the sudden. You gain %d energy!\n\r", kigain);
//just a print….
ch->skigain += 1;
//clarify again please?
}
pracgain = 1;
//pracgain value set to 1
praccheck = (ch->spracgain * ch->spracgain) * 250000;
//praccheck is equal to spracgain * spracgain, * 250k
if (praccheck <= ch->exp)
//if praccheck value is less than characters xp then,
{
ch->practice += pracgain;
//characters practices + pracgain value I think???
ch_printf(ch, "You have gained %d practice session(s)\n\r", pracgain);
ch->spracgain += 1;
//clarify…?
}
statgain = 1;
statcheck = (ch->statgain * ch->statgain) * 10000;
if (statcheck <= ch->exp)
{
ch->stat += statgain;
ch_printf(ch, "You have gained %d attribute training session(s)\n\r", statgain);
ch->statgain += 1;
}
}



I'm not going to comment on stat as its the same as prac but, I understand how it all works, I just…. dont really understand how some of the * ### affect it i think? Help please?

Also, I'm not really a coder, or interested in coding lol. I'm just trying to make some bare minamum changes, while me and my team are finding a coder who wants to take this project on.
20 Feb, 2013, Ripley wrote in the 2nd comment:
Votes: 0
Hi Irish,

I have commented the code in the block below - Replacing yours. This is, IMO, a good way to ask a question. Specific and it looks like you have done your homework and tried a bit. I do suggest you pick up a C or C++ book however, you might find it's more fun than you think.

The xkigain and similar stuff - You need to look in the code for that. if on linux, do:

grep skigain *.c

or

grep skigain *.h

and take a look.

Quote
if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL )
// If the target is not an NPC (i.e. is a player) and is a mortal.
{
kigain = number_range( 30, 40);
// set kigain to a number between 30 and 40, don't change anything in the char yet.
kigain *= get_curr_con(ch) / 5;
// Yes, the kigain variable is now multiplied by the character's con/5.
kicheck = (ch->skigain * ch->skigain) * 1000;
// I am not familiar with skigain…But it looks like it is setting some threshold value here for the next line.
// It seems that if your skigain is high enough, then you need to reduce it somehow but that is not in this code.

if (kicheck <= ch->exp)
// if kicheck is less or equal to characters exp(powerlevel) then,
{
ch->max_mana += kigain;
// Increase the char's max mana value by kigain.

ch_printf(ch, "You feel stronger all of the sudden. You gain %d energy!\n\r", kigain);
//just a print….
ch->skigain += 1;
// Increasing skigain, again there should be another place in the code that manages it.
}
pracgain = 1;
//pracgain value set to 1
praccheck = (ch->spracgain * ch->spracgain) * 250000;
//praccheck is equal to spracgain * spracgain, * 250k
if (praccheck <= ch->exp)
//if praccheck value is less than characters xp then,
{
ch->practice += pracgain;
//characters practices + pracgain value I think???
ch_printf(ch, "You have gained %d practice session(s)\n\r", pracgain);
ch->spracgain += 1;
//This is similar to the skigan stuff above - Check the code.
}
statgain = 1;
statcheck = (ch->statgain * ch->statgain) * 10000;
if (statcheck <= ch->exp)
{
ch->stat += statgain;
ch_printf(ch, "You have gained %d attribute training session(s)\n\r", statgain);
ch->statgain += 1;
}
}
20 Feb, 2013, thebigirish wrote in the 3rd comment:
Votes: 0
I've actually been doing alot of online reading for c++. Some of it is just still a bit confusing :S lol. How do I use grep for windows, please?
20 Feb, 2013, thebigirish wrote in the 4th comment:
Votes: 0
I was checking alot of files manually by opening them and doing ctrl+f and searching for skigain, and similar, but I didnt find anything. Grepping would be alot more manageable once I figure out how it works. Cant seem to understand it just from what putty returns about it.
20 Feb, 2013, plamzi wrote in the 5th comment:
Votes: 0
thebigirish said:
I was checking alot of files manually by opening them and doing ctrl+f and searching for skigain, and similar, but I didnt find anything. Grepping would be alot more manageable once I figure out how it works. Cant seem to understand it just from what putty returns about it.


There are many ways to do it, but I've memorized this one:

find . | xargs grep "what I'm looking for"


It does a recursive grep in all subdirectories under where you are ATM.
20 Feb, 2013, thebigirish wrote in the 6th comment:
Votes: 0
<3 you. LOL.


(after-note: dont type find . | xargs grep "[accidental return upon trying to hit shift+"])
20 Feb, 2013, thebigirish wrote in the 7th comment:
Votes: 0
So statgains is what I wanted to change first, so thats what I grepped for. I dont see where/how its controlled elsewhere :S someone please help? heh.

[storms11@portent src]$ find . | xargs grep "statgain"
./save.c: fprintf( fp, "StatGain %d\n", ch->statgain );
./save.c: KEY( "StatGain", ch->statgain, fread_number( fp ) );
./dbzskills.c: ch_printf( ch, "&YYour current Stat Gain is&O: &R%d\n\r&z____________________________________________", ch->statgain);
./comm.c: ch->statgain = 1;
./mud.h: sh_int statgain;
Binary file ./smaug.exe matches
./update.c: int kicheck, kigain, pracgain, praccheck, statgain, statcheck;
./update.c: statgain = 1;
./update.c: statcheck = (ch->statgain * ch->statgain) * 10000;
./update.c: ch->stat += statgain;
./update.c: ch_printf(ch, "You have gained %d attribute training session(s)\n\r", statgain);
./update.c: ch->statgain += 1;
Binary file ./smaug matches
./o/update.c: int kicheck, kigain, pracgain, praccheck, statgain, statcheck;
./o/update.c: statgain = 1;
./o/update.c: statcheck = (ch->statgain * ch->statgain) * 12300;
./o/update.c: ch->stat += statgain;
./o/update.c: ch_printf(ch, "You have gained %d attribute training session(s)\n\r", statgain);
./o/update.c: ch->statgain += 1;
[storms11@portent src]$
21 Feb, 2013, Davion wrote in the 8th comment:
Votes: 0
thebigirish said:
<3 you. LOL.


(after-note: dont type find . | xargs grep "[accidental return upon trying to hit shift+"])


I assume doing this appears to "hang" your shell? If that's the case you just hit "ctrl+c" to break out of it.
21 Feb, 2013, quixadhal wrote in the 9th comment:
Votes: 0
Also, you can probably save yourself some useless output by restricting the files it searches through.

Untested, but find . -type f -name \*.[ch] | grep -nf - "pattern to look for"

No point looking through binary or object files, and you shouldn't need xargs… grep -f takes the list of files from stdin, which is -
21 Feb, 2013, Vigud wrote in the 10th comment:
Votes: 0
GNU grep has the -I (eye) option for ignoring binary files.
0.0/10