public static void Main (string[] args) { var o = new Obj { Prop = Enm.A }; o.Prop |= Enm.C; }
public static object ParseMetadata(string filename) { Obj obj = new Obj(); obj.LoadObj(filename); return null; }
public int Test1(Obj b) { int tmp = b.FooBar(); int j = 0; j++; Contract.Assert(tmp >= 0); return 7; }
public Obj GetKey(int index) { if (index < 0 || index >= _entries.Count) return Undefined; Obj[] v = new Obj[_entries.Count]; _entries.Keys.CopyTo(v, 0); return v[index]; }
// Removes [key] from [map], if present. Returns the value for the key if found // or `NULL_VAL` otherwise. public Obj Remove(Obj key) { Obj v; if (!_entries.TryGetValue(key, out v)) return Null; _entries.Remove(key); return v; }
// Creates a new instance of the given [classObj]. public ObjInstance(ObjClass classObj) { Fields = new Obj[classObj.NumFields]; // Initialize fields to null. for (int i = 0; i < classObj.NumFields; i++) { Fields[i] = Null; } ClassObj = classObj; }
protected void Page_Load(object sender, EventArgs e) { var id = Request["ID"]; using(var con = DAL.con()) { Item = ObjDal.SelectByRowId(con, new Guid(id)); var pager = BinhLuanDal.PagerByPRowId(con, "?{1}={0}", true, id, 20); ListAll.Item = Item; ListAll.Pager = pager; } }
public void Run() { Failed = false; try { // Older versions of SWIG used IntPtr instead of HandleRef to hold the underlying // C++ pointer, so this test would (usually) fail as the garbage collector would // sometimes collect the Number class while it was being used in unmanaged code for (int i=0; i<5000; i++) { // run test for a few seconds { Obj obj = new Obj(); Number n = new Number(i); Number triple = obj.triple(n); if (triple.Value != i*3) throw new ApplicationException("triple failed: " + triple.Value); } { Obj obj = new Obj(); Number n = new Number(i); Number times6 = obj.times6(n); if (times6.Value != i*6) throw new ApplicationException("times6 failed: " + times6.Value); } { Obj obj = new Obj(); Number n = new Number(i); Number times9 = obj.times9(n); if (times9.Value != i*9) throw new ApplicationException("times9 failed: " + times9.Value); } { Number n = new Number(i); Number quadruple = csharp_typemaps.quadruple(n); if (quadruple.Value != i*4) throw new ApplicationException("quadruple failed: " + quadruple.Value); } { Number n = new Number(i); Number times8 = csharp_typemaps.times8(n); if (times8.Value != i*8) throw new ApplicationException("times8 failed: " + times8.Value); } { Number n = new Number(i); Number times12 = csharp_typemaps.times12(n); if (times12.Value != i*12) throw new ApplicationException("times12 failed: " + times12.Value); } } } catch (Exception e) { Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message); Failed = true; } }
public TriangleMesh(Vector3 position, Obj obj, Material material) { Position = position; _obj = obj; foreach (var face in _obj.FaceList) { var p1 = ToVector3(_obj.VertexList[face.VertexIndexList[0] - 1]) + Position; var p2 = ToVector3(_obj.VertexList[face.VertexIndexList[1] - 1]) + Position; var p3 = ToVector3(_obj.VertexList[face.VertexIndexList[2] - 1]) + Position; Boundables.Add(new Triangle(p1, p2, p3, material)); } }
// Creates a new function object with the given code and constants. The new // function will take over ownership of [bytecode] and [sourceLines]. It will // copy [constants] into its own array. public ObjFn(ObjModule module, Obj[] constants, int numUpvalues, int arity, byte[] bytecode) { Bytecode = bytecode; Constants = constants; Module = module; NumUpvalues = numUpvalues; Arity = arity; ClassObj = SophieVM.FnClass; }
public Map(string name, Project project) { this.name = name; Loader loader = project.loader; PropertyReader info = loader.GetPropertyReader().Select("maps/" + name + "/info.xml"); var groups = info.SelectAll("layers/group"); int numLayers = groups.Count; width = info.GetInt("width"); height = info.GetInt("height"); for (int i = 0; i < numLayers;) { var layerType = groups[i].GetString("type"); var layerName = groups[i].GetString("name"); var layerGroup = LayerGroup.Create(layerName, layerType, width, height, "maps/" + name + "/layers/{0}." + i.ToString(), this, project); layerGroups.Add(layerGroup); i += layerGroup.LayerCount; } this.ladders = new Ladder[width, height]; PropertyReader objects = loader.GetPropertyReader().Select("maps/" + name + "/objects.xml"); foreach (PropertyReader obj in objects.SelectAll("object")) { string spriteName = obj.GetString("sprite"); int x = obj.GetInt("x"); int y = obj.GetInt("y"); int layer = obj.GetInt("layer"); Obj o = new Obj(); o.Sprite = project.sprites[spriteName]; o.movementAIScript = obj.GetString("movement"); o.actionScript = obj.GetString("action"); o.collideScript = obj.GetString("collide"); Layers(layer).objects[x, y] = o; } PropertyReader events = loader.GetPropertyReader().Select("maps/" + name + "/onstep.xml"); foreach (PropertyReader e in events.SelectAll("event")) { int x = e.GetInt("x"); int y = e.GetInt("y"); int layer = e.GetInt("layer"); string script = e.GetString("script"); Layers(layer).tiles[x, y].onStep = script; } PropertyReader ladders = loader.GetPropertyReader().Select("maps/" + name + "/ladders.xml"); foreach (PropertyReader ladder in ladders.SelectAll("ladder")) { int x = ladder.GetInt("x"); int y = ladder.GetInt("y"); int baseLayer = ladder.GetInt("base"); int topLayer = ladder.GetInt("top"); this.ladders[x, y] = new Ladder(Layers(baseLayer), Layers(topLayer)); } }
public Obj[] ObjTemplatesArray() { Obj[] array = new Obj[Count]; for (int i = 0; i < Count; i++) { array[i] = new Obj() { Id = jSonObj.jToken[i]["id"].Value<string>(), ApiName = jSonObj.jToken[i]["api_name"].Value<string>() //Дописать MyExtParams }; } return array; }
static string findStringStoreValue(List<Obj> instrs, string fieldName) { for (int i = 0; i < instrs.Count - 1; i++) { var ldstr = instrs[i]; if (ldstr.OpCode != "ldstr") continue; var stsfld = instrs[i + 1]; if (stsfld.OpCode != "stsfld") continue; var memberRef = new Obj(stsfld.Operand); if (memberRef.MemberDef == null) continue; if (memberRef.MemberDef.Name != fieldName) continue; return (string)ldstr.Operand; } return null; }
public FieldTempNull(Obj parent_arg, string field_arg) { // A FieldTempNull is a placeholder object which exists so that the operation // of setting a new field value without manually calling add_field() can be accomplished. // // This works by putting a FieldTempNull in someObj[someFieldName] // when the .get on that is called for a not-present key, // then _replacing_ the FieldTempNull with a newly-create IObjField // of one of the "real" types when the .set is called on the FieldTempNull. // // As such, it needs to know the parent Obj and the field name by which it is accessed, unlike other IObjField types. // // The surprising thing is, how well this scheme seemed to work upon the first proper trial. // // TODO: Figure out whether there is some problem with this eccentric-but-seemingly-functional scheme... // This seems to approximately match the "lazy initialization" pattern, per http://en.wikipedia.org/wiki/Lazy_initialization // Is also seems partially similar to the "null object" pattern, per http://en.wikipedia.org/wiki/Null_Object_pattern // It also seems somewhat like the "state pattern" pattern, per http://en.wikipedia.org/wiki/State_pattern // parent_obj = parent_arg; field_name = field_arg; }
/// <summary> /// Creates a type from the supplied object and registers the object as prototype for /// the created type. /// </summary> /// <returns>The newly created type.</returns> /// <param name="obj">The object which should become a prototype.</param> public T CreatePrototype(Obj obj) { if (obj == null) throw new ArgumentNullException ("obj"); var groupedInputProperties = ( obj .GroupBy (p => p.Key.Guid) .Select (g => { if (g.Count () > 1) return new TSequence (Context) { InnerT = new List<T>(g.Select(kvp => kvp.Key)) }; else return g.First ().Key; })); var orderedTypesAndSequences = ( groupedInputProperties .GroupBy (p => p is TSequence) .OrderBy (g => g) .Select (g => { if (g.Key) return g.First (); else return new TComposition (Context) { InnerT = new List<T>(g) }; })); TComposition type = new TComposition (Context); type.InnerT.AddRange (orderedTypesAndSequences); Context.Prototypes.Add (type, obj); return type; }
override public void InitAt(long idx, Obj value) { Miscellanea.Assert(idx >= 0 & idx < length); Miscellanea.Assert(items[idx] == null); items[idx] = value; }
static bool Time(SophieVM vm, Obj[] stack, int argStart) { stack[argStart] = new Obj((double)DateTime.Now.Ticks / 10000000); return true; }
// this method is used for the IDE to query object values // Copy from the the existing Unpack with some modifications // 1: It is a non-static method so there is no need to pass the core and heap // 2: It does not traverse the array, array traverse is done in method GetArrayElement // 3: The payload for boolean and null is changed to Boolean and null type in .NET, such that the watch windows can directly call ToString() // to print the value, otherwize for boolean it will print either 0 or 1, for null it will print 0 public Obj Unpack(StackValue val) { Obj obj = null; switch (val.optype) { case AddressType.Pointer: obj = new Obj(val) { Payload = val.Pointer, }; break; case AddressType.ArrayPointer: obj = new Obj(val) { Payload = val.ArrayPointer, }; break; case AddressType.Int: obj = new Obj(val) { Payload = val.IntegerValue, }; break; case AddressType.Boolean: obj = new Obj(val) { Payload = val.BooleanValue, }; break; case AddressType.Double: obj = new Obj(val) { Payload = val.DoubleValue, }; break; case AddressType.Null: obj = new Obj(val) { Payload = null, }; break; case AddressType.FunctionPointer: obj = new Obj(val) { Payload = val.FunctionPointer, }; break; case AddressType.String: obj = new Obj(val) { Payload = val.StringPointer, }; break; case AddressType.Char: obj = new Obj(val) { Payload = val.CharValue, }; break; } return(obj); }
/// <summary> /// <see cref="System.Object.GetHashCode()"/> /// </summary> public override int GetHashCode() { int Result = 0; if (this.title != null) { Result = this.title.GetHashCode(); } if (this.type != null) { Result ^= Result << 5 ^ this.type.GetHashCode(); } if (this.url != null) { Result ^= Result << 5 ^ this.url.GetHashCode(); } if (this.description != null) { Result ^= Result << 5 ^ this.description.GetHashCode(); } if (this.determiner != null) { Result ^= Result << 5 ^ this.determiner.GetHashCode(); } if (this.locale != null) { Result ^= Result << 5 ^ this.locale.GetHashCode(); } if (this.siteName != null) { Result ^= Result << 5 ^ this.siteName.GetHashCode(); } if (this.localeAlternate != null) { foreach (string s in this.localeAlternate) { Result ^= Result << 5 ^ s.GetHashCode(); } } if (this.images != null) { foreach (ImageInformation Obj in this.images) { Result ^= Result << 5 ^ Obj.GetHashCode(); } } if (this.audio != null) { foreach (ImageInformation Obj in this.audio) { Result ^= Result << 5 ^ Obj.GetHashCode(); } } if (this.video != null) { foreach (ImageInformation Obj in this.video) { Result ^= Result << 5 ^ Obj.GetHashCode(); } } return(Result); }
// Verify for single object private static void VerifyInternal(object expectedObject, Obj dsObject, string dsVariable, List <int> indices) { if (expectedObject == null) { if (!dsObject.DsasmValue.IsNull) { Assert.Fail(String.Format("\t{0}{1} is expected to be null, but it isn't.\n{2}", dsVariable, TestFrameWork.BuildIndicesString(indices), TestFrameWork.mErrorMessage)); } return; } Type expectedType = expectedObject.GetType(); if (dsObject.DsasmValue.IsNull && expectedObject != null) { Assert.Fail(String.Format("\tThe value of {0} was null, but wasn't expected to be.\n{1}", dsVariable, mErrorMessage)); } else if (expectedObject is Int32 || expectedObject is Int64) { Int64 expectedValue = Convert.ToInt64(expectedObject); if (!(dsObject.Payload is long)) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual value is not an integer. \n{2}", dsVariable, BuildIndicesString(indices), expectedValue, mErrorMessage)); } else { TestFrameWork.VerifyPodType(expectedValue, dsObject, dsVariable, indices); } } else if (expectedObject is Double) { Double expectedValue = Convert.ToDouble(expectedObject); if (!(dsObject.Payload is Double)) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual value is not a double. \n{3}", dsVariable, BuildIndicesString(indices), expectedValue, mErrorMessage)); } else { try { Double dsValue = Convert.ToDouble(dsObject.Payload); if (!MathUtils.Equals(expectedValue, dsValue)) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual value is {3}. \n{4}", dsVariable, BuildIndicesString(indices), expectedValue, dsValue, mErrorMessage)); } } catch (System.InvalidCastException) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual value can't be converted to Double. \n{3}", dsVariable, BuildIndicesString(indices), expectedValue, mErrorMessage)); } } } else if (expectedObject is Boolean) { Boolean expectedValue = Convert.ToBoolean(expectedObject); if (!(dsObject.Payload is Boolean)) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual type is not bool. \n{3}", dsVariable, BuildIndicesString(indices), expectedValue, mErrorMessage)); } else { TestFrameWork.VerifyPodType(expectedValue, dsObject, dsVariable, indices); } } else if (expectedObject is Char) { Char expectedValue = Convert.ToChar(expectedObject); if (!(dsObject.Payload is long)) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual type is not char. \n{3}", dsVariable, BuildIndicesString(indices), expectedValue, mErrorMessage)); } else { try { Int64 utf8Encoding = Convert.ToInt64(dsObject.Payload); Char dsValue = Convert.ToChar(utf8Encoding); if (!expectedObject.Equals(dsValue)) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual value is {3}. \n{4}", dsVariable, BuildIndicesString(indices), expectedValue, dsValue, mErrorMessage)); } } catch (System.InvalidCastException) { Assert.Fail(String.Format("\t{0}{1} is expected to be {2}, but its actual value can't be converted to Char. \n{3}", dsVariable, BuildIndicesString(indices), expectedValue, mErrorMessage)); } } } else if (expectedObject is String) { string stringValue = dsObject.Payload as string; if (stringValue == null) { Assert.Fail(String.Format("\t{0}{1} is expected to be a string, but its actual value is not a string\n{2}", dsVariable, BuildIndicesString(indices), mErrorMessage)); } else if (!expectedObject.Equals(stringValue)) { Assert.Fail(String.Format("\t{0}{1} is expected to be a string \"{2}\", but its actual value is \"{3}\".\n{4}", dsVariable, BuildIndicesString(indices), expectedObject, stringValue, mErrorMessage)); } } else if (typeof(IEnumerable).IsAssignableFrom(expectedType)) { IEnumerable collection = expectedObject as IEnumerable; int index = 0; ProtoCore.DSASM.Mirror.DsasmArray dsArray = dsObject.Payload as ProtoCore.DSASM.Mirror.DsasmArray; if (dsArray == null) { Assert.Fail(String.Format("{0}{1} is expected to be an array, but its actual value isn't an array.\n{2}", dsVariable, BuildIndicesString(indices), mErrorMessage)); } foreach (var item in collection) { indices.Add(index); VerifyInternal(item, dsArray.members[index], dsVariable, indices); indices.RemoveAt(indices.Count - 1); ++index; } } else { Assert.Fail(string.Format("\tUnexpected object type.\n{0}", mErrorMessage)); } }
private void LogicE() { if (Player.Mana > RMANA + EMANA && Config.Item("autoE", true).GetValue <bool>()) { foreach (var enemy in Program.Enemies.Where(enemy => enemy.IsValidTarget(E.Range) && !OktwCommon.CanMove(enemy) && Game.Time - grabTime > 1)) { E.Cast(enemy.Position, true); return; } if (Config.Item("telE", true).GetValue <bool>()) { foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.IsEnemy && Obj.Distance(Player.ServerPosition) < E.Range && (Obj.HasBuff("teleport_target", true) || Obj.HasBuff("Pantheon_GrandSkyfall_Jump", true)))) { E.Cast(Object.Position); } } if (Program.Combo && Player.IsMoving && Config.Item("comboE", true).GetValue <bool>() && Player.Mana > RMANA + EMANA + WMANA) { var t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget(E.Range) && E.GetPrediction(t).CastPosition.Distance(t.Position) > 200 && (int)E.GetPrediction(t).Hitchance == 5) { E.CastIfWillHit(t, 2); if (t.HasBuffOfType(BuffType.Slow)) { Program.CastSpell(E, t); } else { if (E.GetPrediction(t).CastPosition.Distance(t.Position) > 200) { if (Player.Position.Distance(t.ServerPosition) > Player.Position.Distance(t.Position)) { if (t.Position.Distance(Player.ServerPosition) < t.Position.Distance(Player.Position)) { Program.CastSpell(E, t); } } else { if (t.Position.Distance(Player.ServerPosition) > t.Position.Distance(Player.Position)) { Program.CastSpell(E, t); } } } } } } } }
public void SetLease() { logMessage("Setting Lease for Watch [" + name + "]", SmartPlus_LOG_TYPE.TRACE); Obj leaseObj = httpManager.SendRequest(watchUrl + "lease/", "<reltime val='PT" + leaseInterval.ToString() + "S'/>", MethodType.PUT); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. if (world == null) { world = new World(new Vector2(0, 10)); } Camera.init(); spriteBatch = new SpriteBatch(GraphicsDevice); for (int i = 0; i < 2000; i+= 50) { //Obj obj = new Obj(this, 350, -300, -i, LoadTex("Character")); //obj.zSpeed = -1; } for (int i = 2000; i > 0; i -= 50) { //Obj obj = new Obj(this, -600,-300, -i, LoadTex("Character")); //Camera.Target = obj; //obj.alpha = 0.5f; } for (int i = -4000; i < 4000; i+=291) { //Obj obj = new Obj(this, i, 50, 0, LoadTex("Platform")); Wall floor = new Wall(this, i, 50, 0, 292, 275); } <<<<<<< HEAD for (int i = -4000; i < 4000; i += 291) { //Obj obj = new Obj(this, i, 50, 0, LoadTex("Platform")); Wall floor = new Wall(this, i * 2, -400, 0, 292, 275); } for (int i = -4000; i < 4000; i += 700) { Obj o = new Obj(this,i,-1300,0,LoadTex("Square")); o.createRecBody(1,0,1,true,true); o.type = Obj.PointType.SwingPoint; } //player = new Player(this, 100, 100, 0); ======= player = new Player(this, 100, -600, 0); >>>>>>> 0a728cea804dcf5e74b2e6ecf1581c8cd9109996 Obj swing = new Obj(this, 500, -300, 0, LoadTex("Platform")); swing.type = Obj.PointType.SwingPoint; Camera.Target = Global.Player; Gate gate = new Gate(this, 500, -100, 0); Key key = new Key(this, 300, -100, 0, Color.Red); key.addGate(gate); //create world for physics with gravity = -10 Camera.Target = Global.Player; //create rigid floor //Wall floor = new Wall(this, 100, 0, 0, 1280, 20, true); ///floor.body.Position = ConvertUnits.ToSimUnits(240, 0); //obj.zSpeed = -1f; // TODO: use this.Content to load your game content here }
public void UnSubscribeToWatch(string[] urls) { logMessage("Un-Subscribing objects (" + GetFormattedUrls(urls) + ") from Watch [" + name + "]", SmartPlus_LOG_TYPE.TRACE); Obj obj = httpManager.SendRequest(watchUrl + "remove/", GetWatchXml(urls), MethodType.POST); }
public void DeleteWatch() { logMessage("Deleting Watch [" + name + "]", SmartPlus_LOG_TYPE.TRACE); Obj obj = httpManager.SendRequest(watchUrl + "delete/", "", MethodType.POST); }
// POST: api/Object public void Post([FromBody] Obj obj) { this.context.Objs.Add(obj); this.context.SaveChanges(); }
private static void Game_OnGameUpdate(EventArgs args) { if (E.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA && Config.Item("autoE").GetValue <bool>()) { if (Config.Item("telE").GetValue <bool>()) { foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.Distance(Player.ServerPosition) < E.Range && E.IsReady() && Obj.Team != Player.Team && (Obj.HasBuff("teleport_target", true) || Obj.HasBuff("Pantheon_GrandSkyfall_Jump", true)))) { E.Cast(Object.Position, true); } } foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(E.Range) && !enemy.HasBuff("rocketgrab2") && E.IsReady())) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Suppression) || enemy.IsStunned || enemy.HasBuff("Recall")) { E.Cast(enemy, true); } else { E.CastIfHitchanceEquals(enemy, HitChance.Immobile, true); } } var ta = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical); if (ObjectManager.Player.IsMoving && ta.IsValidTarget(E.Range) && E.GetPrediction(ta).CastPosition.Distance(ta.Position) > 200 && (int)E.GetPrediction(ta).Hitchance == 5 && Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && E.IsReady() && Config.Item("comboE").GetValue <bool>() && ObjectManager.Player.Mana > RMANA + EMANA + WMANA && ta.Path.Count() == 1) { if (ta.HasBuffOfType(BuffType.Slow)) { E.CastIfHitchanceEquals(ta, HitChance.VeryHigh, true); } else if (ta.CountEnemiesInRange(250) > 2) { E.CastIfHitchanceEquals(ta, HitChance.VeryHigh, true); } else { if (ObjectManager.Player.Position.Distance(ta.ServerPosition) > ObjectManager.Player.Position.Distance(ta.Position)) { if (ta.Position.Distance(ObjectManager.Player.ServerPosition) < ta.Position.Distance(ObjectManager.Player.Position)) { CastSpell(E, ta, Config.Item("Hit").GetValue <Slider>().Value); debug("E run"); } } else { if (ta.Position.Distance(ObjectManager.Player.ServerPosition) > ta.Position.Distance(ObjectManager.Player.Position)) { CastSpell(E, ta, Config.Item("Hit").GetValue <Slider>().Value); debug("E escape"); } } } } } if (Q.IsReady()) { ManaMenager(); if (Farm && Config.Item("farmQ").GetValue <bool>() && (Game.Time - lag > 0.1) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + 10 && !FishBoneActive) { farmQ(); lag = Game.Time; } var t = TargetSelector.GetTarget(bonusRange() + 60, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { var distance = GetRealDistance(t); var powPowRange = GetRealPowPowRange(t); if (!FishBoneActive && !Orbwalking.InAutoAttackRange(t)) { if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && (ObjectManager.Player.Mana > RMANA + WMANA + 20 || ObjectManager.Player.GetAutoAttackDamage(t) * 2 > t.Health)) { Q.Cast(); } else if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed && Orbwalker.GetTarget() == null && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + 20 && distance < bonusRange() + t.BoundingRadius + ObjectManager.Player.BoundingRadius) { Q.Cast(); } else if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + WMANA + 20 && distance < bonusRange()) { Q.Cast(); } } } else if (!FishBoneActive && Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && ObjectManager.Player.Mana > RMANA + WMANA + 20 && ObjectManager.Player.CountEnemiesInRange(2000) > 0) { Q.Cast(); } else if (FishBoneActive && Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && ObjectManager.Player.Mana < RMANA + WMANA + 20) { Q.Cast(); } else if (FishBoneActive && Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && ObjectManager.Player.CountEnemiesInRange(2000) == 0) { Q.Cast(); } else if (FishBoneActive && Farm) { Q.Cast(); } } if (W.IsReady() && (Game.Time - QCastTime > 0.6)) { bool cast = false; bool wait = false; foreach (var target in ObjectManager.Get <Obj_AI_Hero>()) { if (target.IsValidTarget(W.Range) && !target.HasBuffOfType(BuffType.PhysicalImmunity) && !target.HasBuffOfType(BuffType.SpellImmunity) && !target.HasBuffOfType(BuffType.SpellShield)) { float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(W.Delay + (Player.Distance(target.ServerPosition) / W.Speed) * 1000)); var Wdmg = W.GetDamage(target); if (Wdmg > predictedHealth) { cast = true; wait = true; PredictionOutput output = R.GetPrediction(target); Vector2 direction = output.CastPosition.To2D() - Player.Position.To2D(); direction.Normalize(); List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList(); foreach (var enemy in enemies) { if (enemy.SkinName == target.SkinName || !cast) { continue; } PredictionOutput prediction = R.GetPrediction(enemy); Vector3 predictedPosition = prediction.CastPosition; Vector3 v = output.CastPosition - Player.ServerPosition; Vector3 w = predictedPosition - Player.ServerPosition; double c1 = Vector3.Dot(w, v); double c2 = Vector3.Dot(v, v); double b = c1 / c2; Vector3 pb = Player.ServerPosition + ((float)b * v); float length = Vector3.Distance(predictedPosition, pb); if (length < (W.Width + enemy.BoundingRadius) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition)) { cast = false; } } if (!Orbwalking.InAutoAttackRange(target) && cast && target.IsValidTarget(W.Range) && ObjectManager.Player.CountEnemiesInRange(400) == 0 && target.Path.Count() < 2) { W.CastIfHitchanceEquals(target, HitChance.VeryHigh, true); debug("W ks"); } } } } var t = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget() && !wait) { if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo && ObjectManager.Player.Mana > RMANA + WMANA + 10 && ObjectManager.Player.CountEnemiesInRange(GetRealPowPowRange(t)) == 0) { if (Config.Item("humanzier").GetValue <bool>()) { Utility.DelayAction.Add(500, () => CastSpell(W, t, Config.Item("Hit").GetValue <Slider>().Value)); } else { CastSpell(W, t, Config.Item("Hit").GetValue <Slider>().Value); } } else if ((Farm && ObjectManager.Player.Mana > RMANA + EMANA + WMANA + WMANA + 40) && Config.Item("haras" + t.CharData).GetValue <bool>() && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.CountEnemiesInRange(bonusRange()) == 0) { if (Config.Item("humanzier").GetValue <bool>()) { Utility.DelayAction.Add(500, () => CastSpell(W, t, Config.Item("Hit").GetValue <Slider>().Value)); } else { CastSpell(W, t, Config.Item("Hit").GetValue <Slider>().Value); } } else if ((Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo || Farm) && ObjectManager.Player.Mana > RMANA + WMANA && ObjectManager.Player.CountEnemiesInRange(GetRealPowPowRange(t)) == 0) { foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(W.Range))) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall")) { W.Cast(enemy, true); } } } } } if (R.IsReady()) { if (Config.Item("useR").GetValue <KeyBind>().Active) { var t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { R1.Cast(t, true, true); } } if (Config.Item("Rjungle").GetValue <bool>()) { KsJungle(); } } if (R.IsReady() && Config.Item("autoR").GetValue <bool>()) { bool cast = false; foreach (var target in ObjectManager.Get <Obj_AI_Hero>()) { if (target.IsValidTarget(R.Range) && (Game.Time - WCastTime > 0.8) && ValidUlt(target)) { float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target.ServerPosition) / R.Speed) * 1000)); var Rdmg = R.GetDamage(target, 1); if (Rdmg > predictedHealth) { cast = true; PredictionOutput output = R.GetPrediction(target); Vector2 direction = output.CastPosition.To2D() - Player.Position.To2D(); direction.Normalize(); List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList(); foreach (var enemy in enemies) { if (enemy.SkinName == target.SkinName || !cast) { continue; } PredictionOutput prediction = R.GetPrediction(enemy); Vector3 predictedPosition = prediction.CastPosition; Vector3 v = output.CastPosition - Player.ServerPosition; Vector3 w = predictedPosition - Player.ServerPosition; double c1 = Vector3.Dot(w, v); double c2 = Vector3.Dot(v, v); double b = c1 / c2; Vector3 pb = Player.ServerPosition + ((float)b * v); float length = Vector3.Distance(predictedPosition, pb); if (length < (R.Width + 150 + enemy.BoundingRadius / 2) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition)) { cast = false; } } if (cast && GetRealDistance(target) > bonusRange() + 300 + target.BoundingRadius && target.CountAlliesInRange(600) == 0 && ObjectManager.Player.CountEnemiesInRange(400) == 0) { castR(target); debug("R normal High"); } else if (cast && target.CountEnemiesInRange(200) > 2 && GetRealDistance(target) > bonusRange() + 200 + target.BoundingRadius) { R1.Cast(target, true, true); debug("R aoe 1"); } } } } } }
static void Main(string[] args) { PDFNet.Initialize(); // Example 1: // Extract images by traversing the display list for // every page. With this approach it is possible to obtain // image positioning information and DPI. try { using (PDFDoc doc = new PDFDoc(input_path + "newsletter.pdf")) using (ElementReader reader = new ElementReader()) { doc.InitSecurityHandler(); PageIterator itr; for (itr = doc.GetPageIterator(); itr.HasNext(); itr.Next()) { reader.Begin(itr.Current()); ImageExtract(doc, reader); reader.End(); } Console.WriteLine("Done."); } } catch (PDFNetException e) { Console.WriteLine(e.Message); } Console.WriteLine("----------------------------------------------------------------"); // Example 2: // Extract images by scanning the low-level document. try { using (PDFDoc doc = new PDFDoc(input_path + "newsletter.pdf")) { doc.InitSecurityHandler(); image_counter = 0; SDFDoc cos_doc = doc.GetSDFDoc(); int num_objs = cos_doc.XRefSize(); for (int i = 1; i < num_objs; ++i) { Obj obj = cos_doc.GetObj(i); if (obj != null && !obj.IsFree() && obj.IsStream()) { // Process only images DictIterator itr = obj.Find("Subtype"); if (!itr.HasNext() || itr.Value().GetName() != "Image") { continue; } itr = obj.Find("Type"); if (!itr.HasNext() || itr.Value().GetName() != "XObject") { continue; } pdftron.PDF.Image image = new pdftron.PDF.Image(obj); Console.WriteLine("--> Image: {0}", ++image_counter); Console.WriteLine(" Width: {0}", image.GetImageWidth()); Console.WriteLine(" Height: {0}", image.GetImageHeight()); Console.WriteLine(" BPC: {0}", image.GetBitsPerComponent()); string fname = output_path + "image_extract2_" + image_counter.ToString(); image.Export(fname); // or ExporAsPng() or ExporAsTiff() ... // Convert PDF bitmap to GDI+ Bitmap... //Bitmap bmp = image.GetBitmap(); //bmp.Save(fname, ImageFormat.Png); //bmp.Dispose(); // Instead of converting PDF images to a Bitmap, you can also extract // uncompressed/compressed image data directly using element.GetImageData() // as illustrated in ElementReaderAdv sample project. } } } } catch (PDFNetException e) { Console.WriteLine(e.Message); } }
public Obj GetFirstValue(string name, int startBlock = 0, int classcope = Constants.kGlobalScope) { Obj retVal = Unpack(GetRawFirstValue(name, startBlock, classcope), MirrorTarget.rmem.Heap, runtimeCore); return(retVal); }
protected override void ApplyChange() { Obj.AddTask(NewValue); }
}//Number public Root( Engine engine ) : base( engine, null, new Props(), new Props() ) { BaseProps.Set( "undefined", _undefined = new Value() ); BaseProps.Set( "null", _null = new Value( Vtype.Object, null ) ); BaseProps.Set( "nan", _nan = new Value( System.Double.NaN ) ); BaseProps.Set( "infinity", _infinity = new Value( System.Double.PositiveInfinity ) ); MoreProps.Set( "inf", _infinity ); var obj = new Obj( engine ); var fun = new FunctionObj( engine, obj ); var str = new StringObj( engine, obj ); var num = new NumberObj( engine, obj ); BaseProps.Set( "function", new Value( _function = new FunctionFun( engine, fun, fun ) ) ); BaseProps.Set( "object", new Value( _object = new ObjectFun( engine, fun, obj, this ) ) ); BaseProps.Set( "string", new Value( _string = new StringFun( engine, fun, str ) ) ); BaseProps.Set( "number", new Value( _number = new NumberFun( engine, fun, num ) ) ); }//.ctor
override protected int InternalCmp(Obj other) { return(other.CmpSeq(items, Offset(), length)); }
private static void Game_OnGameUpdate(EventArgs args) { ManaMenager(); if (Orbwalker.ActiveMode.ToString() == "Mixed" || Orbwalker.ActiveMode.ToString() == "LaneClear" || Orbwalker.ActiveMode.ToString() == "LastHit") { Farm = true; } else { Farm = false; } if (ObjectManager.Player.Mana > RMANA + WMANA && W.IsReady()) { var t = TargetSelector.GetTarget(W.Range + 300, TargetSelector.DamageType.Physical); foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.Distance(Player.ServerPosition) < W.Range && Obj.Team != Player.Team && Obj.HasBuff("teleport_target", true))) { W.Cast(Object.Position, true); } foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(W.Range) && W.IsReady())) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Suppression) || enemy.IsStunned || enemy.HasBuff("Recall")) { W.Cast(enemy, true); } else if (enemy.HasBuffOfType(BuffType.Slow) && t.Path.Count() > 1) { W.CastIfHitchanceEquals(enemy, HitChance.VeryHigh, true); } } } if (E.IsReady()) { ManaMenager(); var t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical); var t2 = TargetSelector.GetTarget(E.Range + 350, TargetSelector.DamageType.Physical); if (t.IsValidTarget() && Config.Item("autoE").GetValue <bool>()) { var eDmg = E.GetDamage(t); var qDmg = Q.GetDamage(t); if (GetRealDistance(t) > bonusRange() && qDmg + eDmg > t.Health && qDmg * 0.8 < t.Health && ObjectManager.Player.Mana > EMANA + QMANA && Q.IsReady()) { E.Cast(t, true); } else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + EMANA && GetRealDistance(t) < 400 && ObjectManager.Player.Health < ObjectManager.Player.MaxHealth * 0.8) { E.Cast(t, true); } else if (ObjectManager.Player.Mana > RMANA + EMANA && GetRealDistance(t) < 500 && ObjectManager.Player.Health < ObjectManager.Player.MaxHealth * 0.3) { E.Cast(t, true); } else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Health > ObjectManager.Player.MaxHealth * 0.3 && !Q.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA && t2.IsValidTarget() && ObjectManager.Player.GetAutoAttackDamage(t2) * 2 > t.Health && GetRealDistance(t2) > GetRealRange(t2) + 100 && !ObjectManager.Player.UnderTurret(true) && t2.CountEnemiesInRange(800) < 2 && (Game.Time - WCastTime > 1)) { var position = ObjectManager.Player.ServerPosition - (Game.CursorPos - ObjectManager.Player.ServerPosition); E.Cast(position, true); } } if (Config.Item("useE").GetValue <KeyBind>().Active) { var position = ObjectManager.Player.ServerPosition - (Game.CursorPos - ObjectManager.Player.ServerPosition); E.Cast(position, true); } } if (Q.IsReady()) { ManaMenager(); var t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { var qDmg = Q.GetDamage(t); if (GetRealDistance(t) > bonusRange() + 60 && qDmg > t.Health) { Q.Cast(t, true); } else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + QMANA + EMANA && Orbwalker.GetTarget() == null) { Q.CastIfHitchanceEquals(t, HitChance.High, true); } else if ((Farm && ObjectManager.Player.Mana > RMANA + EMANA + QMANA + QMANA) && Orbwalker.GetTarget() == null) { if (ObjectManager.Player.Mana > ObjectManager.Player.MaxMana * 0.9) { Q.CastIfHitchanceEquals(t, HitChance.VeryHigh, true); } else if (t.Path.Count() > 1) { Qc.CastIfHitchanceEquals(t, HitChance.VeryHigh, true); } } else if ((Orbwalker.ActiveMode.ToString() == "Combo" || Farm) && ObjectManager.Player.Mana > RMANA + QMANA && ObjectManager.Player.CountEnemiesInRange(GetRealRange(t) - 100) == 0) { foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(Q.Range))) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall")) { Q.CastIfHitchanceEquals(enemy, HitChance.High, true); } } } } } if (R.IsReady() && Config.Item("autoR").GetValue <bool>() && !ObjectManager.Player.UnderTurret(true)) { bool cast = false; foreach (var target in ObjectManager.Get <Obj_AI_Hero>().Where(target => target.IsValidTarget(500 * R.Level + 1500))) { if (target.IsValidTarget() && (Game.Time - WCastTime > 1) && !target.HasBuffOfType(BuffType.PhysicalImmunity) && !target.HasBuffOfType(BuffType.SpellImmunity) && !target.HasBuffOfType(BuffType.SpellShield)) { float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target.ServerPosition) / R.Speed) * 1000)); var Rdmg = R.GetDamage(target); if (Rdmg > predictedHealth && GetRealDistance(target) > bonusRange() + 400 + target.BoundingRadius && target.CountAlliesInRange(500) == 0 && Orbwalker.GetTarget() == null) { cast = true; PredictionOutput output = R.GetPrediction(target); Vector2 direction = output.CastPosition.To2D() - Player.Position.To2D(); direction.Normalize(); List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList(); foreach (var enemy in enemies) { if (enemy.SkinName == target.SkinName || !cast) { continue; } PredictionOutput prediction = R.GetPrediction(enemy); Vector3 predictedPosition = prediction.CastPosition; Vector3 v = output.CastPosition - Player.ServerPosition; Vector3 w = predictedPosition - Player.ServerPosition; double c1 = Vector3.Dot(w, v); double c2 = Vector3.Dot(v, v); double b = c1 / c2; Vector3 pb = Player.ServerPosition + ((float)b * v); float length = Vector3.Distance(predictedPosition, pb); if (length < (400 + enemy.BoundingRadius) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition)) { cast = false; } } if (cast && target.IsValidTarget() && target.CountEnemiesInRange(500) == 1) { R.Cast(target, true); } } } } } PotionMenager(); }
/// <summary> /// Serializes an object to a binary destination. /// </summary> /// <param name="Writer">Serializer.</param> /// <param name="WriteTypeCode">If a type code is to be output.</param> /// <param name="Embedded">If the object is embedded into another.</param> /// <param name="Value">The actual object to serialize.</param> public override async Task Serialize(ISerializer Writer, bool WriteTypeCode, bool Embedded, object Value) { if (Value is null) { if (WriteTypeCode) { Writer.WriteBits(ObjectSerializer.TYPE_NULL, 6); } else { throw new NullReferenceException("Value cannot be null."); } } else if (Value is GenericObject TypedValue) { ISerializer WriterBak = Writer; IObjectSerializer Serializer; object Obj; if (!Embedded) { Writer = Writer.CreateNew(); } if (WriteTypeCode) { if (TypedValue is null) { Writer.WriteBits(ObjectSerializer.TYPE_NULL, 6); return; } else { Writer.WriteBits(ObjectSerializer.TYPE_OBJECT, 6); } } else if (TypedValue is null) { throw new NullReferenceException("Value cannot be null."); } if (Embedded && Writer.BitOffset > 0) { bool WriteObjectId = !TypedValue.ObjectId.Equals(Guid.Empty); Writer.WriteBit(WriteObjectId); if (WriteObjectId) { Writer.Write(TypedValue.ObjectId); } } bool Normalized = this.NormalizedNames; if (Normalized) { if (string.IsNullOrEmpty(TypedValue.TypeName)) { Writer.WriteVariableLengthUInt64(0); } else { Writer.WriteVariableLengthUInt64(await this.Context.GetFieldCode(TypedValue.CollectionName, TypedValue.TypeName)); } if (Embedded) { Writer.WriteVariableLengthUInt64(await this.Context.GetFieldCode(null, string.IsNullOrEmpty(TypedValue.CollectionName) ? this.Context.DefaultCollectionName : TypedValue.CollectionName)); } } else { Writer.Write(TypedValue.TypeName); if (Embedded) { Writer.Write(string.IsNullOrEmpty(TypedValue.CollectionName) ? this.Context.DefaultCollectionName : TypedValue.CollectionName); } } if (TypedValue.ArchivingTime != 0) { if (Normalized) { Writer.WriteVariableLengthUInt64(await this.Context.GetFieldCode(TypedValue.CollectionName, "ArchivingTime")); } else { Writer.Write("ArchivingTime"); } Writer.WriteBits(ObjectSerializer.TYPE_INT32, 6); Writer.Write((int)TypedValue.ArchivingTime); } foreach (KeyValuePair <string, object> Property in TypedValue) { if (Normalized) { Writer.WriteVariableLengthUInt64(await this.Context.GetFieldCode(TypedValue.CollectionName, Property.Key)); } else { Writer.Write(Property.Key); } Obj = Property.Value; if (Obj is null) { Writer.WriteBits(ObjectSerializer.TYPE_NULL, 6); } else { if (Obj is GenericObject) { await this.Serialize(Writer, true, true, Obj); } else { Serializer = await this.Context.GetObjectSerializer(Obj.GetType()); await Serializer.Serialize(Writer, true, true, Obj); } } } Writer.WriteVariableLengthUInt64(0); if (!Embedded) { if (!TypedValue.ObjectId.Equals(Guid.Empty)) { WriterBak.Write(TypedValue.ObjectId); } else { Guid NewObjectId = this.Context.CreateGuid(); WriterBak.Write(NewObjectId); TypedValue.ObjectId = NewObjectId; } byte[] Bin = Writer.GetSerialization(); WriterBak.WriteVariableLengthUInt64((ulong)Bin.Length); WriterBak.WriteRaw(Bin); } } else { IObjectSerializer Serializer = await this.Context.GetObjectSerializer(Value?.GetType() ?? typeof(object)); await Serializer.Serialize(Writer, WriteTypeCode, Embedded, Value); } }
protected override void ApplyChange() { Obj.AddAddress(NewValue); }
public int this[Obj o] { set { Console.WriteLine("Assignment called with " + (o.Incremented ? "incremented" : "original") + " indexer value."); } }
static void Main(string[] args) { PDFNet.Initialize(); // Relative path to the folder containing test files. // string input_path = "../../TestFiles/"; string output_path = "../../TestFiles/Output/"; // The vector used to store the name and count of all fields. // This is used later on to clone the fields Dictionary <string, int> field_names = new Dictionary <string, int>(); //---------------------------------------------------------------------------------- // Example 1: Programatically create new Form Fields and Widget Annotations. //---------------------------------------------------------------------------------- try { using (PDFDoc doc = new PDFDoc()) { // Create a blank new page and add some form fields. Page blank_page = doc.PageCreate(); // Text Widget Creation // Create an empty text widget with black text. TextWidget text1 = TextWidget.Create(doc, new Rect(110, 700, 380, 730)); text1.SetText("Basic Text Field"); text1.RefreshAppearance(); blank_page.AnnotPushBack(text1); // Create a vertical text widget with blue text and a yellow background. TextWidget text2 = TextWidget.Create(doc, new Rect(50, 400, 90, 730)); text2.SetRotation(90); // Set the text content. text2.SetText(" ****Lucky Stars!****"); // Set the font type, text color, font size, border color and background color. text2.SetFont(Font.Create(doc, Font.StandardType1Font.e_helvetica_oblique)); text2.SetFontSize(28); text2.SetTextColor(new ColorPt(0, 0, 1), 3); text2.SetBorderColor(new ColorPt(0, 0, 0), 3); text2.SetBackgroundColor(new ColorPt(1, 1, 0), 3); text2.RefreshAppearance(); // Add the annotation to the page. blank_page.AnnotPushBack(text2); // Create two new text widget with Field names employee.name.first and employee.name.last // This logic shows how these widgets can be created using either a field name string or // a Field object TextWidget text3 = TextWidget.Create(doc, new Rect(110, 660, 380, 690), "employee.name.first"); text3.SetText("Levi"); text3.SetFont(Font.Create(doc, Font.StandardType1Font.e_times_bold)); text3.RefreshAppearance(); blank_page.AnnotPushBack(text3); Field emp_last_name = doc.FieldCreate("employee.name.last", Field.Type.e_text, "Ackerman"); TextWidget text4 = TextWidget.Create(doc, new Rect(110, 620, 380, 650), emp_last_name); text4.SetFont(Font.Create(doc, Font.StandardType1Font.e_times_bold)); text4.RefreshAppearance(); blank_page.AnnotPushBack(text4); // Signature Widget Creation (unsigned) SignatureWidget signature1 = SignatureWidget.Create(doc, new Rect(110, 560, 260, 610)); signature1.RefreshAppearance(); blank_page.AnnotPushBack(signature1); // CheckBox Widget Creation // Create a check box widget that is not checked. CheckBoxWidget check1 = CheckBoxWidget.Create(doc, new Rect(140, 490, 170, 520)); check1.RefreshAppearance(); blank_page.AnnotPushBack(check1); // Create a check box widget that is checked. CheckBoxWidget check2 = CheckBoxWidget.Create(doc, new Rect(190, 490, 250, 540), "employee.name.check1"); check2.SetBackgroundColor(new ColorPt(1, 1, 1), 3); check2.SetBorderColor(new ColorPt(0, 0, 0), 3); // Check the widget (by default it is unchecked). check2.SetChecked(true); check2.RefreshAppearance(); blank_page.AnnotPushBack(check2); // PushButton Widget Creation PushButtonWidget pushbutton1 = PushButtonWidget.Create(doc, new Rect(380, 490, 520, 540)); pushbutton1.SetTextColor(new ColorPt(1, 1, 1), 3); pushbutton1.SetFontSize(36); pushbutton1.SetBackgroundColor(new ColorPt(0, 0, 0), 3); // Add a caption for the pushbutton. pushbutton1.SetStaticCaptionText("PushButton"); pushbutton1.RefreshAppearance(); blank_page.AnnotPushBack(pushbutton1); // ComboBox Widget Creation ComboBoxWidget combo1 = ComboBoxWidget.Create(doc, new Rect(280, 560, 580, 610)); // Add options to the combobox widget. combo1.AddOption("Combo Box No.1"); combo1.AddOption("Combo Box No.2"); combo1.AddOption("Combo Box No.3"); // Make one of the options in the combo box selected by default. combo1.SetSelectedOption("Combo Box No.2"); combo1.SetTextColor(new ColorPt(1, 0, 0), 3); combo1.SetFontSize(28); combo1.RefreshAppearance(); blank_page.AnnotPushBack(combo1); // ListBox Widget Creation ListBoxWidget list1 = ListBoxWidget.Create(doc, new Rect(400, 620, 580, 730)); // Add one option to the listbox widget. list1.AddOption("List Box No.1"); // Add multiple options to the listbox widget in a batch. string[] list_options = new string[2] { "List Box No.2", "List Box No.3" }; list1.AddOptions(list_options); // Select some of the options in list box as default options list1.SetSelectedOptions(list_options); // Enable list box to have multi-select when editing. list1.GetField().SetFlag(Field.Flag.e_multiselect, true); list1.SetFont(Font.Create(doc, Font.StandardType1Font.e_times_italic)); list1.SetTextColor(new ColorPt(1, 0, 0), 3); list1.SetFontSize(28); list1.SetBackgroundColor(new ColorPt(1, 1, 1), 3); list1.RefreshAppearance(); blank_page.AnnotPushBack(list1); // RadioButton Widget Creation // Create a radio button group and add three radio buttons in it. RadioButtonGroup radio_group = RadioButtonGroup.Create(doc, "RadioGroup"); RadioButtonWidget radiobutton1 = radio_group.Add(new Rect(140, 410, 190, 460)); radiobutton1.SetBackgroundColor(new ColorPt(1, 1, 0), 3); radiobutton1.RefreshAppearance(); RadioButtonWidget radiobutton2 = radio_group.Add(new Rect(310, 410, 360, 460)); radiobutton2.SetBackgroundColor(new ColorPt(0, 1, 0), 3); radiobutton2.RefreshAppearance(); RadioButtonWidget radiobutton3 = radio_group.Add(new Rect(480, 410, 530, 460)); // Enable the third radio button. By default the first one is selected radiobutton3.EnableButton(); radiobutton3.SetBackgroundColor(new ColorPt(0, 1, 1), 3); radiobutton3.RefreshAppearance(); radio_group.AddGroupButtonsToPage(blank_page); // Custom push button annotation creation PushButtonWidget custom_pushbutton1 = PushButtonWidget.Create(doc, new Rect(260, 320, 360, 360)); // Set the annotation appearance. custom_pushbutton1.SetAppearance(CreateCustomButtonAppearance(doc, false), Annot.AnnotationState.e_normal); // Create 'SubmitForm' action. The action will be linked to the button. FileSpec url = FileSpec.CreateURL(doc, "http://www.pdftron.com"); pdftron.PDF.Action button_action = pdftron.PDF.Action.CreateSubmitForm(url); // Associate the above action with 'Down' event in annotations action dictionary. Obj annot_action = custom_pushbutton1.GetSDFObj().PutDict("AA"); annot_action.Put("D", button_action.GetSDFObj()); blank_page.AnnotPushBack(custom_pushbutton1); // Add the page as the last page in the document. doc.PagePushBack(blank_page); // If you are not satisfied with the look of default auto-generated appearance // streams you can delete "AP" entry from the Widget annotation and set // "NeedAppearances" flag in AcroForm dictionary: // doc.GetAcroForm().PutBool("NeedAppearances", true); // This will force the viewer application to auto-generate new appearance streams // every time the document is opened. // // Alternatively you can generate custom annotation appearance using ElementWriter // and then set the "AP" entry in the widget dictionary to the new appearance // stream. // // Yet another option is to pre-populate field entries with dummy text. When // you edit the field values using PDFNet the new field appearances will match // the old ones. doc.RefreshFieldAppearances(); doc.Save(output_path + "forms_test1.pdf", 0); Console.WriteLine("Done."); } } catch (PDFNetException e) { Console.WriteLine(e.Message); } //---------------------------------------------------------------------------------- // Example 2: // Fill-in forms / Modify values of existing fields. // Traverse all form fields in the document (and print out their names). // Search for specific fields in the document. //---------------------------------------------------------------------------------- try { using (PDFDoc doc = new PDFDoc(output_path + "forms_test1.pdf")) { doc.InitSecurityHandler(); FieldIterator itr; for (itr = doc.GetFieldIterator(); itr.HasNext(); itr.Next()) { Field field = itr.Current(); string cur_field_name = field.GetName(); // Add one to the count for this field name for later processing field_names[cur_field_name] = (field_names.ContainsKey(cur_field_name) ? field_names[cur_field_name] + 1 : 1); Console.WriteLine("Field name: {0}", field.GetName()); Console.WriteLine("Field partial name: {0}", field.GetPartialName()); string str_val = field.GetValueAsString(); Console.Write("Field type: "); Field.Type type = field.GetType(); switch (type) { case Field.Type.e_button: Console.WriteLine("Button"); break; case Field.Type.e_radio: Console.WriteLine("Radio button: Value = " + str_val); break; case Field.Type.e_check: field.SetValue(true); Console.WriteLine("Check box: Value = " + str_val); break; case Field.Type.e_text: { Console.WriteLine("Text"); // Edit all variable text in the document String old_value = "none"; if (field.GetValue() != null) { old_value = field.GetValue().GetAsPDFText(); } field.SetValue("This is a new value. The old one was: " + old_value); } break; case Field.Type.e_choice: Console.WriteLine("Choice"); break; case Field.Type.e_signature: Console.WriteLine("Signature"); break; } Console.WriteLine("------------------------------"); } // Search for a specific field Field fld = doc.GetField("employee.name.first"); if (fld != null) { Console.WriteLine("Field search for {0} was successful", fld.GetName()); } else { Console.WriteLine("Field search failed."); } // Regenerate field appearances. doc.RefreshFieldAppearances(); doc.Save(output_path + "forms_test_edit.pdf", 0); Console.WriteLine("Done."); } } catch (PDFNetException e) { Console.WriteLine(e.Message); } //---------------------------------------------------------------------------------- // Sample: Form templating // Replicate pages and form data within a document. Then rename field names to make // them unique. //---------------------------------------------------------------------------------- try { // Sample: Copying the page with forms within the same document using (PDFDoc doc = new PDFDoc(output_path + "forms_test1.pdf")) { doc.InitSecurityHandler(); Page src_page = doc.GetPage(1); doc.PagePushBack(src_page); // Append several copies of the second page doc.PagePushBack(src_page); // Note that forms are successfully copied doc.PagePushBack(src_page); doc.PagePushBack(src_page); // Now we rename fields in order to make every field unique. // You can use this technique for dynamic template filling where you have a 'master' // form page that should be replicated, but with unique field names on every page. foreach (KeyValuePair <string, int> cur_field in field_names) { RenameAllFields(doc, cur_field.Key, cur_field.Value); } doc.Save(output_path + "forms_test1_cloned.pdf", 0); Console.WriteLine("Done."); } } catch (PDFNetException e) { Console.WriteLine(e.Message); } //---------------------------------------------------------------------------------- // Sample: // Flatten all form fields in a document. // Note that this sample is intended to show that it is possible to flatten // individual fields. PDFNet provides a utility function PDFDoc.FlattenAnnotations() // that will automatically flatten all fields. //---------------------------------------------------------------------------------- try { using (PDFDoc doc = new PDFDoc(output_path + "forms_test1.pdf")) { doc.InitSecurityHandler(); bool auto = true; if (auto) { doc.FlattenAnnotations(); } else // Manual flattening { // Traverse all pages PageIterator pitr = doc.GetPageIterator(); for (; pitr.HasNext(); pitr.Next()) { Page page = pitr.Current(); for (int i = page.GetNumAnnots() - 1; i >= 0; --i) { Annot annot = page.GetAnnot(i); if (annot.GetType() == Annot.Type.e_Widget) { annot.Flatten(page); } } } } doc.Save(output_path + "forms_test1_flattened.pdf", 0); Console.WriteLine("Done."); } } catch (PDFNetException e) { Console.WriteLine(e.Message); } }
public void drawSprite(Obj obj, Sprite sprite, int x, int y) { if (obj != null && sprite != null && obj.sprite == sprite.id && sprite.animations!= null && sprite.animations[obj.currentAnimation] != null && sprite.animations[obj.currentAnimation].totalFrames <= obj.currentFrame) { offScreenDC.DrawImage(sprite.animations[obj.currentAnimation].frames[obj.currentFrame], new Rectangle(x, y, sprite.animations[obj.currentAnimation].frames[obj.currentFrame].Width, sprite.animations[obj.currentAnimation].frames[obj.currentFrame].Height), 0, 0, sprite.animations[obj.currentAnimation].frames[obj.currentFrame].Width, sprite.animations[obj.currentAnimation].frames[obj.currentFrame].Height, GraphicsUnit.Pixel, imageAttributes); } }
static string GetString(Obj ldstr, List<Obj> instrs, ref int index) { var s = (string)ldstr.Operand; if (index >= instrs.Count) return s; var call = instrs[index]; if (call.OpCode != "call" && call.OpCode != "callvirt") return s; index++; var op = new Obj(call.Operand); if (op.Name == "ToUpper") return s.ToUpper(); if (op.Name == "ToLower") return s.ToLower(); throw new ApplicationException(string.Format("Unknown method {0}", op.Name)); }
}//Scope /// <summary> /// create function.prototype /// </summary> public FunctionObj( Engine engine, Obj baseClass ) : base( engine, baseClass ) { }//.ctor
static void AnnotationLowLevelAPI(PDFDoc doc) { Page page = doc.GetPage(1); Obj annots = page.GetAnnots(); if (annots == null) { // If there are no annotations, create a new annotation // array for the page. annots = doc.CreateIndirectArray(); page.GetSDFObj().Put("Annots", annots); } // Create the Text annotation Obj text_annot = doc.CreateIndirectDict(); text_annot.PutName("Subtype", "Text"); text_annot.PutBool("Open", true); text_annot.PutString("Contents", "The quick brown fox ate the lazy mouse."); text_annot.PutRect("Rect", 266, 116, 430, 204); // Insert the annotation in the page annotation array annots.PushBack(text_annot); // Create a Link annotation Obj link1 = doc.CreateIndirectDict(); link1.PutName("Subtype", "Link"); Destination dest = Destination.CreateFit(doc.GetPage(2)); link1.Put("Dest", dest.GetSDFObj()); link1.PutRect("Rect", 85, 705, 503, 661); annots.PushBack(link1); // Create another Link annotation Obj link2 = doc.CreateIndirectDict(); link2.PutName("Subtype", "Link"); Destination dest2 = Destination.CreateFit(doc.GetPage(3)); link2.Put("Dest", dest2.GetSDFObj()); link2.PutRect("Rect", 85, 638, 503, 594); annots.PushBack(link2); // Note that PDFNet APi can be used to modify existing annotations. // In the following example we will modify the second link annotation // (link2) so that it points to the 10th page. We also use a different // destination page fit type. link2.Put("Dest", Destination.CreateXYZ(doc.GetPage(10), 100, 792 - 70, 10).GetSDFObj()); // Create a third link annotation with a hyperlink action (all other // annotation types can be created in a similar way) Obj link3 = doc.CreateIndirectDict(); link3.PutName("Subtype", "Link"); link3.PutRect("Rect", 85, 570, 503, 524); // Create a URI action Obj action = link3.PutDict("A"); action.PutName("S", "URI"); action.PutString("URI", "http://www.pdftron.com"); annots.PushBack(link3); }
private static void Elogic() { if (Player.ManaPercent < getSliderItem(manaMenu, "EmanaCombo")) { return; } if (blitz != null && blitz.Distance(Player.Position) < E.Range) { foreach (var enemy in Enemies.Where(enemy => enemy.LSIsValidTarget(2000) && enemy.HasBuff("RocketGrab"))) { E.Cast(blitz.Position.Extend(enemy.Position, 30)); return; } } foreach (var enemy in Enemies.Where(enemy => enemy.LSIsValidTarget(E.Range))) { E.CastIfWillHit(enemy, getSliderItem(eMenu, "Eaoe")); if (getCheckBoxItem(eMenu, "Ecc")) { if (!CanMove(enemy)) { E.Cast(enemy.Position); } E.CastIfHitchanceEquals(enemy, EloBuddy.SDK.Enumerations.HitChance.Immobile); } if (enemy.MoveSpeed < 250 && getCheckBoxItem(eMenu, "Eslow")) { E.Cast(enemy); } if (getCheckBoxItem(eMenu, "Edash")) { E.CastIfHitchanceEquals(enemy, EloBuddy.SDK.Enumerations.HitChance.Dashing); } } if (getCheckBoxItem(eMenu, "Etel")) { foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.IsEnemy && Obj.LSDistance(Player.ServerPosition) < E.Range && (Obj.HasBuff("teleport_target") || Obj.HasBuff("Pantheon_GrandSkyfall_Jump")))) { E.Cast(Object.Position); } } if (Combo && Player.IsMoving && getCheckBoxItem(eMenu, "Ecombo")) { var t = TargetSelector.GetTarget(E.Range, DamageType.Magical); if (t.LSIsValidTarget(E.Range) && E.GetPrediction(t).CastPosition.Distance(t.Position) > 200) { if (Player.Position.Distance(t.ServerPosition) > Player.Position.Distance(t.Position)) { if (t.Position.Distance(Player.ServerPosition) < t.Position.Distance(Player.Position)) { CastSpell(E, t); } } else { if (t.Position.Distance(Player.ServerPosition) > t.Position.Distance(Player.Position)) { CastSpell(E, t); } } } } }
Obj FindType(string name) { foreach (var tmp in asmTypes) { var type = new Obj(tmp); if (type.Name == name) return type; } return null; }
public static Value ExportAsValue(Obj obj) { return(obj.GetValue()); }
//@TODO(Luke): Add in the methods here that correspond to each of the internal datastructures in use by the executive //@TODO(Jun): if this method stays static, then the Heap needs to be referenced from a parameter /// <summary> /// Do the recursive unpacking of the data structure into mirror objects /// </summary> /// <param name="val"></param> /// <returns></returns> public static Obj Unpack(StackValue val, Heap heap, RuntimeCore runtimeCore, int type = (int)PrimitiveType.Pointer) { Executable exe = runtimeCore.DSExecutable; switch (val.optype) { case AddressType.ArrayPointer: { DsasmArray ret = new DsasmArray(); //Pull the item out of the heap var array = heap.ToHeapObject <DSArray>(val); StackValue[] nodes = array.Values.ToArray(); ret.members = new Obj[array.Count]; for (int i = 0; i < ret.members.Length; i++) { ret.members[i] = Unpack(nodes[i], heap, runtimeCore, type); } // TODO Jun: ret.members[0] is hardcoded and means we are assuming a homogenous collection // How to handle mixed-type arrays? Obj retO = new Obj(val) { Payload = ret, }; return(retO); } case AddressType.String: { string str = heap.ToHeapObject <DSString>(val).Value; Obj o = new Obj(val) { Payload = str, }; return(o); } case AddressType.Int: { Obj o = new Obj(val) { Payload = val.IntegerValue, }; return(o); } case AddressType.Boolean: { Obj o = new Obj(val) { Payload = val.BooleanValue, }; return(o); } case AddressType.Null: { Obj o = new Obj(val) { Payload = null, }; return(o); } case AddressType.Char: { Obj o = new Obj(val) { Payload = val.CharValue, }; return(o); } case AddressType.Double: { Obj o = new Obj(val) { Payload = val.DoubleValue, }; return(o); } case AddressType.Pointer: { Obj o = new Obj(val) { Payload = val.Pointer, }; return(o); } case AddressType.FunctionPointer: { Obj o = new Obj(val) { Payload = val.FunctionPointer, }; return(o); } case AddressType.Invalid: { return(new Obj(val) { Payload = null }); } default: { throw new NotImplementedException(string.Format("unknown datatype {0}", val.optype.ToString())); } } }
public static T ConvertTo <T>(object value) { if (Obj.IsNull(value)) { return(default);
}//Call public override IObject Create( int argc ) { var it = new Obj( Engine, Engine.Box( Get( "prototype" ) ) ); CreateContext( it ); var args = Ctx.Vars.BaseClass; if( this.Args != null ) { for( var i = 0; i < this.Args.Length; i++ ) { args.Set( this.Args[i].Name, i < argc ? Arg( argc, i ) : this.Args[i].Value < 0 ? new Value() : Engine.Expression( Code, this.Args[i].Value ).Result ); } } Engine.Eval( Code, CodeAt, CodeSize ); DestroyContext(); return it; }//Create
public virtual void Show() { Obj.SetActive(true); }
static bool Read(SophieVM vm, Obj[] stack, int argStart) { stack[argStart] = Obj.MakeString(Console.ReadLine()); if (((ObjString)stack[argStart]).Str == "") { stack[argStart] = Obj.Null; } return true; }
public void RemoveObj(Obj obj) { objList.Remove(obj); }
static bool WriteString(SophieVM vm, Obj[] stack, int argStart) { if (stack[argStart + 1] != null && stack[argStart + 1].Type == ObjType.Obj) { string s = stack[argStart + 1].ToString(); Console.Write(s); } stack[argStart] = Obj.Null; return true; }
public void GetTechnicianTypeNameTest() { var name = Obj.GetTechnicianTypeName(_data.Id); Assert.AreEqual(_data.Name, name); }
}//Prototype public NumberFun( Engine engine, Obj baseClass, NumberObj prototype ) : base( engine, baseClass, new Props( "prototype", prototype ) ) { _prototype = prototype; }//.ctor
private static void Game_OnGameUpdate(EventArgs args) { ManaMenager(); if (Orbwalker.ActiveMode.ToString() == "Mixed" || Orbwalker.ActiveMode.ToString() == "LaneClear" || Orbwalker.ActiveMode.ToString() == "LastHit") { Farm = true; } else { Farm = false; } if (E.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA) { foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(E.Range) && E.IsReady())) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Suppression) || enemy.IsStunned || enemy.HasBuff("Recall")) { E.Cast(enemy, true); } else if (enemy.HasBuffOfType(BuffType.Slow) && enemy.Path.Count() > 1) { E.CastIfHitchanceEquals(enemy, HitChance.VeryHigh, true); } else if (enemy.Path.Count() > 1 && enemy.CountEnemiesInRange(300) > 2) { E.CastIfHitchanceEquals(enemy, HitChance.VeryHigh, true); } else { E.CastIfHitchanceEquals(enemy, HitChance.Immobile, true); } } foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.Distance(Player.ServerPosition) < E.Range && E.IsReady() && Obj.Team != Player.Team && Obj.HasBuff("teleport_target", true))) { E.Cast(Object.Position, true); } var ta = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical); if (Orbwalker.ActiveMode.ToString() == "Combo" && ta.IsValidTarget(E.Range) && ta.Path.Count() == 1 && Config.Item("autoE").GetValue <bool>() && ObjectManager.Player.Mana > RMANA + EMANA + WMANA) { if (ObjectManager.Player.Position.Distance(ta.ServerPosition) > ObjectManager.Player.Position.Distance(ta.Position)) { if (ta.Position.Distance(Game.CursorPos) < ta.Position.Distance(ObjectManager.Player.Position) && ta.IsValidTarget(E.Range - 300)) { E.CastIfHitchanceEquals(ta, HitChance.VeryHigh, true); } } else if (ta.Position.Distance(Game.CursorPos) > ta.Position.Distance(ObjectManager.Player.Position) && ta.IsValidTarget(E.Range - 100)) { E.CastIfHitchanceEquals(ta, HitChance.VeryHigh, true); } } } if (Q.IsReady()) { ManaMenager(); if (Farm) { if (ObjectManager.Player.Mana > RMANA + WMANA + EMANA + 10 && !FishBoneActive) { farmQ(); } } var t = TargetSelector.GetTarget(bonusRange() + 50, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { var distance = GetRealDistance(t); var powPowRange = GetRealPowPowRange(t); if (!FishBoneActive && !Orbwalking.InAutoAttackRange(t)) { if (Orbwalker.ActiveMode.ToString() == "Combo" && (ObjectManager.Player.Mana > RMANA + WMANA + 20 || ObjectManager.Player.GetAutoAttackDamage(t) * 2 > t.Health)) { Q.Cast(); } else if (Farm && haras() && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + WMANA + 20 && distance < bonusRange() + t.BoundingRadius) { Q.Cast(); } } } else if (!FishBoneActive && (Orbwalker.ActiveMode.ToString() == "Combo") && ObjectManager.Player.Mana > RMANA + WMANA + 20) { Q.Cast(); } else if (FishBoneActive && (Orbwalker.ActiveMode.ToString() == "Combo") && ObjectManager.Player.Mana < RMANA + WMANA + 20) { Q.Cast(); } else if (FishBoneActive && Farm) { Q.Cast(); } } if (W.IsReady()) { ManaMenager(); var t = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical); if (t.IsValidTarget()) { var wDmg = W.GetDamage(t); if (!Orbwalking.InAutoAttackRange(t) && wDmg + ObjectManager.Player.GetAutoAttackDamage(t) > t.Health) { W.Cast(t, true); } else if (t.Path.Count() == 1 && Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + WMANA + 10 && ObjectManager.Player.CountEnemiesInRange(GetRealPowPowRange(t)) == 0) { W.CastIfHitchanceEquals(t, HitChance.VeryHigh, true); } else if ((Farm && ObjectManager.Player.Mana > RMANA + EMANA + WMANA + WMANA + 20) && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.CountEnemiesInRange(bonusRange()) == 0 && haras()) { if (ObjectManager.Player.Mana > ObjectManager.Player.MaxMana * 0.8) { W.CastIfHitchanceEquals(t, HitChance.High, true); } else if (t.Path.Count() == 1) { W.CastIfHitchanceEquals(t, HitChance.VeryHigh, true); } } else if ((Orbwalker.ActiveMode.ToString() == "Combo" || Farm) && ObjectManager.Player.Mana > RMANA + WMANA && ObjectManager.Player.CountEnemiesInRange(GetRealPowPowRange(t)) == 0) { foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(W.Range))) { if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) || enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) || enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall")) { W.CastIfHitchanceEquals(t, HitChance.High, true); } } } } } if (R.IsReady() && Config.Item("autoR").GetValue <bool>()) { bool cast = false; foreach (var target in ObjectManager.Get <Obj_AI_Hero>().Where(target => target.IsValidTarget(R.Range))) { if (target.IsValidTarget() && (Game.Time - WCastTime > 1) && !target.HasBuffOfType(BuffType.PhysicalImmunity) && !target.HasBuffOfType(BuffType.SpellImmunity) && !target.HasBuffOfType(BuffType.SpellShield)) { float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target.ServerPosition) / R.Speed) * 1000)); var Rdmg = R.GetDamage(target); if (Rdmg > predictedHealth) { cast = true; PredictionOutput output = R.GetPrediction(target); Vector2 direction = output.CastPosition.To2D() - Player.Position.To2D(); direction.Normalize(); List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList(); foreach (var enemy in enemies) { if (enemy.SkinName == target.SkinName || !cast) { continue; } PredictionOutput prediction = R.GetPrediction(enemy); Vector3 predictedPosition = prediction.CastPosition; Vector3 v = output.CastPosition - Player.ServerPosition; Vector3 w = predictedPosition - Player.ServerPosition; double c1 = Vector3.Dot(w, v); double c2 = Vector3.Dot(v, v); double b = c1 / c2; Vector3 pb = Player.ServerPosition + ((float)b * v); float length = Vector3.Distance(predictedPosition, pb); if (length < (R.Width + 100 + enemy.BoundingRadius / 2) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition)) { cast = false; } } if (cast && target.IsValidTarget() && GetRealDistance(target) > bonusRange() + 150 + target.BoundingRadius && target.CountAlliesInRange(500) == 0 && ObjectManager.Player.CountEnemiesInRange(400) == 0) { if (Config.Item("hitchanceR").GetValue <bool>() && target.Path.Count() == 1) { R.CastIfHitchanceEquals(target, HitChance.VeryHigh, true); } else { R.Cast(target, true); } } else if (target.IsValidTarget() && target.CountEnemiesInRange(200) > 2 && ObjectManager.Player.CountEnemiesInRange(400) == 0) { R1.Cast(target, true, true); } } } } } PotionMenager(); }
public Object(string filename) { Mono = new List<Obj>(); StreamReader obj; obj = new StreamReader(filename); List<string> v = new List<string>(); List<string> vn = new List<string>(); List<string> vt = new List<string>(); List<string> f = new List<string>(); List<string> usematerials = new List<string>(); string materialpath = ""; bool charge = false; Obj test; string Line; Line = obj.ReadLine(); do { switch (Line[0]) { case 'm': { string[] tab = Line.Split(' '); if (tab[0] == "mtllib") { materialpath = tab[1]; } } break; case 'u': { string[] tab = Line.Split(' '); if (tab[0] == "usemtl") { usematerials.Add(tab[1]); } } break; case 'v': if (Line[1] == 't') { vt.Add(Line.Remove(0, 3)); } else if (Line[1] == 'n') { vn.Add(Line.Remove(0, 3)); } else { v.Add(Line.Remove(0, 2)); } break; case 'f': f.Add(Line.Remove(0, 2)); break; case 'o': if (charge == true) { test = new Obj(v,vn,vt,f,usematerials,materialpath); Mono.Add(test); f.Clear(); v.Clear(); vt.Clear(); vn.Clear(); usematerials.Clear(); } else { charge = true; } break; default: break; } Line = obj.ReadLine(); } while (Line != null); obj.Close(); test = new Obj(v,vn,vt,f,usematerials,materialpath); Mono.Add(test); }
public int Test2(Obj o1, int j) { Obj o2 = Obj.MakeObj(); return(o2.f + j); }
public void AddObj(Obj obj) { objList.Add(obj); }
public virtual void Hide() { Obj.SetActive(false); }
// Pointer to the variable this upvalue is referencing. // If the upvalue is closed (i.e. the local variable it was pointing too has // been popped off the stack) then the closed-over value will be hoisted out // of the stack into here. [value] will then be changed to point to this. // Open upvalues are stored in a linked list by the fiber. This points to the // next upvalue in that list. // Creates a new open upvalue pointing to [value] on the stack. public ObjUpvalue(Obj c, int index) { Container = c; Next = null; Index = index; }
/// <summary> /// Serializes an object to a binary destination. /// </summary> /// <param name="Writer">Binary destination.</param> /// <param name="WriteTypeCode">If a type code is to be output.</param> /// <param name="Embedded">If the object is embedded into another.</param> /// <param name="Value">The actual object to serialize.</param> public override void Serialize(IBsonWriter Writer, bool WriteTypeCode, bool Embedded, object Value) { if (Value is null) { if (!WriteTypeCode) { throw new NullReferenceException("Value cannot be null."); } Writer.WriteNull(); } else if (Value is GenericObject TypedValue) { IObjectSerializer Serializer; object Obj; Writer.WriteStartDocument(); if (!Embedded && TypedValue.ObjectId != Guid.Empty) { Writer.WriteName("_id"); Writer.WriteObjectId(GeneratedObjectSerializerBase.GuidToObjectId(TypedValue.ObjectId)); } if (!string.IsNullOrEmpty(TypedValue.TypeName)) { Writer.WriteName("_type"); Writer.WriteString(TypedValue.TypeName); } if (Embedded && !string.IsNullOrEmpty(TypedValue.CollectionName)) { Writer.WriteName("_collection"); Writer.WriteString(TypedValue.CollectionName); } foreach (KeyValuePair <string, object> Field in TypedValue) { Writer.WriteName(Field.Key); Obj = Field.Value; if (Obj is null) { Writer.WriteNull(); } else { if (Obj is GenericObject) { this.Serialize(Writer, true, true, Obj); } else if (Obj is CaseInsensitiveString cis) { Writer.WriteString(cis.Value); Writer.WriteName(Field.Key + "_L"); Writer.WriteString(cis.LowerCase); } else { Serializer = this.Provider.GetObjectSerializer(Obj.GetType()); Serializer.Serialize(Writer, true, true, Obj); } } } Writer.WriteEndDocument(); } else { IObjectSerializer Serializer = this.Provider.GetObjectSerializer(Value.GetType()); Serializer.Serialize(Writer, WriteTypeCode, Embedded, Value); } }