DragonPrime - LoGD Resource Community

Modules, Themes and other customizations for your game => Completed Modules for version 1.x.x => Topic started by: XChrisX on December 06, 2005, 07:17:36 AM



Title: Keep gold after dragonkill
Post by: XChrisX on December 06, 2005, 07:17:36 AM
This has been written, because it has been asked for.

I strongly suggest you ignore this module, as its usage is HIGHLY unbalancing!

Download: Here. (http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1262)

Functionality: Allows to set an amount of gold (either hand or bank or both) which can be kept after dk.

It hasn't been tested, so there might be parse errors due to misspelling. I'm not sure... ;)


Title: Re:Keep gold after dragonkill
Post by: sixf00t4 on December 06, 2005, 07:19:29 AM
heh, take that extra quote out of line 11...(so far  :P )


Title: Re:Keep gold after dragonkill
Post by: XChrisX on December 06, 2005, 07:21:17 AM
And I already thought that this syntax highlighting looked a bit strange... ;)

FIXED.


Title: Re:Keep gold after dragonkill
Post by: XChrisX on December 06, 2005, 09:51:32 AM
Updated to work better (at all....)


Title: Re:Keep gold after dragonkill
Post by: Freeze on January 02, 2006, 09:17:16 PM
I belive this is a bug..

When you dk, you dont get the prize gold. Not sure about the gems though..

I've tried this with both 'Keep gold on hand' off and on.

For a short period of time, i just dont want gold in bank to go away.



Title: Re:Keep gold after dragonkill
Post by: Syb2 on June 10, 2006, 07:46:52 PM
I belive this is a bug..

When you dk, you dont get the prize gold. Not sure about the gems though..

I've tried this with both 'Keep gold on hand' off and on.

For a short period of time, i just dont want gold in bank to go away.



I also have tried it on and off, went so far as to remove it and with it removed players get DK rewards.
Now with it on, logs state that they DID recieve the reward though I know they have not. tested it myself and though I got nothing, logs show I did.
 I also would like to have bank gold stay in bank but also have the players actaully recieve the reward at DK.  :P
Is there a fix for this?


Title: Re: Keep gold after dragonkill
Post by: Elessa on May 22, 2007, 11:40:17 AM
/me uploads the missing file to the downloads area

the file for keepgold.php can be downloaded here. (http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=1262)

if there is a new version than v 1.0, xchrisx needs to update the download.  ;)


Title: Re:Keep gold after dragonkill
Post by: Iori on May 22, 2007, 04:46:35 PM
I belive this is a bug..

When you dk, you dont get the prize gold. Not sure about the gems though..

I've tried this with both 'Keep gold on hand' off and on.

For a short period of time, i just dont want gold in bank to go away.



Line 42:
         
Code:
$session['user']['gold'] = get_module_pref("gold");
change to:
         
Code:
$session['user']['gold'] += get_module_pref("gold");
to get the default DK gold rewards (and any other gold rewards due to modules such as clan stipend)  to add gold properly.


Title: Re: Keep gold after dragonkill
Post by: Aeolus on February 24, 2013, 06:07:27 AM
A Staffer of mine noticed that if a user has a debt before a DK, this module keeps that debt. To anyone else that uses this module and requires a fix:

Find Line 43:
Code:
$session['user']['goldinbank'] = get_module_pref("bank");

Replace With:
Code:
$session['user']['goldinbank'] = (get_module_pref("bank") > 0 ? get_module_pref("bank") : 0);


Title: Re: Keep gold after dragonkill
Post by: rjwboys on October 10, 2014, 12:37:26 PM
i had an issue when installing this and i found out the first line had
<?
and it should of been
<?php


Title: Re: Keep gold after dragonkill
Post by: MarcTheSlayer on October 10, 2014, 03:21:00 PM
Yeah, most servers have php configured to only allow <?php


Title: Re: Keep gold after dragonkill
Post by: TGTarheel on November 23, 2018, 09:28:23 PM
OK...question:

I looked over this module.  I do not think it quite does what I am after.

Would there be a way to make it so that the amount of gold allowed to be saved was dependent on how many DK the player has?

