/// <summary> /// Lors de la phase de picks, permet à l'IA de pick un passif donné (si c'est son tour). /// </summary> public PickResult Picks_PickPassive(EntityUniquePassives passive) { System.IO.MemoryStream s = new System.IO.MemoryStream(); System.IO.StreamWriter output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; output.WriteLine(((int)4).ToString()); output.WriteLine(((int)passive).ToString()); output.Close(); TCPHelper.Send(s.ToArray()); byte[] response = TCPHelper.Receive(); s = new System.IO.MemoryStream(response); System.IO.StreamReader input = new System.IO.StreamReader(s, BOMLESS_UTF8); PickResult returnValue = (PickResult)Int32.Parse(input.ReadLine()); return((PickResult)returnValue); }
/// <summary> /// Lors de la phase de picks, permet à l'IA d'obtenir la liste des ID des spells passifs /// disponibles. /// </summary> public List <EntityUniquePassives> Picks_GetPassiveSpells() { System.IO.MemoryStream s = new System.IO.MemoryStream(); System.IO.StreamWriter output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; output.WriteLine(((int)3).ToString()); output.Close(); TCPHelper.Send(s.ToArray()); byte[] response = TCPHelper.Receive(); s = new System.IO.MemoryStream(response); System.IO.StreamReader input = new System.IO.StreamReader(s, BOMLESS_UTF8); List <EntityUniquePassives> returnValue = new List <EntityUniquePassives>(); int returnValue_count = Int32.Parse(input.ReadLine()); for (int returnValue_i = 0; returnValue_i < returnValue_count; returnValue_i++) { EntityUniquePassives returnValue_e = (EntityUniquePassives)Int32.Parse(input.ReadLine()); returnValue.Add((EntityUniquePassives)returnValue_e); } return((List <EntityUniquePassives>)returnValue); }
public static EntityBaseView Deserialize(System.IO.StreamReader input) { EntityBaseView _obj = new EntityBaseView(); // GetMagicResist float _obj_GetMagicResist = Single.Parse(input.ReadLine()); _obj.GetMagicResist = (float)_obj_GetMagicResist; // GetAbilityPower float _obj_GetAbilityPower = Single.Parse(input.ReadLine()); _obj.GetAbilityPower = (float)_obj_GetAbilityPower; // GetCooldownReduction float _obj_GetCooldownReduction = Single.Parse(input.ReadLine()); _obj.GetCooldownReduction = (float)_obj_GetCooldownReduction; // GetMoveSpeed float _obj_GetMoveSpeed = Single.Parse(input.ReadLine()); _obj.GetMoveSpeed = (float)_obj_GetMoveSpeed; // GetAttackSpeed float _obj_GetAttackSpeed = Single.Parse(input.ReadLine()); _obj.GetAttackSpeed = (float)_obj_GetAttackSpeed; // GetHPRegen float _obj_GetHPRegen = Single.Parse(input.ReadLine()); _obj.GetHPRegen = (float)_obj_GetHPRegen; // GetAttackDamage float _obj_GetAttackDamage = Single.Parse(input.ReadLine()); _obj.GetAttackDamage = (float)_obj_GetAttackDamage; // GetArmor float _obj_GetArmor = Single.Parse(input.ReadLine()); _obj.GetArmor = (float)_obj_GetArmor; // GetHP float _obj_GetHP = Single.Parse(input.ReadLine()); _obj.GetHP = (float)_obj_GetHP; // GetMaxHP float _obj_GetMaxHP = Single.Parse(input.ReadLine()); _obj.GetMaxHP = (float)_obj_GetMaxHP; // UniquePassiveLevel int _obj_UniquePassiveLevel = Int32.Parse(input.ReadLine()); _obj.UniquePassiveLevel = (int)_obj_UniquePassiveLevel; // UniquePassive EntityUniquePassives _obj_UniquePassive = (EntityUniquePassives)Int32.Parse(input.ReadLine()); _obj.UniquePassive = (EntityUniquePassives)_obj_UniquePassive; // Role EntityHeroRole _obj_Role = (EntityHeroRole)Int32.Parse(input.ReadLine()); _obj.Role = (EntityHeroRole)_obj_Role; // BaseArmor float _obj_BaseArmor = Single.Parse(input.ReadLine()); _obj.BaseArmor = (float)_obj_BaseArmor; // Direction Vector2 _obj_Direction = Vector2.Deserialize(input); _obj.Direction = (Vector2)_obj_Direction; // Position Vector2 _obj_Position = Vector2.Deserialize(input); _obj.Position = (Vector2)_obj_Position; // ShieldPoints float _obj_ShieldPoints = Single.Parse(input.ReadLine()); _obj.ShieldPoints = (float)_obj_ShieldPoints; // HP float _obj_HP = Single.Parse(input.ReadLine()); _obj.HP = (float)_obj_HP; // BaseHPRegen float _obj_BaseHPRegen = Single.Parse(input.ReadLine()); _obj.BaseHPRegen = (float)_obj_BaseHPRegen; // BaseMaxHP float _obj_BaseMaxHP = Single.Parse(input.ReadLine()); _obj.BaseMaxHP = (float)_obj_BaseMaxHP; // BaseMoveSpeed float _obj_BaseMoveSpeed = Single.Parse(input.ReadLine()); _obj.BaseMoveSpeed = (float)_obj_BaseMoveSpeed; // IsDead bool _obj_IsDead = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsDead = (bool)_obj_IsDead; // Type EntityTypeRelative _obj_Type = (EntityTypeRelative)Int32.Parse(input.ReadLine()); _obj.Type = (EntityTypeRelative)_obj_Type; // ID int _obj_ID = Int32.Parse(input.ReadLine()); _obj.ID = (int)_obj_ID; // BaseAttackDamage float _obj_BaseAttackDamage = Single.Parse(input.ReadLine()); _obj.BaseAttackDamage = (float)_obj_BaseAttackDamage; // BaseCooldownReduction float _obj_BaseCooldownReduction = Single.Parse(input.ReadLine()); _obj.BaseCooldownReduction = (float)_obj_BaseCooldownReduction; // BaseAttackSpeed float _obj_BaseAttackSpeed = Single.Parse(input.ReadLine()); _obj.BaseAttackSpeed = (float)_obj_BaseAttackSpeed; // BaseAbilityPower float _obj_BaseAbilityPower = Single.Parse(input.ReadLine()); _obj.BaseAbilityPower = (float)_obj_BaseAbilityPower; // BaseMagicResist float _obj_BaseMagicResist = Single.Parse(input.ReadLine()); _obj.BaseMagicResist = (float)_obj_BaseMagicResist; // IsRooted bool _obj_IsRooted = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsRooted = (bool)_obj_IsRooted; // IsSilenced bool _obj_IsSilenced = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsSilenced = (bool)_obj_IsSilenced; // IsStuned bool _obj_IsStuned = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsStuned = (bool)_obj_IsStuned; // IsDamageImmune bool _obj_IsDamageImmune = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsDamageImmune = (bool)_obj_IsDamageImmune; // IsControlImmune bool _obj_IsControlImmune = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsControlImmune = (bool)_obj_IsControlImmune; // IsBlind bool _obj_IsBlind = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsBlind = (bool)_obj_IsBlind; // IsStealthed bool _obj_IsStealthed = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.IsStealthed = (bool)_obj_IsStealthed; // HasTrueVision bool _obj_HasTrueVision = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.HasTrueVision = (bool)_obj_HasTrueVision; // HasWardVision bool _obj_HasWardVision = Int32.Parse(input.ReadLine()) == 0 ? false : true; _obj.HasWardVision = (bool)_obj_HasWardVision; // VisionRange float _obj_VisionRange = Single.Parse(input.ReadLine()); _obj.VisionRange = (float)_obj_VisionRange; return(_obj); }
/// <summary> /// Lors de la phase de picks, permet à l'IA de pick un passif donné (si c'est son tour). /// </summary> public PickResult Picks_PickPassive(EntityUniquePassives passive, int clientId) { return(Codinsa2015.Server.GameServer.GetScene().GetControler(clientId).Picks_PickPassive(passive)); }
// Génère le code pour la fonction de traitement des messages. public byte[] ProcessRequest(byte[] request, int clientId) { System.IO.MemoryStream s = new System.IO.MemoryStream(request); System.IO.StreamReader input = new System.IO.StreamReader(s, BOMLESS_UTF8); System.IO.StreamWriter output; int functionId = Int32.Parse(input.ReadLine()); switch (functionId) { case 0: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; GameStaticDataView retValue0 = GetStaticData(clientId); retValue0.Serialize(output); output.Close(); return(s.ToArray()); case 1: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; PickAction retValue1 = Picks_NextAction(clientId); output.WriteLine(((int)retValue1).ToString()); output.Close(); return(s.ToArray()); case 2: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue2 = Picks_GetActiveSpells(clientId); output.WriteLine(retValue2.Count.ToString()); for (int retValue2_it = 0; retValue2_it < retValue2.Count; retValue2_it++) { output.WriteLine(((int)retValue2[retValue2_it]).ToString()); } output.Close(); return(s.ToArray()); case 3: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <EntityUniquePassives> retValue3 = Picks_GetPassiveSpells(clientId); output.WriteLine(retValue3.Count.ToString()); for (int retValue3_it = 0; retValue3_it < retValue3.Count; retValue3_it++) { output.WriteLine(((int)retValue3[retValue3_it]).ToString()); } output.Close(); return(s.ToArray()); case 4: EntityUniquePassives arg4_0 = (EntityUniquePassives)Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; PickResult retValue4 = Picks_PickPassive(arg4_0, clientId); output.WriteLine(((int)retValue4).ToString()); output.Close(); return(s.ToArray()); case 5: int arg5_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; PickResult retValue5 = Picks_PickActive(arg5_0, clientId); output.WriteLine(((int)retValue5).ToString()); output.Close(); return(s.ToArray()); case 6: int arg6_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; ShopTransactionResult retValue6 = ShopPurchaseItem(arg6_0, clientId); output.WriteLine(((int)retValue6).ToString()); output.Close(); return(s.ToArray()); case 7: EquipmentType arg7_0 = (EquipmentType)Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; ShopTransactionResult retValue7 = ShopSell(arg7_0, clientId); output.WriteLine(((int)retValue7).ToString()); output.Close(); return(s.ToArray()); case 8: EquipmentType arg8_0 = (EquipmentType)Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; ShopTransactionResult retValue8 = ShopUpgrade(arg8_0, clientId); output.WriteLine(((int)retValue8).ToString()); output.Close(); return(s.ToArray()); case 9: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <WeaponModelView> retValue9 = ShopGetWeapons(clientId); output.WriteLine(retValue9.Count.ToString()); for (int retValue9_it = 0; retValue9_it < retValue9.Count; retValue9_it++) { retValue9[retValue9_it].Serialize(output); } output.Close(); return(s.ToArray()); case 10: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue10 = ShopGetArmors(clientId); output.WriteLine(retValue10.Count.ToString()); for (int retValue10_it = 0; retValue10_it < retValue10.Count; retValue10_it++) { output.WriteLine(((int)retValue10[retValue10_it]).ToString()); } output.Close(); return(s.ToArray()); case 11: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue11 = ShopGetBoots(clientId); output.WriteLine(retValue11.Count.ToString()); for (int retValue11_it = 0; retValue11_it < retValue11.Count; retValue11_it++) { output.WriteLine(((int)retValue11[retValue11_it]).ToString()); } output.Close(); return(s.ToArray()); case 12: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue12 = ShopGetEnchants(clientId); output.WriteLine(retValue12.Count.ToString()); for (int retValue12_it = 0; retValue12_it < retValue12.Count; retValue12_it++) { output.WriteLine(((int)retValue12[retValue12_it]).ToString()); } output.Close(); return(s.ToArray()); case 13: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; float retValue13 = GetMyPA(clientId); output.WriteLine(((float)retValue13).ToString()); output.Close(); return(s.ToArray()); case 14: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue14 = GetMyWeaponId(clientId); output.WriteLine(((int)retValue14).ToString()); output.Close(); return(s.ToArray()); case 15: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue15 = GetMyWeaponLevel(clientId); output.WriteLine(((int)retValue15).ToString()); output.Close(); return(s.ToArray()); case 16: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue16 = GetMyArmorId(clientId); output.WriteLine(((int)retValue16).ToString()); output.Close(); return(s.ToArray()); case 17: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue17 = GetMyArmorLevel(clientId); output.WriteLine(((int)retValue17).ToString()); output.Close(); return(s.ToArray()); case 18: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue18 = GetMyBootsId(clientId); output.WriteLine(((int)retValue18).ToString()); output.Close(); return(s.ToArray()); case 19: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue19 = GetMyBootsLevel(clientId); output.WriteLine(((int)retValue19).ToString()); output.Close(); return(s.ToArray()); case 20: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue20 = GetMyWeaponEnchantId(clientId); output.WriteLine(((int)retValue20).ToString()); output.Close(); return(s.ToArray()); case 21: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; EntityBaseView retValue21 = GetMyHero(clientId); retValue21.Serialize(output); output.Close(); return(s.ToArray()); case 22: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; Vector2 retValue22 = GetMyPosition(clientId); retValue22.Serialize(output); output.Close(); return(s.ToArray()); case 23: Vector2 arg23_0 = Vector2.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue23 = StartMoveTo(arg23_0, clientId); output.WriteLine(retValue23 ? 1 : 0); output.Close(); return(s.ToArray()); case 24: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue24 = IsAutoMoving(clientId); output.WriteLine(retValue24 ? 1 : 0); output.Close(); return(s.ToArray()); case 25: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue25 = EndMoveTo(clientId); output.WriteLine(retValue25 ? 1 : 0); output.Close(); return(s.ToArray()); case 26: Vector2 arg26_0 = Vector2.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue26 = HasSightAt(arg26_0, clientId); output.WriteLine(retValue26 ? 1 : 0); output.Close(); return(s.ToArray()); case 27: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <EntityBaseView> retValue27 = GetDeadHeroes(clientId); output.WriteLine(retValue27.Count.ToString()); for (int retValue27_it = 0; retValue27_it < retValue27.Count; retValue27_it++) { retValue27[retValue27_it].Serialize(output); } output.Close(); return(s.ToArray()); case 28: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <EntityBaseView> retValue28 = GetEntitiesInSight(clientId); output.WriteLine(retValue28.Count.ToString()); for (int retValue28_it = 0; retValue28_it < retValue28.Count; retValue28_it++) { retValue28[retValue28_it].Serialize(output); } output.Close(); return(s.ToArray()); case 29: int arg29_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; EntityBaseView retValue29 = GetEntityById(arg29_0, clientId); retValue29.Serialize(output); output.Close(); return(s.ToArray()); case 30: int arg30_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUseResult retValue30 = UseMyWeapon(arg30_0, clientId); output.WriteLine(((int)retValue30).ToString()); output.Close(); return(s.ToArray()); case 31: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; float retValue31 = GetMyAttackRange(clientId); output.WriteLine(((float)retValue31).ToString()); output.Close(); return(s.ToArray()); case 32: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <Vector2> retValue32 = GetMyTrajectory(clientId); output.WriteLine(retValue32.Count.ToString()); for (int retValue32_it = 0; retValue32_it < retValue32.Count; retValue32_it++) { retValue32[retValue32_it].Serialize(output); } output.Close(); return(s.ToArray()); case 33: Vector2 arg33_0 = Vector2.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; bool retValue33 = MoveTowards(arg33_0, clientId); output.WriteLine(retValue33 ? 1 : 0); output.Close(); return(s.ToArray()); case 34: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; List <int> retValue34 = GetMySpells(clientId); output.WriteLine(retValue34.Count.ToString()); for (int retValue34_it = 0; retValue34_it < retValue34.Count; retValue34_it++) { output.WriteLine(((int)retValue34[retValue34_it]).ToString()); } output.Close(); return(s.ToArray()); case 35: int arg35_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUpgradeResult retValue35 = UpgradeMyActiveSpell(arg35_0, clientId); output.WriteLine(((int)retValue35).ToString()); output.Close(); return(s.ToArray()); case 36: int arg36_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue36 = GetMyActiveSpellLevel(arg36_0, clientId); output.WriteLine(((int)retValue36).ToString()); output.Close(); return(s.ToArray()); case 37: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; int retValue37 = GetMyPassiveSpellLevel(clientId); output.WriteLine(((int)retValue37).ToString()); output.Close(); return(s.ToArray()); case 38: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUpgradeResult retValue38 = UpgradeMyPassiveSpell(clientId); output.WriteLine(((int)retValue38).ToString()); output.Close(); return(s.ToArray()); case 39: int arg39_0 = Int32.Parse(input.ReadLine()); SpellCastTargetInfoView arg39_1 = SpellCastTargetInfoView.Deserialize(input); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellUseResult retValue39 = UseMySpell(arg39_0, arg39_1, clientId); output.WriteLine(((int)retValue39).ToString()); output.Close(); return(s.ToArray()); case 40: int arg40_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellView retValue40 = GetMySpell(arg40_0, clientId); retValue40.Serialize(output); output.Close(); return(s.ToArray()); case 41: s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SceneMode retValue41 = GetMode(clientId); output.WriteLine(((int)retValue41).ToString()); output.Close(); return(s.ToArray()); case 42: int arg42_0 = Int32.Parse(input.ReadLine()); s = new System.IO.MemoryStream(); output = new System.IO.StreamWriter(s, BOMLESS_UTF8); output.NewLine = "\n"; SpellLevelDescriptionView retValue42 = GetMySpellCurrentLevelDescription(arg42_0, clientId); retValue42.Serialize(output); output.Close(); return(s.ToArray()); } return(new byte[0]); }