Example #1
0
 public virtual void DecreaseValue()
 {
     if ((int)SkillValue.a < (int)Value)
     {
         Value = (SkillValue)((int)Value - 1);
     }
 }
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("AvailableViewDataSourceCell");

                if (cell == null)
                {
                    cell = new DataListViewCell(UITableViewCellStyle.Default, "AvailableViewDataSourceCell");
                }

                SkillValue v = state._CurrentSkills[indexPath.Row];


                cell.TextLabel.Text = v.FullName;
                cell.TextLabel.Font = UIFont.SystemFontOfSize(16f);
                cell.Data           = v;

                GradientButton b   = new GradientButton();
                var            man = new ButtonPropertyManager(b, state.DialogParent, v, "Mod");

                man.FormatDelegate = a => ((int)a).PlusFormat();
                state._SkillModManagers[indexPath.Row] = man;
                b.SetSize(65, 22);
                cell.AccessoryView = b;


                return(cell);
            }
Example #3
0
 public virtual void IncreaseValue()
 {
     if ((int) Value < (int) SkillValue.c)
     {
         Value = (SkillValue) ((int) Value + 1);
     }
 }
Example #4
0
        protected override void Load(ScriptableData.FunctionData functionData)
        {
            ScriptableData.CallData callData = functionData.Call;
            if (null != callData)
            {
                for (int i = 0; i < callData.GetParamNum(); ++i)
                {
                    ScriptableData.ISyntaxComponent param = callData.GetParam(i);
                    SkillValue val = new SkillValue();
                    val.InitFromDsl(param);
                    m_LoadedIterators.Add(val);
                    m_Iterators.Enqueue(val);
                }
                for (int i = 0; i < functionData.Statements.Count; i++)
                {
                    ICommand cmd = CommandManager.Instance.CreateCommand(functionData.Statements[i]);
                    if (null != cmd)
                    {
                        m_LoadedCommands.Add(cmd);
                    }
                }

                /*
                 * foreach (ScriptableData.ISyntaxComponent statement in functionData.Statements) {
                 * ICommand cmd = StoryCommandManager.Instance.CreateCommand(statement);
                 * if(null!=cmd)
                 *  m_LoadedCommands.Add(cmd);
                 * }*/
            }
        }
Example #5
0
        public static SkillValueDTO Map(SkillValue skillValue)
        {
            SkillValueDTO result = new SkillValueDTO {
                Id = skillValue.Id, Skill = Map(skillValue.Skill), Value = skillValue.Value
            };

            return(result);
        }
            public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
            {
                SkillValue sv = state._CurrentSkills[indexPath.Row];

                state.CurrentMonster.SkillValueDictionary.Remove(sv.FullName);
                state.CurrentMonster.UpdateSkillValueList();
                state.UpdateSelectableSkills();
            }
Example #7
0
        void HandleModChanged(EditText field, SkillValue val)
        {
            int value;

            if (int.TryParse(field.Text, out value))
            {
                EditMonster.ChangeSkill(val.Name, value - val.Mod);
            }
        }
Example #8
0
    //apply skill;
    public void ApplySkills()
    {
        foreach (KeyValuePair <SkillEnum, SkillValue> pair in mSkillAbilities)
        {
            SkillValue skillValue = pair.Value;
            skillValue.callback();

            Debug.Log("Apply skill --> " + skillValue.ToString());
        }
    }
Example #9
0
 //add skill;
 public void AddSkill(SkillValue skillValue)
 {
     if (mSkillAbilities.ContainsKey(skillValue.ID))
     {
         mSkillAbilities[skillValue.ID] = skillValue;
     }
     else
     {
         mSkillAbilities.Add(skillValue.ID, skillValue);
     }
 }
        protected override void Load(ScriptableData.CallData callData)
        {
            int num = callData.GetParamNum();

            for (int i = 0; i < num; ++i)
            {
                IValue <string> val = new SkillValue <string>();
                val.InitFromDsl(callData.GetParam(i));
                m_MsgIds.Add(val);
            }
        }
Example #11
0
        public static void PrintCurrenSkillStatus()
        {
            SkillValue mf = SkillsHelper.GetSkillValue("MaceFighting");
            SkillValue fe = SkillsHelper.GetSkillValue("Fencing");
            SkillValue sw = SkillsHelper.GetSkillValue("Swordsmanship");
            SkillValue wr = SkillsHelper.GetSkillValue("Wrestling");

            Game.PrintMessage(String.Format("{0} - {1} / {2}", "MaceFighting", mf.RealValue, mf.MaxValue));
            Game.PrintMessage(String.Format("{0} - {1} / {2}", "Wrestling", wr.RealValue, wr.MaxValue));
            Game.PrintMessage(String.Format("{0} - {1} / {2}", "Fencing", fe.RealValue, fe.MaxValue));
            Game.PrintMessage(String.Format("{0} - {1} / {2}", "Swordsmanship", sw.RealValue, sw.MaxValue));
        }
