Пример #1
0
			$weapon->weaponStrength += $toRepair;
			$user->cacheStats();
			$weapon->save();
		}
		else {
			$t->err = 'Not enough gold';
		}
	}
}

else if ($filtered['sell'] and $filtered['wId']) {
	$weapon = new Weapon();
	$weapon->get($filtered['wId']);
	if ($weapon->userId == $user->id) {
		$toSell = min($filtered['sell'], $weapon->weaponCount);
		$cost = $weapon->getSellCost($user, $toSell);
		$user->bank += $cost;
		$weapon->weaponCount -= $toSell;
		if ($weapon->weaponCount <= 0) {
			$weapon->delete();
		}
		else {
			$weapon->save();
		}
		$user->cacheStats();
	}
}

else if($filtered['armoury-buy']) {

	/// TODO: make this section better