market implement

This commit is contained in:
2026-04-21 20:24:17 +03:00
parent c41eebac87
commit a6af694482
6 changed files with 107 additions and 9 deletions

View File

@@ -114,7 +114,7 @@ window.sendCommand = async function() {
}
payload = { building_id };
} else {
} else if (type === 'recruit') {
const unit_id = document.getElementById('unit-select').value;
const amount = parseInt(document.getElementById('recruit-amount').value) || 1;
const uData = town.unit_data?.[unit_id];
@@ -142,6 +142,15 @@ window.sendCommand = async function() {
}
payload = { unit_id, amount };
} else if (type === 'market_offer') {
const offer = parseInt(document.getElementById('market-offer-amount').value) || 1000;
const offer_type = document.getElementById('market-offer-type').value;
const demand = parseInt(document.getElementById('market-demand-amount').value) || 1000;
const demand_type = document.getElementById('market-demand-type').value;
const max_delivery_time = parseInt(document.getElementById('market-max-time').value) || 1800;
const visibility = document.getElementById('market-visibility').value;
payload = { offer, offer_type, demand, demand_type, max_delivery_time, visibility };
}
try {

View File

@@ -7,6 +7,7 @@ window.onCmdTypeChange = function() {
document.getElementById('build-options').style.display = type === 'build' ? '' : 'none';
document.getElementById('recruit-options').style.display = type === 'recruit' ? '' : 'none';
document.getElementById('amount-group').style.display = type === 'recruit' ? '' : 'none';
document.getElementById('market-options').style.display = type === 'market_offer' ? '' : 'none';
};
window.renderBuildingDropdown = function() {