Example #12
0
        private void btnSkill_Click(object sender, RoutedEventArgs e)
        {
            SkillValue skill = ((sender as Button).Tag as SkillValue);

            if (skill == null)
            {
                return;
            }

            EditSkillValueWindow window = new EditSkillValueWindow(skill);

            window.ShowDialog(this);
        }
Example #13
0
        protected override void Load(ScriptableData.CallData callData)
        {
            int num = callData.GetParamNum();

            if (num > 0)
            {
                m_Format.InitFromDsl(callData.GetParam(0));
            }
            for (int i = 1; i < callData.GetParamNum(); ++i)
            {
                SkillValue val = new SkillValue();
                val.InitFromDsl(callData.GetParam(i));
                m_FormatArgs.Add(val);
            }
        }
        void AddSkillButtonClicked(object sender, EventArgs e)
        {
            SkillValue v = new SkillValue(_SelectedSkill);

            if (_OptionsSkills.Contains(_SelectedSkill))
            {
                v.Subtype = _DetailText.Trim().ToLower();
            }

            if (!CurrentMonster.SkillValueDictionary.ContainsKey(v.FullName))
            {
                CurrentMonster.AddOrChangeSkill(v.Name, v.Subtype, 0);
                UpdateSelectableSkills();
            }
        }
Example #15
0
 public void InitFromDsl(ScriptableData.ISyntaxComponent param)
 {
     ScriptableData.CallData callData = param as ScriptableData.CallData;
     if (null != callData && callData.GetId() == "max")
     {
         for (int i = 0; i < callData.GetParamNum(); ++i)
         {
             ScriptableData.ISyntaxComponent arg = callData.GetParam(i);
             SkillValue val = new SkillValue();
             val.InitFromDsl(arg);
             m_List.Add(val);
         }
         TryUpdateValue();
     }
 }
Example #16
0
    private void SetSpriteState(SingleSkillInfo selectedSkillInfo)
    {
        //int consumeMoneyValue = SkillValue.GetSkillValue(selectedSkillInfo.SkillLevel, selectedSkillInfo.localSkillData.m_upgradeMoneyParams);
        int consumeMoneyValue  = selectedSkillInfo.localSkillData.m_upgradeMoneyParams.Length >= selectedSkillInfo.SkillLevel?selectedSkillInfo.localSkillData.m_upgradeMoneyParams[selectedSkillInfo.SkillLevel - 1]:0;
        int skillHurtValue     = SkillValue.GetSkillValue(selectedSkillInfo.SkillLevel, selectedSkillInfo.localSkillData.m_mightParams);
        int nextSkillHurtValue = SkillValue.GetSkillValue(selectedSkillInfo.SkillLevel + 1, selectedSkillInfo.localSkillData.m_mightParams);
        //int needLv = selectedSkillInfo.SkillLevel + 1;
        int needLv = selectedSkillInfo.localSkillData.m_unlockLevel + selectedSkillInfo.SkillLevel * selectedSkillInfo.localSkillData.m_UpdateInterval;

        if (consumeMoneyValue > 0)
        {
            if (PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_HOLDMONEY < consumeMoneyValue)
            {
                ConsumeLabel.color = Color.red;
            }
            else
            {
                ConsumeLabel.color = Color.white;
            }
        }

        if (needLv > 0)
        {
            if (PlayerManager.Instance.FindHeroDataModel().UnitValues.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL < needLv)
            {
                NeedLabel.color        = Color.red;
                ArrowSprite.enabled    = false;
                MightLeftLabel.enabled = false;
                MightRightLabel.color  = Color.white;
                MightRightLabel.text   = skillHurtValue.ToString();
            }
            else
            {
                NeedLabel.color        = Color.white;
                MightLeftLabel.enabled = true;
                ArrowSprite.enabled    = true;
                MightRightLabel.color  = Color.green;
                MightRightLabel.text   = nextSkillHurtValue.ToString();
            }
        }


        NeedLabel.text      = needLv.ToString();
        MightLeftLabel.text = skillHurtValue.ToString();
        ConsumeLabel.text   = consumeMoneyValue.ToString();
    }
Example #17
0
 public void InitFromDsl(ScriptableData.ISyntaxComponent param)
 {
     ScriptableData.CallData callData = param as ScriptableData.CallData;
     if (null != callData && callData.GetId() == "format")
     {
         int num = callData.GetParamNum();
         if (num > 0)
         {
             m_Format.InitFromDsl(callData.GetParam(0));
         }
         for (int i = 1; i < callData.GetParamNum(); ++i)
         {
             SkillValue val = new SkillValue();
             val.InitFromDsl(callData.GetParam(i));
             m_FormatArgs.Add(val);
         }
         TryUpdateValue();
     }
 }
Example #18
0
        //---------------------------------------------------------------------------------------------

        protected double GetScroolTimeout()
        {
            SkillValue skv = SkillsHelper.GetSkillValue("Magery");

            if (skv.RealValue > 960)
            {
                return(2.000);
            }
            else if (skv.Value > 910)
            {
                return(4.000);
            }
            else if (skv.RealValue > 860)
            {
                return(7.000);
            }
            else if (skv.RealValue > 810)
            {
                return(10.000);
            }
            else if (skv.RealValue > 750)
            {
                return(13.000);
            }
            else if (skv.RealValue > 710)
            {
                return(16.000);
            }
            else if (skv.RealValue > 660)
            {
                return(19.000);
            }
            else if (skv.RealValue > 610)
            {
                return(22.000);
            }
            else
            {
                return(25.000);
            }
        }
