01-18-2015, 12:33 PM
(01-17-2015, 09:58 PM)Greyman Wrote:(01-17-2015, 09:01 PM)madalilng Wrote: here's my computation to calculate miners/pumps this should work.
Code:double[] collector_max = { 500, 1000, 1500, 2500, 10000, 20000, 30000, 50000, 75000, 100000, 150000, 200000 };
double[] collector_ph = { 200, 400, 600, 800, 1000, 1300, 1600, 1900, 2200, 2500, 3000, 3500 };
foreach (var B in _b.buildings)
{
int _lvl = B.lvl; // Collector level..
var _collectedtime = B.res_time;
var _timedif = (collector_max[_lvl] / collector_ph[_lvl] * 3600) - _collectedtime ;
var _collectedres = (_timedif * (collector_ph[_lvl] / 3600));
if (B.data == 1000002){ // elixir pump
Total_elix += (double)(_collectedres);
}
if (B.data == 1000004)
{ // Gold Mine
Total_Gold += (double)(_collectedres);
}
}
Hi Madalilng,
I've seen code very similar to this in a VMT entry, about 5 or 6 pointer references deep from the elixir collector base struct. It was one of about half a dozen routines I'd bookmarked for further analysis
Many thanks for the heads up, I'll definitely be trying this out. I'm pretty sure I've seen something similar to res_time relatively close to the VMT entry in question, which makes it the top candidate for analysis when I circle back to collectors.
Interestingly, the res_time when the collector is boosted (if what I've found is equivalent) seems to go constantly backwards, while the in-memory reference to the resource per hour stays the same. It looked like SuperCell dodgy the boost by modifying the time basepoint, rather than boosting the collection rate. Have you noticed anything similar? Bizarre if true, but the same result in the end I guess.
Hi Madalilng,
So the "res_time" parameter isn't directly readable from memory for a collector, but has to be calculated from a couple of values elsewhere in the struct and then divided by a constant. There's two separate "last collected time" and "active time this session" variables that are inputs into the equation. Other than that, your formula was perfect. There's a couple of VMT methods that expose the details, including the locations of the two variables and the constant divider.
Thanks again for the information, it was incredibly useful in narrowing down the correct routines to analyze.
Grey.