Page 1 of 1

Galak's banking rule in obblm..

Posted: Thu Aug 18, 2011 1:16 am
by Daht
Working on this in my spare time, as we may want to add this to our perpetual league.

I can get it to work for the team info and statistics by modifying line 864 in class_team_htmlout.php to:


<td><?php echo ($team->tv+$team->treasury-200000)/1000 . 'k'; ?></td>

(using a 200k bank instead of 100, obviously this is easily varied)..

but have yet to crack how to make this adjustment for the pdf out.

Re: Galak's banking rule in obblm..

Posted: Thu Aug 18, 2011 6:29 am
by mepmuff
Don't know where that exact statement is echo'ed, but I think it should read:

<td><?php echo ($team->tv+min(0,$team->treasury-200000)/1000) . 'k'; ?></td>

Re: Galak's banking rule in obblm..

Posted: Thu Aug 18, 2011 7:34 am
by Daht
Yes it needs to be set to minimum zero for the bank, but that equation doesn't work it puts out the full team value (no bank adjustments) with a k after it (123000k instead of 123k)

Need to either figure out a syntax to use, or create a new variable for treasury minus 200k, minimum zero, to plug in and just add.



Also, for the pdf format printout feild... in pdf_roster.php it's on line 499 as:

$pdf->Mf($team->value + $ind_cost));


that is the formula at the end of the line after formatting code.

I can add +$team->treasury to add all the treasury, but trying to make an equation

$pdf->Mf($team->value + $ind_cost + ($team->treasury - 100000)));

gives the following error:

Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in /nfs/www/WWW_pages/daht/obbl/modules/pdf/pdf_roster.php on line 499

The new part of the equation also needs to be minimum 0, so we would need to set a new variable for $team->bank set at treasury - 100k (or whatever value) with a minimum of zero for this as well.

I have yet to find where to try and put that in to test, for either case.

Re: Galak's banking rule in obblm..

Posted: Thu Aug 18, 2011 8:13 pm
by Daht
<?$treasury = ($team->treasury - 200000 > 0) ? ($team->treasury - 200000) : 0;$value = ($team->tv + $treasury) / 1000 . 'k';?><td><?= $value ?></td>


on line 864 in class_team_htmlout.php works, can adjust the 200000 to whatever value wanted.

still workin on the pdf output

Re: Galak's banking rule in obblm..

Posted: Fri Sep 23, 2011 7:18 pm
by Daht
picked this back up and I'm a bit stumped due to not actually knowing php..

to get this to work on the team pdf roster I need this:

$pdf->Mf(($team->value+$ind_cost+ $team->treasury-150000)));

to have a provision that treasury-150000 has a minimum of zero.

$team->min(0,$team->treasury-150000) doesn't work still gives negatives to the team value

Re: Galak's banking rule in obblm..

Posted: Fri Sep 23, 2011 7:52 pm
by Daht
ok figured it out.. above line 499 add the following:

if ( $team->treasury - 150000 > 0 ){
$treasury = $team->treasury - 150000;
} else {
$treasury = 0;
}
$value = ($team->tv + $treasury);

then modify the end of 499 to :

$pdf->Mf($team->value + $treasury + $ind_cost));

and bank rules work in the pdf print rosters

Re: Galak's banking rule in obblm..

Posted: Fri Sep 23, 2011 8:53 pm
by nicholasmr
What exactly is this banking rule? Maybe I can help you sort this most effectively :-).

Nicholas

Re: Galak's banking rule in obblm..

Posted: Fri Sep 23, 2011 9:29 pm
by Daht
Bank rule was originally intended (and fully tested) for lbr6 but pulled and replaced with the petty cash rules by Jervis at the last minute.

Basically, if your team treasury is over 100k (150k being more popular due to player/reroll costs) it counts toward team value.

I've got it working now to reflect that (at 150k) in both the team value in stats/team page, and the pdf printout.

Re: Galak's banking rule in obblm..

Posted: Sat Jan 04, 2014 12:48 am
by ChenZhen
I'd be interesting in using this for our league (as we use the banking rule), but I'm new to OBBLM and wanted to make sure I didn't mess it up while I tried to make the change!

Could anyone clarify all the changes that were made?

Thanks much!

Re: Galak's banking rule in obblm..

Posted: Sun Jan 12, 2014 11:04 am
by nicholasmr
Yes this was added. You need at least version 0.91 as far as I remember.

Re: Galak's banking rule in obblm..

Posted: Sun Jan 12, 2014 7:21 pm
by ChenZhen
Excellent. Thanks! :D