private Character CreateCharacter(string characterName, Ancestry ancestry, int genderID, PyDictionary appearance, long currentTime, CallInformation call) { // load the item into memory ItemEntity owner = this.ItemManager.LocationSystem; int stationID, solarSystemID, constellationID, regionID, corporationID, careerID, schoolID, careerSpecialityID; this.GetRandomCareerForRace(ancestry.Bloodline.RaceID, out careerID, out schoolID, out careerSpecialityID, out corporationID); this.GetLocationForCorporation(corporationID, out stationID, out solarSystemID, out constellationID, out regionID); int itemID = this.DB.CreateCharacter( ancestry.Bloodline.ItemType, characterName, owner, call.Client.AccountID, this.mConfiguration.Balance, 0.0, corporationID, 0, 0, 0, 0, 0, currentTime, currentTime, currentTime, ancestry.ID, careerID, schoolID, careerSpecialityID, genderID, appearance.ContainsKey("accessoryID") ? appearance["accessoryID"] as PyInteger : null, appearance.ContainsKey("beardID") ? appearance["beardID"] as PyInteger : null, appearance["costumeID"] as PyInteger, appearance.ContainsKey("decoID") ? appearance["decoID"] as PyInteger : null, appearance["eyebrowsID"] as PyInteger, appearance["eyesID"] as PyInteger, appearance["hairID"] as PyInteger, appearance.ContainsKey("lipstickID") ? appearance["lipstickID"] as PyInteger : null, appearance.ContainsKey("makeupID") ? appearance["makeupID"] as PyInteger : null, appearance["skinID"] as PyInteger, appearance["backgroundID"] as PyInteger, appearance["lightID"] as PyInteger, appearance["headRotation1"] as PyDecimal, appearance["headRotation2"] as PyDecimal, appearance["headRotation3"] as PyDecimal, appearance["eyeRotation1"] as PyDecimal, appearance["eyeRotation2"] as PyDecimal, appearance["eyeRotation3"] as PyDecimal, appearance["camPos1"] as PyDecimal, appearance["camPos2"] as PyDecimal, appearance["camPos3"] as PyDecimal, appearance.ContainsKey("morph1e") ? appearance["morph1e"] as PyDecimal : null, appearance.ContainsKey("morph1n") ? appearance["morph1n"] as PyDecimal : null, appearance.ContainsKey("morph1s") ? appearance["morph1s"] as PyDecimal : null, appearance.ContainsKey("morph1w") ? appearance["morph1w"] as PyDecimal : null, appearance.ContainsKey("morph2e") ? appearance["morph2e"] as PyDecimal : null, appearance.ContainsKey("morph2n") ? appearance["morph2n"] as PyDecimal : null, appearance.ContainsKey("morph2s") ? appearance["morph2s"] as PyDecimal : null, appearance.ContainsKey("morph2w") ? appearance["morph2w"] as PyDecimal : null, appearance.ContainsKey("morph3e") ? appearance["morph3e"] as PyDecimal : null, appearance.ContainsKey("morph3n") ? appearance["morph3n"] as PyDecimal : null, appearance.ContainsKey("morph3s") ? appearance["morph3s"] as PyDecimal : null, appearance.ContainsKey("morph3w") ? appearance["morph3w"] as PyDecimal : null, appearance.ContainsKey("morph4e") ? appearance["morph4e"] as PyDecimal : null, appearance.ContainsKey("morph4n") ? appearance["morph4n"] as PyDecimal : null, appearance.ContainsKey("morph4s") ? appearance["morph4s"] as PyDecimal : null, appearance.ContainsKey("morph4w") ? appearance["morph4w"] as PyDecimal : null, stationID, solarSystemID, constellationID, regionID); return(this.ItemManager.LoadItem(itemID) as Character); }
public PyDataType 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 (PyDataType entry in result.Rows) { PyList row = entry as PyList; PyInteger marketGroupID = row[0] as PyInteger; PyDataType parentGroupID = row[1]; PyList types = new PyList(); if (marketTypeIDsMap.ContainsKey(marketGroupID) == true) { foreach (int typeID in marketTypeIDsMap[marketGroupID]) { types.Add(typeID); } } row[6] = types; PyDataType resultKey = parentGroupID ?? key; if (finalResult.ContainsKey(resultKey) == false) { finalResult[resultKey] = new PyList(); } (finalResult[resultKey] as PyList).Add(row); } return(new PyObjectData("util.FilterRowset", new PyDictionary { ["header"] = result.Header, ["idName"] = "parentGroupID", ["RowClass"] = new PyToken("util.Row"), ["idName2"] = null, ["items"] = finalResult } )); }