public Vector[] PopulateOccupanciesFromBinaryFile(string fileName) { var parameters = fileName.Split('_'); cellSize = int.Parse(parameters[2]); chainSize = int.Parse(parameters[3]); fillFactor = decimal.Parse(parameters[4]); var totalVacancies = cellSize * cellSize * cellSize / 2; // only half the number of cubic cells are occupiable numChains = (int)(totalVacancies * fillFactor / chainSize); numChains = numChains - numChains % 2; occupancies = new Vector[numChains * chainSize]; lattice = new OccupationType[cellSize, cellSize, cellSize]; var bytebuffer = new byte[12]; int vectorIndex = 0; using (var stream = File.OpenRead(fileName)) { while (vectorIndex < numChains * chainSize) { stream.Read(bytebuffer, 0, 12); var vector = new Vector(BitConverter.ToInt32(bytebuffer, 0), BitConverter.ToInt32(bytebuffer, 4), BitConverter.ToInt32(bytebuffer, 8)); occupancies[vectorIndex] = vector; lattice[vector.x, vector.y, vector.z] = OccupancyTypeOfChain(vectorIndex / numChains); vectorIndex++; } } return(occupancies); }
public Vector[] PopulateOccupanciesFromFile(string fileName) { var parameters = fileName.Split('_'); cellSize = int.Parse(parameters[2]); chainSize = int.Parse(parameters[3]); fillFactor = decimal.Parse(parameters[4]); var totalVacancies = cellSize * cellSize * cellSize / 2; // only half the number of cubic cells are occupiable numChains = (int)(totalVacancies * fillFactor / chainSize); numChains = numChains - numChains % 2; var content = File.ReadAllText(fileName); content = content.Substring(1, content.Length - 1); var vectors = content.Split(new string[] { ")", "(" }, StringSplitOptions.RemoveEmptyEntries); occupancies = new Vector[numChains * chainSize]; lattice = new OccupationType[cellSize, cellSize, cellSize]; int vectorIndex = 0; foreach (var vectorString in vectors) { var split = vectorString.Split(','); var vector = new Vector(int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2])); occupancies[vectorIndex] = vector; lattice[vector.x, vector.y, vector.z] = OccupancyTypeOfChain(vectorIndex / numChains); vectorIndex++; } return(occupancies); }
public DE_Character(OccupationType ocp, short mxLv, IReadOnlyList <DE_Unit> unitAllLv, IReadOnlyList <DE_CharacterData> charDataAllLv) { m_occupation = ocp; m_characterMaxLevel = mxLv; m_unitAllLevel = unitAllLv; m_characterDataAllLevel = charDataAllLv; }
public IReadOnlyList <short> GetSkillIdByOccupation(OccupationType ocp) { IReadOnlyList <short> res; m_ocpSkillIdDict.TryGetValue(ocp, out res); return(res); }
public static Player GeneratePlayer(OccupationType id, string name) { Player player = null; switch (id) { case OccupationType.Warrior: player = new Warrior(name); break; case OccupationType.Support: player = new Support(name); break; case OccupationType.Mage: player = new Mage(name); break; case OccupationType.Assassin: player = new Assassin(name); break; default: break; } return(player); }
private int AttrToCombatEfct(OccupationType ocp, int atk, int mag, int maxHp, int maxMp, int def, int agl, int criticalRate, int criticalBonus, int hitRate, int dodgeRate) { double res = 0; switch (ocp) { case OccupationType.WARRIOR: res = Math.Pow(atk, 1.5); break; case OccupationType.ROGUE: res = 1.2 * Math.Pow(atk, 1.5); break; case OccupationType.MAGE: res = 0.9 * Math.Pow(mag, 1.5); break; case OccupationType.TAOIST: res = 1.3 * Math.Pow(mag, 1.5); break; } res = res + Math.Pow(maxHp, 0.5) * 0.5; res = res + Math.Pow(maxMp, 0.4) * 0.3; res = res + Math.Pow(def * agl, 0.75); res = res * (1 + 0.72 * criticalRate * 0.01 * criticalBonus); res = res * hitRate / (1 - dodgeRate * 0.01f) * 0.01f; return((int)res); }
public static void UpdateType(Occupation occupation, OccupationType newType) { Db.Transact(() => { occupation.Type = newType; }); }
public NO_LoginCharacter(int charId, OccupationType ocp, string name, short lv) { m_charId = charId; m_ocp = ocp; m_name = name; m_level = lv; }
public (int, int) GetCombatEfctAndRank(OccupationType ocp, int charId, OccupationType myOcp) { var combatEfct = m_charIdAndOriCombatEfctDict[charId]; if (myOcp != ocp) { return(combatEfct, -1); } int rank = -1; switch (ocp) { case OccupationType.ALL: rank = m_allRankTree.GetIndexOfElement(new CombatEffectiveItem(charId, combatEfct, null, 0, 0)); break; case OccupationType.WARRIOR: rank = m_warriorRankTree.GetIndexOfElement(new CombatEffectiveItem(charId, combatEfct, null, 0, 0)); break; case OccupationType.ROGUE: rank = m_rogueRankTree.GetIndexOfElement(new CombatEffectiveItem(charId, combatEfct, null, 0, 0)); break; case OccupationType.MAGE: rank = m_mageRankTree.GetIndexOfElement(new CombatEffectiveItem(charId, combatEfct, null, 0, 0)); break; case OccupationType.TAOIST: rank = m_taoistRankTree.GetIndexOfElement(new CombatEffectiveItem(charId, combatEfct, null, 0, 0)); break; } return(combatEfct, rank); }
private static Collision checkCollision(OccupationType collider1, OccupationType collider2) { if (collider1 == OccupationType.Player) { if (collider2 == OccupationType.Enemy) { return(Collision.PlayerXEnemy); } else if (collider2 == OccupationType.Goal) { return(Collision.PlayerXGoal); } } else if (collider1 == OccupationType.Enemy) { if (collider2 == OccupationType.Player) { return(Collision.PlayerXEnemy); } } else if (collider1 == OccupationType.Goal) { if (collider2 == OccupationType.Player) { return(Collision.PlayerXGoal); } } return(Collision.Nothing); }
private void initialize() { Panels = new List <Panel>(); AlteredPanels = new List <Panel>(); StaticObjects = new List <GameObject>(); MovableObjects = new List <GameObject>(); AlteredObjects = new List <GameObject>(); for (int y = 0; y < Rows; y++) { for (int x = 0; x < Columns; x++) { Panels.Add(new Panel(x, y, this)); } } var enumValues = Enum.GetValues(typeof(OccupationType)); Formats = new Dictionary <OccupationType, ConsoleOutputFormat>(enumValues.Length); for (int i = 0; i < enumValues.Length; i++) { OccupationType occupationType = ((OccupationType)enumValues.GetValue(i)); Formats.Add(occupationType, occupationType.GetAttributeOfType <ConsoleOutputFormat>()); } }
public void SetOccupation(OccupationType occupation) { HtmlSpan occupationInput = this.Find.AllByTagName <HtmlSpan>("span").Where(s => s.InnerText.Contains("Изберете занимание")).FirstOrDefault(); occupationInput.Click(); HtmlUnorderedList occupationList = this.Find.ById <HtmlUnorderedList>("WorkEducationStatusId_listbox"); switch (occupation) { case OccupationType.Ученик: occupationList.Find.ByContent <HtmlListItem>("Ученик").Click(); break; case OccupationType.Студент: occupationList.Find.ByContent <HtmlListItem>("Студент").Click(); break; case OccupationType.аботещ: occupationList.Find.ByContent <HtmlListItem>("Работещ").Click(); break; default: occupationList.Find.ByContent <HtmlListItem>("Друго").Click(); break; } }
public DDO_Character(int charId, int playerId, OccupationType ocp, string name) { m_characterId = charId; m_playerId = playerId; m_occupation = ocp; m_name = name; }
private void UpdateCharCombatEfct(int charId, int combatEfct, OccupationType ocp, string name, short lv) { int oriCombatEfct; m_charIdAndOriCombatEfctDict.TryGetValue(charId, out oriCombatEfct); m_allRankTree.Remove(new CombatEffectiveItem(charId, oriCombatEfct, null, 0, 0)); m_allRankTree.Insert(new CombatEffectiveItem(charId, combatEfct, name, ocp, lv)); switch (ocp) { case OccupationType.WARRIOR: m_warriorRankTree.Remove(new CombatEffectiveItem(charId, oriCombatEfct, null, 0, 0)); m_warriorRankTree.Insert(new CombatEffectiveItem(charId, combatEfct, name, ocp, lv)); break; case OccupationType.ROGUE: m_rogueRankTree.Remove(new CombatEffectiveItem(charId, oriCombatEfct, null, 0, 0)); m_rogueRankTree.Insert(new CombatEffectiveItem(charId, combatEfct, name, ocp, lv)); break; case OccupationType.MAGE: m_mageRankTree.Remove(new CombatEffectiveItem(charId, oriCombatEfct, null, 0, 0)); m_mageRankTree.Insert(new CombatEffectiveItem(charId, combatEfct, name, ocp, lv)); break; case OccupationType.TAOIST: m_taoistRankTree.Remove(new CombatEffectiveItem(charId, oriCombatEfct, null, 0, 0)); m_taoistRankTree.Insert(new CombatEffectiveItem(charId, combatEfct, name, ocp, lv)); break; } m_charIdAndOriCombatEfctDict[charId] = combatEfct; }
public Occupation(string occupationName, OccupationType type, Guid referenceId, string description = "") : base(referenceId) { Name = occupationName; Type = type; Description = description; ItemType = MemoryItemType.Occupation; }
public CombatEffectiveItem(int charId, int combatEfct, string name, OccupationType ocp, short lv) { m_charId = charId; m_combatEfct = combatEfct; m_name = name; m_ocp = ocp; m_level = lv; }
/// <summary> /// 获取门派名称 /// </summary> /// <returns>The occupation name.</returns> /// <param name="type">Type.</param> public static string GetOccupationName(OccupationType type) { if (occupationNameMapping.ContainsKey(type)) { return(occupationNameMapping[type]); } return(""); }
public DDO_CombatEfct(int charId, int combatEfct, OccupationType ocp, string name, short lv) { m_charId = charId; m_combatEfct = combatEfct; m_ocp = ocp; m_name = name; m_level = lv; }
/// <summary> /// Create web model from entity [dropdown] /// </summary> public static ApiModel.OccupationTypeDropDown CreateFrom(this OccupationType source) { return(new ApiModel.OccupationTypeDropDown { OccupationTypeId = source.OccupationTypeId, OccupationTypeCodeName = source.OccupationTypeCode + " - " + source.OccupationTypeName }); }
public DE_EquipmentData(DO_Equipment equipDo) { m_validOccupation = equipDo.m_validOccupation; m_equipLevelInNeed = equipDo.m_equipLevelInNeed; m_equipPosition = equipDo.m_equipPosition; m_attrList = new List <ValueTuple <ActorUnitConcreteAttributeType, int> > (equipDo.m_equipmentAttributeArr); m_attrWave = equipDo.m_attrWave; }
public OccupationType Post(OccupationType request) { if (request == null || !ModelState.IsValid) { throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request"); } return(occupationTypeService.AddUpdateOccupationType(request.CreateFromm()).CreateFromm()); }
public void Execute(NetDataReader reader, int netId) { int playerId = reader.GetInt(); OccupationType ocp = (OccupationType)reader.GetByte(); string name = reader.GetString(); GL_User.s_instance.CommandCreateCharacter(netId, playerId, ocp, name); }
/// <summary> /// Update OccupationType Properties while updating the instance /// </summary> private void UpdateOccupationTypeProperties(OccupationType occupationTypeRequest, OccupationType dbVersion) { dbVersion.RecLastUpdatedBy = occupationTypeRepository.LoggedInUserIdentity; dbVersion.RecLastUpdatedDt = DateTime.Now; dbVersion.RowVersion = dbVersion.RowVersion + 1; dbVersion.OccupationTypeCode = occupationTypeRequest.OccupationTypeCode; dbVersion.OccupationTypeName = occupationTypeRequest.OccupationTypeName; dbVersion.OccupationTypeDescription = occupationTypeRequest.OccupationTypeDescription; }
public Boolean Delete(OccupationType request) { if (request == null || !ModelState.IsValid) { throw new HttpException((int)HttpStatusCode.BadRequest, "Invalid Request"); } occupationTypeService.DeleteOccupationType(request.OccupationTypeId); return(true); }
public static NO_LoginCharacter GetLoginCharacter(this NetDataReader reader) { int charId = reader.GetInt(); OccupationType ocp = (OccupationType)reader.GetByte(); string name = reader.GetString(); short lv = reader.GetShort(); return(new NO_LoginCharacter(charId, ocp, name, lv)); }
public void CreateCharacter(int charId, OccupationType ocp) { var skillIdList = m_dem.GetSkillIdByOccupation(ocp); for (int i = 0; i < skillIdList.Count; i++) { m_dds.InsertSkill(new DDO_Skill(skillIdList[i], charId, 0, 0)); } }
public Occupation GetOccupation(OccupationType occupationType) { Occupation ret = m_occupations[occupationType]; if (ret == null) { Debug.LogWarning("Unit missing " + occupationType + " Occupation"); } return(m_occupations[occupationType]); }
/// <summary> /// Create web model from entity /// </summary> public static ApiModel.OccupationType CreateFromm(this OccupationType source) { return(new ApiModel.OccupationType { OccupationTypeId = source.OccupationTypeId, OccupationTypeCode = source.OccupationTypeCode, OccupationTypeName = source.OccupationTypeName, OccupationTypeDescription = source.OccupationTypeDescription }); }
public void OccupationTypeTest() { // get test Assert.That(OccupationType.Work.ToString(), Is.EqualTo("work")); Assert.That(OccupationType.School.ToString(), Is.EqualTo("school")); Assert.That(OccupationType.University.ToString(), Is.EqualTo("university")); // parse test Assert.That(OccupationType.FromJsonString("work"), Is.EqualTo(OccupationType.Work)); Assert.That(OccupationType.FromJsonString("school"), Is.EqualTo(OccupationType.School)); Assert.That(OccupationType.FromJsonString("university"), Is.EqualTo(OccupationType.University)); }
public NO_SightCharacter(int netId, int charId, Vector2 pos, OccupationType ocp, string name, short lv, bool isMarket, short attachedTitleMisId) { m_netId = netId; m_charId = charId; m_position = pos; m_occupation = ocp; m_name = name; m_level = lv; m_isMarket = isMarket; m_attachedTitleMisId = attachedTitleMisId; }