Example #19
0
        public void HideDruid(int wait)
        {
            Journal.Clear();
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }


            Game.RunScript(3000);


            UO.UseSkill(usedSkill);


            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText    = "Vracecka: ";
            counter.HighlightTime = 1500;
            counter.Step          = 400;
            counter.StopMessage   = "You can't seem to hide here,You have hidden yourself well,You can't do much in your";
            counter.StopMethod    = IsHidden;
            counter.Run();

            if (World.Player.Backpack.AllItems.FindType(0x1B17, 0x0493).Exist)
            {
                Game.Wait(wait);
                UO.UseType(0x1B17, 0x0493);
            }
            else
            {
                World.Player.PrintMessage("Nemas artefakt!");
            }
        }
Example #20
0
 public void Set(Name skill, int value, bool addValue = false)
 {
     if (addValue || (!addValue && value >= 0))
     {
         SkillValue sv = list.Find(s => s.name == skill);
         if (sv == null)
         {
             list.Add(new SkillValue {
                 name = skill, value = value
             });
         }
         else
         {
             sv.value = Mathf.Clamp((addValue ? sv.value : 0) + value, 0, maxSkillValue);
         }
         if (sv.value < 1)
         {
             list.Remove(sv);
         }
     }
 }
Example #21
0
        public override void Update(GameTime time)
        {
            SkillValue s;

            if (Inspector != null)
            {
                // Read from the callback
                s = Inspector();
            }
            else
            {
                // Read from the client state instead
                NameLabel.Text = Skill.LongName;
                s = new SkillValue()
                {
                    Value   = Skill.Value,
                    Percent = Skill.Percent
                };
            }

            ValueLabel.Text = FormatNumber(s.Value);

            base.Update(time);
        }
Example #22
0
        void CreateSkillsList()
        {
            LinearLayout l = FindViewById <LinearLayout>(Resource.Id.skillsLinearLayout);

            l.RemoveAllViews();

            foreach (SkillValue v in EditMonster.SkillValueList)
            {
                LinearLayout row = new LinearLayout(this);
                row.Orientation = Orientation.Horizontal;
                row.SetBackgroundColor(new Android.Graphics.Color(0xff, 0xff, 0xff));
                row.SetPadding(1, 2, 1, 2);

                TextView t = new TextView(this);
                t.Text = v.Name;
                t.SetTextSize(Android.Util.ComplexUnitType.Dip, 18);
                //t.SetBackgroundColor(new Android.Graphics.Color(0xff, 0x33, 0x33));
                t.SetMinimumWidth(130);


                row.AddView(t);
                if (Monster.SkillsDetails[v.Name].Subtypes != null)
                {
                    EditText et = new EditText(this);
                    et.Text             = v.Subtype;
                    et.LayoutParameters = new LinearLayout.LayoutParams(
                        ViewGroup.LayoutParams.FillParent,
                        ViewGroup.LayoutParams.MatchParent, 1f);
                    row.AddView(et);
                }
                else
                {
                    t.LayoutParameters = new LinearLayout.LayoutParams(
                        ViewGroup.LayoutParams.FillParent,
                        ViewGroup.LayoutParams.MatchParent, 1f);
                }

                SkillValue s = v;


                EditText mod = new EditText(this);
                mod.MakeNumber();
                mod.Text = v.Mod.ToString();
                row.AddView(mod);
                mod.SetMinimumWidth(60);
                mod.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>

                {
                    HandleModChanged((EditText)sender, s);
                };


                ImageButton b = new ImageButton(this);
                b.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.redx));

                row.AddView(b);
                b.Tag    = v.FullName;
                b.Click += (object sender, EventArgs e) =>
                {
                    AlertDialog.Builder bui = new AlertDialog.Builder(this);
                    bui.SetMessage("Remove skill?");
                    bui.SetPositiveButton("Yes", (a, x) => {
                        EditMonster.SkillValueDictionary.Remove(s.FullName);
                        EditMonster.UpdateSkillValueList();
                        CreateSkillsList();
                    });
                    bui.SetNegativeButton("No", (a, x) => {});
                    bui.Show();
                };


                l.AddView(row);
            }
        }
Example #23
0
        public override void Update(GameTime time)
        {
            SkillValue s;
            if (Inspector != null)
            {
                // Read from the callback
                s = Inspector();
            }
            else
            {
                // Read from the client state instead
                NameLabel.Text = Skill.LongName;
                s = new SkillValue()
                {
                    Value = Skill.Value,
                    Percent = Skill.Percent
                };
            }

            ValueLabel.Text = FormatNumber(s.Value);

            base.Update(time);
        }
