Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<float> CalculateExtractorValues()
- {
- //Corresponding ingame view: http://i.imgur.com/2LWLj2w.png
- //Graph of this code: http://i.imgur.com/6VsmWCX.png
- int sec = 1;
- List<float> values = new List<float>();
- int installTime = 0;
- int expiryTime = 171000; //1d 23h 30m; from API expiryTime-installTime
- int cycleTime = 30*60; //30 minutes, value from API * 60
- int quantityPerCycle = 6965; //Value from API
- int numIterations = (expiryTime-installTime)/(cycleTime);
- float decayFactor = 0.012f; //Dogma attribute 1683 for this pin typeID - using defaults from dgmAttributeTypes
- float noiseFactor = 0.8f; //Dogma attribute 1687 for this pin typeID - using defaults from dgmAttributeTypes
- float barWidth = (float)cycleTime / sec / 900.0f;
- const float f1 = 1f / 12;
- const float f2 = 1f / 5;
- const float f3 = 1f / 2;
- for (int i = 0; i < numIterations; i++)
- {
- //timeDiff equals currentTime because installTime is zero. installTime has no effect on the results as long as total time remains constant.
- int timeDiff = (i + 1)*cycleTime;
- int cycleNum = Math.Max((timeDiff + sec)/cycleTime - 1, 0);
- float t = (cycleNum + 0.5f)*barWidth;
- float decayValue = quantityPerCycle/(1 + t * decayFactor);
- double phaseShift = Math.Pow(quantityPerCycle, 0.7f);
- double sinA = Math.Cos(phaseShift + t*f1);
- double sinB = Math.Cos(phaseShift/2 + t*f2);
- double sinC = Math.Cos(t*f3);
- double sinStuff = (sinA + sinB + sinC)/3;
- sinStuff = Math.Max(sinStuff, 0);
- double barHeight = decayValue*(1 + noiseFactor*sinStuff);
- values.Add((float) (barWidth*barHeight));
- }
- return values;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement