Notings of Attention™
Acmlmboard 2 Released
Github/GIT | @acmlmboard
Chatting Places
Discord

Affiliates
Super Mario Bros. X | Kuribo64 | NeoRHDN
Views: 11,030,477
Main | FAQ | IRC chat | Memberlist | Active users | Latest posts | Stats | Ranks | Online users | Search
11-21-24 11:57 AM
Guest: Register | Login

0 users currently in AcmlmBoard Developer Zone | 5 bots

Main - AcmlmBoard Developer Zone - How userstats are calculated.
Next newer thread | Next older thread


XerX
Posted on 03-25-15 06:01 AM Link | ID: 83775
Normal User


Level: 19


Posts: 54/69
EXP: 35213
Next: 564

Since: 07-22-14

Last post: 3509 days
Last view: 3094 days
This has been baffling me for quite some time now. I cannot, for the life of me, figure out how status.php calculates the stat changes with the equipment.

As some of you may know, I'm coding up a battle system for this forum software. I would really like to utilize the shops and the equipment, but without the additional stats that the equipment gives, the battle system seems off.

I've read through rpg.php, status.php, and profile.php many times now, and I cannot figure it out sadly.

getstats($user,$items); doesn't seem to get the item's stats, but only their id's. I've even tried fetching the data from the tables themselves, but I have come out unsuccessful.

Anyone out there know how the hell this works?

Epele
Posted on 03-25-15 11:47 AM (rev. 2 of 03-25-15 01:53 PM by Epele) Link | ID: 83778
Site Administrator
The Sorceress.
Boing~

Level: 237


Posts: 13523/20774
EXP: 205437244
Next: 2541690

Since: 01-01-12
From: UK

Last post: 1051 days
Last view: 11 hours
The stats are calculated as part of the getstats() process. Here's something you can use to play about with to try to get whatever you're after:

<?php
require 'lib/common.php';
pageheader("Testing");
echo "<pre>";
//We need the user rpg stuff, so that's fetched here.
$user=$sql->fetchq("SELECT u.name, u.posts, u.regdate, r.* "
."FROM users u "
."LEFT JOIN usersrpg r ON r.id=u.id "
."WHERE u.id='1'");
$p=$user['posts'];
$d=(ctime()-$user['regdate'])/86400;


//This part fetches the item stats
$it=$_GET['it'];
checknumeric($it);
$eqitems=$sql->query("SELECT * FROM items WHERE id=$user[eq1] OR id=$user[eq2] OR id=$user[eq3] OR id=$user[eq4] OR id=$user[eq5] OR id=$user[eq6] OR id=$it");

while($item=$sql->fetch($eqitems))
$items[$item[id]]=$item;
$ct=$_GET['ct'];
if($ct){
$GPdif=floor($items[$user['eq'.$ct]][coins]*0.6)-$items[$it][coins];
$user['eq'.$ct]=$it;
}


//Now for printouts.
$st1=getstats($user,$items);
$st2=getstats($user,0);
//This is an array printout of the stats with items
print_r($st1);
//This one likewise, is without item stats
print_r($st2);
//This gives you the item stats
print_r($items);
echo "</pre>";
pagefooter();
?>


Can't be much more helpful, kinda tired from waking up right now. Scratch that. Now I've woken up and had another look at it. The part you want here, is the $items section. It's not going to be a clean job, but you should be able to get to wherever you want to be from this. It shows you where all the stats come from.


The world could always use more heroes!

XerX
Posted on 03-25-15 03:55 PM Link | ID: 83779
Normal User


Level: 19


Posts: 55/69
EXP: 35213
Next: 564

Since: 07-22-14

Last post: 3509 days
Last view: 3094 days
I had something similar written out. I don't understand why it didn't work ahahaha. Thank you for the help, @"CherryBunny". It has worked. I can now continue working on this without the stress of the stats not working.

Next newer thread | Next older thread
Main - AcmlmBoard Developer Zone - How userstats are calculated.


Acmlmboard v2.5.6 (06/11/2024)
© 2005-2024 Acmlm, Emuz, et al.

Page rendered in 4.808 seconds. (768KB of memory used)
MySQL - queries: 70, rows: 495/529, time: 4.798 seconds.