コード例 #1
0
        public void When_Type_Is_Object_DataFormat_Json_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter()));

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter()));

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ <dynamic>(key, GetVBucket(), new AutoByteConverter(),
                                          new DefaultTranscoder(new AutoByteConverter()));

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Json, getQ.Format);

            var result = IOStrategy.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Json, getQ.Format);
        }
コード例 #2
0
        public void When_Type_Is_Object_DataFormat_Json_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            IOService.Execute(delete);

            //Add the key
            var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout);

            Assert.IsTrue(IOService.Execute(add).Success);

            var getQ = new GetQ <dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Json, getQ.Format);

            var result = IOService.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Json, getQ.Format);
        }
コード例 #3
0
        public void When_Key_Exists_GetK_Returns_Value()
        {
            var key = "When_Key_Exists_GetQ_Returns_Value";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter()));

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter()));

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getK = new GetQ <dynamic>(key, GetVBucket(), new AutoByteConverter(),
                                          new DefaultTranscoder(new AutoByteConverter()));

            var result = IOStrategy.Execute(getK);

            Assert.IsTrue(result.Success);

            var expected = new { foo = "foo" };

            Assert.AreEqual(result.Value.foo.Value, expected.foo);
        }
コード例 #4
0
        public void When_Type_Is_String_DataFormat_String_Is_Used()
        {
            var key = "When_Type_Is_String_GetQ_Uses_DataFormat_String";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout);

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ <string>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.String, getQ.Format);

            var result = IOStrategy.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.String, getQ.Format);
        }
コード例 #5
0
ファイル: Spells.cs プロジェクト: sergix1/addons
        private bool notKilleableWithOthersSpells(Obj_AI_Hero tar)
        {
            double totalDamage = 0;
            double qDamage = 0d, wDamage = 0d, eDamage = 0d;

            if (GetQ.IsReady())
            {
                qDamage = GetQ.GetDamage(tar);
            }
            if (GetW.IsReady())
            {
                wDamage = GetW.GetDamage(tar);
            }
            if (GetE.IsReady())
            {
                eDamage = GetE.GetDamage(tar);
            }
            totalDamage = qDamage + wDamage + eDamage;

            if (isKilleable(tar, totalDamage))
            {
                return(false);
            }

            return(true);
        }
コード例 #6
0
        public void When_Type_Is_ByteArray_DataFormat_Binary_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <byte[]>(key, new byte[] { 0x0 }, GetVBucket(), Transcoder, OperationLifespanTimeout);

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ <byte[]>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Binary, getQ.Format);

            var result = IOStrategy.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Binary, getQ.Format);
        }
コード例 #7
0
ファイル: Spells.cs プロジェクト: sergix1/addons
        public void CastQE(Obj_AI_Base target)
        {
            if (GetE.IsReady())
            {
                //    var prediction = Prediction.GetPrediction(target, 500);
                var predictionInput = new PredictionInput
                {
                    Aoe       = false,
                    Collision = EQ.Collision,
                    Speed     = EQ.Speed,
                    Delay     = EQ.Delay,
                    Range     = EQ.Range,
                    From      = HeroManager.Player.ServerPosition,
                    Radius    = EQ.Width,
                    Unit      = target,
                    Type      = SkillshotType.SkillshotLine
                };
                var prediction = Prediction.GetPrediction(predictionInput);


                Vector3 castQpos = prediction.CastPosition;

                if (HeroManager.Player.Distance(castQpos) > GetQ.Range)
                {
                    castQpos = HeroManager.Player.Position.Extend(castQpos, GetE.Range);
                }


                if (prediction.Hitchance >= HitChance.VeryHigh)
                {
                    EQcastNow = true;
                    GetQ.Cast(castQpos);
                }
            }
        }
コード例 #8
0
        public void Test_OperationResult_Returns_Defaults()
        {
            var op = new GetQ<string>("Key", GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout);

            var result = op.GetResultWithValue();
            Assert.IsNull(result.Value);
            Assert.IsEmpty(result.Message);
        }
コード例 #9
0
        public void Test_OperationResult_Returns_Defaults()
        {
            var op = new GetQ <string>("Key", GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout);

            var result = op.GetResultWithValue();

            Assert.IsNull(result.Value);
            Assert.IsEmpty(result.Message);
        }
