public int GetSelfProduction(Resource.CurrencyProducts currency) { var amount = 0; amount += _production.Storage[currency]; amount += _tempProduction.Storage[currency]; amount += _noTradeProduction.Storage[currency]; return(amount); }
public void TradeRequest(PlayerDirection playerDirection, Resource.CurrencyProducts currency) { if (CurrentSession.LocalPlayerData.CanBuyCurrency(playerDirection, currency)) { // TODO -- request } else { // TODO -- error } }
public void BuyCurrency(PlayerDirection playerDirection, Resource.CurrencyProducts currency) { var tradeCost = ResourcesBuyCost.GetCost(playerDirection, currency); // Trade process var trader = GetNeighborByDirection(playerDirection); resources.ChangeMoney(-tradeCost); trader.resources.EarnTempMoney(tradeCost); resources.EarnTempProduction(new Resource.CurrencyItem { Currency = currency, Amount = 1 }); TradeInfo.Lock(currency); }
public bool CanBuyCurrency(PlayerDirection playerDirection, Resource.CurrencyProducts currency) // Didnt trade this currency in current move // Has enough money => !TradeInfo.Check(currency) || Resources.GetMoney() < ResourcesBuyCost.GetCost(playerDirection, currency);
public void Lock(Resource.CurrencyProducts currency) => _info[currency] = false;
public bool Check(Resource.CurrencyProducts currency) => _info[currency];
public void Trade(PlayerData player, PlayerDirection playerDirection, Resource.CurrencyProducts currency) { player.BuyCurrency(playerDirection, currency); }
public void SetCost(PlayerDirection playerDirection, Resource.CurrencyProducts currency, int cost) { _resources[playerDirection][currency] = cost; }
public int GetCost(PlayerDirection playerDirection, Resource.CurrencyProducts currency) => _resources[playerDirection][currency];
public int GetTradeProduction(Resource.CurrencyProducts currency) { return(_production.Storage[currency]); }