vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   RPG Integration Hack (https://vborg.vbsupport.ru/forumdisplay.php?f=102)
-   -   Bug or install error? (https://vborg.vbsupport.ru/showthread.php?t=76427)

Cyricx 02-16-2005 12:02 PM

Bug or install error?
 
I've got a problem that I think is a bug due to everything else going perfect for the install.

Basically, if you make like certain armor or weapons usable by only one class type.

Someone can edit their character to that class, buy those items and then change their class to whatever else they want and they will still keep the items.

For example, if you made a plate armor that only warriors could use and mages could only use robes.

The mage player could edit their character to a warrior, buy the plate armor and then edit their character back to a mage and they'd keep the plate armor on :dead:

I haven't seen anything about this posted except for one person that hinted at having found a major bug but hasn't seen a thread about it.

Thinking this is the one he was referring too...

Any ideas on how to fix it?

Revan 02-16-2005 03:27 PM

Then again, if they do that they will have wasted their money.
The item is 100% unusable if the class does not match.
An error will occur in battle, saying "The [itemname] is for a different class. Please sell it."
;)


//peace

Cyricx 02-17-2005 12:03 AM

Maybe I miss hacked something then because we didn't get that error in my testing.

Even made a class for mages and gave them a fireball spell, made sure the item type was only for mages and then switch to warriors, started a battle, jumped in and fireballed each other =/

We also made warriors, equipped with warrior only armor (positive of this as a mage the armor was not available to purchase in the item shop), then switch to mages. :dead:

Revan 02-17-2005 05:26 AM

Hmmm... weird...
I will look into this when I get home.

Cyricx 02-17-2005 04:09 PM

If you want access to the test forums I have it on just fire me a pm. :)

Cyricx 02-21-2005 11:55 AM

Were you able to duplicate the problem on your newest version Revan?

Revan 02-21-2005 12:12 PM

Um I forgot all about this :p
Im gonna check it out later today, I promise.
Right now Im coding some on the installer for v3, then gotta go outside for a lil bit :)


EDIT: Ok I tried it out, and it is just ok in here.
In your battlefight.php, check if you have this piece of code:
Code:

Your $onehanded[onehanded] is for a different class.  Please sell it.

Cyricx 02-22-2005 04:26 PM

Found it in battlefight.php, so you can only define specific classes of items for a class?

Because I have all my armor grouped up but then use the itemtype to determine which class can access them but it's not catching that or the weapons but they are grouped the same.

It looks like you have the code right in battlefight for what I'm thinking..

I've got all my weapons grouped up in a group of one-handed weapons.

Classes are spread out over various class types, then I use the "item type" to link which class types can use which individual weapon. However right now a mage type that can't buy a broadsword, can switch to a warrior type, buy it, switch back to a mage, and then attack with it...

Revan 02-22-2005 05:28 PM

Ok that there was abit confusing, so here's a detailed instruction of what I did to test this:
* Created a Battle Type called "Holy"
* Inserted White Mage into this type
* Created a Battle Type called "Unholy"
* Inserted Vampire into this type
* Edited Item Type, checking Air Racket off under Holy type only
* Edited Item Type, checking Blade off under Unholy type only
* Changed my Class to White Mage
* Purchased Air Racket
* Changed my Class to Vampire
* Went into battle

And I was unable to use the Air Racket.

Cyricx 02-24-2005 01:35 AM

Hmmm, okay, so it's just armor that it's not stopping you from battling with?

Revan 02-26-2005 03:28 PM

Armor (please note the difference between Armor and Shield type) are currently not being prohibited, yes.
The fix is hassle to test, so I didn't, but you feel free to test it for me.

File: battleupdate.php
Find (BOTH instances of):
PHP Code:

                    rpgrace

Add BELOW:
PHP Code:

                    rpgtype

Find:
PHP Code:

                    $defense $DB_site->query_first("SELECT damage FROM " TABLE_PREFIX "rpg_items WHERE itemid='$opparmor[id]'");
                    if (
$defense['damage'] > 0
                    {
                        
$armor $armor $defense['damage'];
                    } 

Replace with:
PHP Code:

                    $defense $DB_site->query_first("SELECT damage, type FROM " TABLE_PREFIX "rpg_items WHERE itemid='$opparmor[id]'");
                    if (
$defense['damage'] > 0
                    {
                        
$opparmortype explode(' '$defense['type']);
                        if (
in_array($opponent['rpgtype'], $opparmortype))
                        {
                            
$armor $armor $defense['damage'];
                        }
                    } 

IMPORTANT: To test this fix, do the following BEFORE doing the above:
  1. Set $battledebug to 1 in battleupdate.php
  2. Make yourself have armor your not supposed to have
  3. Let both combatants have weapons they ARE supposed to have
  4. Let your opponent attack you (thus having your illegal armor reduce the damage
  5. Note down the second last Debug Variable under Damage Done
  6. Apply the fix
  7. Upload the file
  8. Let your opponent attack you (thus in theory having the armor not count)
  9. Compare the second last Debug Variable under Damage Done to the value you saw before
If the fix worked, the Armor should have no effect.

PS: I will add an error message like the "your weapon is for a different class" in v3.

Thanks for helping me make this hack better :)


//peace

Cyricx 02-28-2005 04:59 PM

Nope, didn't do the trick, didn't get an error or anything, but the debugs stayed the same.

Before the fix -

Debug Variables:
Anger ($anger): 1
Hit Chance ($hitchance): 0.49279003035213
Random Number ($randnum): 35
Regular Attack Bonus ($regattbonus): 6.0456592223288
Regular Defense Minus ($regdefminus): 3.145988105131
Damage Done ($damagedone): -1 == [floor((28 + 6.0456592223288) * 0.5 * 1 + 0 - 14 - 3.145988105131)]
Random Mad ($randmad): 10

After the fix -
Debug Variables:
Anger ($anger): 1
Hit Chance ($hitchance): 0.49279003035213
Random Number ($randnum): 22
Regular Attack Bonus ($regattbonus): 6.0456592223288
Regular Defense Minus ($regdefminus): 3.145988105131
Damage Done ($damagedone): -1 == [floor((28 + 6.0456592223288) * 0.5 * 1 + 0 - 14 - 3.145988105131)]
Random Mad ($randmad): 8

Revan 02-28-2005 07:36 PM

Goddamit!
Ok guess I have tomorrow's work cut out for me then :p
I'll either edit this post or make a new reply
because Im gonna fuggen do this even if it's the last thing I do! :p

Cyricx 03-01-2005 01:12 AM

Hehe, I'll happily test out anything you need bro :)

I can add in hacks like crazy, but when it comes to writting arrays and explode and all that my mind fragments into a trillion pieces ;)

Revan 03-01-2005 03:17 PM

Well I can say that the fix works.
I just applied it, and here's the results:

BEFORE the fix:
Damage Done ($damagedone): 166 == [floor((82 + 839.48094618951) * 1 * 1 + 0 - 0 - 756.75105588525)]


AFTER the fix:
Damage Done ($damagedone): 109 == [floor((82 + 839.48094618951) * 1 * 1 + 0 - 54 - 756.75105588525)]

And 54 IS indeed the buff value I set the Armor I tested it with to be.

Cyricx 03-01-2005 04:13 PM

I'll double check my values on test. See if I can find out what I did wrong incase someone else repeats my mistake.


All times are GMT. The time now is 11:18 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01904 seconds
  • Memory Usage 1,763KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete