public PyDataType CharGetNewTransactions(PyInteger sellBuy, PyInteger typeID, PyNone clientID, PyInteger quantity, PyNone fromDate, PyNone maxPrice, PyInteger minPrice, CallInformation call) { int callerCharacterID = call.Client.EnsureCharacterIsSelected(); TransactionType transactionType = TransactionType.Either; if (sellBuy is PyInteger) { switch ((int)(sellBuy as PyInteger)) { case 0: transactionType = TransactionType.Sell; break; case 1: transactionType = TransactionType.Buy; break; } } return(this.DB.CharGetNewTransactions( callerCharacterID, clientID, transactionType, typeID as PyInteger, quantity, minPrice )); }
public PyDataType BeanCount(PyInteger stackID, CallInformation call) { PyTuple res = new PyTuple(2); res[0] = new PyNone(); res[1] = new PyInteger(0); return(res); }
public PyDataType BeanCount(PyInteger stackID, PyDictionary namedPayload, object client) { PyTuple res = new PyTuple(2); res[0] = new PyNone(); res[1] = new PyInteger(0); return(res); }
private void _read() { _type = ((ObjectType)m_io.ReadU1()); switch (Type) { case ObjectType.String: { _value = new PyString(m_io, this, m_root); break; } case ObjectType.Tuple: { _value = new Tuple(m_io, this, m_root); break; } case ObjectType.Int: { _value = m_io.ReadU4le(); break; } case ObjectType.PyTrue: { _value = new PyTrue(m_io, this, m_root); break; } case ObjectType.PyFalse: { _value = new PyFalse(m_io, this, m_root); break; } case ObjectType.None: { _value = new PyNone(m_io, this, m_root); break; } case ObjectType.StringRef: { _value = new StringRef(m_io, this, m_root); break; } case ObjectType.CodeObject: { _value = new CodeObject(m_io, this, m_root); break; } case ObjectType.Interned: { _value = new InternedString(m_io, this, m_root); break; } } }
public PyDataType BookmarkLocation(PyInteger itemID, PyNone unk, PyString name, PyString comment, CallInformation call) { if (ItemManager.IsStaticData(itemID) == false) { throw new CustomError("Bookmarks for non-static locations are not supported yet!"); } ItemEntity item = this.ItemManager.GetItem(itemID); if (item.HasPosition == false) { throw new CustomError("Cannot bookmark a non-location item"); } ulong bookmarkID = this.DB.CreateBookmark(call.Client.EnsureCharacterIsSelected(), item.ID, item.Type.ID, name, comment, (double)item.X, (double)item.Y, (double)item.Z, item.LocationID); PyDataType bookmark = KeyVal.FromDictionary(new PyDictionary { ["bookmarkID"] = bookmarkID, ["itemID"] = item.ID, ["typeID"] = item.Type.ID, ["memo"] = name, ["comment"] = comment, ["x"] = item.X, ["y"] = item.Y, ["z"] = item.Z, ["locationID"] = item.LocationID, ["created"] = DateTime.UtcNow.ToFileTimeUtc() } ); // send a request to the client to update the bookmarks call.Client.ClusterConnection.SendServiceCall(call.Client, "addressbook", "OnBookmarkAdd", new PyTuple(1) { [0] = bookmark }, new PyDictionary(), null, null, null, 0); return(new PyTuple(7) { [0] = bookmarkID, // bookmarkID [1] = itemID, // itemID [2] = item.Type.ID, // typeID [3] = item.X, // x [4] = item.Y, // y [5] = item.Z, // z [6] = item.LocationID //locationID }); }
public PyDataType GetInventory(PyInteger containerID, PyNone none, CallInformation call) { int callerCharacterID = call.Client.EnsureCharacterIsSelected(); ItemFlags flag = ItemFlags.None; switch ((int)containerID) { case (int)ItemContainer.Wallet: flag = ItemFlags.Wallet; break; case (int)ItemContainer.Hangar: flag = ItemFlags.Hangar; break; case (int)ItemContainer.Character: flag = ItemFlags.Skill; break; case (int)ItemContainer.Global: flag = ItemFlags.None; break; default: throw new CustomError($"Trying to open container ID ({containerID.Value}) is not supported"); } // get the inventory item first ItemEntity inventoryItem = this.ItemManager.LoadItem(this.mObjectID); // also make sure it's a container if (inventoryItem is ItemInventory == false) { throw new ItemNotContainer(inventoryItem.ID); } // build the meta inventory item now ItemInventory inventoryByOwner = this.ItemManager.MetaInventoryManager.RegisterMetaInventoryForOwnerID(inventoryItem as ItemInventory, callerCharacterID); // create an instance of the inventory service and bind it to the item data return(BoundInventory.BindInventory(this.ItemDB, inventoryByOwner, flag, this.ItemManager, this.NodeContainer, this.BoundServiceManager)); }
// TODO: THIS PyNone SHOULD REALLY BE AN INTEGER, ALTHOUGH THIS FUNCTIONALITY IS NOT USED // TODO: IT REVEALS AN IMPORTANT ISSUE, WE CAN'T HAVE A WILDCARD PARAMETER PyDataType public PyDataType SelectCharacterID(PyInteger characterID, PyInteger loadDungeon, PyNone secondChoiceID, CallInformation call) { // ensure the character belongs to the current account Character character = this.ItemManager.LoadItem(characterID) as Character; if (character.AccountID != call.Client.AccountID) { // unload character this.ItemManager.UnloadItem(character); // throw proper error throw new CustomError("The selected character does not belong to this account, aborting..."); } // update the session data for this client call.Client.CharacterID = character.ID; call.Client.CorporationID = character.CorporationID; if (character.StationID == 0) { call.Client.SolarSystemID = character.SolarSystemID; } else { call.Client.StationID = character.StationID; } call.Client.SolarSystemID2 = character.SolarSystemID; call.Client.ConstellationID = character.ConstellationID; call.Client.RegionID = character.RegionID; call.Client.HQID = 0; call.Client.CorporationRole = character.CorpRole; call.Client.RolesAtAll = character.RolesAtAll; call.Client.RolesAtBase = character.RolesAtBase; call.Client.RolesAtHQ = character.RolesAtHq; call.Client.RolesAtOther = character.RolesAtOther; call.Client.ShipID = character.LocationID; // TODO: CHECK WHAT NODE HAS THE SOLAR SYSTEM LOADED AND PROPERLY LET THE CLIENT KNOW call.Client.SendSessionChange(); // update the character and set it's only flag to true character.Online = 1; // the online status must be persisted after update, so force the entity to be updated in the database character.Persist(); // unload the character, let the session change handler handle everything // TODO: CHECK IF THE PLAYER IS GOING TO SPAWN IN THIS NODE AND IF IT IS NOT, UNLOAD IT FROM THE ITEM MANAGER List <int> onlineFriends = this.DB.GetOnlineFriendList(character); foreach (int friendID in onlineFriends) { call.Client.ClusterConnection.SendNotification("OnContactLoggedOn", "charid", friendID, new PyTuple(1) { [0] = character.ID }); } return(null); }
public PyDataType SelectCharacterID(PyInteger characterID, PyBool loadDungeon, PyNone secondChoiceID, CallInformation call) { return(this.SelectCharacterID(characterID, loadDungeon == true ? 1 : 0, secondChoiceID, call)); }
public PyDataType GetInitVals(PyDictionary namedPayload, Client client) { if (this.ServiceManager.CacheStorage.Exists("machoNet.serviceInfo") == false) { // Cache does not exists, create it PyDictionary dict = new PyDictionary(); // this cached object indicates where the packets should be directed to when the client // wants to communicate with a service (as in PyAddress types or integers) dict["trademgr"] = "station"; dict["tutorialSvc"] = "station"; dict["bookmark"] = "station"; dict["slash"] = "station"; dict["wormholeMgr"] = "station"; dict["account"] = "station"; dict["gangSvc"] = "station"; dict["contractMgr"] = "station"; dict["LSC"] = "location"; dict["station"] = "location"; dict["config"] = "locationPreferred"; dict["scanMgr"] = "solarsystem"; dict["keeper"] = "solarsystem"; dict["stationSvc"] = new PyNone(); dict["zsystem"] = new PyNone(); dict["invbroker"] = new PyNone(); dict["droneMgr"] = new PyNone(); dict["userSvc"] = new PyNone(); dict["map"] = new PyNone(); dict["beyonce"] = new PyNone(); dict["standing2"] = new PyNone(); dict["ram"] = new PyNone(); dict["DB"] = new PyNone(); dict["posMgr"] = new PyNone(); dict["voucher"] = new PyNone(); dict["entity"] = new PyNone(); dict["damageTracker"] = new PyNone(); dict["agentMgr"] = new PyNone(); dict["dogmaIM"] = new PyNone(); dict["machoNet"] = new PyNone(); dict["dungeonExplorationMgr"] = new PyNone(); dict["watchdog"] = new PyNone(); dict["ship"] = new PyNone(); dict["DB2"] = new PyNone(); dict["market"] = new PyNone(); dict["dungeon"] = new PyNone(); dict["npcSvc"] = new PyNone(); dict["sessionMgr"] = new PyNone(); dict["allianceRegistry"] = new PyNone(); dict["cache"] = new PyNone(); dict["character"] = new PyNone(); dict["factory"] = new PyNone(); dict["facWarMgr"] = new PyNone(); dict["corpStationMgr"] = new PyNone(); dict["authentication"] = new PyNone(); dict["effectCompiler"] = new PyNone(); dict["charmgr"] = new PyNone(); dict["BSD"] = new PyNone(); dict["reprocessingSvc"] = new PyNone(); dict["billingMgr"] = new PyNone(); dict["billMgr"] = new PyNone(); dict["lookupSvc"] = new PyNone(); dict["emailreader"] = new PyNone(); dict["lootSvc"] = new PyNone(); dict["http"] = new PyNone(); dict["repairSvc"] = new PyNone(); dict["gagger"] = new PyNone(); dict["dataconfig"] = new PyNone(); dict["lien"] = new PyNone(); dict["i2"] = new PyNone(); dict["pathfinder"] = new PyNone(); dict["alert"] = new PyNone(); dict["director"] = new PyNone(); dict["dogma"] = new PyNone(); dict["aggressionMgr"] = new PyNone(); dict["corporationSvc"] = new PyNone(); dict["certificateMgr"] = new PyNone(); dict["clones"] = new PyNone(); dict["jumpCloneSvc"] = new PyNone(); dict["insuranceSvc"] = new PyNone(); dict["corpmgr"] = new PyNone(); dict["warRegistry"] = new PyNone(); dict["corpRegistry"] = new PyNone(); dict["objectCaching"] = new PyNone(); dict["counter"] = new PyNone(); dict["petitioner"] = new PyNone(); dict["LPSvc"] = new PyNone(); dict["clientStatsMgr"] = new PyNone(); dict["jumpbeaconsvc"] = new PyNone(); dict["debug"] = new PyNone(); dict["languageSvc"] = new PyNone(); dict["skillMgr"] = new PyNone(); dict["voiceMgr"] = new PyNone(); dict["onlineStatus"] = new PyNone(); dict["gangSvcObjectHandler"] = new PyNone(); this.ServiceManager.CacheStorage.Store("machoNet.serviceInfo", dict, DateTime.Now.ToFileTimeUtc()); } PyDataType srvInfo = this.ServiceManager.CacheStorage.GetHint("machoNet.serviceInfo"); PyTuple res = new PyTuple(2); PyDictionary initvals = this.ServiceManager.CacheStorage.GetHints(CacheStorage.LoginCacheTable); res[0] = srvInfo; res[1] = initvals; return(res); }
public PyObjectData GetMarketGroups() { // this one is a messy boy, there is a util.FilterRowset which is just used here presumably // due to this being an exclusive case, better build it manually and call it a day Rowset result = Database.PrepareRowsetQuery("SELECT marketGroupID, parentGroupID, marketGroupName, description, graphicID, hasTypes, 0 AS types, 0 AS dataID FROM invMarketGroups ORDER BY parentGroupID"); // build some dicts to know what points where Dictionary <int, List <int> > marketToTypeID = new Dictionary <int, List <int> >(); // Dictionary<int, int> marketToParent = new Dictionary<int, int>(); Dictionary <int, List <int> > parentToMarket = new Dictionary <int, List <int> >(); Dictionary <int, List <int> > marketTypeIDsMap = new Dictionary <int, List <int> >(); MySqlConnection connection = null; MySqlDataReader reader = null; reader = Database.Query(ref connection, "SELECT marketGroupID, parentGroupID FROM invMarketGroups"); using (connection) using (reader) { while (reader.Read() == true) { int child = reader.GetInt32(0); int parent = reader.IsDBNull(1) == true ? -1 : reader.GetInt32(1); if (parentToMarket.ContainsKey(parent) == false) { parentToMarket[parent] = new List <int>(); } parentToMarket[parent].Add(child); // marketToParent[child] = parent; } } connection = null; reader = Database.Query(ref connection, "SELECT marketGroupID, typeID FROM invTypes WHERE marketGroupID IS NOT NULL ORDER BY marketGroupID"); using (connection) using (reader) { while (reader.Read() == true) { int marketGroupID = reader.GetInt32(0); int typeID = reader.GetInt32(1); if (marketToTypeID.ContainsKey(marketGroupID) == false) { marketToTypeID[marketGroupID] = new List <int>(); } marketToTypeID[marketGroupID].Add(typeID); } } // maps for ids are already built, time to build the correct list of item types this.BuildItemTypeList(ref marketTypeIDsMap, marketToTypeID, parentToMarket, -1); PyDictionary finalResult = new PyDictionary(); PyNone key = new PyNone(); foreach (PyList row in result.Rows) { PyInteger marketGroupID = row[0] as PyInteger; PyDataType parentGroupID = row[1]; PyList <PyInteger> types = new PyList <PyInteger>(); if (marketTypeIDsMap.TryGetValue(marketGroupID, out List <int> typeIDsMap) == true) { foreach (int typeID in typeIDsMap) { types.Add(typeID); } } row[6] = types; PyDataType resultKey = parentGroupID ?? key; if (finalResult.TryGetValue(resultKey, out PyList values) == false) { finalResult[resultKey] = values = new PyList(); } values.Add(row); } return(new PyObjectData("util.FilterRowset", new PyDictionary { ["header"] = result.Header, ["idName"] = "parentGroupID", ["RowClass"] = new PyToken("util.Row"), ["idName2"] = null, ["items"] = finalResult } )); }
/// <summary> /// Binds a new object of this type with the given objectData to provide a stateful /// interface to itself /// /// WARNING: Some MachoBindObject calls also include a call to a method inside the new stateful /// service, this also handles that behaviour /// </summary> /// <param name="objectID">The information of the object to be stateful about</param> /// <param name="callInfo">The information on the call</param> /// <param name="call">The call object with extra information</param> /// <returns></returns> public PyDataType MachoBindObject(PyInteger objectID, PyNone callInfo, CallInformation call) { return(this.MachoBindObject(objectID, callInfo as PyDataType, call)); }
/// <summary> /// Binds a new object of this type with the given objectData to provide a stateful /// interface to itself /// /// WARNING: Some MachoBindObject calls also include a call to a method inside the new stateful /// service, this also handles that behaviour /// </summary> /// <param name="objectData">The information of the object to be stateful about</param> /// <param name="callInfo">The information on the call</param> /// <param name="call">The call object with extra information</param> /// <returns></returns> public PyDataType MachoBindObject(PyTuple objectData, PyNone callInfo, CallInformation call) { return(this.MachoBindObject(objectData, callInfo as PyDataType, call)); }