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

Affiliates
Super Mario Bros. X | Kuribo64
Views: 8,952,257
Main | FAQ | IRC chat | Memberlist | Active users | Latest posts | Stats | Ranks | Online users | Search
03-28-24 02:42 PM
Guest: Register | Login

0 users currently in AcmlmBoard Developer Zone | 2 bots

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


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


Level: 19


Posts: 54/69
EXP: 34085
Next: 1692

Since: 07-22-14

Last post: 3271 days
Last view: 2857 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, in (rev. 2 of 03-25-15 01:53 PM by Epele) Link | ID: 83778
Site Administrator
The Sorceress.
Boing~

Level: 235


Posts: 13523/20774
EXP: 200179348
Next: 1746544

Since: 01-01-12
From: UK

Last post: 813 days
Last view: 2 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, in Link | ID: 83779
Normal User


Level: 19


Posts: 55/69
EXP: 34085
Next: 1692

Since: 07-22-14

Last post: 3271 days
Last view: 2857 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.5 (10/04/2020)
© 2005-2024 Acmlm, Emuz, et al.

Page rendered in 0.044 seconds. (769KB of memory used)
MySQL - queries: 74, rows: 497/532, time: 0.032 seconds.