Example #24
0
    public void InitViewInfo(SingleSkillInfo itemFielInfo)
    {
        m_itemFielInfo = itemFielInfo;
        bool   isNull      = itemFielInfo == null;
        string skillName   = isNull?"":LanguageTextManager.GetString(itemFielInfo.localSkillData.m_name);
        string breakLev    = isNull?"":ConvertBreakLev(itemFielInfo.localSkillData.m_breakLevel);
        string skillLev    = isNull?"":itemFielInfo.SkillLevel.ToString();
        string skillDesc   = isNull?"":LanguageTextManager.GetString(itemFielInfo.localSkillData.m_descSimple);
        string skillPower  = isNull?"":SkillValue.GetSkillValue(itemFielInfo.SkillLevel, itemFielInfo.localSkillData.m_mightParams).ToString();
        string skillHitNum = isNull?"":itemFielInfo.localSkillData.m_skillAttacktimes.ToString();
        string skillCDTime = isNull?"":itemFielInfo.localSkillData.m_coolDown.ToString();

        //float[] skillHurts=itemFielInfo.localSkillData.m_skillDamage;
        if (!isNull)
        {
            //向下取整((向下取整((参数1×(技能等级)^2+参数2×技能等级+参数3)/参数4)×参数4) /1000)*100%
            //int skillHurt = Mathf.FloorToInt((Mathf.FloorToInt((skillHurts[0] * Mathf.Pow(itemFielInfo.SkillLevel, 2) + skillHurts[1] * itemFielInfo.SkillLevel + skillHurts[2]) / skillHurts[3]) * skillHurts[3]) / 1000) * 100;
            //2014-8-27策划修改
            //向下取整((向下取整((参数1×(技能等级)^2+参数2×技能等级+参数3)/参数4)×参数4) /10)
//            int skillHurt = Mathf.FloorToInt((Mathf.FloorToInt((skillHurts[0] * Mathf.Pow(itemFielInfo.SkillLevel, 2) + skillHurts[1] * itemFielInfo.SkillLevel + skillHurts[2]) / skillHurts[3]) * skillHurts[3]) / 10);
//            SkillHurt.text=skillHurt.ToString();
        }
        else
        {
            SkillHurt.text = string.Empty;
        }
        SkillName.text   = skillName;
        BreakLev.text    = breakLev;
        SkillLev.text    = skillLev;
        SkillDesc.text   = skillDesc;
        SkillPower.text  = skillPower;
        SkillHitNum.text = skillHitNum;
        SkillCDTime.text = skillCDTime;


        SkillUpgradeBtn.gameObject.SetActive(!isNull);
        EffPoint.transform.ClearChild();
        //是否满级处理
        if (itemFielInfo.IsFullLev())
        {
            SkillUpgradeBtn.gameObject.SetActive(false);
            NotReachUpLev.gameObject.SetActive(false);
            NGUITools.AddChild(EffPoint, FullLevEff);

            UpgradeConsume.text = "0";
        }
        else
        {
            int upNeedLev;
            int skillManaValue = itemFielInfo.UpgradeConsume(out m_enough, out m_reachUpLev, out upNeedLev);
            SkillUpgradeBtn.gameObject.SetActive(true);

            //铜币是否足够
            if (m_enough)
            {
                SkillUpgradeBtn.Enable = true;
                UpgradeConsume.text    = "[fffa6f]" + skillManaValue.ToString() + "[-]";
                if (m_reachUpLev)
                {
                    NGUITools.AddChild(EffPoint, UpgradeBtnEff);
                }
            }
            else
            {
                //SkillUpgradeBtn.Enable=false;
                UpgradeConsume.text = "[fe768b]" + skillManaValue.ToString() + "[-]";
            }
            NotReachUpLev.text = m_reachUpLev?"":string.Format(LanguageTextManager.GetString("IDS_I7_14"), upNeedLev);
            NotReachUpLev.gameObject.SetActive(!m_reachUpLev);
            SkillUpgradeBtn.gameObject.SetActive(m_reachUpLev);
        }
        //选中特效
    }
Example #25
0
    public void AddSkill(SkillEnum skill, float value, SkillAbilityCallBack callback)
    {
        SkillValue skillValue = new SkillValue(skill, value, callback);

        AddSkill(skillValue);
    }
        public EditSkillValueWindow(SkillValue skill)
        {
            this.skill = skill;

            InitializeComponent();
        }