コード例 #10
0
        public void Test_OperationResult_Returns_Defaults()
        {
            var op = new GetQ <string>("Key", GetVBucket(), new AutoByteConverter(),
                                       new DefaultTranscoder(new AutoByteConverter()));

            var result = op.GetResult();

            Assert.IsNull(result.Value);
            Assert.IsEmpty(result.Message);
        }
コード例 #11
0
 public void TryBallE(AIHeroClient t)
 {
     if (!castE(t))
     {
         if (GetQ.IsReady())
         {
             CastQE(t);
         }
     }
 }
コード例 #12
0
ファイル: Spells.cs プロジェクト: sergix1/addons
 public void TryBallE(Obj_AI_Hero t)
 {
     if (!castE(t))
     {
         if (GetQ.IsReady())
         {
             CastQE(t);
         }
     }
 }
コード例 #13
0
ファイル: Spells.cs プロジェクト: sergix1/Ensoul
        public bool CastW()
        {
            if (!GetW.IsReady())
            {
                return(false);
            }
            var wTarget = TargetSelector.GetTarget(GetW.Range, DamageType.Magical);

            if (wTarget == null)
            {
                return(false);
            }


            if (!GetW.IsInRange(wTarget))
            {
                return(false);
            }

            ;

            if (ObjectManager.Player.GetBuff("syndrawtooltip") != null)
            {
                if (ObjectManager.Player.GetBuff("syndrawtooltip").IsActive&& GetW.IsReady())
                {
                    if (GetW.IsInRange(wTarget))
                    {
                        var predictW = GetQ.GetPrediction(wTarget, true);
                        if (predictW.Hitchance >= HitChance.High)
                        {
                            GetW.Cast(predictW.CastPosition);
                        }



                        GetW.Cast(wTarget.Position, true);
                        //   GetW.Cast()
                        return(true);
                    }
                }
            }



            if (GetW.IsReady())
            {
                var orb = GetOrbs.GetOrbToGrab((int)GetW.Range);
                GetW.Cast(orb);
            }
            //   Game.Print("-> " + ObjectManager.Player.GetBuff(+ " toggle " + ObjectManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState));
            return(false);
        }
コード例 #14
0
        public void Test_Clone()
        {
            var operation = new GetQ <string>("key", GetVBucket(), Transcoder, OperationLifespanTimeout)
            {
                Cas = 1123
            };
            var cloned = operation.Clone();

            Assert.AreEqual(operation.CreationTime, cloned.CreationTime);
            Assert.AreEqual(operation.Cas, cloned.Cas);
            Assert.AreEqual(operation.VBucket.Index, cloned.VBucket.Index);
            Assert.AreEqual(operation.Key, cloned.Key);
            Assert.AreEqual(operation.Opaque, cloned.Opaque);
        }
コード例 #15
0
ファイル: Spells.cs プロジェクト: sergix1/addons
        public bool CastQ()
        {
            if (!GetQ.IsReady())
            {
                return(false);
            }
            var qTarget = TargetSelector.GetTarget(GetQ.Range, TargetSelector.DamageType.Magical);

            if (qTarget != null)
            {
                var predictQ = GetQ.GetPrediction(qTarget, true);
                if (predictQ.Hitchance >= HitChance.VeryHigh)
                {
                    return(GetQ.Cast(predictQ.CastPosition));
                }
            }
            return(false);
        }
コード例 #16
0
ファイル: Spells.cs プロジェクト: sergix1/addons
 private bool NotKilleableWithOtherSpells(Obj_AI_Hero target, SyndraCore core)
 {
     if (GetQ.IsReady() && GetQ.IsKillable(target))
     {
         CastQ();
         return(false);
     }
     if (GetW.IsReady() && GetW.IsKillable(target))
     {
         CastW();
         return(false);
     }
     if (GetE.IsReady() && GetE.IsKillable(target))
     {
         CastE(core);
         return(false);
     }
     return(true);
 }
コード例 #17
0
        public override IOperation Clone()
        {
            var cloned = new GetQ <T>
            {
                Key                     = Key,
                Content                 = Content,
                Transcoder              = Transcoder,
                VBucketId               = VBucketId,
                Opaque                  = Opaque,
                Attempts                = Attempts,
                Cas                     = Cas,
                CreationTime            = CreationTime,
                LastConfigRevisionTried = LastConfigRevisionTried,
                BucketName              = BucketName,
                ErrorCode               = ErrorCode
            };

            return(cloned);
        }
