DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • December 11, 2018, 12:40:16 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: 1 ... 3 4 [5]   Go Down
  Print  
Author Topic: GP Professions Pack  (Read 20043 times)
0 Members and 1 Guest are viewing this topic.
CavemanJoe
Mod God
*****
Offline Offline

Posts: 556


Opener of WormCans


View Profile WWW
« Reply #60 on: July 04, 2008, 09:18:49 AM »

Another slight bug in gprun.php...  When buying weapons or armour, while there is a check to see if the player has enough gold, it's a check against the purchase price of their weapon, not the buying price.  So, a canny player who knows that a negative value of Gold will reset to zero at the next Village screen will know that they can get all of their original purchase price back by not having quite enough money.

For example, if I have exactly 360 Gold and buy a Floppy Tin Breastplate at 360 Gold, I can then buy another Floppy Tin Breastplate (despite having 0 gold) and end up with -90 Gold (which is 25% of 360).

To fix, find:

Code:
        if ($session['user']['gold'] + $session['user']['armorvalue'] < get_module_setting("armor".$id."price")) {
           output("You reach into your pocket for enough gold to buy the new armor, but you realize you don't have enough! How embarrassing!");

Replace with:

Code:
    $depreciation = $session['user']['armorvalue']*.75;
        if ($session['user']['gold'] + $depreciation < get_module_setting("armor".$id."price")) {
           output("You reach into your pocket for enough gold to buy the new armor, but you realize you don't have enough! How embarrassing!");

Do the same for weaponry, too.
Logged

White Knight
Mod God
*****
Offline Offline

Posts: 1030

For the truth!


View Profile
« Reply #61 on: July 05, 2008, 01:58:31 PM »

(posting here 'cause there's a better chance you'll see it)
White Knight, the Bridge module you posted in the GP Professions Pack thread is working - somewhat.  It fixes the original bug, but it seems that when it fires, something is blocking the GP Professions module from adding its own stats:

Bought +1 weapon from Shop, leads to 23 atk.
Bought +1 weapon from WorkShop, leads to 22 atk.
Bought +1 weapon from Shop, leads to 22 atk.
Sold +1 weapon at the Shop, leads to 21 atk.
Bought +15 weapon from Shop, leads to 36 atk.
Bought +15 weapon from WorkShop, leads to 21 atk.

No problems buying equipment sequentially from the WorkShop or from the Equipment Shop, but when buying equipment from the WorkShop to replace equipment purchased at the Equipment Shop, either the WorkShop isn't adding the attack points or something else is taking them away.  I've been through the code, but I confess I'm not quite proficient enough to follow all of it.

Fixed and reattached.
Logged

Helping you help yourself.
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #62 on: November 12, 2008, 12:54:17 PM »

I believe I've found a bug, else I've missed a setting somewhere.I've set the location for gathering wood to "NO", wishing it to appear in the forest, the next setting i've also set to "NO", wishing it to not appear in every village/forest. The problme is, it appears in EVERY forest, is there a setting I missed or is it supposed to be this way?

Any help would be greatly appreciated,
Rayn
Logged

White Knight
Mod God
*****
Offline Offline

Posts: 1030

For the truth!


View Profile
« Reply #63 on: November 14, 2008, 12:56:50 AM »

Well, I suppose the author decided that there is only one forest for all cities, which is how many view it. Here's the relevant code:

Code: (gphook.php)
<?php
    
case "forest":
      if (
get_module_setting("queryinvillage") == 0) {
        
addnav("Walk To");
        
addnav(get_module_setting("gathername"),"runmodule.php?module=".$mostrecentmodule."&op=query");
      }
    break;

To make a long story short, it's coded this way. That is not to say that it can't be changed to distinguish between different cities' forests, but simply that it's not the way it's currently done. This really isn't a bug, but a difference in interpretation of where the forest "physically" appears.
Logged

Helping you help yourself.
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #64 on: November 15, 2008, 12:45:50 AM »

My appologies then, how would you change it to get the location for collecting materials to appear in only one forest?

I am VERY new to coding, but I do have a very experienced coder teaching me, so if I dont understand it.. i'll ask Smiley.

Thanks,
~Rayn
Logged

White Knight
Mod God
*****
Offline Offline

Posts: 1030

For the truth!


View Profile
« Reply #65 on: November 15, 2008, 09:23:31 PM »

That should be pretty straightforward. Find the file named gphook.php in modules/lib/ directory. Starting from line 20, the code should be exactly like I showed it in my previous post. You need to modify the condition to make it recognize the player's current location. This is stored in $session['user']['location']. The modified code could now be something like this:

Code: (modules/lib/gphook.php)
<?php...
    case 
"forest":
      if( 
get_module_setting('queryinvillage') == 0
&& ( $session['user']['location'] == get_module_setting('queryloc'
|| get_module_setting('queryallvillage') == 1
)
)
{
        
addnav("Walk To");
        
addnav(get_module_setting("gathername"),"runmodule.php?module=".$mostrecentmodule."&op=query");
      }
    break;

I've provided the code up to the break statement for some context, but all that's really changed is the conditional (the if statement).

Note: I use "<?php" (sometimes with an ellipsis to indicate omission of a chunk of code) because doing so forces the forum software to provide some syntax highlighting; this is not in the lines that we're talking about here and you can just ignore it. It's supposed to be only at the very top of the PHP file. Line 20 begins with a "case."
Logged

Helping you help yourself.
RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #66 on: November 16, 2008, 12:55:18 PM »

Thank you so much!

~Rayn
Logged

RaynDarren
Mod God
*****
Offline Offline

Posts: 732


View Profile WWW
« Reply #67 on: November 26, 2008, 03:28:42 PM »

I'd like to make a suggestion for this module, please oh please, can we have an editor for these professions? it would make things so much easier!
Logged

Pages: 1 ... 3 4 [5]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
56 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search