Example #27
0
        public void TameCharacter(UOCharacter character, int maxTries, bool keepDisttance)//, Robot r)
        {
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            Robot r = new Robot();

            r.UseTryGoOnly     = true;
            r.SearchSuqareSize = 20;

            UOItem currentStaff = EnsuredTamingStaff;
            int    tries        = 0;

            Game.PrintMessage(String.Format("{0}, {1}, {2}, {3}, {4}", character.Exist, character.RequestStatus(500), character.Hits, character.Distance, UO.Dead));

            while (character.Exist && character.RequestStatus(500) && character.Hits > 0 && character.Distance < 6 && !UO.Dead)
            {
                UO.DeleteJournal();

                bool end  = false;
                bool kill = false;

                if (character.Distance > 2 && keepDisttance)
                {
                    r.GoTo(new UOPositionBase(character.X, character.Y, 0), 2, 2);
                    Game.Wait(500);
                }
                UO.Say("Baf");
                Game.Wait();

                UO.UseSkill("Hiding");
                Game.Wait();
                IRequestResult result = UO.WaitTargetObject(character.Serial);
                currentStaff.Use();
                //Game.Wait(500);
                SkillValue tamingValue = SkillsHelper.GetSkillValue("AnimalTaming");
                UOItem     robe        = World.Player.Layers[Layer.OuterTorso];
                Game.PrintMessage("RV: " + tamingValue.RealValue + " / " + robe.Exist);

                using (JournalEventWaiter jew = new JournalEventWaiter(true,
                                                                       "You can't see the target",
                                                                       "Ochoceni se nezdarilo",
                                                                       "Your taming failed",
                                                                       "byl tamnut",
                                                                       "not tamable",
                                                                       "You are not able to tame",
                                                                       "Jsi moc daleko",
                                                                       "Jeste nemuzes pouzit hulku",
                                                                       "toto zvire nelze ochocit",
                                                                       "Toto zvire nedokazes ochocit",
                                                                       "You are not able to tame this animal"

                                                                       ))
                {
                    if (jew.Wait(15000))
                    {
                        if (Journal.Contains(true, "Ochoceni se nezdarilo"))
                        {
                            Game.PrintMessage("Try - Ochoceni se nezdarilo");
                        }
                        else if (Journal.Contains(true, "Your taming failed"))
                        {
                            Game.PrintMessage("Try - Your taming failed");
                        }
                        else if (Journal.Contains(true, "Jeste nemuzes pouzit hulku"))
                        {
                            Game.PrintMessage("Try - Jeste nemuzes pouzit hulku");
                            Game.Wait(6000);
                        }
                        else if (Journal.Contains(true, "Jsi moc daleko"))
                        {
                            if (keepDisttance)
                            {
                                bool go = r.GoTo(new UOPositionBase(character.X, character.Y, 0), 1, 10);
                                if (!go)
                                {
                                    end = true;
                                }
                                Game.Wait();
                                Game.PrintMessage("Try - Jsi moc daleko: " + go);
                            }
                        }
                        else if (Journal.Contains(true, "You can't see the target"))
                        {
                            UO.WaitTargetCancel();
                            Game.Wait();
                            UO.Press(System.Windows.Forms.Keys.Escape);
                            Game.Wait();
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            Game.Wait();
                            bool go = r.GoTo(new UOPositionBase(character.X, character.Y, 0), 1, 10);
                            if (!go)
                            {
                                end = true;
                            }
                            Game.Wait();

                            Game.PrintMessage("Try - You can't see the target go: " + go);
                        }
                        else if (Journal.Contains(true, "byl tamnut"))// && currentStaff.Color == TamingStaff.Color)
                        {
                            Game.PrintMessage("End - byl tamnut");
                            end = true;
                        }
                        else if (Journal.Contains(true, "not tamable") || Journal.Contains(true, "toto zvire nelze ochocit"))
                        {
                            character.Click();
                            Game.Wait(500);
                            character.RequestStatus(500);

                            bool isTrofejAnimal = false;// TrofejKlamaci.Contains(character.Model);

                            foreach (Graphic g in TrofejKlamaci)
                            {
                                if (g == character.Model)
                                {
                                    isTrofejAnimal = true;
                                }
                            }


                            if (isTrofejAnimal && character.Notoriety != Notoriety.Innocent && character.Notoriety != Notoriety.Invulnerable && character.Notoriety != Notoriety.Guild)//krysa/hind/bear/goat/snake atd)TODO
                            {
                                kill = true;
                                //zabit / riznout / vylotit
                                Game.PrintMessage("Kill - not tamable " + character.Model);
                            }
                            else
                            {
                                Game.PrintMessage("End - not tamable");
                                end = true;
                            }
                        }
                        else if (Journal.Contains(true, "Toto zvire nedokazes ochocit") || Journal.Contains(true, "You are not able to tame this animal"))
                        {
                            if (World.Player.Backpack.AllItems.FindType(0x1F03).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F03).Use();
                                Game.Wait(500);
                            }
                            else if (World.Player.Backpack.AllItems.FindType(0x1F01).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F01).Use();
                                Game.Wait(500);
                            }

                            if (tries > 1)
                            {
                                Game.PrintMessage("End - Nelze ochocit " + character.Serial);
                                end = true;
                            }

                            Game.Wait(3500);
                        }
                        else
                        {
                            Game.Wait(1000);
                        }
                    }
                    else
                    {
                        if (Game.CurrentGame.WorldSave())
                        {
                            Game.Wait(60000);
                            Game.PrintMessage("Try - WordSave" + character.Serial);
                        }
                        else
                        {
                            if (tries > 1)
                            {
                                Game.PrintMessage("End - JEW timeout " + character.Serial);
                                end = true;
                            }
                        }
                    }

                    if (tries > maxTries)// && currentStaff.Color == TrainTamingStaff.Color)
                    {
                        end = true;
                    }

                    if (tamingValue.RealValue < 1000 && maxTries < 100)
                    {
                        bool switchToTrain  = false;
                        bool switchToTaming = false;
                        if (tries == 0)
                        {
                            if ((Journal.Contains(true, "nenauc") || Journal.Contains(true, "You Cannot learn anything more")) && robe.Exist)
                            {
                                robe.Move(1, World.Player.Backpack);
                                Game.Wait();
                                switchToTrain = true;
                            }

                            if (!Journal.Contains(true, "nenauc"))
                            {
                                switchToTrain = true;
                            }
                        }
                        else if (tries == 1)
                        {
                            if (Journal.Contains(true, "nenauc") || Journal.Contains(true, "You Cannot learn anything more"))
                            {
                                switchToTaming = true;

                                Game.PrintMessage("robe.Exist:" + robe.Exist);

                                if (robe.Exist)
                                {
                                    robe.Use();
                                    Game.Wait();
                                }
                            }
                        }

                        if (switchToTrain)
                        {
                            if (World.Player.Backpack.AllItems.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color).Exist)
                            {
                                currentStaff = World.Player.Backpack.AllItems.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color);
                            }
                            else if (World.Player.Layers.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color).Exist)
                            {
                                currentStaff = World.Player.Backpack.AllItems.FindType(TrainTamingStaff.Graphic, TrainTamingStaff.Color);
                            }

                            Game.Wait();
                        }


                        if (switchToTaming)
                        {
                            currentStaff = EnsuredTamingStaff;
                            Game.Wait();
                        }
                    }
                    if (tries > 2)
                    {
                        if (Journal.Contains(true, "nenauc") || currentStaff.Color == TamingStaffCharged.Color && !World.Player.Layers[Layer.OuterTorso].Exist)
                        {
                            if (World.Player.Backpack.AllItems.FindType(0x1F03).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F03).Use();
                                Game.Wait();
                            }
                            else if (World.Player.Backpack.AllItems.FindType(0x1F01).Exist)
                            {
                                World.Player.Backpack.AllItems.FindType(0x1F01).Use();
                                Game.Wait(500);
                            }
                        }
                    }

                    if (kill)
                    {
                        this.KillCharacter(character);
                    }

                    if (end)
                    {
                        Game.PrintMessage("While - end: " + tries);
                        //   doneList.Remove(character.Serial);
                        break;
                    }
                }
                tries++;
                Game.PrintMessage("While - cyklus pokus: " + tries);
            }

            foreach (UOItem item in World.Ground)
            {
                if (item.Distance < 5)
                {
                    bool isKlamak = false;
                    foreach (Graphic g in Taming2.ShrinkKlamaci)
                    {
                        if (item.Graphic == g)
                        {
                            isKlamak = true;
                        }
                    }

                    if (Array.IndexOf(ItemLibrary.ShrinkKlamaci.GraphicArray, item.Graphic) > -1 || Array.IndexOf(ShrinkKlamaci, item.Graphic) > -1 || isKlamak)
                    {
                        item.Move(1, (ushort)(World.Player.X + 1), (ushort)(World.Player.Y + 1), item.Z);
                        Game.Wait(150);
                        item.Move(1, World.Player.Backpack, 30, 30);
                        Game.Wait(150);
                    }
                }
            }

            Game.PrintMessage("While - END");
            if (World.Player.Backpack.AllItems.FindType(0x1F03).Exist)
            {
                World.Player.Backpack.AllItems.FindType(0x1F03).Use();
                Game.Wait(250);
            }
            else if (World.Player.Backpack.AllItems.FindType(0x1F01).Exist)
            {
                World.Player.Backpack.AllItems.FindType(0x1F01).Use();
                Game.Wait(250);
            }
        }
