public MarketCreateBuyOrder(MarketHandler marketHandler, MarketHelper marketHelper, IMarketInfoService marketInfoService, IMarketOrderRepository marketOrderRepository) { _marketHandler = marketHandler; _marketHelper = marketHelper; _marketInfoService = marketInfoService; _marketOrderRepository = marketOrderRepository; }
/// <summary> /// Авторизация в стиме /// </summary> public void Auth() { try { _account = Web.RetryDoLogin(TimeSpan.FromSeconds(5), 10, _config.SteamLogin, _config.SteamPassword, _config.SteamMachineAuth); if (!string.IsNullOrEmpty(_account.SteamMachineAuth)) { _config.SteamMachineAuth = _account.SteamMachineAuth; Config.Save(_config); } Console.WriteLine("Авторизован!"); _timeLastLogin = DateTimeOffset.Now.ToUnixTimeSeconds(); offerHandler = new EconServiceHandler(""); marketHandler = new MarketHandler(); marketHandler.EligibilityCheck(_account.SteamId, _account.AuthContainer); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private static void PollOffers() { Console.WriteLine("Polling offers every ten seconds."); bool isPolling = true; var offerHandler = new EconServiceHandler(_apiKey); var marketHandler = new MarketHandler(); marketHandler.EligibilityCheck(_account.SteamId, _account.AuthContainer); //required to perform trades (?). Checks to see whether or not we're allowed to trade. // ReSharper disable once ConditionIsAlwaysTrueOrFalse // ReSharper disable once LoopVariableIsNeverChangedInsideLoop while (isPolling) //permanent loop, can be changed { Thread.Sleep(10000); var recData = new Dictionary <string, string> { { "get_received_offers", "1" }, { "active_only", "1" }, { "time_historical_cutoff", "999999999999" } //arbitrarily high number to retrieve latest offers }; var offers = offerHandler.GetTradeOffers(recData).TradeOffersReceived; if (offers == null) { continue; } foreach (CEconTradeOffer cEconTradeOffer in offers) { if (cEconTradeOffer.ItemsToGive == null) { offerHandler.AcceptTradeOffer(cEconTradeOffer.TradeOfferId, cEconTradeOffer.AccountIdOther, _account.AuthContainer, "1"); Console.WriteLine("Accepted a donation!"); } else { offerHandler.DeclineTradeOffer(Convert.ToUInt64(cEconTradeOffer.TradeOfferId)); Console.WriteLine("Refused a \"donation\" that would have taken items from us."); } } } }
private static void PollOffers() { Console.WriteLine("Polling offers every ten seconds."); bool isPolling = true; var offerHandler = new EconServiceHandler(_config.ApiKey); var marketHandler = new MarketHandler(); Inventory csgoInventory = new Inventory(_account.SteamId, 730); marketHandler.EligibilityCheck(_account.SteamId, _account.AuthContainer); //required to perform trades (?). Checks to see whether or not we're allowed to trade. // ReSharper disable once ConditionIsAlwaysTrueOrFalse // ReSharper disable once LoopVariableIsNeverChangedInsideLoop while (isPolling) //permanent loop, can be changed { Thread.Sleep(10000); var recData = new Dictionary <string, string> { { "get_received_offers", "1" }, { "active_only", "1" }, { "time_historical_cutoff", "999999999999" } //arbitrarily high number to retrieve latest offers }; var offers = offerHandler.GetTradeOffers(recData).TradeOffersReceived; if (offers == null) { continue; } foreach (CEconTradeOffer cEconTradeOffer in offers) { TradeOffer offer = new TradeOffer(); offer.Them.Assets = cEconTradeOffer.ItemsToReceive; offer.Me.Assets.Add(csgoInventory.Items.First().Value.Items.First().ToCEconAsset(730)); offerHandler.ModifyTradeOffer(IdConversions.AccountIdToUlong(cEconTradeOffer.AccountIdOther), "Here you go!", "1", cEconTradeOffer.TradeOfferId, offer, _account.AuthContainer); } } }
public MarketBuyItem(MarketHandler marketHandler, MarketHelper marketHelper, IMarketOrderRepository marketOrderRepository) { _marketHandler = marketHandler; _marketHelper = marketHelper; _marketOrderRepository = marketOrderRepository; }
public MarketInsertAverageForCF(IEntityServices entityServices, ItemPriceHelper itemPriceHelper, MarketHandler marketHandler) { _entityServices = entityServices; _itemPriceHelper = itemPriceHelper; _marketHandler = marketHandler; }
public PriceCalculator(MarketHandler marketHandler, IProductionDataAccess productionDataAccess, IRobotTemplateRelations robotTemplateRelations) { _marketHandler = marketHandler; _productionDataAccess = productionDataAccess; _robotTemplateRelations = robotTemplateRelations; }
// Update is called once per frame void Update() { if (tooltipOn == true) { tooltipPanel.SetActive(true); tooltip1.enabled = true; BuildingValue(); } if (tooltipOn == false) { tooltip1.enabled = false; tooltipPanel.SetActive(false); } if (uiChange != uiState) { if (uiState == "Main") { mainPanel.SetActive(true); heroesPanel.SetActive(false); governmentPanel.SetActive(false); marketPanel.SetActive(false); buildPanel.SetActive(false); buildCat.SetActive(false); buildingSelectedPanel.SetActive(false); buildGatheringPanel.SetActive(false); buildRefiningPanel.SetActive(false); //hireButton.onClick.RemoveAllListeners(); //questButton.onClick.RemoveAllListeners(); characterSelPanel.SetActive(false); armouryPanel.SetActive(false); tooltipOn = false; armouryOnPanel.SetActive(false); characterStatsPanel.SetActive(false); } if (uiState == "Build") { marketPanel.SetActive(false); buildPanel.SetActive(true); buildCat.SetActive(true); heroesPanel.SetActive(false); governmentPanel.SetActive(false); mainPanel.SetActive(false); buildGatheringPanel.SetActive(false); buildRefiningPanel.SetActive(false); buildingSelectedPanel.SetActive(false); tooltipOn = false; armouryPanel.SetActive(false); characterStatsPanel.SetActive(false); } if (uiState == "Building Selected") { buildingSelectedPanel.SetActive(true); heroesPanel.SetActive(false); governmentPanel.SetActive(false); buildPanel.SetActive(false); mainPanel.SetActive(false); buildGatheringPanel.SetActive(false); buildRefiningPanel.SetActive(false); buildCat.SetActive(false); characterSelPanel.SetActive(false); marketPanel.SetActive(false); armouryPanel.SetActive(false); characterStatsPanel.SetActive(false); } if (uiState == "Build Gathering") { marketPanel.SetActive(false); //buildPanel.SetActive(false); buildGatheringPanel.SetActive(true); buildCat.SetActive(false); heroesPanel.SetActive(false); governmentPanel.SetActive(false); mainPanel.SetActive(false); buildingSelectedPanel.SetActive(false); buildRefiningPanel.SetActive(false); tooltipOn = false; } if (uiState == "Build Refining") { marketPanel.SetActive(false); //buildPanel.SetActive(false); buildRefiningPanel.SetActive(true); buildCat.SetActive(false); heroesPanel.SetActive(false); governmentPanel.SetActive(false); mainPanel.SetActive(false); buildingSelectedPanel.SetActive(false); buildGatheringPanel.SetActive(false); tooltipOn = false; } if (uiState == "Build Heroes") { marketPanel.SetActive(false); //buildPanel.SetActive(false); heroesPanel.SetActive(true); buildCat.SetActive(false); governmentPanel.SetActive(false); mainPanel.SetActive(false); buildingSelectedPanel.SetActive(false); buildGatheringPanel.SetActive(false); buildRefiningPanel.SetActive(false); tooltipOn = false; } if (uiState == "Build Government") { marketPanel.SetActive(false); //buildPanel.SetActive(false); governmentPanel.SetActive(true); heroesPanel.SetActive(false); buildCat.SetActive(false); mainPanel.SetActive(false); buildingSelectedPanel.SetActive(false); buildGatheringPanel.SetActive(false); buildRefiningPanel.SetActive(false); tooltipOn = false; } if (uiState == "CharacterSelected") { characterSelPanel.SetActive(true); buildPanel.SetActive(false); governmentPanel.SetActive(false); heroesPanel.SetActive(false); buildCat.SetActive(false); mainPanel.SetActive(false); buildingSelectedPanel.SetActive(false); buildGatheringPanel.SetActive(false); buildRefiningPanel.SetActive(false); tooltipOn = false; armouryPanel.SetActive(false); marketPanel.SetActive(false); armouryOnPanel.SetActive(false); } } uiChange = uiState; if (uiState == "CharacterSelected") { characterPanelButton.enabled = false; if (characterRef) { armourIcon.sprite = emptyInventory; string name = "No Name", className = "No Class", level = "1"; CharacterHealthHandler healthRef = characterRef.GetComponent <CharacterHealthHandler>(); CharacterStats statsRef = characterRef.GetComponent <CharacterStats>(); healthBar.maxValue = healthRef.maxHealth; healthBar.value = healthRef.currentHealth; if (characterRef.tag != "Hero") { questButton.interactable = true; questButton.onClick.AddListener(() => { QuestDatabase.questDB.AddQuest(characterRef); }); characterName.text = "Enemy"; characterHP.text = "Health: " + characterRef.GetComponent <CharacterHealthHandler>().currentHealth; } else { weaponIcon.color = new Color(1, 1, 1, 0); Color noAlpha = new Color(armourIcon.color.r, armourIcon.color.g, armourIcon.color.b, 1); questButton.interactable = false; characterHP.text = "Health: " + characterRef.GetComponent <CharacterHealthHandler>().currentHealth; //hireButton.enabled = false; //upgradeButton.enabled = false; if (characterRef.GetComponent <WarriorHandler>()) { weaponIcon.color = new Color(1, 1, 1, 0); WarriorHandler warRef = characterRef.GetComponent <WarriorHandler>(); name = characterRef.GetComponent <WarriorHandler>().myName; characterName.text = "Name: " + name; className = "Warrior"; characterPanelButton.enabled = true; if (warRef.tier1Weapon) { weaponIcon.sprite = meleeWT1Sprite; weaponIcon.color = noAlpha; } } if (characterRef.GetComponent <RangerHandler>()) { RangerHandler rangerRef = characterRef.GetComponent <RangerHandler>(); name = characterRef.GetComponent <RangerHandler>().myName; characterName.text = "Name: " + name; className = "Ranger"; characterPanelButton.enabled = true; if (rangerRef.tier1Weapon) { weaponIcon.sprite = rangedWT1Sprite; weaponIcon.color = noAlpha; } } } if (characterStatsPanel.activeSelf) { characterStatsTxt.text = "Strenght:" + statsRef.strenght + "\nAgility:" + statsRef.agility + "\nStamina:" + statsRef.stamina + "\nIntelect:" + statsRef.intelect + "\nArmour:" + statsRef.armor + "\nMoney:" + characterRef.GetComponent <HeroMoney>().currentMoney; characterDetailsTxt.text = "Name: " + name + "\nClass: " + className + "\nLevel: " + level; } } //else uiState = "Main"; } //building selected block if (uiState == "Building Selected") { ////////////////////////////////////////////Carpentry Block////////////////////////////////////// if (selectedBuilding == "Carpenter") { hireButton.interactable = true; CarpentryHandler carpenterRef = buildingRef.GetComponent <CarpentryHandler>(); if (carpenterRef.buildingOn) { carpenterMoney.text = "Carpenter Available Money: " + (int)carpenterRef.carpentryMoney; hireButton.interactable = false; workProgress.enabled = true; } else { hireButton.interactable = true; workProgress.enabled = false; } if (lastBSelected != buildingRef) { lastBSelected = buildingRef; //hireButtonRef.SetActive(false); txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(carpenterRef.HireCarpenter); } if (carpenterRef.buildBed) { workProgress.text = "Constructing Bed: " + Mathf.RoundToInt(carpenterRef.workProgress) + "%"; } if (carpenterRef.buildTable) { workProgress.text = "Constructing Table: " + Mathf.RoundToInt(carpenterRef.workProgress) + "%"; } if (carpenterRef.buildChair) { workProgress.text = "Constructing Chair: " + Mathf.RoundToInt(carpenterRef.workProgress) + "%"; } if (!carpenterRef.buildBed && !carpenterRef.buildTable && !carpenterRef.buildChair) { workProgress.text = "No money for raw resources"; } } else { carpenterMoney.text = ""; } //////////////Armoury block//////////////////////////////////// if (selectedBuilding == "Armoury") { ArmoryHandler armRef = buildingRef.GetComponent <ArmoryHandler>(); if (lastBSelected != buildingRef) { armouryChange = true; lastBSelected = buildingRef; txt_buildingName.text = buildingRef.tag; armouryHire.onClick.RemoveAllListeners(); buildingSelectedPanel.SetActive(false); armouryPanel.SetActive(true); } armouryMoney.text = "Available Money: " + armRef.armouryMoney; if (armRef.working) { armouryWorkingPercent.text = "Working: " + (int)armRef.workProgress; } else { armouryWorkingPercent.text = ""; } if (armouryChange) { buildingSelectedPanel.SetActive(false); armouryChange = false; if (armRef.buildingOn) { buildingSelectedPanel.SetActive(false); armouryPanel.SetActive(false); armouryOnPanel.SetActive(true); armouryOffPanel.SetActive(false); if (armRef.meleeTier1) { armouryMTier1.SetActive(true); armouryMeleeT1Count.text = armRef.tier1MCount.ToString(); } else { armouryMTier1.SetActive(false); } if (armRef.meleeTier2) { armouryMTier2.SetActive(true); } else { armouryMTier2.SetActive(false); } if (armRef.meleeTier3) { armouryMTier3.SetActive(true); } else { armouryMTier3.SetActive(false); } if (armRef.rangedTier1) { armouryRTier1.SetActive(true); armouryRangedT1Count.text = armRef.tier1RCount.ToString(); } else { armouryRTier1.SetActive(false); } if (armRef.rangedTier2) { armouryRTier2.SetActive(true); } else { armouryRTier2.SetActive(false); } if (armRef.rangedTier3) { armouryRTier3.SetActive(true); } else { armouryRTier3.SetActive(false); } } else { armouryPanel.SetActive(true); armouryOnPanel.SetActive(false); armouryOffPanel.SetActive(true); armouryHire.onClick.AddListener(armRef.HireSmith); buildingSelectedPanel.SetActive(false); } } } else { armouryOnPanel.SetActive(false); } if (selectedBuilding == "Farmhouse") { hireButton.interactable = true; FarmhouseHandler farmRef = buildingRef.GetComponent <FarmhouseHandler>(); if (farmRef.buildingOn) { hireButton.interactable = false; workProgress.enabled = true; } else { hireButton.interactable = true; workProgress.enabled = false; } if (lastBSelected != buildingRef) { debugResource.text = farmRef.grainAmmount.ToString(); lastBSelected = buildingRef; //hireButtonRef.SetActive(false); txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(farmRef.HireWorker); } farmRef.grainAmmount = int.Parse(debugResource.text); //DEBUG STUFF workProgress.text = "Growing Crops: " + (int)farmRef.progressGrain + "%"; } if (selectedBuilding == "Mine") { hireButton.interactable = true; MineHandler mineRef = buildingRef.GetComponent <MineHandler>(); if (mineRef.buildingOn) { hireButton.interactable = false; workProgress.enabled = true; } else { hireButton.interactable = true; workProgress.enabled = false; } if (lastBSelected != buildingRef) { debugResource.text = mineRef.ironAmmount.ToString(); lastBSelected = buildingRef; //hireButtonRef.SetActive(false); txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(mineRef.HireMiner); } mineRef.ironAmmount = int.Parse(debugResource.text); if (mineRef.mining) { workProgress.text = "Mining: " + (int)mineRef.progressMining + "%"; } if (mineRef.processingOre) { workProgress.text = "Smelting: " + (int)mineRef.progressSmelt + "%"; } } if (selectedBuilding == "Quarry") { QuarryHandler quarryRef = buildingRef.GetComponent <QuarryHandler>(); if (lastBSelected != buildingRef) { debugResource.text = quarryRef.stoneAmmount.ToString(); lastBSelected = buildingRef; //hireButtonRef.SetActive(false); txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(quarryRef.HireWorker); } quarryRef.stoneAmmount = int.Parse(debugResource.text); if (quarryRef.buildingOn) { hireButton.interactable = false; workProgress.enabled = true; } else { hireButton.interactable = true; workProgress.enabled = false; } workProgress.text = "Cutting Stone: " + (int)quarryRef.progressStone + "%"; } if (selectedBuilding == "Lumber Mill") { LumberMillHandler lMRef = buildingRef.GetComponent <LumberMillHandler>(); if (lMRef.buildingOn) { hireButton.interactable = false; workProgress.enabled = true; } else { hireButton.interactable = true; workProgress.enabled = false; } workProgress.text = "Processing Wood: " + (int)lMRef.processingPercent + "%"; if (moneyRef.currentMoney > lMRef.upgradeCost) { upgradeButton.interactable = true; upgradeButton.onClick.RemoveAllListeners(); upgradeButton.onClick.AddListener(lMRef.UpgradeBuilding); } else { upgradeButton.interactable = false; } if (lastBSelected != buildingRef) { debugResource.text = lMRef.woodAmmount.ToString(); lastBSelected = buildingRef; hireButton.enabled = true; txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(lMRef.HireLumberjack); } lMRef.woodAmmount = int.Parse(debugResource.text); } //else workProgress.text = ""; if (selectedBuilding == "Warrior Guild") { hireButton.interactable = true; if (lastBSelected != buildingRef) { workProgress.enabled = false; lastBSelected = buildingRef; txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(buildingRef.GetComponent <HeroHallHandler>().CreateWarrior); } } if (selectedBuilding == "Archery Guild") { hireButton.interactable = true; if (lastBSelected != buildingRef) { workProgress.enabled = false; lastBSelected = buildingRef; txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); hireButton.onClick.AddListener(buildingRef.GetComponent <HeroHallHandler>().CreateRanger); } } ////////////////////////Market block///////////////////////////////// if (selectedBuilding == "Market") { MarketHandler marketRef = buildingRef.GetComponent <MarketHandler>(); if (lastBSelected != buildingRef) { mRef = buildingRef.GetComponent <MarketHandler>(); marketState = "Main"; marketChange = true; lastBSelected = buildingRef; txt_buildingName.text = buildingRef.tag; hireButton.onClick.RemoveAllListeners(); } if (marketState == "Main" && marketChange) { marketChange = false; marketMainPanel.SetActive(true); marketPanel.SetActive(true); marketBuyPanel.SetActive(false); buildingSelectedPanel.SetActive(false); marketAutomationPanel.SetActive(false); marketInventoryPanel.SetActive(false); return; } if (marketState == "Buy") { if (marketChange) { marketBuyPanel.SetActive(true); marketChange = false; marketMainPanel.SetActive(false); marketAutomationPanel.SetActive(false); marketInventoryPanel.SetActive(false); if (!marketSetup) { marketSetup = true; marketM1.interactable = false; marketM1.onClick.AddListener(marketRef.marketMultiplierX1); marketM5.onClick.AddListener(marketRef.marketMultiplierX5); marketM10.onClick.AddListener(marketRef.marketMultiplierX10); marketM50.onClick.AddListener(marketRef.marketMultiplierX50); marketBuyIron.onClick.AddListener(marketRef.BuyIron); marketSellIron.onClick.AddListener(marketRef.SellIron); marketBuyWood.onClick.AddListener(marketRef.BuyWood); marketSellWood.onClick.AddListener(marketRef.SellWood); marketBuyStone.onClick.AddListener(marketRef.BuyStone); marketSellStone.onClick.AddListener(marketRef.SellStone); marketBuyGrain.onClick.AddListener(marketRef.BuyGrain); marketSellGrain.onClick.AddListener(marketRef.SellGrain); } } if (tooltipOn) { marketRef.AddTooltip(marketTooltip); } return; } if (marketState == "Automate") { if (marketChange) { marketAutomationPanel.SetActive(true); marketChange = false; marketMainPanel.SetActive(false); marketBuyPanel.SetActive(false); marketInventoryPanel.SetActive(false); return; } } if (marketState == "Inventory" && marketChange) { marketInventoryPanel.SetActive(true); marketChange = false; marketMainPanel.SetActive(false); marketBuyPanel.SetActive(false); marketAutomationPanel.SetActive(false); } if (marketState == "Inventory") { marketIron.text = "Iron: " + moneyRef.currentIron; marketWood.text = "Wood: " + moneyRef.currentWood; marketStone.text = "Stone: " + moneyRef.currentStone; marketGems.text = "Gems: " + moneyRef.currentGems; } ////////////////////////////////////////////////////////////////////////////////////////////////// } else { if (marketState != "") { //marketMainPanel.SetActive(false); marketPanel.SetActive(false); marketBuyPanel.SetActive(false); marketState = ""; marketInventoryPanel.SetActive(false); marketAutomationPanel.SetActive(false); //buildingSelectedPanel.SetActive(true); } } } ///////////////////////////////////////building selected block end////////////////////////////////////////////////////////////////////////////// }
public MarketGetDefinitionAveragePrice(IEntityServices entityServices, IMarketInfoService marketInfoService, MarketHandler marketHandler) { _entityServices = entityServices; _marketInfoService = marketInfoService; _marketHandler = marketHandler; }
public MarketGlobalAveragePrices(MarketHandler marketHandler) { _marketHandler = marketHandler; }
public MarketItemsInRange(MarketHandler marketHandler, IMarketOrderRepository marketOrderRepository) { _marketHandler = marketHandler; _marketOrderRepository = marketOrderRepository; }