williamleonard / obblm

Automatically exported from code.google.com/p/obblm
1 stars 0 forks source link

Banking rules #546

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Anyone have or know how to set a function where treasury over a set amount 
(100k default) would add to team value?

This was a rule Galak was unable to get implemented in lbr6 and our league 
wants to try it to cut down on monster hoarding dwarf/orc/chaos teams.

Original issue reported on code.google.com by Goo...@daht.org on 17 Aug 2011 at 5:40

GoogleCodeExporter commented 9 years ago
This is not possible, sorry. Will leave this open to think a bit about it.

Original comment by Nimda...@gmail.com on 17 Aug 2011 at 10:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
<?$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

Original comment by Goo...@daht.org on 18 Aug 2011 at 8:13

GoogleCodeExporter commented 9 years ago
Just make sure you implement it as optional and disabled by default.

Original comment by funnyfin...@hotmail.com on 20 Aug 2011 at 5:26

GoogleCodeExporter commented 9 years ago
 I'm just modding the files/code , not making a module.  I have zero php skills, mostly using algebra and php research (incl programmer friends) to do this.   My site is for one specific league, and we're not sure if we will implement this or not yet, so been slacking on making the pdf work.

If/when I figure both out, anyone that wants to make a mod for it using this as 
reference is welcome to.

Original comment by Goo...@daht.org on 21 Aug 2011 at 5:28

GoogleCodeExporter commented 9 years ago
Why have it as an issue then?

Original comment by funnyfin...@hotmail.com on 22 Aug 2011 at 2:05

GoogleCodeExporter commented 9 years ago
Will not implement this any time soon.

Original comment by Nimda...@gmail.com on 10 Oct 2011 at 7:24

GoogleCodeExporter commented 9 years ago
I got it all working now.  

Original comment by Goo...@daht.org on 11 Oct 2011 at 4:23

GoogleCodeExporter commented 9 years ago
We are using the bank rules and it does help.  I'd like to have it integrated 
into OBBLM so we don't have to do the calculation manually.

Original comment by dennis.b...@gmail.com on 12 Oct 2011 at 5:43

GoogleCodeExporter commented 9 years ago
To get it working, first add:

<?$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

Then, on line 500 of pdf_roster.php insert:

if ( $team->treasury - 150000 > 0 ){ 
$treasury = $team->treasury - 150000;
} else { 
$treasury = 0;
}
$value = ($team->tv + $treasury);
$pdf->print_box($currentx+=40, ($currenty), 65, $h, COLOR_ROSTER_NORMAL, 
DEFLINECOLOR, 0, 0, 8, 'Tahoma', true, 'R', $pdf->Mf($team->value + $treasury + 
$ind_cost));

This will have the team value in the main obbl and the pdf roster reflect 
treasury over 150k adding to team value (can adjust the 150k as needed in the 
scripting).

Original comment by Goo...@daht.org on 13 Oct 2011 at 1:01

GoogleCodeExporter commented 9 years ago
Here is a set of diffs against 0.91 to add the bank rules on a league by league 
basis.

There are 2 settings 'usebank' and 'bankvalue' which are used by the 
class_team_htmlout.php and pdf_roster.php

Original comment by dennis.b...@gmail.com on 13 Oct 2011 at 8:04

Attachments:

GoogleCodeExporter commented 9 years ago
Could you do this more seemless where the team value would just change?  If you 
did this other modules would be able to automatically use this without adding 
additional code.  I think if you could do this in a module, you could just go 
ahead and add this in.

Original comment by funnyfin...@hotmail.com on 13 Oct 2011 at 8:22

GoogleCodeExporter commented 9 years ago

Original comment by Nimda...@gmail.com on 13 Oct 2011 at 11:54

GoogleCodeExporter commented 9 years ago
Thanks for the Diffs Dennis, they made it easy to add to my league (and turn 
off until I surprise my players with it).

Original comment by lee.ry...@gmail.com on 30 Mar 2012 at 8:43

GoogleCodeExporter commented 9 years ago
Issue 588 has been merged into this issue.

Original comment by Nimda...@gmail.com on 3 Oct 2012 at 12:07

GoogleCodeExporter commented 9 years ago
I agree this should be added as an option, but don't know when I can do this or 
if it should be a core feature or module (in some weird way).

I cannot say if the fix above will behave properly for the end-user, because 
you merely change what is displayed to the user. The OBBLM system still has 
different values stored in the DB, so the above fix is at most a hack. I cannot 
say if problems will arise by using that patch.

