public static ItemInfo FromItemData(ItemData item, IList<Rarity> rarities, IList<ItemType> types) { ItemInfo info = new ItemInfo(); info.Id = item.DataId; info.Name = item.Name; info.Rarity = rarities.Where(r => r.Id == item.Rarity).FirstOrDefault().Name; info.Type = types.Where(t => t.Id == item.TypeId).FirstOrDefault().Name; info.BuyPrice = item.MaxOfferUnitPrice; info.SellPrice = item.MinSaleUnitPrice; return info; }
public static void LoadItem(ItemInfo i, int copperWatchFlag = 0) { OverlayManager.ExecuteJavascript(string.Format("loadItem({0});", string.Format("{{\"name\":\"{0}\", \"buy\":{1}, \"sell\":{2}, \"margin\":{3}, \"watchFlag\":{4}}}", i.Name, i.BuyPrice.ToString(), i.SellPrice.ToString(), i.ProfitMargin.ToString(), copperWatchFlag.ToString().ToLower()))); }
private void HotKeyPressed(object sender, HotKeyManager.HotKeyEventArgs e) { bool lockTaken = false; try { m_SpinLock.Enter(ref lockTaken); if (e.Modifiers == 0 && m_CurrentItem != null) { SpinWait.SpinUntil(() => !HotKeyManager.IsKeyPressed(e.Key)); if (m_KeyHook_KEYS.Contains(e.Key)) { long buyPrice = m_CurrentItem.BuyPrice + 1; if (CopperValue >= 0) { buyPrice = (long)((Math.Floor(m_CurrentItem.BuyPrice / 100.0) * 100) + CopperValue); if (buyPrice <= m_CurrentItem.BuyPrice + 1) buyPrice += 100; } long buyPriceC = (buyPrice % 100); long buyPriceS = (long)(Math.Floor(buyPrice / 100.0) % 100); long buyPriceG = (long)(Math.Floor(buyPrice / 10000.0)); switch (m_CurrentState) { case HandlerState.SEARCH: SendKeys.Send(m_CurrentItem.Name); m_CurrentState = HandlerState.ENTERG; break; case HandlerState.ENTERG: SendKeys.Send(buyPriceG.ToString()); m_CurrentState = HandlerState.ENTERS; break; case HandlerState.ENTERS: SendKeys.Send(buyPriceS.ToString()); m_CurrentState = HandlerState.ENTERC; break; case HandlerState.ENTERC: SendKeys.Send(buyPriceC.ToString()); m_CurrentState = HandlerState.NEXT; break; case HandlerState.NEXT: m_CurrentItem = null; m_CurrentState = HandlerState.SEARCH; break; } } else if (m_KeyHook_KEYS_SKIP.Contains(e.Key)) { m_CurrentItem = null; m_CurrentState = HandlerState.SEARCH; } } } finally { if (lockTaken) m_SpinLock.Exit(); } }