Example #28
0
        public void HideInBattle(int highlightTime, ushort highlightColor, int counterStep)
        {
            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(250);
            }


            Journal.Clear();
            SkillValue    hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue    stealthSV = SkillsHelper.GetSkillValue("Stealth");
            StandardSkill usedSkill = StandardSkill.Hiding;

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }

            Game.RunScript(3000);
            UO.UseSkill(usedSkill);

            if (Journal.WaitForText(true, 200, "You are preoccupied with thoughts of battle"))
            {
                Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                World.Player.PrintMessage("[ Preoccupied ]", MessageType.Warning);
                Game.Wait(250);

                if (World.Player.Hits < World.Player.Strenght)
                {
                    UO.BandageSelf();
                }
                else
                {
                    UO.UseSkill(StandardSkill.Meditation);
                }

                //else if (World.Player.Mana > 4)
                //  UO.Cast(StandardSpell.MagicArrow, World.Player.Serial);
            }
            else
            {
                counter.Step        = counterStep;
                counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
                counter.StopMethod  = IsHidden;
                counter.Run();
            }


            //You are preoccupied with thoughts of battle

            //Game.RunScript(3500);



            //Hiding.HideRunning = true;

            //if (needAction)
            //{
            //  World.Player.PrintMessage("[ HID Action ]", MessageType.Warning);

            //  if (World.Player.Hits < World.Player.Strenght)
            //    UO.BandageSelf();
            //  else if (World.Player.Mana > 4)
            //    UO.Cast(StandardSpell.MagicArrow, World.Player.Serial);
            //}

            //Game.Wait(250);
            //UO.UseSkill(usedSkill);
            //Game.Wait(50);
        }