コード例 #18
0
        public void When_Key_Exists_GetK_Returns_Value()
        {
            var key = "When_Key_Exists_GetQ_Returns_Value";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout);
            IOService.Execute(delete);

            //Add the key
            var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout);
            Assert.IsTrue(IOService.Execute(add).Success);

            var getK = new GetQ<dynamic>(key, GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout);

            var result = IOService.Execute(getK);
            Assert.IsTrue(result.Success);

            var expected = new {foo = "foo"};
            Assert.AreEqual(result.Value.foo.Value, expected.foo);
        }
コード例 #19
0
ファイル: Spells.cs プロジェクト: sergix1/addons
        public bool CastW()
        {
            if (!GetW.IsReady())
            {
                return(false);
            }
            var wTarget = TargetSelector.GetTarget(GetW.Range, TargetSelector.DamageType.Magical);

            if (wTarget == null)
            {
                return(false);
            }
            if (GetW.IsInRange(wTarget))
            {
                if (HeroManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState == 1 && GetW.IsReady())
                {
                    var orb = GetOrbs.GetOrbToGrab((int)GetW.Range);
                    GetW.Cast(orb);
                }
                else if (HeroManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState != 1 && HeroManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState != 1 && GetW.IsReady())
                {
                    if (GetW.IsInRange(wTarget))
                    {
                        if (GetOrbs.WObject(false) == null)
                        {
                            return(false);
                        }
                        GetW.From = GetOrbs.WObject(false).ServerPosition;

                        var predictW = GetQ.GetPrediction(wTarget, true);
                        if (predictW.Hitchance >= HitChance.VeryHigh)
                        {
                            GetW.Cast(predictW.CastPosition, true);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #20
0
        public void When_Type_Is_String_DataFormat_String_Is_Used()
        {
            var key = "When_Type_Is_String_GetQ_Uses_DataFormat_String";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add<string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout);
            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ<string>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.String, getQ.Format);

            var result = IOStrategy.Execute(getQ);
            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.String, getQ.Format);
        }
コード例 #21
0
        public void When_Type_Is_Object_DataFormat_Json_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            IOService.Execute(delete);

            //Add the key
            var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout);
            Assert.IsTrue(IOService.Execute(add).Success);

            var getQ = new GetQ<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Json, getQ.Format);

            var result = IOService.Execute(getQ);
            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Json, getQ.Format);
        }
コード例 #22
0
ファイル: Spells.cs プロジェクト: sergix1/addons
 public override bool castQ(Core core)
 {
     if (GetQ.IsReady())
     {
         var qTarget     = TargetSelector.GetTarget(GetQ.Range, TargetSelector.DamageType.Magical);
         var onlyBlazedQ = core.GetMenu.getMenuBoolOption("CQS");
         if (qTarget == null || !GetQ.IsInRange(qTarget))
         {
             return(false);
         }
         if (onlyBlazedQ)
         {
             if (isBlazed(qTarget))
             {
                 core.cast(qTarget, GetQ, SebbyLib.Prediction.SkillshotType.SkillshotLine);
             }
         }
         else
         {
             core.cast(qTarget, GetQ, SebbyLib.Prediction.SkillshotType.SkillshotLine);
         }
     }
     return(false);
 }
コード例 #23
0
 public void Test_Clone()
 {
     var operation = new GetQ<string>("key", GetVBucket(), Transcoder, OperationLifespanTimeout)
     {
         Cas = 1123
     };
     var cloned = operation.Clone();
     Assert.AreEqual(operation.CreationTime, cloned.CreationTime);
     Assert.AreEqual(operation.Cas, cloned.Cas);
     Assert.AreEqual(operation.VBucket.Index, cloned.VBucket.Index);
     Assert.AreEqual(operation.Key, cloned.Key);
     Assert.AreEqual(operation.Opaque, cloned.Opaque);
 }
コード例 #24
0
        public void When_Type_Is_ByteArray_DataFormat_Binary_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add<byte[]>(key, new byte[] { 0x0 }, GetVBucket(), Transcoder, OperationLifespanTimeout);
            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ<byte[]>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Binary, getQ.Format);

            var result = IOStrategy.Execute(getQ);
            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Binary, getQ.Format);
        }