//static void Test() //{ // //// if the member is definitely contained in this instance's type (and not inherited) // //var x = new Weapon().GetField<string>("m_someWeaponField"); // // if the member is inherited // var y = new Weapon().GetField<string, Item>("m_someItemField"); // // static fields will be fine as long as you use the correct type // var z = typeof(Item).GetField<string>("s_someStaticField"); //} // ========= field extensions /// <summary> /// Helper to get the value of a non-static field on an object instance. <br/><br/> /// If the field is <see langword="private"/>, it must be contained inside the <see cref="Type"/> of <typeparamref name="T"/>. /// </summary> /// <typeparam name="R">The Type of the return value you are expecting</typeparam> /// <typeparam name="T">The type which contains the field, can be inherited if not private.</typeparam> /// <param name="instance">The instance you want to get a field from</param> /// <param name="fieldName">The name of the field to get</param> /// <returns>The value from the field if successful, and/or null.</returns> public static R GetField <R, T>(this T instance, string fieldName) => At.Internal_GetField <R>(typeof(T), fieldName, instance);
/// <summary> /// Gets the color at the relative position inside a BasicElement. /// </summary> /// <param name="element">The BasicElement which color should be read.</param> /// <param name="relativePosition">The relative position inside the BasicElement.</param> /// <returns>The System.Drawing.Color at the relative position inside the BasicElement.</returns> public static Color GetColor(BasicElement element, At relativePosition) { return(GetColor(relativePosition.GetPoint(element))); }
public override void SerializeEffect <T>(T effect) { this.HealthRatio = (float)At.GetField(effect as AddAbsorbHealth, "m_healthRatio"); }
public void Calculate_Program() { //rep_file_name = Path.Combine(user_path, "DESIGN_OF_ONE_RCC_SLAB.TXT"); string view_file = Path.Combine(system_path, "DESIGN.FIL"); string boq_file = Path.Combine(system_path, "BoQ.FIL"); StreamWriter sw_view = new StreamWriter(new FileStream(view_file, FileMode.Create)); StreamWriter sw_boq = new StreamWriter(new FileStream(boq_file, FileMode.Create)); StreamWriter sw = new StreamWriter(new FileStream(rep_file_name, FileMode.Create)); try { sw.WriteLine(); sw.WriteLine(); sw.WriteLine("\t\t***********************************************"); sw.WriteLine("\t\t* ASTRA Pro *"); sw.WriteLine("\t\t* TechSOFT Engineering Services *"); sw.WriteLine("\t\t* *"); sw.WriteLine("\t\t* DESIGN OF SINGLE SPAN *"); sw.WriteLine("\t\t* ONE WAY RCC SLAB BY LIMIT STATE METHOD *"); sw.WriteLine("\t\t***********************************************"); sw.WriteLine("\t\t-----------------------------------------------"); sw.WriteLine("\t\tTHIS RESULT CREATED ON " + System.DateTime.Now.ToString("dd.MM.yyyy AT HH:mm:ss") + " "); sw.WriteLine("\t\t----------------------------------------------"); sw.WriteLine(); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("USER'S DATA"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine(); sw.WriteLine(" Length Perpendicular to Span [L] = {0:f2} m", L); sw.WriteLine(" Design Span for Slab [B]= {0:f2} m", B); sw.WriteLine(" Super imposed / Live Load [LL]= {0:f2} kN/sq.m", LL); sw.WriteLine(" Slab Load = {0:f2} kN/sq.m", Slab_load); sw.WriteLine(" Concrete Grade [f_ck] = M {0} N/sq.mm", sigma_ck); sw.WriteLine(" steel Grade [f_y] = Fe {0} N/sq.mm", sigma_y); sw.WriteLine(" Diameter of Main Reinforcement [d1] = {0} mm", d1); sw.WriteLine(" Diameter of Distribution Reinforcement [d2] = {0} mm", d2); sw.WriteLine(" Clear Cover [h1] = {0} mm", h1); sw.WriteLine(" End Cover [h2] = {0} mm", h2); sw.WriteLine(" Provide Distribution Reinforcement [ads] = {0} %", ads); sw.WriteLine(" Shear Strength of Concrete as % of Steel = {0} %", tc); sw.WriteLine(" α = {0}", alpha); sw.WriteLine(" β = {0}", beta); sw.WriteLine(" γ = {0}", gamma); sw.WriteLine(" δ = {0}", delta); sw.WriteLine(" λ = {0}", lamda); sw.WriteLine(); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("DESIGN CALCULATIONS"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("■ STEP 1: Calculations for Overall and effective depth"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine(" Since length of the slab is more than twice the width, it is a"); sw.WriteLine("ONE WAY RCC SLAB. Load will be transferred to the supports along"); sw.WriteLine("the shorter span."); sw.WriteLine(); sw.WriteLine("Consider a 100 cm wide strip of the slab parallel to its shorter span."); sw.WriteLine(); double d, lowest_Span; double val1, val2; lowest_Span = (L > B) ? B * 1000 : L * 1000; d = (lowest_Span / (alpha * beta * gamma * delta * lamda)); sw.WriteLine("Minimum depth of slab"); sw.WriteLine(" d = L /(α * β * γ * δ * λ)"); sw.WriteLine(); sw.WriteLine("Let α = {0}, β = {1}, γ = {2}, δ = {3} and λ = {4}", alpha, beta, gamma, delta, lamda); sw.WriteLine(); sw.WriteLine("So, d = {0}/{1} = {2} mm", lowest_Span.ToString("0.0"), (alpha * beta * gamma * delta * lamda).ToString("0.00"), d.ToString("0.00")); double D = (d + h1); sw.WriteLine(); sw.WriteLine("Let us adopt overall depth D = {0} mm.", D.ToString("0.00")); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("■ STEP 2: Calculations for Design Load, Moment and Shear"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); double deadLoad_slab = (D / 1000) * 1.0 * Slab_load; sw.WriteLine("Dead Load of slab = {0} * {1} * {2} = {3} kN/m.", (D / 1000).ToString("0.00"), 1.0, Slab_load, deadLoad_slab.ToString("0.00")); sw.WriteLine(); sw.WriteLine("Superimposed load = {0} * 1 = {1} kN/m.", ll.ToString("0.00"), ll.ToString("0.00")); double totalLoad = deadLoad_slab + ll; sw.WriteLine(); sw.WriteLine("Total Load = {0:f2} + {1:f2} = {2:f2} kN/m.", deadLoad_slab, LL, totalLoad); sw.WriteLine(); double factoredLoad, loadFactor; loadFactor = 1.5d; factoredLoad = totalLoad * loadFactor; sw.WriteLine("Factored load if the load factor is {0}", loadFactor.ToString("0.00")); sw.WriteLine(); sw.WriteLine(" = {0} * {1} = {2} kN/m", loadFactor.ToString("0.00"), totalLoad.ToString("0.00"), factoredLoad.ToString("0.00")); sw.WriteLine(); sw.WriteLine("Maximum BM at centre of shorter span"); sw.WriteLine(" = (Wu * l * l) / 8"); sw.WriteLine(); sw.WriteLine("Assume steel consist of {0} mm bars with {1} mm clear cover.", d1, h1); double half_depth = d1 / 2; double eff_depth = D - h1 - half_depth; sw.WriteLine(); sw.WriteLine("Effective depth = {0} - {1} - {2} = {3} mm", D.ToString("0.0"), h1.ToString("0.0"), half_depth.ToString("0.00"), eff_depth.ToString("0.00")); lowest_Span = lowest_Span / 1000; double eff_span = (lowest_Span) + (eff_depth / 1000); sw.WriteLine(); sw.WriteLine("Effective Span of Slab = {0} + d = {0} + {1} = {2} m", (lowest_Span).ToString("0.00"), (eff_depth / 1000).ToString("0.00"), eff_span.ToString("0.00")); double BM = factoredLoad * eff_span * eff_span / 8; //sw.WriteLine("So, BM = ({0} * {1} * {1}) / 8 = {2} kNm", factoredLoad.ToString("0.00"), eff_span.ToString("0.00"), BM.ToString("0.00")); sw.WriteLine(); sw.WriteLine("So, BM = M = ({0} * {1} * {1}) / 8 = {2} kNm", factoredLoad.ToString("0.00"), eff_span.ToString("0.00"), BM.ToString("0.00")); sw.WriteLine(); sw.WriteLine("Max shear force = Vu = (Wn * lc) / 2"); double max_shear_force = (factoredLoad * lowest_Span / 2.0); sw.WriteLine(" = {0} * {1}/2 = {2} kN = {3} N", factoredLoad.ToString("0.00"), lowest_Span.ToString("0.0"), max_shear_force.ToString("0.0"), (max_shear_force * 1000).ToString("0.00")); max_shear_force *= 1000; sw.WriteLine(); sw.WriteLine("Depth of the slab is given by"); sw.WriteLine(" BM = 0.138 * σ_ck * b * d* d"); double M = (BM * 10E+5); d = ((BM * 10E+5) / (0.138 * sigma_ck * 1000)); d = Math.Sqrt(d); sw.WriteLine(); sw.WriteLine("or d = √(({0} * 10E+5)/(0.138 * {1} * 1000)) = {2} mm", BM.ToString("0.00"), sigma_ck.ToString("0.00"), d.ToString("0.00")); d = (int)(d / 10); d += 2; d *= 10; sw.WriteLine(); sw.WriteLine("Adopt effective depth d = {0} mm and over all depth", d.ToString("0.0")); sw.WriteLine(" D = {0} mm", eff_depth); sw.WriteLine(); sw.WriteLine("Adopt of tension steel is given by "); sw.WriteLine(" M = 0.87 * σ_y * A_t( d - ((σ_y * A_t)/(σ_ck * b))"); double a, b, c, At; a = (0.87 * sigma_y * sigma_y) / (sigma_ck * 1000); b = 0.87 * sigma_y * d; c = M; double b_ac = (b * b) - 4 * a * c; At = (b) - Math.Sqrt(Math.Abs(b_ac)); At = At / (2 * a); At = (int)At / 10; At += 1; At = At * 10; sw.WriteLine(); sw.WriteLine(" {0} * 10E+5 = 0.87 * {1} * At * ({2} - {3} * At / ({4} * 1000))", BM.ToString("0.00"), sigma_y.ToString("0.00"), d.ToString("0.0"), sigma_y.ToString("0.00"), sigma_ck.ToString("0.00")); sw.WriteLine(); sw.WriteLine("or At = {0} sq.mm", At); sw.WriteLine(); sw.WriteLine("Use {0} mm bars @ {1} mm c/c giving total area ", d1, d.ToString("0.0")); double est_value = (Math.PI * (d1 * d1) / 4) * (1000 / d); val1 = est_value; val2 = At; sw.WriteLine(); if (val1 > val2) { sw.WriteLine(" = {0} sq.mm. > {1} sq.mm OK", est_value.ToString("0"), At.ToString("0")); } else { sw.WriteLine(" = {0} sq.mm. < {1} sq.mm NOT OK", est_value.ToString("0"), At.ToString("0")); } double n_rod = At / ((Math.PI * (d1 * d1) / 4)); n_rod = (int)n_rod; n_rod += 1; sw.WriteLine(); sw.WriteLine(" Bend alternate bars at L/{0} from the face of support where ", n_rod); sw.WriteLine("moment reduces to less than half its maximum value. Temperature "); sw.WriteLine("reinforcement equal to {0}% of the gross concrete area will be", ads); sw.WriteLine("provided in the longitudinal direction."); sw.WriteLine(); double dirArea = (ads / 100) * 1000 * eff_depth; sw.WriteLine(" = {0:f4} * 1000 * {1:f2}", (Ads / 100), eff_depth); sw.WriteLine(" = {0:f3} sq.mm.", dirArea); sw.WriteLine(); sw.WriteLine("Use {0} mm MS bars @ 100 mm c/c giving total area ", d2.ToString("0")); sw.WriteLine(); double a_st = Math.PI * d2 * d2 / 4; val1 = a_st * 10; val2 = dirArea; if (val1 > val2) { sw.WriteLine(" = {0} * (1000/100) = {1} sq.mm. > {2} sq.mm OK", a_st.ToString("0.00"), (a_st * 10).ToString("0.00"), dirArea.ToString("0.0")); } else { sw.WriteLine(" = {0} * (1000/100) = {1} sq.mm. < {2} sq.mm NOT OK", a_st.ToString("0.00"), (a_st * 10).ToString("0.00"), dirArea.ToString("0.0")); } sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("■ STEP 3: Check for Shear"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine("Percent tension steel = (100 * At)/ (b * d)"); a_st = Math.PI * d1 * d1 / 4; double percent = (100 * (a_st * (1000 / 300))) / (1000 * d); sw.WriteLine(" = (100 * ({0} * (1000/300)) / (1000 * {1}) = {2}%", a_st.ToString("0.0"), d.ToString("0.0"), percent.ToString("0.00")); sw.WriteLine(); sw.WriteLine("Shear strength of concrete for {0}% steel", percent.ToString("0.00")); ShearValue sh = new ShearValue(); double tau_c = 0.0; tau_c = sh.Get_M15(percent); sw.WriteLine(" τ_c = {0} N/sq.mm.", tau_c); double k = kVal_Table.Get_KValue(eff_depth); double tc_dash = k * tau_c; //tau_c = tau_c; sw.WriteLine(); sw.WriteLine("For {0} mm thick slab, k = {1}", eff_depth.ToString("0.00"), k.ToString("0.00")); sw.WriteLine(); sw.WriteLine(" So, τ_c` = k * Tc = {0} * {1} = {2} N/sq.mm", k.ToString("0.00"), tau_c.ToString("0.00"), tc_dash.ToString("0.00")); double Vu = max_shear_force; double t_v = Vu / (1000 * d); sw.WriteLine(); sw.WriteLine("Nominal shear stress Tv = Vu / b * d = {0}/(1000 * {1}) = {2} N/sq.mm", Vu, d, t_v.ToString("0.00")); sw.WriteLine(); sw.WriteLine("The Slab is safe in shear."); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("■ STEP 4: Check for development length"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine("Moment of resistance offered by {0} mm bars @ {1} mm c/c", d1, d * 2); sw.WriteLine(); sw.WriteLine("M1 = 0.87 * σ_y * At * (d - (σ_y * At / σ_ck * b))"); sw.WriteLine(" = 0.87 * {0:f2} * {1:f2} * (1000/300) * ", sigma_y, a_st); sw.WriteLine(" ({0:f2} - ({1:f2} * {2:f2} * (1000 / 300)) / {3:f2} * 1000)", d, sigma_y, a_st, Sigma_ck); double M1 = 0.87 * sigma_y * a_st * (1000.0 / 300.0) * (d - (sigma_y * a_st * (1000.0d / 300.0d) / (sigma_ck * 1000.0))); sw.WriteLine(); sw.WriteLine(" = {0:F2} N mm", M1); sw.WriteLine("Vu = {0:F2} N", Vu); sw.WriteLine(); sw.WriteLine("Let us assume anchorage length Lo = 0"); sw.WriteLine(" Ld <= 1.3 * (M1/Vu)"); sw.WriteLine(" 56φ <= 1.3 * ({0}/{1})", M1.ToString("0.00"), Vu.ToString("0.00")); double phi = (1.3 * (M1 / Vu) / 56.0); val1 = phi; val2 = d1; sw.WriteLine(); if (val1 > val2) { sw.WriteLine(" φ < {0}", phi.ToString("0.00")); sw.WriteLine("We have provided φ = {0} mm, So OK.", d1.ToString("0.00")); } else { sw.WriteLine(" φ > {0}", phi.ToString("0.00")); sw.WriteLine("We have provided φ = {0} mm, So NOT OK.", d1.ToString("0.00")); } sw.WriteLine(); sw.WriteLine(" The Code requires that bars must be carried"); sw.WriteLine("into the supports by atleast Ld / 3 = 190 mm"); sw.WriteLine(); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine("■ STEP 5: Check for deflection"); sw.WriteLine("------------------------------------------------------------"); sw.WriteLine(); sw.WriteLine("Percent tension steel at midspan"); sw.WriteLine(" = (100 * As) / (b * d)"); sw.WriteLine(" = (100 * {0:F2} * 1000 / 150) / (1000 * 150)", a_st); double pps = (100 * a_st * 1000 / 150) / (1000 * 150); sw.WriteLine(" = {0}%", pps.ToString("0.00")); double gama = ModificationFactor.GetGamma(pps); sw.WriteLine(); sw.WriteLine(" γ = {0}%", gama.ToString("0.00")); //sw.WriteLine(" σσσγγβαδλ■ √"); sw.WriteLine(); sw.WriteLine(" β = {0}, δ = {1} and λ = {2}", beta, delta, lamda); // Constant 20 sw.WriteLine(); sw.WriteLine("Allowable L/d = 20 * {0} = {1}", gama.ToString("0.00"), (20 * gama).ToString("0.00")); val1 = (eff_span * 1000) / d; val2 = (20 * gama); sw.WriteLine(); if (val1 < val2) { sw.WriteLine("Actual L/d = {0} / {1} = {2} < {3} OK", (eff_span * 1000).ToString("0.00"), d, (eff_span * 1000 / d).ToString("0.00"), (20 * gama).ToString("0.00")); } else { sw.WriteLine("Actual L/d = {0} / {1} = {2} > {3} NOT OK", (eff_span * 1000).ToString("0.00"), d, (eff_span * 1000 / d).ToString("0.00"), (20 * gama).ToString("0.00")); } sw.WriteLine(); sw.WriteLine("---------------------------------------------------------------------------"); sw.WriteLine("--------------------- END OF REPORT --------------------------"); sw.WriteLine("---------------------------------------------------------------------------"); double fd = 500; sw_view.WriteLine("SLAB DESIGN 02"); sw_view.WriteLine("L = {0}", lowest_Span * 1000); sw_view.WriteLine("D = {0}", eff_depth); sw_view.WriteLine("b1 = {0}", d); sw_view.WriteLine("b2 = 100"); sw_view.WriteLine("h1 = {0}", h1); sw_view.WriteLine("h2 = {0}", h2); sw_view.WriteLine("d1 = {0}", d1); sw_view.WriteLine("d2 = {0}", d2); sw_view.WriteLine("fd = {0:f0}", fd); sw_view.WriteLine("w1 = {0}", w1); sw_view.WriteLine("w2 = {0}", w1); sw_view.WriteLine("END"); //BoQ CODE //S_No 1.,2.,3. //Member 3.5 8.0 //Bar_Mark 01,02,03 //Bar_CODE T10_B1,T6_B2,T10_B1 //Bar_Grade Fe415,Fe415,Fe415 //Bar_Dia 10,6,10 //Bar_Length 3470,7970,3470 //Bar_Nos 56,35,56 //Bar_Weight 0.330,0.220,0.330 //Bar_Shape 3019,120,1209 //Bar_Shape 1209,120,3019 //END BoQ int main_bar_nos, dist_bar_nos; double wt_main_bar, wt_dist_bar; sw_boq.WriteLine("BoQ Code"); sw_boq.WriteLine("S_No {0}.,{1}.,{2}.", 1, 2, 3); sw_boq.WriteLine("Member {0} {1}", B.ToString("0.0"), L.ToString("0.0")); sw_boq.WriteLine("Bar_Spacing {0},{1}", d.ToString("0.0"), "100.0"); sw_boq.WriteLine("Bar_Mark 01,02,03"); sw_boq.WriteLine("Bar_Code T{0}_B1,T{1}_B2,T{0}_B1", d1, d2); sw_boq.WriteLine("BAR_Grade Fe{0},Fe{0},Fe{0}", sigma_y); sw_boq.WriteLine("Bar_Dia {0},{1},{0}", d1, d2); sw_boq.WriteLine("Bar_Length {0},{1},{0}", (B * 1000 - 2 * h1), (L * 1000 - 2 * h1)); main_bar_nos = (int)(L * 1000 / d); dist_bar_nos = (int)(B * 1000 / 100.0d); wt_main_bar = 0.00616 * d1 * d1 * (B)*main_bar_nos; wt_dist_bar = 0.00616 * d2 * d2 * (L)*dist_bar_nos; wt_main_bar /= 1000.0d; wt_dist_bar /= 1000.0d; //sw_boq.WriteLine("Bar_Nos {0},{1},{0}", "56", "35", "56"); sw_boq.WriteLine("Bar_Nos {0},{1},{0}", main_bar_nos, dist_bar_nos); sw_boq.WriteLine("Bar_Weight {0},{1},{0}", wt_main_bar.ToString("0.000"), wt_dist_bar.ToString("0.000")); //sw_boq.WriteLine("Bar_Weight {0},{1},{0}", "0.330", "0.220"); double k_d = eff_depth - (2 * ((h1 + (d1 / 2)))); double aaa = Math.Sqrt((k_d * k_d) + (k_d * k_d)); double tot_len = (lowest_Span * 1000.0) + 2 * w1 - 2 * h1; double sh1 = tot_len - (fd + (w1 - h1)); double sh2 = (fd + (w1 - h1)) - eff_depth; sw_boq.WriteLine("Bar_Shape {0},{1:f0},{2}", sh1, aaa, sh2); //sw_boq.WriteLine("Bar_Shape {0},{1:f0},{2}", 3140, aaa, 1290); sw_boq.WriteLine("Bar_Shape {0}", ((L * 1000.0) - (2 * h1))); sw_boq.WriteLine("Bar_Shape {0},{1},{2}", sh2, aaa, sh1); sw_boq.WriteLine("END BoQ"); } catch (Exception exx) { } finally { GC.Collect(); sw.Flush(); sw.Close(); sw_view.Flush(); sw_view.Close(); sw_boq.Flush(); sw_boq.Close(); } }
public static void SetupTendrils() { // ============== setup base skill ============== var tendrils = ResourcesPrefabManager.Instance.GetItemPrefab(8890100) as AttackSkill; // setup skill tendrils.CastModifier = Character.SpellCastModifier.Mobile; // can move while casting but movement speed is 0.3x tendrils.MobileCastMovementMult = 0.3f; // clear existing effects SideLoader.Helpers.UnityHelpers.DestroyChildren(tendrils.transform); // ============= normal effects =============== // // create new effects var effects = new GameObject("Effects"); effects.transform.parent = tendrils.transform; // add our custom PlagueAura proximity condition component (INVERT = TRUE, we DONT want the aura on these effects). var auraCondition1 = effects.AddComponent <PlagueAuraProximityCondition>(); auraCondition1.ProximityDist = 2.5f; auraCondition1.Invert = true; // create the Tendrils effect, a custom class derived from ShootProjectile NoxiousTendrils shootTendrils = effects.AddComponent <NoxiousTendrils>(); var orig = ResourcesPrefabManager.Instance.GetItemPrefab(8300292).transform.Find("Effects").GetComponent <ShootProjectile>(); At.CopyFields(shootTendrils, orig, null, true); shootTendrils.SyncType = Effect.SyncTypes.Everyone; // disable clone target before cloning it var origProjectile = shootTendrils.BaseProjectile.gameObject; origProjectile.SetActive(false); var projectileObj = GameObject.Instantiate(origProjectile); GameObject.DontDestroyOnLoad(projectileObj); //projectileObj.SetActive(true); projectileObj.name = "NoxiousTendrils"; // get the actual Projectile component from our new Projectile Object, and set our "BaseProjectile" to this component var projectile = projectileObj.GetComponent <RaycastProjectile>(); shootTendrils.BaseProjectile = projectile; shootTendrils.IntanstiatedAmount = 8; // 2 per character, potential 3 summoned skeletons, so 8 total subeffects needed. projectile.Lifespan = 0.75f; projectile.DisableOnHit = false; projectile.EndMode = Projectile.EndLifeMode.LifetimeOnly; projectile.HitEnemiesOnly = true; // sound play if (projectileObj.GetComponentInChildren <SoundPlayer>() is SoundPlayer lightPlayer) { lightPlayer.Sounds = new List <GlobalAudioManager.Sounds> { GlobalAudioManager.Sounds.SFX_FireThrowLight }; } // heal on hit if (projectile.GetComponentInChildren <AffectHealthParentOwner>() is AffectHealthParentOwner heal) { heal.AffectQuantity = NecromancerMod.settings.ShootTendrils_Heal_NoPlagueAura; } // change damage and hit effects var hit = projectile.transform.Find("HitEffects").gameObject; hit.GetComponent <PunctualDamage>().Damages = NecromancerMod.settings.ShootTendrils_Damage_NoPlagueAura; hit.GetComponent <PunctualDamage>().Knockback = NecromancerMod.settings.ShootTendrils_Knockback_NoPlagueAura; var comp = hit.AddComponent <AddStatusEffectBuildUp>(); comp.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Curse"); comp.BuildUpValue = 25; // adjust visuals foreach (ParticleSystem ps in projectileObj.GetComponentsInChildren <ParticleSystem>()) { var m = ps.main; m.startColor = Color.green; m.startSize = new ParticleSystem.MinMaxCurve(0.05f, 0.09f); } // ================= plague aura interaction effects =============== var plagueEffectsObj = new GameObject("Effects"); plagueEffectsObj.transform.parent = tendrils.transform; // add our custom PlagueAura proximity condition component var auraCondition2 = plagueEffectsObj.AddComponent <PlagueAuraProximityCondition>(); auraCondition2.ProximityDist = 2.5f; auraCondition2.Invert = false; // add our custom ShootTendrils component NoxiousTendrils strongTendrils = plagueEffectsObj.AddComponent <NoxiousTendrils>(); At.CopyFields(strongTendrils, orig, null, true); // clone the projectile origProjectile.SetActive(false); var strongProjObj = GameObject.Instantiate(origProjectile); GameObject.DontDestroyOnLoad(strongProjObj); origProjectile.SetActive(true); strongProjObj.name = "StrongNoxiousTendrils"; var strongProj = strongProjObj.GetComponent <RaycastProjectile>(); strongTendrils.BaseProjectile = strongProj; strongTendrils.IntanstiatedAmount = 8; strongProj.Lifespan = 0.75f; strongProj.DisableOnHit = false; strongProj.EndMode = Projectile.EndLifeMode.LifetimeOnly; strongProj.HitEnemiesOnly = true; // sound play if (strongProjObj.GetComponentsInChildren <SoundPlayer>() is SoundPlayer[] strongPlayers && strongPlayers.Count() > 0) { foreach (SoundPlayer player in strongPlayers) { player.Sounds = new List <GlobalAudioManager.Sounds> { GlobalAudioManager.Sounds.SFX_SKILL_ElemantalProjectileWind_Shot }; } } // heal on hit if (strongProj.GetComponentInChildren <AffectHealthParentOwner>() is AffectHealthParentOwner strongHeal) { //DestroyImmediate(heal); strongHeal.AffectQuantity = NecromancerMod.settings.ShootTendrils_Heal_InsideAura; } // change damage and hit effects. var strongHit = strongProj.transform.Find("HitEffects").gameObject; strongHit.GetComponent <PunctualDamage>().Damages = NecromancerMod.settings.ShootTendrils_Damage_InsideAura; strongHit.GetComponent <PunctualDamage>().Knockback = NecromancerMod.settings.ShootTendrils_Knockback_InsideAura; comp = strongHit.AddComponent <AddStatusEffectBuildUp>(); comp.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Curse"); comp.BuildUpValue = 60; // adjust visuals foreach (ParticleSystem ps in strongProjObj.GetComponentsInChildren <ParticleSystem>()) { var m = ps.main; m.startColor = Color.green; m.startSize = new ParticleSystem.MinMaxCurve(0.12f, 0.20f); } }
public async Task <IActionResult> SendMessage(SendMessageAddressModel model) { if (model.RecordTime > DateTime.UtcNow || model.RecordTime + TimeSpan.FromSeconds(100) < DateTime.UtcNow) { model.RecordTime = DateTime.UtcNow; } model.At = model.At ?? new string[0]; var user = await GetKahlaUser(); var target = await _dbContext .Conversations .Include(t => (t as PrivateConversation).RequestUser) .ThenInclude(t => t.HisDevices) .Include(t => (t as PrivateConversation).TargetUser) .ThenInclude(t => t.HisDevices) .Include(t => (t as GroupConversation).Users) .ThenInclude(t => t.User) .ThenInclude(t => t.HisDevices) .SingleOrDefaultAsync(t => t.Id == model.Id); if (target == null) { return(this.Protocol(ErrorType.NotFound, $"Can not find conversation with id: {model.Id}.")); } if (!target.HasUser(user.Id)) { return(this.Protocol(ErrorType.Unauthorized, "You don't have any relationship with that conversation.")); } if (model.Content.Trim().Length == 0) { return(this.Protocol(ErrorType.InvalidInput, "Can not send empty message.")); } // Create message. var message = new Message { Id = Guid.Parse(model.MessageId), Content = model.Content, SenderId = user.Id, Sender = user, ConversationId = target.Id, SendTime = model.RecordTime }; _dbContext.Messages.Add(message); await _dbContext.SaveChangesAsync(); // Create at info for this message. foreach (var atTargetId in model.At) { if (target.HasUser(atTargetId)) { var at = new At { MessageId = message.Id, TargetUserId = atTargetId }; message.Ats.Add(at); _dbContext.Ats.Add(at); } else { _dbContext.Messages.Remove(message); await _dbContext.SaveChangesAsync(); return(this.Protocol(ErrorType.InvalidInput, $"Can not at person with Id: '{atTargetId}' because he is not in this conversation.")); } } // Save the ats. await _dbContext.SaveChangesAsync(); // Set last read time. var lastReadTime = await target.SetLastRead(_dbContext, user.Id); await _dbContext.SaveChangesAsync(); await target.ForEachUserAsync((eachUser, relation) => { var mentioned = model.At.Contains(eachUser.Id); return(_pusher.NewMessageEvent( stargateChannel: eachUser.CurrentChannel, devices: eachUser.HisDevices, conversation: target, message: message, pushAlert: eachUser.Id != user.Id && (mentioned || !(relation?.Muted ?? false)), mentioned: mentioned )); }); return(Json(new AiurValue <Message>(message) { Code = ErrorType.Success, Message = "Your message has been sent." })); }
// Token: 0x06000007 RID: 7 RVA: 0x0000225C File Offset: 0x0000045C public static bool AdaptGrip(Character __instance, ref int _type, ref int _id) { Weapon weapon = (__instance != null) ? __instance.CurrentWeapon : null; bool flag = weapon == null; bool result; if (flag) { result = false; } else { bool flag2 = _type == 2502; if (flag2) { MeleeSkill meleeSkill = At.GetValue(typeof(Character), __instance, "m_lastUsedSkill") as MeleeSkill; bool flag3 = meleeSkill != null && meleeSkill.ActivateEffectAnimType == Character.SpellCastType.WeaponSkill1; if (flag3) { bool flag4 = meleeSkill.RequiredWeaponTypes[0] != weapon.Type; if (flag4) { CustomWeaponBehaviour.ChangeGrip(__instance, meleeSkill.RequiredWeaponTypes[0]); return(true); } } } bool flag5 = weapon.HasTag(CustomWeaponBehaviour.FinesseTag); if (flag5) { bool flag6 = _type == 1 && !BehaviourManager.IsComboAttack(__instance, _type, _id); if (flag6) { CustomWeaponBehaviour.ChangeGrip(__instance, Weapon.WeaponType.Axe_1H); return(true); } } bool flag7 = BehaviourManager.IsHalfHandedMode(weapon); if (flag7) { bool flag8 = _type == 1 && !BehaviourManager.IsComboAttack(__instance, _type, _id); if (flag8) { CustomWeaponBehaviour.ChangeGrip(__instance, Weapon.WeaponType.Spear_2H); return(true); } } bool flag9 = BehaviourManager.IsBastardMode(weapon); if (flag9) { Weapon.WeaponType?bastardType = BehaviourManager.GetBastardType(weapon.Type); Weapon.WeaponType valueOrDefault; bool flag10; if (bastardType != null) { valueOrDefault = bastardType.GetValueOrDefault(); flag10 = true; } else { flag10 = false; } bool flag11 = flag10; if (flag11) { bool flag12 = _type != 2502; if (flag12) { CustomWeaponBehaviour.ChangeGrip(__instance, valueOrDefault); return(true); } } } result = false; } return(result); }
// TODO DOC public static void SetProperty <T>(this T instance, string propertyName, object value) => At.Internal_SetProperty(typeof(T), propertyName, value, instance);
// TODO DOC public static void SetProperty(this Type type, string propertyName, object value) => At.Internal_SetProperty(type, propertyName, value, null);
// ========= property extensions // TODO DOC public static R GetProperty <R, T>(this T instance, string propertyName) => (R)At.Internal_GetProperty(typeof(T), propertyName, instance);
// TODO DOC public static R GetProperty <R>(this Type type, string propertyName) => At.Internal_GetProperty <R>(type, propertyName, null);
// TODO DOC public static void SetField(this Type type, string fieldName, object value) => At.Internal_SetField(type, fieldName, null, value);
/// <summary> /// Helper to set the value of a field.<br/><br/> /// If the field is <see langword="private"/>, it must be contained inside the <see cref="Type"/> of <typeparamref name="T"/>. /// </summary> /// <typeparam name="T">The type which contains the field, can be inherited if not private.</typeparam> /// <param name="instance">The instance you want to set the field on</param> /// <param name="fieldName">The name of the field to set</param> /// <param name="value">The value you want to set on the field</param> public static void SetField <T>(this T instance, string fieldName, object value) => At.Internal_SetField(typeof(T), fieldName, instance, value);
/// <summary> /// Helper to get the value of a static field inside a Type. /// </summary> /// <typeparam name="R">The Type of the return value you are expecting</typeparam> /// <param name="type">The type which contains the field you want to get.</param> /// <param name="fieldName">The name of the field to get</param> /// <returns>The value from the field if successful, and/or null.</returns> public static R GetField <R>(this Type type, string fieldName) => At.Internal_GetField <R>(type, fieldName, null);
// Token: 0x06000006 RID: 6 RVA: 0x000022B4 File Offset: 0x000004B4 public static void SetupTrainerClientSide(GameObject juggernautGameObject, int trainerViewID) { GameObject gameObject = new GameObject("UNPC_The Juggernaut"); gameObject.transform.position = JuggernautTrainer.TrainerLocation; juggernautGameObject.transform.parent = gameObject.transform; juggernautGameObject.transform.position = gameObject.transform.position; juggernautGameObject.transform.rotation = Quaternion.Euler(0f, 220.5518f, 0f); juggernautGameObject.transform.localScale = new Vector3(1.15f, 1.15f, 1.15f); UnityEngine.Object.DestroyImmediate(juggernautGameObject.GetComponent <StartingEquipment>()); Character component = juggernautGameObject.GetComponent <Character>(); component.Stats.enabled = false; Weapon currentWeapon = component.CurrentWeapon; bool flag = currentWeapon != null && currentWeapon.TwoHanded; if (flag) { component.LeftHandEquipment = component.CurrentWeapon; component.LeftHandChanged(); } component.Sheathed = false; GameObject gameObject2 = UnityEngine.Object.Instantiate(Resources.Load("editor/templates/TrainerTemplate")) as GameObject; gameObject2.transform.parent = juggernautGameObject.transform; gameObject2.transform.position = juggernautGameObject.transform.position; gameObject2.transform.rotation = juggernautGameObject.transform.rotation; DialogueActor componentInChildren = gameObject2.GetComponentInChildren <DialogueActor>(); componentInChildren.SetName("The Juggernaut"); Trainer componentInChildren2 = gameObject2.GetComponentInChildren <Trainer>(); At.SetValue <UID>(JuggernautMod.juggernautTreeInstance.UID, typeof(Trainer), componentInChildren2, "m_skillTreeUID"); DialogueTreeController componentInChildren3 = gameObject2.GetComponentInChildren <DialogueTreeController>(); Graph graph = componentInChildren3.graph; List <DialogueTree.ActorParameter> list = At.GetValue(typeof(DialogueTree), graph as DialogueTree, "_actorParameters") as List <DialogueTree.ActorParameter>; list[0].actor = componentInChildren; list[0].name = componentInChildren.name; List <Node> list2 = At.GetValue(typeof(Graph), graph, "_nodes") as List <Node>; StatementNodeExt statementNodeExt = graph.AddNode <StatementNodeExt>(); statementNodeExt.statement = new Statement("What do you want, peasant?"); statementNodeExt.SetActorName(componentInChildren.name); MultipleChoiceNodeExt multipleChoiceNodeExt = graph.AddNode <MultipleChoiceNodeExt>(); multipleChoiceNodeExt.availableChoices.Add(new MultipleChoiceNodeExt.Choice { statement = new Statement { text = "I wish to become a legend like you!" } }); multipleChoiceNodeExt.availableChoices.Add(new MultipleChoiceNodeExt.Choice { statement = new Statement { text = "Who are you?" } }); ActionNode actionNode = list2[1] as ActionNode; (actionNode.action as TrainDialogueAction).Trainer = new BBParameter <Trainer>(componentInChildren2); StatementNodeExt statementNodeExt2 = graph.AddNode <StatementNodeExt>(); statementNodeExt2.statement = new Statement("Hah! Like you don't know... Everyone knows me, I'm a living legend known as \"The Juggernaut\"!"); statementNodeExt2.SetActorName(componentInChildren.name); list2.Clear(); list2.Add(statementNodeExt); list2.Add(multipleChoiceNodeExt); list2.Add(actionNode); list2.Add(statementNodeExt2); graph.primeNode = statementNodeExt; graph.ConnectNodes(statementNodeExt, multipleChoiceNodeExt, -1, -1); graph.ConnectNodes(multipleChoiceNodeExt, actionNode, 0, -1); graph.ConnectNodes(multipleChoiceNodeExt, statementNodeExt2, 1, -1); graph.ConnectNodes(statementNodeExt2, statementNodeExt, -1, -1); gameObject.SetActive(true); }
// ========= method extensions // TODO DOC public static R Invoke <R, T>(this T instance, string methodName, Type[] argumentTypes = null, params object[] args) => At.Internal_Invoke <R>(typeof(T), methodName, argumentTypes, instance, args);
public override void SerializeEffect <T>(T effect, DM_Effect holder) { var selector = (TagSourceSelector)At.GetField(effect as AddStatusImmunity, "m_statusImmunity"); (holder as DM_AddStatusImmunity).ImmunityTag = selector.Tag.TagName; }
// TODO DOC public static R Invoke <R>(this Type type, string methodName, Type[] argumentTypes = null, params object[] args) => At.Internal_Invoke <R>(type, methodName, argumentTypes, null, args);
public async Task <IActionResult> SendMessage(SendMessageAddressModel model) { model.At = model.At ?? new string[0]; var user = await GetKahlaUser(); var target = await _dbContext.Conversations.FindAsync(model.Id); if (!await _dbContext.VerifyJoined(user.Id, target)) { return(this.Protocol(ErrorType.Unauthorized, "You don't have any relationship with that conversation.")); } if (model.Content.Trim().Length == 0) { return(this.Protocol(ErrorType.InvalidInput, "Can not send empty message.")); } // Create message. var message = new Message { Content = model.Content, SenderId = user.Id, ConversationId = target.Id }; _dbContext.Messages.Add(message); await _dbContext.SaveChangesAsync(); // Create at info for this message. foreach (var atTargetId in model.At) { if (await _dbContext.VerifyJoined(atTargetId, target)) { var at = new At { MessageId = message.Id, TargetUserId = atTargetId }; _dbContext.Ats.Add(at); } else { _dbContext.Messages.Remove(message); await _dbContext.SaveChangesAsync(); return(this.Protocol(ErrorType.InvalidInput, $"Can not at person with Id: '{atTargetId}' because he is not in this conversation.")); } } await _dbContext.SaveChangesAsync(); await target.ForEachUserAsync(async (eachUser, relation) => { var mentioned = model.At.Contains(eachUser.Id); await _pusher.NewMessageEvent( receiver: eachUser, conversation: target, content: model.Content, sender: user, muted: !mentioned && (relation?.Muted ?? false), mentioned: mentioned ); }, _userManager); try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(this.Protocol(ErrorType.RequireAttention, "Your message has been sent. But an error occured while sending web push notification.")); } //Return success message. return(this.Protocol(ErrorType.Success, "Your message has been sent.")); }
public void LocalTrainerSetup(Character trainer, string _) { // remove unwanted components DestroyImmediate(trainer.GetComponent <CharacterStats>()); DestroyImmediate(trainer.GetComponent <StartingEquipment>()); // add NPCLookFollow component trainer.gameObject.AddComponent <NPCLookFollow>(); // =========== setup Trainer DialogueTree from the template =========== var trainertemplate = Instantiate(Resources.Load <GameObject>("editor/templates/TrainerTemplate")); trainertemplate.transform.parent = trainer.transform; trainertemplate.transform.position = trainer.transform.position; // set Dialogue Actor name var necroActor = trainertemplate.GetComponentInChildren <DialogueActor>(); necroActor.SetName(trainerTemplate.Name); // get "Trainer" component, and set the SkillTreeUID to our custom tree UID var trainerComp = trainertemplate.GetComponentInChildren <Trainer>(); At.SetField(trainerComp, "m_skillTreeUID", SkillManager.NecromancerTree.UID); // setup dialogue tree var graphController = trainertemplate.GetComponentInChildren <DialogueTreeController>(); var graph = graphController.graph; // the template comes with an empty ActorParameter, we can use that for our NPC actor. var actors = At.GetField(graph as DialogueTree, "_actorParameters") as List <DialogueTree.ActorParameter>; actors[0].actor = necroActor; actors[0].name = necroActor.name; // setup the actual dialogue now var rootStatement = graph.AddNode <StatementNodeExt>(); rootStatement.statement = new Statement("Do you seek to harness the power of Corruption, traveler?"); rootStatement.SetActorName(necroActor.name); var multiChoice1 = graph.AddNode <MultipleChoiceNodeExt>(); multiChoice1.availableChoices.Add(new MultipleChoiceNodeExt.Choice { statement = new Statement { text = "I'm interested, what can you teach me?" } }); multiChoice1.availableChoices.Add(new MultipleChoiceNodeExt.Choice { statement = new Statement { text = "Who are you?" } }); multiChoice1.availableChoices.Add(new MultipleChoiceNodeExt.Choice { statement = new Statement { text = "What is this place?" } }); // the template already has an action node for opening the Train menu. // Let's grab that and change the trainer to our custom Trainer component (setup above). var openTrainer = graph.allNodes[1] as ActionNode; (openTrainer.action as TrainDialogueAction).Trainer = new BBParameter <Trainer>(trainerComp); // create some custom dialogue var answer1 = graph.AddNode <StatementNodeExt>(); answer1.statement = new Statement("I wish I could remember..."); answer1.SetActorName(necroActor.name); var answer2 = graph.AddNode <StatementNodeExt>(); answer2.statement = new Statement("This is the fortress of the Plague Doctor, a powerful Lich. I've learned a lot about Corruption within these walls."); answer2.SetActorName(necroActor.name); // ===== finalize nodes ===== graph.allNodes.Clear(); // add the nodes we want to use graph.allNodes.Add(rootStatement); graph.allNodes.Add(multiChoice1); graph.allNodes.Add(openTrainer); graph.allNodes.Add(answer1); graph.allNodes.Add(answer2); graph.primeNode = rootStatement; graph.ConnectNodes(rootStatement, multiChoice1); // prime node triggers the multiple choice graph.ConnectNodes(multiChoice1, openTrainer, 0); // choice1: open trainer graph.ConnectNodes(multiChoice1, answer1, 1); // choice2: answer1 graph.ConnectNodes(answer1, rootStatement); // - choice2 goes back to root node graph.ConnectNodes(multiChoice1, answer2, 2); // choice3: answer2 graph.ConnectNodes(answer2, rootStatement); // - choice3 goes back to root node // set the trainer active trainer.gameObject.SetActive(true); }
public override void SerializeEffect <T>(T effect, DM_Effect holder) { (holder as DM_AffectFood).AffectQuantity = (float)At.GetField(effect as AffectNeed, "m_affectQuantity"); }
public override void SerializeEffect <T>(T effect) { AffectQuantity = (float)At.GetField(effect as AffectNeed, "m_affectQuantity"); }
public static void RefreshVertical(SplitScreenManager self, DictionaryExt <int, SplitPlayer> localUIs) { if (GameDisplayInUI.Instance.gameObject.activeSelf != self.RenderInImage) { GameDisplayInUI.Instance.gameObject.SetActive(self.RenderInImage); } for (int i = 0; i < localUIs.Count; i++) { SplitPlayer splitPlayer = localUIs.Values[i]; Vector3 default_OFFSET = CharacterCamera.DEFAULT_OFFSET; Vector2 zero = Vector2.zero; Vector2 zero2 = Vector2.zero; Rect splitRect = new Rect(0f, 0f, 0f, 0f); RawImage rawImage = (!self.RenderInImage) ? null : GameDisplayInUI.Instance.Screens[i]; float foV; if (localUIs.Count == 1) { splitRect.position = Vector2.zero; splitRect.size = Vector2.one; foV = OptionManager.Instance.GetFoVSolo(i); if (self.RenderInImage) { rawImage.rectTransform.localScale = Vector3.one; GameDisplayInUI.Instance.Screens[1].gameObject.SetActive(false); } GameDisplayInUI.Instance.SetMultiDisplayActive(false); } else { if (localUIs.Count != 2) { throw new NotImplementedException("Support for more than 2 players is not implemented."); } int num = i + 1; if (self.RenderInImage) { splitRect.position = ((i != 0) ? new Vector2(0.5f, 0f) : Vector2.zero); splitRect.size = new Vector2(0.5f, 1f); } else { splitRect.position = new Vector2(0.5f * (float)((i != 0) ? 1 : -1), 0f); splitRect.size = Vector2.one; } foV = OptionManager.Instance.GetFoVSplit(i); default_OFFSET.z = -2.5f; zero2.x = -0.5f; zero.x = (float)((num % 2 != 1) ? -1 : 1) * 0.5f; if (self.RenderInImage) { GameDisplayInUI.Instance.Screens[1].gameObject.SetActive(true); } } CameraSettings settings; settings.FoV = foV; settings.SplitRect = splitRect; settings.Offset = default_OFFSET; settings.CameraDepth = 2 * i; settings.Image = rawImage; splitPlayer.RefreshSplitScreen(zero, zero2, settings); } if ((bool)CONFIG.GetValue(Settings.moveGlobalUiToPlayer1.ToString())) { Vector2 zero3 = Vector2.zero; Vector2 zero4 = Vector2.zero; if (self.LocalPlayers.Count == 2) { zero4.x = -0.5f; zero3.x = 0.5f; } Vector2 vector = Vector2.Scale(zero4, MenuManager.Instance.ScreenSize); Vector2 anchoredPosition = Vector2.Scale(zero3, vector); if (At.GetField(MenuManager.Instance, "m_masterLoading") is LoadingFade loadingFade) { RectTransform componentInChildren = loadingFade.GetComponentInChildren <RectTransform>(); bool flag7 = componentInChildren != null; if (flag7) { componentInChildren.sizeDelta = vector; componentInChildren.anchoredPosition = anchoredPosition; } } if (At.GetField(MenuManager.Instance, "m_prologueScreen") is ProloguePanel prologuePanel) { RectTransform rectTransform = prologuePanel.RectTransform; rectTransform.sizeDelta = vector; rectTransform.anchoredPosition = anchoredPosition; } } }
public void Can_use_At_time_with_seconds() { var time = At.Time(14, 15, 16); time.ShouldBe(new TimeSpan(0, 14, 15, 16)); }
public static void SetupDeathRitual() { var detonateSkill = ResourcesPrefabManager.Instance.GetItemPrefab(8890106) as AttackSkill; // setup skill detonateSkill.CastSheathRequired = -1; detonateSkill.RequiredOffHandTypes.Clear(); detonateSkill.RequiredTags = new TagSourceSelector[0]; detonateSkill.StartVFX = null; // destroy these existing effects GameObject.Destroy(detonateSkill.transform.Find("RunicRay").gameObject); GameObject.DestroyImmediate(detonateSkill.transform.Find("Effects").gameObject); // hang onto the ShootBlast, we want to use this var shootBlast = detonateSkill.transform.Find("RunicBlast").GetChild(0).GetComponent <ShootBlast>(); // ======== setup weak blast ============ // create new Effects object var effects = new GameObject("Effects"); effects.transform.parent = detonateSkill.transform; var detonateBlast = effects.AddComponent <DeathRitual>(); At.CopyFields(detonateBlast, shootBlast, null, true); // destroy the old RunicBlast now that we stole the blast component GameObject.Destroy(detonateSkill.transform.Find("RunicBlast").gameObject); // add condition. Required item on summon is Mertons Bones. var condition = effects.AddComponent <DeathRitualCondition>(); condition.RequiredSummonEquipment = 3200030; condition.Invert = false; // disable clone target before cloning it var origBlast = detonateBlast.BaseBlast.gameObject; origBlast.SetActive(false); var blastObj = GameObject.Instantiate(origBlast); GameObject.DontDestroyOnLoad(blastObj); blastObj.name = "DetonateBlast"; var blast = blastObj.GetComponentInChildren <CircularBlast>(); detonateBlast.BaseBlast = blast; if (blast.GetComponentInChildren <PunctualDamage>() is PunctualDamage pDamage) { pDamage.Damages = NecromancerMod.settings.DeathRitual_WeakExplosionDamage; pDamage.Knockback = NecromancerMod.settings.DeathRitual_WeakKnockback; } var explosionFX = blast.transform.Find("ExplosionFX").gameObject; foreach (var particles in explosionFX.GetComponentsInChildren <ParticleSystem>()) { var m = particles.main; m.startColor = Color.green; } // =========== STRONG DETONATION (blue ghost) ================= // var effects2 = new GameObject("Effects"); effects2.transform.parent = detonateSkill.transform; var detonateBlast2 = effects2.AddComponent <DeathRitual>(); At.CopyFields(detonateBlast2, detonateBlast, null, true); // add condition. Required item on summon is Blue Ghost robes. var condition2 = effects2.AddComponent <DeathRitualCondition>(); condition2.RequiredSummonEquipment = 3200040; condition2.Invert = false; origBlast.SetActive(false); var blastObj2 = GameObject.Instantiate(origBlast); origBlast.SetActive(false); GameObject.DontDestroyOnLoad(blastObj2); blastObj2.name = "StrongDetonateBlast"; var blast2 = blastObj2.GetComponent <CircularBlast>(); detonateBlast2.BaseBlast = blast2; if (blast2.GetComponentInChildren <PunctualDamage>() is PunctualDamage pDamage2) { pDamage2.Damages = NecromancerMod.settings.DeathRitual_StrongExplosionDamage; pDamage2.Knockback = NecromancerMod.settings.DeathRitual_StrongKnockback; var comp = pDamage2.gameObject.AddComponent <AddStatusEffect>(); comp.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Slow Down"); } var explosionFX2 = blast2.transform.Find("ExplosionFX").gameObject; foreach (ParticleSystem particles in explosionFX2.GetComponentsInChildren <ParticleSystem>()) { var m = particles.main; m.startColor = new Color() { r = 0.2f, g = 0.4f, b = 1, a = 1 }; // cyan-ish } }
public static MessageChainBuilder AddAt(this MessageChainBuilder builder, long who) { var at = new At(who); return(builder.Add(at)); }
public static Color GetColor(BasicElement element, int relativePositionX = 1, int relativePositionY = 1) { return(GetColor(element, At.TopLeft(relativePositionX, relativePositionY))); }
public async Task <IActionResult> SendMessage(SendMessageAddressModel model) { // Ensure everything is safe. model.At ??= new string[0]; var user = await GetKahlaUser(); var target = await _dbContext .Conversations .Include(t => (t as PrivateConversation).RequestUser) .ThenInclude(t => t.HisDevices) .Include(t => (t as PrivateConversation).TargetUser) .ThenInclude(t => t.HisDevices) .Include(t => (t as GroupConversation).Users) .ThenInclude(t => t.User) .ThenInclude(t => t.HisDevices) .SingleOrDefaultAsync(t => t.Id == model.Id); if (target == null) { return(this.Protocol(ErrorType.NotFound, $"Can not find conversation with id: {model.Id}.")); } if (!target.HasUser(user.Id)) { return(this.Protocol(ErrorType.Unauthorized, "You don't have any relationship with that conversation.")); } if (model.Content.Trim().Length == 0) { return(this.Protocol(ErrorType.InvalidInput, "Can not send empty message.")); } // Get last message Id. string lastMessageId; try { lastMessageId = _lastSaidJudger.LastMessageId(target.Id); } catch (InvalidOperationException) { Guid?nullableLastMessageId = await _dbContext .Messages .Where(t => t.ConversationId == target.Id) .OrderByDescending(t => t.SendTime) .Select(t => t.Id) .FirstOrDefaultAsync(); lastMessageId = nullableLastMessageId.Value.ToString(); } // Create message. var message = new Message { Id = Guid.Parse(model.MessageId), Content = model.Content, SenderId = user.Id, Sender = user.Build(_onlineJudger), ConversationId = target.Id, SendTime = DateTime.UtcNow, GroupWithPrevious = _lastSaidJudger.ShallBeGroupped(user.Id, target.Id) }; await _dbContext.Messages.AddAsync(message); await _dbContext.SaveChangesAsync(); _lastSaidJudger.MarkSend(user.Id, target.Id, message.Id); // Create at info for this message. foreach (var atTargetId in model.At) { if (target.HasUser(atTargetId)) { var at = new At { MessageId = message.Id, TargetUserId = atTargetId }; message.Ats.Add(at); await _dbContext.Ats.AddAsync(at); } else { _dbContext.Messages.Remove(message); await _dbContext.SaveChangesAsync(); return(this.Protocol(ErrorType.InvalidInput, $"Can not at person with Id: '{atTargetId}' because he is not in this conversation.")); } } // Save the ats. await _dbContext.SaveChangesAsync(); // Set last read time. await _dbContext.SetLastRead(target, user.Id); await _dbContext.SaveChangesAsync(); await target.ForEachUserAsync((eachUser, relation) => { var mentioned = model.At.Contains(eachUser.Id); return(_pusher.NewMessageEvent( stargateChannel: eachUser.CurrentChannel, devices: eachUser.HisDevices, conversation: target, message: message, lastMessageId: lastMessageId, pushAlert: eachUser.Id != user.Id && (mentioned || !(relation?.Muted ?? false)), mentioned: mentioned )); }); return(Json(new AiurValue <Message>(message) { Code = ErrorType.Success, Message = "Your message has been sent." })); }
public override void ApplyToComponent <T>(T component) { At.SetField(component as AddAbsorbHealth, "m_healthRatio", this.HealthRatio); }
public override void SerializeEffect <T>(T effect) { var selector = (TagSourceSelector)At.GetField(effect as AffectNeed, "m_statusImmunity"); ImmunityTag = selector.Tag.TagName; }