Example #29
0
        public void HideRay(int highlightTime, ushort highlightColor, int counterStep)
        {
            Journal.Clear();


            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(250);
            }


            Game.RunScript(3000);

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }

            Hiding.HideRunning = true;

            UO.BandageSelf();
            Game.Wait(100);
            UO.UseSkill(usedSkill);
            Game.Wait(50);
            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }
Example #30
0
 public HardSkill(string name, SkillValue value)
 {
     this.Name = name;
     this.Value = value;
 }
Example #31
0
    public int Get(Name skill)
    {
        SkillValue sv = list.Find(s => s.name == skill);

        return(sv != null ? sv.value : 0);
    }
Example #32
0
        public void Hide(int highlightTime, ushort highlightColor, int counterStep, Graphic dropItemGraphic, UOColor dropItemColor)
        {
            Journal.Clear();
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(150);
            }


            Game.RunScript(3000);

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }


            if (!dropItemGraphic.IsInvariant)
            {
                int origDistance = World.FindDistance;
                World.FindDistance = 3;
                UOItem item = World.Ground.FindType(dropItemGraphic, dropItemColor);
                if (item.Exist && item.Distance <= 3)
                {
                    item.Move(item.Amount, World.Player.Backpack);
                }
                World.FindDistance = origDistance;
            }

            Hiding.HideRunning = true;
            UO.UseSkill(usedSkill);
            Game.Wait(50);

            if (!dropItemGraphic.IsInvariant && World.Player.Backpack.AllItems.FindType(dropItemGraphic, dropItemColor).Exist)
            {
                DropItemGraphic = dropItemGraphic;
                DropItemColor   = dropItemColor;

                counter.RunComplete += Counter_RunComplete;
            }


            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }
Example #33
0
        //---------------------------------------------------------------------------------------------

        public void TrainTamingRecusive(int maxTries, params string[] positionsDefinition)
        {
            Robot r = new Robot();

            r.UseTryGoOnly     = true;
            r.UseMinWait       = true;
            r.UseRun           = true;
            r.SearchSuqareSize = 450;
            this.doneList      = new List <Serial>();


            string[] locations = positionsDefinition;

            foreach (string loc in locations)
            {
                string[] options = loc.Split('|');

                int    button   = -1;
                string bookType = "r";

                if (!String.IsNullOrEmpty(options[0]) && Regex.IsMatch(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})"))
                {
                    Match m = Regex.Match(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})");
                    bookType = m.Groups["booktype"].Value.ToLower();
                    button   = Int32.Parse(m.Groups["button"].Value);
                }

                if (button > -1)
                {
                    string book = "RuneBookUse";
                    if (bookType == "t")
                    {
                        Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1);
                        UO.Wait(1000);
                        book = "TravelBookUse";
                    }
                    else if (bookType == "c")
                    {
                        Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["CestovniKnihaUse"], 1);
                        UO.Wait(1000);
                        book = "CestovniKnihaUse";
                    }



                    bool teleported = false;
                    while (!teleported)
                    {
                        UO.DeleteJournal();

                        Phoenix.Runtime.RuntimeCore.Executions.Execute(RuntimeCore.ExecutableList[book], button);
                        Game.Wait(500);
                        if (!World.Player.Hidden)
                        {
                            UO.UseSkill("Hiding");
                        }

                        UO.Print("Cekam na kop.. nehybat");

                        if (Journal.WaitForText(true, 2000, "Nesmis vykonavat zadnou akci"))
                        {
                            Game.CurrentGame.CurrentPlayer.SwitchWarmode();
                            Game.Wait(1000);
                        }
                        else if (Journal.WaitForText(true, 120000, "You have been teleported"))
                        {
                            teleported = true;
                        }

                        if (Game.CurrentGame.WorldSave())
                        {
                            UO.Print("WS opakovani kopu za 45s");
                            Game.Wait(45000);
                            if (bookType == "t")
                            {
                                Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1);
                                UO.Wait(1000);
                            }
                            Game.Wait(500);
                        }
                    }
                }

                for (int i = 1; i < options.Length; i++)
                {
                    if (UO.Dead)
                    {
                        return;
                    }

                    string[] parm = options[i].Split('.');

                    string   x         = parm[0];
                    string[] y         = parm[1].Split(new string[] { "//" }, StringSplitOptions.RemoveEmptyEntries);
                    string   placeName = "";
                    if (y.Length > 1)
                    {
                        placeName = y[1];
                    }


                    UOPositionBase pos = new UOPositionBase(ushort.Parse(x), ushort.Parse(y[0]), (ushort)0);

                    int distance = parm.Length > 2 ? UOExtensions.Utils.ToNullInt(parm[2]).GetValueOrDefault(1) : 1;
                    int gotries  = parm.Length > 3 ? UOExtensions.Utils.ToNullInt(parm[3]).GetValueOrDefault(1000) : 1000;

                    Game.PrintMessage("GoTo: " + pos);
                    if (r.GoTo(pos, distance, gotries))
                    {
                        Game.PrintMessage("In position: " + pos);

                        if (parm[parm.Length - 1].ToLower() == "opendoor")
                        {
                            ItemHelper.OpenDoorAll();
                            Game.Wait();


                            if (World.Player.Layers[Layer.OuterTorso].Exist)
                            {
                                World.Player.Layers[Layer.OuterTorso].Move(1, World.Player.Backpack);
                                Game.Wait();
                            }
                        }

                        List <UOCharacter> characters = new List <UOCharacter>();
                        characters.AddRange(World.Characters);
                        characters.Sort(delegate(UOCharacter char1, UOCharacter char2)
                        {
                            return(char1.Distance.CompareTo(char2.Distance));
                        });

                        foreach (UOCharacter character in characters)
                        {
                            if (UO.Dead)
                            {
                                return;
                            }

                            Game.Wait(50);

                            if (character.Distance < 6 && character.Serial != World.Player.Serial && !doneList.Contains(character.Serial) && character.Model != 0x0190 && character.Model != 0x0191 && character.Model != 0x0192)
                            {
                                SkillValue atSkill = SkillsHelper.GetSkillValue("Animal Taming");
                                bool       isBird  = character.Model == 0x0006;

                                World.Player.PrintMessage(isBird + " / " + atSkill.Value);

                                if (isBird && atSkill.RealValue > 450)
                                {
                                    World.Player.PrintMessage("Try Kill.");
                                    UO.Cast(StandardSpell.Harm, character.Serial);
                                    Game.Wait(3000);

                                    if (character.Exist)
                                    {
                                        UO.Cast(StandardSpell.Harm, character.Serial);
                                        Game.Wait(2500);
                                    }
                                    //World.Player.PrintMessage("Try Kill result: " + KillCharacter(character));
                                }
                                else
                                {
                                    this.TameCharacter(character, maxTries);
                                    doneList.Add(character);
                                }

                                //if (!isBird || atSkill.RealValue < 450)
                                //{

                                //}
                                //else
                                //{

                                //}
                            }
                        }
                    }
                    //else
                    //  Phoenix.Runtime.RuntimeCore.Executions.Terminate(musicRun.ManagedThreadId);
                }
            }

            if (UO.Dead)
            {
                return;
            }

            TrainTamingRecusive(maxTries, positionsDefinition);
        }