Ideally, I'd like all players less than 50 DK not to carry any gold in bank
players for 50 -100 DK to be able to carry 50,000
players for 100-200 DK to be able to carry 100,000
players for 200-500 DK to be able to carry 250,000
and over 500 DK to be able to carry 500,000

The problem here, as I see it...is getting the value of gold in bank before DK....because if they have less than the allowed amount for their level, I want them to only keep that...for example, a player with 300 DK would be allowed to carry 250,000 - but if they only had 120,000 in bank at time of DK they only carry that 120,000 and not the 250,000 max....on the other hand if they had a million in gold, they would lose all but 250,000

Trying to find where in the actual coding that dragonkill resets bank gold to zero, to see if a core/module change could d what I want, but damned if I can find where it is done that bank gold is set to zero on a dragonkill.


Title: Re: Keep gold after dragonkill
Post by: MarcTheSlayer on November 24, 2018, 07:27:57 AM
Check out my DK Stats Reset module (http://dragonprime.net/index.php?topic=11204.0). There's a hook in the Dragon.php (line 280ish) that allows you to block fields being reset. Directly above that is the array for fields that wont be reset. :-)


Title: Re: Keep gold after dragonkill
Post by: Aeolus on November 24, 2018, 03:29:18 PM
As for the actual checks, in the module, find where $session['user']['goldinbank'] is being set. (Hint, it's not being set to zero, it's being set to a module pref, calculated earlier.)

If they have 120k and the limit is 250k, then they get 120k. If they have 1m and the limit is 250k, then they get 250k. So, what you're wanting is the minimum between the limit and their current gold. So, use the following logic:

If dragonkills < 50 then goldinbank = 0
else if dragonkills >= 50 and dragonkills < 100 then goldinbank = (minimum of 50000 and current gold)
else if dragonkills >= 100 and dragonkills < 200 then goldinbank = (minimum of 100000 and current gold)
else if dragonkills >= 200 and dragonkills < 500 then goldinbank = (minimum of 250000 and current gold)
else if dragonkills >= 500 then goldinbank = (minimum of 500000 and current gold)


Title: Re: Keep gold after dragonkill
Post by: TGTarheel on November 24, 2018, 09:17:06 PM
As for the actual checks, in the module, find where $session['user']['goldinbank'] is being set. (Hint, it's not being set to zero, it's being set to a module pref, calculated earlier.)

If they have 120k and the limit is 250k, then they get 120k. If they have 1m and the limit is 250k, then they get 250k. So, what you're wanting is the minimum between the limit and their current gold. So, use the following logic:

If dragonkills < 50 then goldinbank = 0
else if dragonkills >= 50 and dragonkills < 100 then goldinbank = (minimum of 50000 and current gold)
else if dragonkills >= 100 and dragonkills < 200 then goldinbank = (minimum of 100000 and current gold)
else if dragonkills >= 200 and dragonkills < 500 then goldinbank = (minimum of 250000 and current gold)
else if dragonkills >= 500 then goldinbank = (minimum of 500000 and current gold)
Right.  I sorta got that figured.  I was trying to find it within the core code and make a core edit.
The module presented seemed to require a fair bit of reworking to get where I wanted.  I am gonna check out the other module presented and see if it more meets my needs here.
Will update.

Not quite there, either.  I need to not have booleans...I need to be able to have values of goldinbank saved across a DK - and set those based on number of DK's

Damn...seems like this is an easier core rewrite, if only I can find exactly WHERE in the core the damn reset happens.

UPDATE:  Paying careful attention across a DK, I was able to find where the reset happens, and believe I have now made the correct core modification...have to see.


Title: Re: Keep gold after dragonkill
Post by: Aeolus on November 24, 2018, 10:19:41 PM
Right.  I sorta got that figured.  I was trying to find it within the core code and make a core edit.
The module presented seemed to require a fair bit of reworking to get where I wanted.  I am gonna check out the other module presented and see if it more meets my needs here.
Will update.

Not quite there, either.  I need to not have booleans...I need to be able to have values of goldinbank saved across a DK - and set those based on number of DK's

Damn...seems like this is an easier core rewrite, if only I can find exactly WHERE in the core the damn reset happens.


This module is basically created for what you want. It saves how much gold you have before a DK, then sets your gold to that after a DK (i.e. "values of goldinbank saved across a DK"). You just want different levels of gold saved. The logic I provided can be used directly (after turning it into code) in the post-DK hook, barely any reworking necessary.


Title: Re: Keep gold after dragonkill
Post by: TGTarheel on November 25, 2018, 01:10:42 AM
Right.  I sorta got that figured.  I was trying to find it within the core code and make a core edit.
The module presented seemed to require a fair bit of reworking to get where I wanted.  I am gonna check out the other module presented and see if it more meets my needs here.
Will update.

Not quite there, either.  I need to not have booleans...I need to be able to have values of goldinbank saved across a DK - and set those based on number of DK's

Damn...seems like this is an easier core rewrite, if only I can find exactly WHERE in the core the damn reset happens.



This module is basically created for what you want. It saves how much gold you have before a DK, then sets your gold to that after a DK (i.e. "values of goldinbank saved across a DK"). You just want different levels of gold saved. The logic I provided can be used directly (after turning it into code) in the post-DK hook, barely any reworking necessary.

I think I have managed the same as a core edit.  Just needed to know where to put it.  At least it seems to parse correctly, now just need to test it across a dragonkill to see if what I did works.
What I wanted was dragon.php & op=prologue1

What I was looking for...erroneously...was a reset gold in bank to zero.  What that op DOES, however...is tell the game what to keep.  Everything else by default goes away.
SO...just a matter of the if statements - capturing goldinbank before it resets, and setting a variable.  Then valuing the variable according to the parameters I want...then, after everything resets, add a line in to set goldinbank to the value of the variable.

It seems like it ought to work, anyway.  The proof is in the pudding though.

I just wanted this so that people could save a little money in the bank so that pets would not run away due to neglect all the time every time you got creamed in the forest and lost all your gold.

Not trying to actually allow a huge amount to be saved.  You can save more in your dwelling coffers in my game...but the pets module won't auto-withdraw from coffers to feed pets, it will only do that from the bank...hence my wanting to be able to save a small amount of gold...in the bank...and not have the PITA of having to remember to withdraw it all every time you want to fight a dragon.


Title: Re: Keep gold after dragonkill
Post by: Aeolus on November 25, 2018, 04:32:04 AM
Core code, module, either works. The logic works at any rate, I tested it in about two minutes. Cheers.


Title: Re: Keep gold after dragonkill
Post by: TGTarheel on November 27, 2018, 04:47:55 AM
Core code, module, either works. The logic works at any rate, I tested it in about two minutes. Cheers.
The logic works...and so does the core edit I did.  It worked like it was supposed to.  Tested across a DK with less than limit in bank and with more than limit in back, and it did what it was supposed to do in both cases.


Title: Re: Keep gold after dragonkill
Post by: Aeolus on November 27, 2018, 05:34:54 AM
Good to hear. Make sure that you have a check to disable it in case you ever need to. Core edits should only be done in the most necessary of circumstances, and can go terribly wrong in the future when other things are changed. That's what modules were created for. Cheers.


Title: Re: Keep gold after dragonkill
Post by: TGTarheel on November 28, 2018, 11:52:01 PM
Good to hear. Make sure that you have a check to disable it in case you ever need to. Core edits should only be done in the most necessary of circumstances, and can go terribly wrong in the future when other things are changed. That's what modules were created for. Cheers.

TBH, I do core edits when I can't figure out where to hook a module into to get it to do what I want.  I was not quite sure where to hook this, because, if you hook to "dragonkill" then I think the gold would wipe out first...so it would ruin what I was trying to do.

I also always notate my core edits by wrapping them with comment lines, at the beginning and end of the core edit, and leave myself a note of what I was trying to achieve with the core edit.

Additionally, after I make a core edit work right...I have a backup of the original core file...and a backup of the working core file...thus I always have a way to back up to where I was when things worked in case something breaks.

I'm pretty careful with core edits.  I agree with you, I don't like them much but there are times when it's just easier.

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines