Skip to content

Commit

Permalink
V1.0.2 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaro2709 committed Apr 17, 2020
1 parent aa39c41 commit f53c368
Show file tree
Hide file tree
Showing 135 changed files with 13,199 additions and 3,524 deletions.
944 changes: 0 additions & 944 deletions CHANGES.md

This file was deleted.

2 changes: 1 addition & 1 deletion game.php
Expand Up @@ -14,7 +14,7 @@
* @version 1.8.0
* @link https://github.com/jkroepke/2Moons
*/
define('DATABASE_VERSION', 'OLD');
//define('DATABASE_VERSION', 'OLD');

define('MODE', 'INGAME');
define('ROOT_PATH', str_replace('\\', '/',dirname(__FILE__)).'/');
Expand Down
2 changes: 1 addition & 1 deletion includes/GeneralFunctions.php
Expand Up @@ -69,7 +69,7 @@ function getFactors($USER, $Type = 'basic', $TIME = NULL) {
continue;
}

if(in_array($elementID, $reslist['dmfunc'])) {
if(in_array($elementID, array_merge($reslist['dmfunc'], $reslist['premium']))) {
if(DMExtra($elementLevel, $TIME, false, true)) {
continue;
}
Expand Down
2,033 changes: 0 additions & 2,033 deletions includes/backups/clean.sql

This file was deleted.

259 changes: 148 additions & 111 deletions includes/backups/no_clean.sql

Large diffs are not rendered by default.

70 changes: 43 additions & 27 deletions includes/classes/cache/builder/VarsBuildCache.class.php
Expand Up @@ -41,6 +41,7 @@ function buildCache()
$reslist['dmfunc'] = array();

$reslist['race'] = array();
$reslist['premium'] = array();

$db = Database::get();

Expand Down Expand Up @@ -77,31 +78,39 @@ function buildCache()
'tech' => $varsRow['speedTech'],
'time' => $varsRow['timeBonus'],
'bonus' => array(
'Attack' => array($varsRow['bonusAttack'], $varsRow['bonusAttackUnit']),
'Defensive' => array($varsRow['bonusDefensive'], $varsRow['bonusDefensiveUnit']),
'Shield' => array($varsRow['bonusShield'], $varsRow['bonusShieldUnit']),
'BuildTime' => array($varsRow['bonusBuildTime'], $varsRow['bonusBuildTimeUnit']),
'ResearchTime' => array($varsRow['bonusResearchTime'], $varsRow['bonusResearchTimeUnit']),
'ResearchSlotPlanet'=> array($varsRow['bonusResearchSlotPlanet'], $varsRow['bonusResearchSlotPlanetUnit']),
'ShipTime' => array($varsRow['bonusShipTime'], $varsRow['bonusShipTimeUnit']),
'DefensiveTime' => array($varsRow['bonusDefensiveTime'], $varsRow['bonusDefensiveTimeUnit']),
'Resource' => array($varsRow['bonusResource'], $varsRow['bonusResourceUnit']),
'Pmetal' => array($varsRow['bonusPmetal'], $varsRow['bonusPmetalUnit']),
'Pcrystal' => array($varsRow['bonusPcrystal'], $varsRow['bonusPcrystalUnit']),
'Pdeuterium' => array($varsRow['bonusPdeuterium'], $varsRow['bonusPdeuteriumUnit']),
'Senergy' => array($varsRow['bonusSenergy'], $varsRow['bonusSenergyUnit']),
'ResourceStorage' => array($varsRow['bonusResourceStorage'], $varsRow['bonusResourceStorageUnit']),
'ShipStorage' => array($varsRow['bonusShipStorage'], $varsRow['bonusShipStorageUnit']),
'FlyTime' => array($varsRow['bonusFlyTime'], $varsRow['bonusFlyTimeUnit']),
'FlyTimeCom' => array($varsRow['bonusFlyTimeCom'], $varsRow['bonusFlyTimeComUnit']),
'FlyTimeImp' => array($varsRow['bonusFlyTimeImp'], $varsRow['bonusFlyTimeImpUnit']),
'FlyTimeHyp' => array($varsRow['bonusFlyTimeHyp'], $varsRow['bonusFlyTimeHypUnit']),
'FleetSlots' => array($varsRow['bonusFleetSlots'], $varsRow['bonusFleetSlotsUnit']),
'Planets' => array($varsRow['bonusPlanets'], $varsRow['bonusPlanetsUnit']),
'SpyPower' => array($varsRow['bonusSpyPower'], $varsRow['bonusSpyPowerUnit']),
'Expedition' => array($varsRow['bonusExpedition'], $varsRow['bonusExpeditionUnit']),
'GateCoolTime' => array($varsRow['bonusGateCoolTime'], $varsRow['bonusGateCoolTimeUnit']),
'MoreFound' => array($varsRow['bonusMoreFound'], $varsRow['bonusMoreFoundUnit']),
'AttackA' => array($varsRow['bonusAttackA'], $varsRow['bonusAttackAUnit']),
'DefensiveA' => array($varsRow['bonusDefensiveA'], $varsRow['bonusDefensiveAUnit']),
'ShieldA' => array($varsRow['bonusShieldA'], $varsRow['bonusShieldAUnit']),
'AttackD' => array($varsRow['bonusAttackD'], $varsRow['bonusAttackDUnit']),
'DefensiveD' => array($varsRow['bonusDefensiveD'], $varsRow['bonusDefensiveDUnit']),
'ShieldD' => array($varsRow['bonusShieldD'], $varsRow['bonusShieldDUnit']),
'Attack' => array($varsRow['bonusAttack'], $varsRow['bonusAttackUnit']),
'Defensive' => array($varsRow['bonusDefensive'], $varsRow['bonusDefensiveUnit']),
'Shield' => array($varsRow['bonusShield'], $varsRow['bonusShieldUnit']),
'BuildTime' => array($varsRow['bonusBuildTime'], $varsRow['bonusBuildTimeUnit']),
'BuildSlots' => array($varsRow['bonusBuildSlots'], $varsRow['bonusBuildSlotsUnit']),
'ResearchTime' => array($varsRow['bonusResearchTime'], $varsRow['bonusResearchTimeUnit']),
'ResearchSlots' => array($varsRow['bonusResearchSlots'], $varsRow['bonusResearchSlotsUnit']),
'ResearchSlotPlanet' => array($varsRow['bonusResearchSlotPlanet'], $varsRow['bonusResearchSlotPlanetUnit']),
'ShipTime' => array($varsRow['bonusShipTime'], $varsRow['bonusShipTimeUnit']),
'DefensiveTime' => array($varsRow['bonusDefensiveTime'], $varsRow['bonusDefensiveTimeUnit']),
'Resource' => array($varsRow['bonusResource'], $varsRow['bonusResourceUnit']),
'Pmetal' => array($varsRow['bonusPmetal'], $varsRow['bonusPmetalUnit']),
'Pcrystal' => array($varsRow['bonusPcrystal'], $varsRow['bonusPcrystalUnit']),
'Pdeuterium' => array($varsRow['bonusPdeuterium'], $varsRow['bonusPdeuteriumUnit']),
'Senergy' => array($varsRow['bonusSenergy'], $varsRow['bonusSenergyUnit']),
'ResourceStorage' => array($varsRow['bonusResourceStorage'], $varsRow['bonusResourceStorageUnit']),
'ShipStorage' => array($varsRow['bonusShipStorage'], $varsRow['bonusShipStorageUnit']),
'FlyTime' => array($varsRow['bonusFlyTime'], $varsRow['bonusFlyTimeUnit']),
'FlyTimeCom' => array($varsRow['bonusFlyTimeCom'], $varsRow['bonusFlyTimeComUnit']),
'FlyTimeImp' => array($varsRow['bonusFlyTimeImp'], $varsRow['bonusFlyTimeImpUnit']),
'FlyTimeHyp' => array($varsRow['bonusFlyTimeHyp'], $varsRow['bonusFlyTimeHypUnit']),
'FleetSlots' => array($varsRow['bonusFleetSlots'], $varsRow['bonusFleetSlotsUnit']),
'Planets' => array($varsRow['bonusPlanets'], $varsRow['bonusPlanetsUnit']),
'SpyPower' => array($varsRow['bonusSpyPower'], $varsRow['bonusSpyPowerUnit']),
'Expedition' => array($varsRow['bonusExpedition'], $varsRow['bonusExpeditionUnit']),
'GateCoolTime' => array($varsRow['bonusGateCoolTime'], $varsRow['bonusGateCoolTimeUnit']),
'MoreFound' => array($varsRow['bonusMoreFound'], $varsRow['bonusMoreFoundUnit']),
),
);

Expand All @@ -124,8 +133,12 @@ function buildCache()
if(array_filter($ProdGrid[$varsRow['elementID']]['storage']))
$reslist['storage'][] = $varsRow['elementID'];

if(($varsRow['bonusAttack'] + $varsRow['bonusDefensive'] + $varsRow['bonusShield'] + $varsRow['bonusBuildTime'] +
$varsRow['bonusResearchSlotPlanet'] + $varsRow['bonusResearchTime'] + $varsRow['bonusShipTime'] + $varsRow['bonusDefensiveTime'] +
if(($varsRow['bonusAttackA'] + $varsRow['bonusDefensiveA'] + $varsRow['bonusShieldA'] +
$varsRow['bonusAttackD'] + $varsRow['bonusDefensiveD'] + $varsRow['bonusShieldD'] +
$varsRow['bonusAttack'] + $varsRow['bonusDefensive'] + $varsRow['bonusShield'] +
$varsRow['bonusBuildTime'] + $varsRow['bonusBuildSlots'] +
$varsRow['bonusResearchTime'] + $varsRow['bonusResearchSlots'] + $varsRow['bonusResearchSlotPlanet'] +
$varsRow['bonusShipTime'] + $varsRow['bonusDefensiveTime'] +
$varsRow['bonusResource'] + $varsRow['bonusPmetal'] + $varsRow['bonusPcrystal'] + $varsRow['bonusPdeuterium'] + $varsRow['bonusSenergy'] +
$varsRow['bonusResourceStorage'] + $varsRow['bonusShipStorage'] +
$varsRow['bonusFlyTime'] + $varsRow['bonusFlyTimeCom'] + $varsRow['bonusFlyTimeImp'] + $varsRow['bonusFlyTimeHyp'] +
Expand Down Expand Up @@ -165,6 +178,9 @@ function buildCache()
case 1500:
$reslist['race'][] = $varsRow['elementID'];
break;
case 2100:
$reslist['premium'][] = $varsRow['elementID'];
break;
}
}

Expand Down
59 changes: 34 additions & 25 deletions includes/classes/class.BuildFunctions.php
Expand Up @@ -19,31 +19,33 @@ class BuildFunctions
{

static $bonusList = array(
'AttackA',
'DefensiveA',
'ShieldA',
'AttackD',
'DefensiveD',
'ShieldD',
'Attack',
'Defensive',
'Shield',
'BuildTime',
'ResearchTime',
// $new_code
'ResearchSlotPlanet',
// $new_code
'BuildTime',
'BuildSlots',
'ResearchTime',
'ResearchSlots',
'ResearchSlotPlanet',
'ShipTime',
'DefensiveTime',
'Resource',
// $new_code
'Pmetal',
'Pcrystal',
'Pdeuterium',
'Senergy',
// $new_code
'Senergy',
'ResourceStorage',
'ShipStorage',
'FlyTime',
// $new_code
'FlyTimeCom',
'FlyTimeImp',
'FlyTimeHyp',
// $new_code
'FleetSlots',
'Planets',
'SpyPower',
Expand Down Expand Up @@ -195,13 +197,15 @@ public static function getBuildingTime($USER, $PLANET, $Element, $elementPrice =
$elementCost += $elementPrice[902];
}

if (in_array($Element, $reslist['build'])) {
$time = $elementCost / ($config->game_speed * (1 + $PLANET[$resource[14]])) * pow(0.5, $PLANET[$resource[15]]) * (1 + $USER['factor']['BuildTime']);
} elseif (in_array($Element, $reslist['fleet'])) {
$time = $elementCost / ($config->game_speed * (1 + $PLANET[$resource[21]])) * pow(0.5, $PLANET[$resource[15]]) * (1 + $USER['factor']['ShipTime']);
} elseif (in_array($Element, $reslist['defense'])) {
$time = $elementCost / ($config->game_speed * (1 + $PLANET[$resource[21]])) * pow(0.5, $PLANET[$resource[15]]) * (1 + $USER['factor']['DefensiveTime']);
} elseif (in_array($Element, $reslist['tech'])) {
if(in_array($Element, $reslist['build'])) {
$time = $elementCost / ($config->game_speed * (1 + $PLANET[$resource[14]])) * pow(0.5, $PLANET[$resource[15]]) * (pow(0.99, ($USER['factor']['BuildTime'] * 100)));
}elseif (in_array($Element, $reslist['fleet'])) {
$time = $elementCost/($config->game_speed * (1 + $PLANET[$resource[14]] + $PLANET[$resource[21]])) * pow(0.88, $PLANET[$resource[15]]) * pow(0.99, $USER['factor']['ShipTime'] * 100);
}elseif (in_array($Element, $reslist['defense'])) {
$time = $elementCost/($config->game_speed * (1 + $PLANET[$resource[14]] + $PLANET[$resource[21]])) * pow(0.88, $PLANET[$resource[15]]) * pow(0.99, $USER['factor']['DefensiveTime'] * 100);
}elseif (in_array($Element, $reslist['missile'])) {
$time = $elementCost/($config->game_speed * (1 + (3 * $PLANET[$resource[44]])));
}elseif (in_array($Element, $reslist['tech'])) {
if(is_numeric($PLANET[$resource[31].'_inter']))
{
$Level = $PLANET[$resource[31]];
Expand All @@ -214,16 +218,21 @@ public static function getBuildingTime($USER, $PLANET, $Element, $elementPrice =
}
}

$time = $elementCost / (1000 * (1 + $Level)) / ($config->game_speed / 2500) * pow(1 - $config->factor_university / 100, $PLANET[$resource[6]]) * (1 + $USER['factor']['ResearchTime']);
$time = $elementCost / (1000 * (1 + $Level)) / ($config->game_speed / 2500) * pow(1 - $config->factor_university / 100, $PLANET[$resource[6]]) * (pow(0.99, $USER['factor']['ResearchTime'] * 100));
}

if($forDestroy) {
$time = floor($time * 1300);
} else {
$time = floor($time * 3600);
}

return max($time, $config->min_build_time);
if((in_array($Element, $reslist['fleet']) || in_array($Element, $reslist['defense']))){
$time = $time * 3600;
}
else{
if($forDestroy) {
$time = floor($time * 1300);
} else {
$time = floor($time * 3600);
}
$time = max($time, $config->min_build_time);
}
return $time;
}

public static function isElementBuyable($USER, $PLANET, $Element, $elementPrice = NULL, $forDestroy = false, $forLevel = NULL)
Expand Down
2 changes: 2 additions & 0 deletions includes/classes/missions/functions/GenerateReport.php
Expand Up @@ -120,8 +120,10 @@ function GenerateReport($combatResult, $reportInfo)
$DATA['rounds'][$Round]['defender'][] = $playerData;
}
$round_no++;
/*
if ($Round >= MAX_ATTACK_ROUNDS || $Destroy['att'] == count($RoundInfo['attackers']) || $Destroy['def'] == count($RoundInfo['defenders']))
break;
*/

if(isset($RoundInfo['attack'], $RoundInfo['attackShield'], $RoundInfo['defense'], $RoundInfo['defShield']))
$DATA['rounds'][$Round]['info'] = array($RoundInfo['attack'], $RoundInfo['attackShield'], $RoundInfo['defense'], $RoundInfo['defShield']);
Expand Down
12 changes: 6 additions & 6 deletions includes/classes/missions/functions/calculateAttack.php
Expand Up @@ -87,9 +87,9 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
$attackShield[$fleetID] = 0;
$attackAmount[$fleetID] = 0;

$attTech = (1 + $attacker['player']['factor']['Attack']); //attaque
$defTech = (1 + $attacker['player']['factor']['Defensive']); //bouclier
$shieldTech = (1 + $attacker['player']['factor']['Shield']); //coque
$attTech = (1 + $attacker['player']['factor']['Attack'] + $attacker['player']['factor']['AttackA']); //attaque
$defTech = (1 + $attacker['player']['factor']['Defensive'] + $attacker['player']['factor']['DefensiveA']); //bouclier
$shieldTech = (1 + $attacker['player']['factor']['Shield'] + $attacker['player']['factor']['ShieldA']); //coque
$attackers[$fleetID]['techs'] = array($attTech, $defTech, $shieldTech);

foreach ($attacker['unit'] as $element => $amount) {
Expand All @@ -113,9 +113,9 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
$defenseShield[$fleetID] = 0;
$defenseAmount[$fleetID] = 0;

$attTech = (1 + $defender['player']['factor']['Attack']); //attaquue
$defTech = (1 + $defender['player']['factor']['Defensive']); //bouclier
$shieldTech = (1 + $defender['player']['factor']['Shield']); //coque
$attTech = (1 + $defender['player']['factor']['Attack'] + $defender['player']['factor']['AttackD']); //attaquue
$defTech = (1 + $defender['player']['factor']['Defensive'] + $defender['player']['factor']['DefensiveD']); //bouclier
$shieldTech = (1 + $defender['player']['factor']['Shield'] + $defender['player']['factor']['ShieldD']); //coque
$defenders[$fleetID]['techs'] = array($attTech, $defTech, $shieldTech);

foreach ($defender['unit'] as $element => $amount) {
Expand Down

0 comments on commit f53c368

Please sign in to comment.