Example #34
0
        public void Hide(int highlightTime, ushort highlightColor, int counterStep)
        {
            Journal.Clear();
            Game.CurrentGame.CurrentPlayer.SwitchWarmode();

            StandardSkill usedSkill = StandardSkill.Hiding;

            SkillValue hidingSV  = SkillsHelper.GetSkillValue("Hiding");
            SkillValue stealthSV = SkillsHelper.GetSkillValue("Stealth");

            if (stealthSV.RealValue > hidingSV.RealValue)
            {
                usedSkill = StandardSkill.Stealth;
            }

            if (World.Player.Layers[Layer.LeftHand].Graphic == 0x0A15)//lantern
            {
                UOItem shield = new UOItem(Serial.Invalid);

                List <UOItem> items = new List <UOItem>();
                items.AddRange(World.Player.Backpack.Items);

                foreach (UOItem item in items)
                {
                    foreach (Graphic g in ItemLibrary.Shields.GraphicArray)
                    {
                        if (item.Graphic == g && (!shield.Exist || shield.Graphic != 0x1B76))
                        {
                            shield = item;
                        }
                    }
                }

                if (shield.Exist)
                {
                    shield.Use();
                }
                else
                {
                    World.Player.Layers[Layer.LeftHand].Move(1, World.Player.Backpack, 100, 30);
                }

                Game.Wait(150);
            }
            //UOItem whWepna = World.Player.FindColor(0x0B60, new Graphic[] { 0x143A, 0x1404, 0x0F62, 0x13B9, 0x0F5C, 0x1438, 0x0F60, 0x0F5E, 0x0E87 });        //Nightstone zbran u WJ
            //if (whWepna.Exist && whWepna.Layer != Layer.LeftHand && whWepna.Layer != Layer.RightHand)
            //{
            //  whWepna.Use();
            //  Game.Wait(150);
            //  Targeting.ResetTarget();

            //}

            Game.RunScript(3000);

            AsyncCounter counter = new AsyncCounter();

            counter.PrefixText = "";
            if (highlightTime > 0)
            {
                counter.HighlightTime = highlightTime;
            }

            if (highlightColor > 0)
            {
                counter.HighlightColor = highlightColor;
            }

            Hiding.HideRunning = true;
            UO.UseSkill(usedSkill);
            Game.Wait(50);
            counter.Step        = counterStep;
            counter.StopMessage = "You can't seem to hide here,You have hidden yourself well";
            counter.StopMethod  = IsHidden;
            counter.Run();
        }