Original comment by Nimda...@gmail.com on 3 Oct 2012 at 12:16

GoogleCodeExporter commented 9 years ago
So let me get this straight (never played with this rule)...

When a team suddenly has more than 100k in treasury, the amount more than 100k 
goes directly as a PERMANENT addition to the TV and is never subtracted again?

Original comment by Nimda...@gmail.com on 15 Oct 2012 at 9:11

GoogleCodeExporter commented 9 years ago
No, all cash in your treasury over the Bank Threshold (100k) counts towards TV. 
If your treasury drops below the threshold then nothing counts until it rises 
above again.

Original comment by lee.ry...@gmail.com on 15 Oct 2012 at 9:13

GoogleCodeExporter commented 9 years ago
so say your treasury amount is 140k, then
   treasury = 100k
   TV = TV + 40k

then I buy a player for 30 K What happens?
What If his price is 50 instead?

..just want to be sure on this.

Original comment by Nimda...@gmail.com on 15 Oct 2012 at 9:20

GoogleCodeExporter commented 9 years ago
TV = 1,000k
Treasury = 150k
Treasury contributing to TV = 50k
Effective TV = 1,050k

Buy a player for 30k (New calculation below)
TV = 1,030k
Treasury = 120k
Treasury contributing to TV = 20k
Effective TV = 1,050k

Or Buy a player for 50k (New calculation below)
TV = 1,050k
Treasury = 100k
Treasury contributing to TV = 0k
Effective TV = 1,050k

In our league we allow teams to dump cash (Buying and discarding Cheerleaders) 
and we have a bounties system that allows people to spend cash above the 
banking threshold.

Original comment by lee.ry...@gmail.com on 15 Oct 2012 at 9:24

GoogleCodeExporter commented 9 years ago
So basically the TV value is lifted WITHOUT removing that amount from the 
treasury?

Original comment by Nimda...@gmail.com on 15 Oct 2012 at 9:50

GoogleCodeExporter commented 9 years ago
Correct, you dont actually lose the cash, it just counts to TV once over the 
threshold.

Original comment by lee.ry...@gmail.com on 15 Oct 2012 at 9:51

GoogleCodeExporter commented 9 years ago
I've added this feature now in r941.
However, it's not ready yet for a per-league implementation, since that would 
require a major code re-write (unfortunately).

Could someone please test this? I did a small test and it seems to work, but I 
will not close this until I get a verification :-).

Original comment by Nimda...@gmail.com on 15 Oct 2012 at 11:42

GoogleCodeExporter commented 9 years ago
Tested and does NOT seems to be working for me.

Settings.php
$rules['bank_threshold'] = 300

ran "Re-install DB back-end procedures and functions"

http://www.level10.org/BloodBowlSVN/index.php?section=objhandler&type=1&obj=2&ob
j_id=16
Shows a team with Treasury: 315k so 15k of this should be carried into TV. 
However it is showing as TV: 1710k if it is adding 15k to TV then its TV should 
definitely finish in a 5.

Original comment by lee.ry...@gmail.com on 18 Oct 2012 at 7:06

GoogleCodeExporter commented 9 years ago
ah okay. Yes, you need the team stats to update first. That'll happen next time 
you play a match or buy a player etc..

Alternatively backup the database and run the syncAll() command from the "OBBLM 
core panel"

Original comment by Nimda...@gmail.com on 29 Oct 2012 at 11:29

GoogleCodeExporter commented 9 years ago
Looks to be working. I will be moving to the latest build for the new season in 
January if there is anything else you want me to test before then (No Cyanide 
stuff as we are TT).

Original comment by lee.ry...@gmail.com on 29 Oct 2012 at 2:21

GoogleCodeExporter commented 9 years ago
Great. It should, it was a very minor change in code.. should be as simple as 
this :-).

Actually, I am trying to implement some last features now, maybe you could (or 
some from your league) test them and a few other things from a list I'll make 
soon. After that I'll release it as version 0.95.

Original comment by Nimda...@gmail.com on 29 Oct 2012 at 2:51

GoogleCodeExporter commented 9 years ago

Original comment by Nimda...@gmail.com on 30 Oct 2012 at 10:28

GoogleCodeExporter commented 9 years ago
Just Reinstalled  version .91  how do I patch this in?  I originally  manually 
adjusted a few files would like to implement the toggle feature.

Original comment by Goo...@daht.org on 13 Dec 2012 at 8:54