User prompt
müşteri yazısını fotoğrafın hemen altına getir
User prompt
müşteri gelmediğinde dükkanı kapat bekleme
User prompt
dükkan açılış saati 09.00 kapanış 19.00 bu zaman aralına göre saat yap envanter kutucuğunu düzelt açıldığı gibi kapansın
User prompt
saati düzelt
User prompt
satıcı müşteri ve söylediği şeyleri biraz yukarıya doğru çıkar
User prompt
oynayan yazısını kaldır sağ en üst köşeye saat ekle o saate göre gün bitsin
User prompt
alım yapmak ne satış yapmak istiyem müşteri aynı ada geliyor bunu düzelt
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'storage.inventory = inventory;' Line Number: 546
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'inventory.push({' Line Number: 529
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'inventory.push({' Line Number: 525
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'inventory.push({' Line Number: 515
User prompt
küçük oe ve büyük oe yi biraz aşşa al ve üstlerinde yazan yazıları daha alta a
User prompt
müşterinin resimlerini her zaman değiştir
User prompt
pazarlık et yazısına değil içeriğne ekle pazarlık et aynı kalsın alınan tüm ürünler envanterde kalsın günler değişse bile orda kalsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
pazarlık et kısmına 8 rakamını ve - işaretini ekle
User prompt
itibar da düz 10 olsun . olmasın
User prompt
itibar artıkça ürün fiyatı ve ürün kalitesi artsın itibar daha zor kazanılsın her ürün alım satımında 0,20 itibar artsın alım satımlar sırayla değil belli aralıkla olsun envanter yazısını kaldır
User prompt
çalıntı ürünlerde küçük oe şüpheli ürünlerde bişey söyleme
User prompt
şüpheli ürünler için küçük oe uyarıda bulunsun
User prompt
envanter yazısını kutunun üstüne koy envanteri açınca renkler gözükmesin 1. gün aldığım ürün satmadığım sürece hep envanterde kalsın
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var AntiqueItem = Container.expand(function () {
var self = Container.call(this);
self.init = function (name, baseValue, isCounterfeit, isStolen) {
self.itemName = name;
self.baseValue = baseValue;
self.isCounterfeit = isCounterfeit || false;
self.isStolen = isStolen || false;
self.customerPrice = Math.floor(baseValue * (0.3 + Math.random() * 0.4));
var itemGraphics = self.attachAsset('antique', {
anchorX: 0.5,
anchorY: 0.5
});
if (self.isCounterfeit) {
itemGraphics.tint = 0xFF0000;
} else if (self.isStolen) {
itemGraphics.tint = 0x800080;
}
return self;
};
return self;
});
var Button = Container.expand(function () {
var self = Container.call(this);
self.init = function (text, x, y, callback) {
self.callback = callback;
var buttonBg = self.attachAsset('buttonBG', {
anchorX: 0.5,
anchorY: 0.5
});
self.buttonText = new Text2(text, {
size: 40,
fill: 0xFFFFFF
});
self.buttonText.anchor.set(0.5, 0.5);
self.addChild(self.buttonText);
self.x = x;
self.y = y;
return self;
};
self.down = function (x, y, obj) {
if (self.callback) {
self.callback();
}
};
return self;
});
var Character = Container.expand(function () {
var self = Container.call(this);
self.init = function (type, x, y) {
self.characterType = type;
var characterGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 1.0
});
self.x = x;
self.y = y;
return self;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2F4F4F
});
/****
* Game Code
****/
// Game state variables - Reset to initial values
var currentPlayer = 'bigOE'; // 'bigOE' or 'littleOE'
var gamePhase = 'waiting'; // 'waiting', 'negotiating', 'inputting', 'selling'
var money = 100;
var reputation = 10;
var dailyCustomerCount = 0;
var maxDailyCustomers = Math.floor(reputation / 10) + 1;
var currentCustomer = null;
var currentAntique = null;
var negotiationRound = 0;
var maxNegotiationRounds = 3;
var customPriceInput = '';
var inventory = [];
// Load inventory from storage, ensuring it's always an array
try {
var storedInventory = storage.inventory;
if (Array.isArray(storedInventory)) {
inventory = storedInventory;
}
} catch (e) {
// If storage fails, keep empty array
inventory = [];
}
var isSelling = false;
var sellingPrice = 0;
// Antique types with base values that scale with reputation
// Customer types with different appearances
var customerTypes = ['customer1', 'customer2', 'customer3', 'customer4', 'customer5'];
var antiqueTypes = [{
name: 'Antika Vazo',
baseValue: 150,
rarity: 'yaygın'
}, {
name: 'Eski Tablo',
baseValue: 300,
rarity: 'nadir'
}, {
name: 'Antika Saat',
baseValue: 250,
rarity: 'orta'
}, {
name: 'Mücevher Kutusu',
baseValue: 180,
rarity: 'yaygın'
}, {
name: 'Nadir Kitap',
baseValue: 120,
rarity: 'yaygın'
}, {
name: 'Çini Takımı',
baseValue: 220,
rarity: 'orta'
}, {
name: 'Gümüş Şamdan',
baseValue: 160,
rarity: 'yaygın'
}, {
name: 'Antika Lamba',
baseValue: 140,
rarity: 'yaygın'
}, {
name: 'Antika Kılıç',
baseValue: 500,
rarity: 'çok nadir'
}, {
name: 'Roma Heykeli',
baseValue: 800,
rarity: 'efsanevi'
}];
function getScaledAntiqueValue(baseValue) {
// Scale antique value based on reputation (higher reputation = better quality items)
var reputationMultiplier = 1 + (reputation - 10) * 0.05; // 5% increase per reputation point above 10
return Math.floor(baseValue * Math.max(1, reputationMultiplier));
}
// UI Elements
var shopBackground = game.attachAsset('shopBackground', {
x: 0,
y: 0
});
var counterTop = game.attachAsset('counterTop', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1800
});
// Characters
var bigOEChar = game.addChild(new Character().init('bigOE', 800, 1800));
var littleOEChar = game.addChild(new Character().init('littleOE', 1200, 2000));
var customerChar = null;
var antiqueDisplay = null;
// Character labels
var bigOELabel = game.addChild(new Text2('Büyük OE', {
size: 40,
fill: 0xFFFFFF
}));
bigOELabel.anchor.set(0.5, 0);
bigOELabel.x = 800;
bigOELabel.y = 1600;
var littleOELabel = game.addChild(new Text2('Küçük OE', {
size: 40,
fill: 0xFFFFFF
}));
littleOELabel.anchor.set(0.5, 0);
littleOELabel.x = 1200;
littleOELabel.y = 1800;
var customerLabel = game.addChild(new Text2('', {
size: 40,
fill: 0xFFFFFF
}));
customerLabel.anchor.set(0.5, 0);
customerLabel.x = 1024;
customerLabel.y = 1150;
// UI Text elements
var moneyText = game.addChild(new Text2('Para: $' + money, {
size: 60,
fill: 0xFFFFFF
}));
moneyText.x = 100;
moneyText.y = 200;
var reputationText = game.addChild(new Text2('İtibar: ' + reputation, {
size: 60,
fill: 0xFFFFFF
}));
reputationText.x = 100;
reputationText.y = 300;
var infoText = game.addChild(new Text2('Müşteri bekleniyor...', {
size: 50,
fill: 0xFFFFFF
}));
infoText.anchor.set(0.5, 0);
infoText.x = 1024;
infoText.y = 600;
var negotiationText = game.addChild(new Text2('', {
size: 45,
fill: 0xFFFF00
}));
negotiationText.anchor.set(0.5, 0);
negotiationText.x = 1024;
negotiationText.y = 800;
var customPriceText = game.addChild(new Text2('', {
size: 40,
fill: 0x00FF00
}));
customPriceText.anchor.set(0.5, 0);
customPriceText.x = 1024;
customPriceText.y = 1000;
// Clock and day system
var gameStartTime = Date.now();
var gameHour = 9; // Start at 9 AM
var gameDay = 1;
var dayDuration = 30000; // 30 seconds = 1 game day
var hourDuration = dayDuration / 12; // 12 hours per day (9 AM to 9 PM)
var clockText = game.addChild(new Text2('Gün 1 - 09:00', {
size: 45,
fill: 0xFFFFFF
}));
clockText.anchor.set(1.0, 0);
clockText.x = 1948; // 100px from right edge to avoid platform menu
clockText.y = 100;
var stolenGoodsNotification = game.addChild(new Text2('', {
size: 35,
fill: 0xFF0000
}));
stolenGoodsNotification.anchor.set(0.5, 0);
stolenGoodsNotification.x = 1200;
stolenGoodsNotification.y = 1950;
stolenGoodsNotification.visible = false;
// Suspicious goods warning display
var suspiciousWarning = game.addChild(new Text2('', {
size: 35,
fill: 0xFF4444
}));
suspiciousWarning.anchor.set(0.5, 0);
suspiciousWarning.x = 1024;
suspiciousWarning.y = 1450;
suspiciousWarning.visible = false;
// Inventory box in bottom right corner
var inventoryBox = game.attachAsset('customerArea', {
anchorX: 1.0,
anchorY: 1.0,
x: 2048,
y: 2732,
scaleX: 0.8,
scaleY: 0.6
});
inventoryBox.tint = 0x333333;
// Make inventory box clickable
inventoryBox.down = function (x, y, obj) {
showFullInventory();
};
var fullInventoryDisplay = game.addChild(new Text2('', {
size: 45,
fill: 0xFFFFFF
}));
fullInventoryDisplay.anchor.set(0.5, 0.5);
fullInventoryDisplay.x = 1024;
fullInventoryDisplay.y = 1366;
fullInventoryDisplay.visible = false;
var inventoryOverlay = game.attachAsset('shopBackground', {
x: 0,
y: 0,
alpha: 0.8
});
inventoryOverlay.tint = 0x000000;
inventoryOverlay.alpha = 0.95;
inventoryOverlay.visible = false;
// Make overlay clickable to close inventory
inventoryOverlay.down = function (x, y, obj) {
hideFullInventory();
};
// Buttons
var acceptButton = game.addChild(new Button().init('Kabul Et', 400, 2200, acceptDeal));
var rejectButton = game.addChild(new Button().init('Reddet', 800, 2200, rejectDeal));
var bargainButton = game.addChild(new Button().init('Pazarlık Et', 1200, 2200, startBargaining));
var callPoliceButton = game.addChild(new Button().init('Polis Çağır', 1600, 2200, callPolice));
// Number input buttons
var numberButtons = [];
var inputRow1Y = 2400;
var inputRow2Y = 2500;
var clearButton = game.addChild(new Button().init('Temizle', 200, 2600, clearInput));
var subtractButton = game.addChild(new Button().init('-', 400, 2600, subtractFromInput));
var addButton = game.addChild(new Button().init('+', 600, 2600, addToInput));
var submitButton = game.addChild(new Button().init('Enter', 800, 2600, submitCustomPrice));
var sellButton = game.addChild(new Button().init('Sat', 1000, 2200, startSelling));
var inventoryButton = game.addChild(new Button().init('Envanter', 400, 2300, showInventory));
// Create number buttons 1-9 and 0
for (var i = 1; i <= 9; i++) {
var x = 200 + (i - 1) % 3 * 200;
var y = inputRow1Y + Math.floor((i - 1) / 3) * 100;
numberButtons.push(game.addChild(new Button().init(i.toString(), x, y, createNumberHandler(i.toString()))));
}
numberButtons.push(game.addChild(new Button().init('0', 400, inputRow2Y + 100, createNumberHandler('0'))));
numberButtons.push(game.addChild(new Button().init('8', 1000, 2600, createNumberHandler('8'))));
numberButtons.push(game.addChild(new Button().init('-', 1200, 2600, createNumberHandler('-'))));
// Hide UI initially
hideNegotiationUI();
hideInputUI();
function createNumberHandler(digit) {
return function () {
if (gamePhase === 'inputting' && customPriceInput.length < 5) {
customPriceInput += digit;
updateCustomPriceDisplay();
}
};
}
function clearInput() {
customPriceInput = '';
updateCustomPriceDisplay();
}
function subtractFromInput() {
if (customPriceInput.length > 0) {
customPriceInput = customPriceInput.slice(0, -1);
updateCustomPriceDisplay();
}
}
function addToInput() {
if (customPriceInput && parseInt(customPriceInput) > 0) {
var currentValue = parseInt(customPriceInput);
var newValue = currentValue + 10;
customPriceInput = newValue.toString();
updateCustomPriceDisplay();
}
}
function updateCustomPriceDisplay() {
customPriceText.setText('Teklifiniz: $' + customPriceInput);
}
function submitCustomPrice() {
if (customPriceInput && parseInt(customPriceInput) > 0) {
var offer = parseInt(customPriceInput);
processCustomOffer(offer);
customPriceInput = '';
updateCustomPriceDisplay();
hideInputUI();
gamePhase = 'negotiating';
}
}
function showInputUI() {
for (var i = 0; i < numberButtons.length; i++) {
numberButtons[i].visible = true;
}
clearButton.visible = true;
subtractButton.visible = true;
addButton.visible = true;
submitButton.visible = true;
}
function hideInputUI() {
for (var i = 0; i < numberButtons.length; i++) {
numberButtons[i].visible = false;
}
clearButton.visible = false;
subtractButton.visible = false;
addButton.visible = false;
submitButton.visible = false;
}
function showNegotiationUI() {
if (isSelling) {
acceptButton.visible = true;
rejectButton.visible = true;
bargainButton.visible = true;
callPoliceButton.visible = false;
sellButton.visible = false;
inventoryButton.visible = false;
} else {
acceptButton.visible = true;
rejectButton.visible = true;
bargainButton.visible = true;
if (currentPlayer === 'littleOE') {
callPoliceButton.visible = true;
} else {
callPoliceButton.visible = false;
}
if (currentPlayer === 'bigOE' && inventory.length > 0) {
sellButton.visible = true;
} else {
sellButton.visible = false;
}
inventoryButton.visible = true;
}
}
function hideNegotiationUI() {
acceptButton.visible = false;
rejectButton.visible = false;
bargainButton.visible = false;
callPoliceButton.visible = false;
sellButton.visible = false;
inventoryButton.visible = false;
}
function spawnCustomer() {
// Check if it's past 8 PM (day ended)
var currentTime = Date.now();
var elapsedTime = currentTime - gameStartTime;
var totalHoursPassed = Math.floor(elapsedTime / hourDuration);
var currentDayHour = totalHoursPassed % 12 + 9;
if (currentDayHour > 20) {
infoText.setText('Dükkan kapandı. Yeni güne geçiliyor...');
return;
}
// Check daily customer limit
if (dailyCustomerCount >= maxDailyCustomers) {
infoText.setText('Bugün için yeterli müşteri geldi. Dükkan kapanana kadar bekleyin...');
return;
}
if (customerChar) {
customerChar.destroy();
}
if (antiqueDisplay) {
antiqueDisplay.destroy();
}
// Randomly select customer type for visual variety
var randomCustomerType = customerTypes[Math.floor(Math.random() * customerTypes.length)];
customerChar = game.addChild(new Character().init(randomCustomerType, 1024, 1100));
dailyCustomerCount++;
if (isSelling) {
// Customer wants to BUY from the shop
customerLabel.setText('Alıcı Müşteri');
gamePhase = 'selling';
updateSellingDisplay();
} else {
// Customer wants to SELL to the shop
customerLabel.setText('Satıcı Müşteri');
// Create random antique with reputation-scaled value
var antiqueType = antiqueTypes[Math.floor(Math.random() * antiqueTypes.length)];
var scaledValue = getScaledAntiqueValue(antiqueType.baseValue);
var isCounterfeit = Math.random() < 0.15;
var isStolen = Math.random() < 0.1;
currentAntique = new AntiqueItem().init(antiqueType.name, scaledValue, isCounterfeit, isStolen);
antiqueDisplay = game.addChild(currentAntique);
antiqueDisplay.x = 1024;
antiqueDisplay.y = 1400;
gamePhase = 'negotiating';
updateInfoDisplay();
}
negotiationRound = 0;
showNegotiationUI();
}
function updateInfoDisplay() {
if (currentAntique) {
var sellingDialogues = ['Bu ' + currentAntique.itemName + ' için ' + currentAntique.customerPrice + ' dolar istiyorum.', 'Bu değerli ' + currentAntique.itemName + ' için ' + currentAntique.customerPrice + ' dolar alır mısınız?', 'Bu antika ' + currentAntique.itemName + ' için ' + currentAntique.customerPrice + ' dolar verirseniz satarım.', 'Bu güzel ' + currentAntique.itemName + ' için ' + currentAntique.customerPrice + ' dolar nasıl olur?'];
var randomDialogue = sellingDialogues[Math.floor(Math.random() * sellingDialogues.length)];
infoText.setText(randomDialogue + '\n(Enderlik: ' + antiqueTypes.find(function (a) {
return a.name === currentAntique.itemName;
}).rarity + ')');
// Show suspicious goods warning only for stolen items
if (currentAntique.isStolen) {
suspiciousWarning.setText('⚠️ ŞÜPHELİ: Bu ürün çalıntı olabilir!');
suspiciousWarning.visible = true;
} else {
suspiciousWarning.visible = false;
}
// Handle stolen goods notification for Little OE
if (currentPlayer === 'littleOE') {
if (currentAntique.isStolen) {
stolenGoodsNotification.setText('Çalıntı mal geldi!');
stolenGoodsNotification.visible = true;
} else if (currentAntique.isCounterfeit) {
stolenGoodsNotification.setText('Bu sahte olabilir...');
stolenGoodsNotification.visible = true;
} else {
stolenGoodsNotification.visible = false;
}
} else {
stolenGoodsNotification.visible = false;
}
negotiationText.setText('');
}
}
function acceptDeal() {
if (gamePhase !== 'negotiating' && gamePhase !== 'selling' || !currentAntique) return;
LK.getSound('accept').play();
if (isSelling) {
// Big OE is selling from inventory
money += sellingPrice;
reputation += 0.20;
infoText.setText('Satış başarılı! +$' + sellingPrice);
} else {
// Buying items
var profit = currentAntique.baseValue - currentAntique.customerPrice;
if (currentAntique.isStolen) {
// Caught with stolen goods
money -= 200;
reputation -= 20;
infoText.setText('Polis çalıntı mal buldu! Ceza: $200');
} else if (currentAntique.isCounterfeit) {
// Bought counterfeit
money -= currentAntique.customerPrice;
reputation -= 5;
infoText.setText('Sahte ürün aldınız! Para ve itibar kaybettiniz');
} else {
// Legitimate deal - add to inventory with day purchased
money -= currentAntique.customerPrice;
// Ensure inventory is always properly initialized before pushing
if (!inventory || !Array.isArray(inventory)) {
inventory = [];
}
try {
inventory.push({
name: currentAntique.itemName,
baseValue: currentAntique.baseValue,
buyPrice: currentAntique.customerPrice,
dayPurchased: Math.floor(LK.ticks / 3600) // Track which day item was purchased
});
} catch (e) {
// If push fails, reinitialize inventory and try again
inventory = [];
inventory.push({
name: currentAntique.itemName,
baseValue: currentAntique.baseValue,
buyPrice: currentAntique.customerPrice,
dayPurchased: Math.floor(LK.ticks / 3600)
});
}
try {
storage.inventory = inventory;
} catch (e) {
// If storage fails, continue without saving
console.log('Storage save failed:', e);
}
updateInventoryDisplay();
reputation += 0.20;
if (profit < 0) {
reputation -= 1;
}
infoText.setText('Anlaşma kabul edildi! Envantere eklendi. Kar potansiyeli: $' + profit);
}
}
updateDisplays();
endTransaction();
}
function rejectDeal() {
if (gamePhase !== 'negotiating') return;
LK.getSound('reject').play();
infoText.setText('Anlaşma reddedildi. Müşteri ayrıldı.');
endTransaction();
}
function startBargaining() {
if (gamePhase !== 'negotiating' && gamePhase !== 'selling') return;
if (!currentAntique) {
infoText.setText('Hata: Pazarlık edilecek ürün bulunamadı.');
return;
}
LK.getSound('negotiate').play();
gamePhase = 'inputting';
if (isSelling) {
infoText.setText('Satış fiyatınızı girin:\n(Şu anki teklif: $' + sellingPrice + ')');
} else {
infoText.setText('Karşı teklifinizi girin:\n(Müşteri teklifi: $' + currentAntique.customerPrice + ')');
}
hideNegotiationUI();
showInputUI();
}
function processCustomOffer(offer) {
negotiationRound++;
var difference = Math.abs(offer - currentAntique.customerPrice);
var acceptance_threshold = currentAntique.customerPrice * 0.2;
var rejection_threshold = currentAntique.customerPrice * 0.6;
if (difference <= acceptance_threshold) {
// Customer accepts
LK.getSound('accept').play();
currentAntique.customerPrice = offer;
infoText.setText('Müşteri teklifinizi kabul etti!');
LK.setTimeout(function () {
acceptDeal();
}, 1500);
} else if (difference >= rejection_threshold || negotiationRound >= maxNegotiationRounds) {
// Customer rejects or max rounds reached
LK.getSound('reject').play();
infoText.setText('Müşteri teklifinizi reddetti ve ayrıldı.');
endTransaction();
} else {
// Customer makes counter-offer
LK.getSound('negotiate').play();
var newPrice;
if (offer > currentAntique.customerPrice) {
// Player offered more, customer slightly increases their offer
newPrice = Math.floor(currentAntique.customerPrice + (offer - currentAntique.customerPrice) * 0.3);
} else {
// Player offered less, customer slightly decreases their price
newPrice = Math.floor(currentAntique.customerPrice - (currentAntique.customerPrice - offer) * 0.4);
}
currentAntique.customerPrice = newPrice;
var counterOfferDialogues = ['Hayır, ' + newPrice + ' dolar son teklifim.', 'Bu çok az, ' + newPrice + ' dolar verebilirim.', 'O fiyata olmaz, ' + newPrice + ' dolar nasıl?', 'Biraz daha yüksek olsun, ' + newPrice + ' dolar son fiyatım.'];
var randomResponse = counterOfferDialogues[Math.floor(Math.random() * counterOfferDialogues.length)];
infoText.setText(randomResponse);
negotiationText.setText('Müşteri karşı teklif yaptı - Tur: ' + negotiationRound + '/' + maxNegotiationRounds);
showNegotiationUI();
}
}
function callPolice() {
if (gamePhase !== 'negotiating' || currentPlayer !== 'littleOE') return;
LK.getSound('police').play();
if (currentAntique.isStolen) {
reputation += 10;
money += 100; // Reward for good citizenship
infoText.setText('İyi yakaladın! Çalıntı mal bildirildi. Ödül: $100');
} else {
reputation -= 2;
infoText.setText('Yanlış alarm. Müşteri alındı.');
}
updateDisplays();
endTransaction();
}
function endTransaction() {
gamePhase = 'waiting';
isSelling = false;
sellingPrice = 0;
hideNegotiationUI();
hideInputUI();
stolenGoodsNotification.visible = false;
suspiciousWarning.visible = false;
if (customerChar) {
tween(customerChar, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
customerChar.destroy();
customerChar = null;
}
});
}
if (antiqueDisplay) {
tween(antiqueDisplay, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
antiqueDisplay.destroy();
antiqueDisplay = null;
}
});
}
// Switch players
currentPlayer = currentPlayer === 'bigOE' ? 'littleOE' : 'bigOE';
updateDisplays();
// Schedule next customer with variable timing (3-8 seconds)
var nextCustomerDelay = 3000 + Math.random() * 5000;
LK.setTimeout(function () {
if (gamePhase === 'waiting') {
spawnCustomer();
}
}, nextCustomerDelay);
}
function startSelling() {
if (currentPlayer !== 'bigOE' || inventory.length === 0) return;
// Pick random item from inventory
var randomIndex = Math.floor(Math.random() * inventory.length);
var itemToSell = inventory[randomIndex];
inventory.splice(randomIndex, 1);
try {
storage.inventory = inventory;
} catch (e) {
// If storage fails, continue without saving
console.log('Storage save failed:', e);
}
updateInventoryDisplay();
// Create selling antique with markup
sellingPrice = Math.floor(itemToSell.baseValue * (0.7 + Math.random() * 0.6));
currentAntique = new AntiqueItem().init(itemToSell.name, itemToSell.baseValue, false, false);
antiqueDisplay = game.addChild(currentAntique);
antiqueDisplay.x = 1024;
antiqueDisplay.y = 1400;
isSelling = true;
gamePhase = 'selling';
updateSellingDisplay();
showNegotiationUI();
}
function showInventory() {
// Always update inventory display
updateInventoryDisplay();
}
function showFullInventory() {
if (inventory.length === 0) {
fullInventoryDisplay.setText('Henüz hiç ürün yok.\n\nÜrün almak için müşterilerle anlaşma yapın.');
} else {
var inventoryList = inventory.length + ' ürün mevcut:\n\n';
for (var i = 0; i < inventory.length; i++) {
var item = inventory[i];
var potentialProfit = item.baseValue - item.buyPrice;
inventoryList += i + 1 + '. ' + item.name + '\n';
inventoryList += ' Alış: $' + item.buyPrice + ' | Değer: $' + item.baseValue + '\n';
inventoryList += ' Kar Potansiyeli: $' + potentialProfit + '\n\n';
}
inventoryList += 'Kapatmak için tıklayın';
fullInventoryDisplay.setText(inventoryList);
}
fullInventoryDisplay.tint = 0xCCCCCC;
inventoryOverlay.visible = true;
fullInventoryDisplay.visible = true;
}
function hideFullInventory() {
inventoryOverlay.visible = false;
fullInventoryDisplay.visible = false;
}
function updateInventoryDisplay() {
// Inventory display is now handled by clicking the inventory box
// This function is kept for compatibility but doesn't display text
}
function updateSellingDisplay() {
if (isSelling && currentAntique) {
var buyingDialogues = ['Bu ' + currentAntique.itemName + ' için ' + sellingPrice + ' dolar veriyorum.', 'Bu güzel ' + currentAntique.itemName + ' için ' + sellingPrice + ' dolar öderiyim.', 'Bu ' + currentAntique.itemName + ' çok güzel, ' + sellingPrice + ' dolar veriyorum.', 'Bu ' + currentAntique.itemName + ' için ' + sellingPrice + ' dolar kabul eder misiniz?'];
var randomDialogue = buyingDialogues[Math.floor(Math.random() * buyingDialogues.length)];
infoText.setText(randomDialogue);
negotiationText.setText('Müşteri sizden satın almak istiyor');
}
}
function updateDisplays() {
moneyText.setText('Para: $' + money);
reputationText.setText('İtibar: ' + Math.floor(reputation));
// Update clock
var currentTime = Date.now();
var elapsedTime = currentTime - gameStartTime;
var totalHoursPassed = Math.floor(elapsedTime / hourDuration);
var currentDayHour = totalHoursPassed % 12 + 9; // 9 AM to 8 PM (12 hours)
var currentGameDay = Math.floor(totalHoursPassed / 12) + 1;
// Check if day has ended (after 8 PM / 20:00)
if (currentDayHour > 20) {
// Reset to next day
gameStartTime = Date.now();
gameDay = currentGameDay + 1;
dailyCustomerCount = 0;
maxDailyCustomers = Math.floor(reputation / 10) + 1;
currentDayHour = 9; // Reset to 9 AM
}
// Format hour display
var hourDisplay = currentDayHour < 10 ? '0' + currentDayHour + ':00' : currentDayHour + ':00';
clockText.setText('Gün ' + gameDay + ' - ' + hourDisplay);
// Update daily customer limit based on reputation
maxDailyCustomers = Math.floor(reputation / 10) + 1;
// Clear saved progress to restart fresh
storage.money = 100;
storage.reputation = 10;
// Check game over conditions
if (money < 0) {
LK.showGameOver();
}
}
// Clear any existing elements before restart
if (customerChar) {
customerChar.destroy();
customerChar = null;
}
if (antiqueDisplay) {
antiqueDisplay.destroy();
antiqueDisplay = null;
}
// Reset UI states
hideNegotiationUI();
hideInputUI();
stolenGoodsNotification.visible = false;
// Update displays with reset values
updateDisplays();
// Start the game
LK.setTimeout(function () {
spawnCustomer();
}, 1000);
game.update = function () {
// Handle visual feedback for current player
if (currentPlayer === 'bigOE') {
bigOEChar.alpha = 1.0;
littleOEChar.alpha = 0.6;
} else {
bigOEChar.alpha = 0.6;
littleOEChar.alpha = 1.0;
}
// Update custom price display
if (gamePhase === 'inputting') {
customPriceText.visible = true;
} else {
customPriceText.visible = false;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -202,15 +202,8 @@
fill: 0xFFFFFF
}));
reputationText.x = 100;
reputationText.y = 300;
-var playerText = game.addChild(new Text2('Oynayan: Büyük OE', {
- size: 80,
- fill: 0xFFD700
-}));
-playerText.anchor.set(0.5, 0);
-playerText.x = 1024;
-playerText.y = 400;
var infoText = game.addChild(new Text2('Müşteri bekleniyor...', {
size: 50,
fill: 0xFFFFFF
}));
@@ -230,8 +223,21 @@
}));
customPriceText.anchor.set(0.5, 0);
customPriceText.x = 1024;
customPriceText.y = 1000;
+// Clock and day system
+var gameStartTime = Date.now();
+var gameHour = 9; // Start at 9 AM
+var gameDay = 1;
+var dayDuration = 30000; // 30 seconds = 1 game day
+var hourDuration = dayDuration / 12; // 12 hours per day (9 AM to 9 PM)
+var clockText = game.addChild(new Text2('Gün 1 - 09:00', {
+ size: 45,
+ fill: 0xFFFFFF
+}));
+clockText.anchor.set(1.0, 0);
+clockText.x = 1948; // 100px from right edge to avoid platform menu
+clockText.y = 100;
var stolenGoodsNotification = game.addChild(new Text2('', {
size: 35,
fill: 0xFF0000
}));
@@ -399,20 +405,20 @@
sellButton.visible = false;
inventoryButton.visible = false;
}
function spawnCustomer() {
+ // Check if it's past 8 PM (day ended)
+ var currentTime = Date.now();
+ var elapsedTime = currentTime - gameStartTime;
+ var totalHoursPassed = Math.floor(elapsedTime / hourDuration);
+ var currentDayHour = totalHoursPassed % 12 + 9;
+ if (currentDayHour > 20) {
+ infoText.setText('Dükkan kapandı. Yeni güne geçiliyor...');
+ return;
+ }
// Check daily customer limit
if (dailyCustomerCount >= maxDailyCustomers) {
- infoText.setText('Bugün için yeterli müşteri geldi. Sonraki güne geçiliyor...');
- // Progress to next day
- LK.setTimeout(function () {
- dailyCustomerCount = 0;
- maxDailyCustomers = Math.floor(reputation / 10) + 1;
- infoText.setText('Yeni gün başladı! Müşteri bekleniyor...');
- LK.setTimeout(function () {
- spawnCustomer();
- }, 1000);
- }, 2000);
+ infoText.setText('Bugün için yeterli müşteri geldi. Dükkan kapanana kadar bekleyin...');
return;
}
if (customerChar) {
customerChar.destroy();
@@ -719,9 +725,26 @@
}
function updateDisplays() {
moneyText.setText('Para: $' + money);
reputationText.setText('İtibar: ' + Math.floor(reputation));
- playerText.setText('Oynayan: ' + (currentPlayer === 'bigOE' ? 'Büyük OE' : 'Küçük OE'));
+ // Update clock
+ var currentTime = Date.now();
+ var elapsedTime = currentTime - gameStartTime;
+ var totalHoursPassed = Math.floor(elapsedTime / hourDuration);
+ var currentDayHour = totalHoursPassed % 12 + 9; // 9 AM to 8 PM (12 hours)
+ var currentGameDay = Math.floor(totalHoursPassed / 12) + 1;
+ // Check if day has ended (after 8 PM / 20:00)
+ if (currentDayHour > 20) {
+ // Reset to next day
+ gameStartTime = Date.now();
+ gameDay = currentGameDay + 1;
+ dailyCustomerCount = 0;
+ maxDailyCustomers = Math.floor(reputation / 10) + 1;
+ currentDayHour = 9; // Reset to 9 AM
+ }
+ // Format hour display
+ var hourDisplay = currentDayHour < 10 ? '0' + currentDayHour + ':00' : currentDayHour + ':00';
+ clockText.setText('Gün ' + gameDay + ' - ' + hourDisplay);
// Update daily customer limit based on reputation
maxDailyCustomers = Math.floor(reputation / 10) + 1;
// Clear saved progress to restart fresh
storage.money = 100;