コード例 #1
0
ファイル: HunterTalentsForm.cs プロジェクト: say1981/Rawr
        private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cb     = (ComboBox)sender;
            string   talent = cb.Tag as string;

            if (Character.Talents.Trees.ContainsKey(cb.Parent.Text) && !String.IsNullOrEmpty(talent))
            {
                List <TalentItem> talents = Character.Talents.Trees[cb.Parent.Text];
                TalentItem        item    = null;
                for (int i = 0; i < Character.Talents.Trees[cb.Parent.Text].Count; i++)
                {
                    if (string.Compare(talents[i].Name.Trim(), talent.Trim(), true) == 0)
                    {
                        item = talents[i];
                        break;
                    }
                }

                if (item != null)
                {
                    item.PointsInvested = Convert.ToInt32(cb.SelectedItem);
                    if (!calculationSuspended)
                    {
                        Character.OnItemsChanged();
                    }
                }
            }
        }
コード例 #2
0
    static int GetConfigData(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        TalentConfig obj  = (TalentConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "TalentConfig");
        uint         arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        TalentItem   o    = obj.GetConfigData(arg0);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
コード例 #3
0
 public TalentIcon(TalentForm parentForm, TalentItem ti, Character.CharacterClass charClass)
     : this(parentForm)
 {
     Talent    = ti;
     _name     = ti.Name;
     CharClass = charClass;
     getIcon(ti, charClass);
     panel1.Width  = _icon.Width;
     panel1.Height = _icon.Height;
 }
コード例 #4
0
ファイル: TalentIcon.cs プロジェクト: say1981/Rawr
 public TalentIcon(TalentItem ti, Character.CharacterClass charClass, Label treeLabel) : this()
 {
     Talent     = ti;
     _name      = ti.Name;
     _treeLabel = treeLabel;
     CharClass  = charClass;
     getIcon(ti, charClass);
     panel1.Width  = _icon.Width;
     panel1.Height = _icon.Height;
 }
コード例 #5
0
        private void buildPanel(Panel p, List <TalentItem> tals, Character.CharacterClass charClass, GroupBox gb, string tree)
        {
            int points       = 0;
            int _vertbuffer  = 5;
            int _horizbuffer = 2;
            int maxVert      = 0;

            tals.ForEach(delegate(TalentItem ti) { maxVert = ti.VerticalPosition > maxVert ? ti.VerticalPosition : maxVert; });

            int maxHoriz = 0;

            tals.ForEach(delegate(TalentItem ti) { maxHoriz = ti.HorizontalPosition > maxHoriz ? ti.HorizontalPosition : maxHoriz; });

            /* "talent[i] = [0, \"Improved Eviscerate\", 3, 1, 1]; i++;"
             * ??, name, rank, horiz, vert                                  */

            TalentIcon bg = new TalentIcon(new TalentItem("talent[i] = [0, \"background\", 0, 0, 0];", tree), charClass, gb);

            p.BackgroundImage = bg.getIcon();
            TalentIcon temp = new TalentIcon();

            p.Width  = ((maxHoriz) * _horizbuffer + maxHoriz * temp.Width);
            p.Height = ((maxVert) * _vertbuffer + (maxVert) * temp.Height);

            int vertoffset = 0;

            for (int row = 1; row <= maxVert; row++)
            {
                int horizoffset = 0;
                vertoffset += _vertbuffer;
                int maxCurrHoriz = 0;
                tals.ForEach(delegate(TalentItem ti) { if (ti.VerticalPosition == row)
                                                       {
                                                           maxCurrHoriz = ti.HorizontalPosition > maxCurrHoriz ? ti.HorizontalPosition : maxCurrHoriz;
                                                       }
                             });
                for (int col = 1; col <= maxCurrHoriz; col++)
                {
                    horizoffset += _horizbuffer;
                    //temp = new TalentIcon(tals.Find(ti => ti.VerticalPosition == row && ti.HorizontalPosition == col), CharClass);
                    TalentItem ti = tals.Find(delegate(TalentItem ti2) { return(ti2.VerticalPosition == row && ti2.HorizontalPosition == col); });
                    if (ti != null)
                    {
                        points       += ti.PointsInvested;
                        temp          = new TalentIcon(ti, charClass, gb);
                        temp.Location = new Point(horizoffset, vertoffset);
                        p.Controls.Add(temp);
                    }
                    horizoffset += temp.Width;
                }
                vertoffset += temp.Height;
            }

            gb.Text = tree + " (" + points.ToString() + ")";
        }
コード例 #6
0
 private void getIcon(TalentItem ti, Character.CharacterClass charclass)
 {
     if (_icon == null)
     {
         WebRequestWrapper wrw      = new WebRequestWrapper();
         string            filePath = wrw.DownloadTalentIcon(charclass, ti.Tree.Replace(" ", ""), ti.Name.Replace(" ", "").Replace(":", ""));
         if (!String.IsNullOrEmpty(filePath))
         {
             _icon = new Bitmap(filePath);
         }
     }
 }
コード例 #7
0
ファイル: TalentForm.cs プロジェクト: say1981/Rawr
        private void buildPanel(Panel p, List <TalentItem> tals, Character.CharacterClass charclass, Label treeLabel, string treeName)
        {
            int points       = 0;
            int _vertbuffer  = 5;
            int _horizbuffer = 2;
            int maxVert      = 0;

            tals.ForEach(delegate(TalentItem ti) { maxVert = ti.VerticalPosition > maxVert ? ti.VerticalPosition : maxVert; });

            int maxHoriz = 0;

            tals.ForEach(delegate(TalentItem ti) { maxHoriz = ti.HorizontalPosition > maxHoriz ? ti.HorizontalPosition : maxHoriz; });

            TalentIcon temp = new TalentIcon();

            p.Width  = ((maxHoriz) * _horizbuffer + maxHoriz * temp.Width);
            p.Height = ((maxVert) * _vertbuffer + (maxVert) * temp.Height);


            int vertoffset = 0;

            for (int row = 1; row <= maxVert; row++)
            {
                int horizoffset = 0;
                vertoffset += _vertbuffer;
                int maxCurrHoriz = 0;
                tals.ForEach(delegate(TalentItem ti) { if (ti.VerticalPosition == row)
                                                       {
                                                           maxCurrHoriz = ti.HorizontalPosition > maxCurrHoriz ? ti.HorizontalPosition : maxCurrHoriz;
                                                       }
                             });
                for (int col = 1; col <= maxCurrHoriz; col++)
                {
                    horizoffset += _horizbuffer;
                    //temp = new TalentIcon(tals.Find(ti => ti.VerticalPosition == row && ti.HorizontalPosition == col), CharClass);
                    TalentItem ti = tals.Find(delegate(TalentItem ti2) { return(ti2.VerticalPosition == row && ti2.HorizontalPosition == col); });
                    if (ti != null)
                    {
                        points       += ti.PointsInvested;
                        temp          = new TalentIcon(ti, charclass, treeLabel);
                        temp.Location = new Point(horizoffset, vertoffset);
                        p.Controls.Add(temp);
                    }
                    horizoffset += temp.Width;
                }
                vertoffset += temp.Height;
            }

            treeLabel.Text = treeName + " (" + points.ToString() + ")";
        }
コード例 #8
0
    public TalentItem createTalentItem(CommonDefine.eTalentType type, int id, string name, string des, CommonDefine.TalentSlotState btnState)
    {
        TalentItem talentItem = Instantiate(_talentPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        talentItem.transform.SetParent(_talentItemRoot.transform);

        talentItem.transform.localPosition = new Vector3(0, -id * _talentInteral, 0);

        talentItem.updateTalentItem(this, type, id, name, des, btnState);

        talentItem.transform.localScale = talentItem.transform.localScale * CommonUtil.Util.getScreenScale();

        return(talentItem);
    }
コード例 #9
0
    static int _CreateTalentItem(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            TalentItem obj = new TalentItem();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: TalentItem.New");
        }

        return(0);
    }
コード例 #10
0
ファイル: TalentIcon.cs プロジェクト: say1981/Rawr
        private void getIcon(TalentItem ti, Character.CharacterClass charclass)
        {
            string filePath = "";

            if (_icon == null)
            {
                WebRequestWrapper wrw = new WebRequestWrapper();
                try {
                    filePath = wrw.DownloadTalentIcon(charclass, ti.Tree.Replace(" ", ""), ti.Name.Replace(" ", ""));
                }
                catch (Exception e) {
                    MessageBox.Show("Error downloading talent icon for " + ti.Name + ": " + e.ToString());
                }
                if (!String.IsNullOrEmpty(filePath))
                {
                    _icon = new Bitmap(filePath);
                }
            }
        }
コード例 #11
0
ファイル: HunterTalentsForm.cs プロジェクト: say1981/Rawr
        private void ComputeTalentTotals()
        {
            List <string> totals = new List <string>();

            foreach (Control c in Controls)
            {
                if (c is GroupBox)
                {
                    int total = 0;
                    foreach (Control cc in c.Controls)
                    {
                        if (cc is ComboBox)
                        {
                            ComboBox cb     = (ComboBox)cc;
                            string   talent = cb.Tag as string;
                            if (Character.Talents.Trees.ContainsKey(c.Text) && !String.IsNullOrEmpty(talent))
                            {
                                List <TalentItem> talents = Character.Talents.Trees[c.Text];
                                TalentItem        ti      = null;
                                for (int i = 0; i < talents.Count; i++)
                                {
                                    if (string.Compare(talents[i].Name.Trim(), talent.Trim(), true) == 0)
                                    {
                                        ti = talents[i];
                                        break;
                                    }
                                }
                                if (ti != null)
                                {
                                    total += ti.PointsInvested;
                                }
                            }
                        }
                    }
                    totals.Add(total.ToString());
                }
            }
            totals.Reverse();
            Text = "Hunter Talents (" + string.Join("/", totals.ToArray()) + ")";
        }
コード例 #12
0
ファイル: TalentIcon.cs プロジェクト: say1981/Rawr
        public TalentIcon(TalentItem ti, Character.CharacterClass charClass, GroupBox gb)
            : this()
        {
            Talent    = ti;
            _name     = ti.Name;
            _gb       = gb;
            CharClass = charClass;
            getIcon(ti, charClass);

            if (_icon == null)
            {
                _icon = new Bitmap(43, 45);
                for (int i = 0; i < 43; i++)
                {
                    _icon.SetPixel(i, i, Color.Red);
                    _icon.SetPixel(43 - i - 1, i, Color.Red);
                }
            }

            panelIcon.Width  = _icon.Width;
            panelIcon.Height = _icon.Height;
        }
コード例 #13
0
    static int get_icon(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        TalentItem obj = (TalentItem)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name icon");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index icon on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.icon);
        return(1);
    }
コード例 #14
0
    static int set_desc(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        TalentItem obj = (TalentItem)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name desc");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index desc on a nil value");
            }
        }

        obj.desc = LuaScriptMgr.GetString(L, 3);
        return(0);
    }
コード例 #15
0
ファイル: HunterTalentsForm.cs プロジェクト: say1981/Rawr
        private void LoadTalents()
        {
            calculationSuspended = true;
            foreach (Control c in Controls)
            {
                if (c is GroupBox)
                {
                    foreach (Control cc in c.Controls)
                    {
                        if (cc is ComboBox)
                        {
                            ComboBox cb     = (ComboBox)cc;
                            string   talent = cb.Tag as string;

                            if (Character.Talents.Trees.ContainsKey(c.Text) && !String.IsNullOrEmpty(talent))
                            {
                                List <TalentItem> talents = Character.Talents.Trees[c.Text];
                                TalentItem        ti      = null;
                                for (int i = 0; i < talents.Count; i++)
                                {
                                    if (string.Compare(talents[i].Name.Trim(), talent.Trim(), true) == 0)
                                    {
                                        ti = talents[i];
                                        break;
                                    }
                                }
                                if (ti != null)
                                {
                                    cb.SelectedItem = ti.PointsInvested.ToString();
                                }
                            }
                        }
                    }
                }
            }
            calculationSuspended = false;
            ComputeTalentTotals();
        }
コード例 #16
0
        public static void SendTalentList(this Player p)
        {
            HashSet <int>        nextTalent = new HashSet <int>();
            HashSet <TalentItem> talents    = new HashSet <TalentItem>();

            foreach (SkillLineAbility ability in DBC.SkillLineAbility.Values)
            {
                TRAINER_SERVICE status = TRAINER_SERVICE.TRAINER_SERVICE_AVAILABLE;

                if (!TalentExtension.TALENT_LINES.Contains(ability.m_skillLine)) //Remove incorrect skill lines
                {
                    continue;
                }

                Spell spell = null;
                if (!DBC.Spell.TryGetValue((uint)ability.m_spell, out spell)) //Only use those with spells
                {
                    continue;
                }

                if (p.Talents.Contains(ability.m_ID)) //Already have ability
                {
                    if (ability.m_supercededBySpell > 0)
                    {
                        nextTalent.Add(ability.m_supercededBySpell); //Store next as possibly available
                    }
                    status = TRAINER_SERVICE.TRAINER_SERVICE_USED;
                }
                else
                {
                    if (nextTalent.Contains(ability.m_spell))
                    {
                        status = TRAINER_SERVICE.TRAINER_SERVICE_AVAILABLE; //Definitely available as in superceed list
                    }
                    else if (spell.iRank == 1)
                    {
                        status = TRAINER_SERVICE.TRAINER_SERVICE_AVAILABLE; //Definitely available as Rank 1
                    }
                    else
                    {
                        status = TRAINER_SERVICE.TRAINER_SERVICE_UNAVAILABLE; //Probably not available as fallen through
                    }
                }

                TalentItem ti = new TalentItem();
                ti.SpellId           = (uint)ability.m_spell;
                ti.Status            = (byte)status;
                ti.Cost              = 0;
                ti.TalentPoints      = 10;
                ti.RequiredLevel     = (ushort)spell.baseLevel;
                ti.RequiredSkillLine = 0;
                ti.RequiredSkillRank = 0;
                ti.RequiredSkillStep = 0;
                ti.RequiredAbility   = new ushort[] { 0, 0, 0 };
                ti.Usable            = 0;
                ti.Enabled           = 0;
                talents.Add(ti);
            }

            PacketWriter pk = new PacketWriter(Opcodes.SMSG_TRAINER_LIST);

            pk.WriteUInt64(p.Guid);
            pk.WriteUInt32((uint)TRAINER_TYPE.TRAINER_TYPE_TALENTS); //Type
            pk.WriteUInt32((uint)talents.Count);                     //Spell count
            foreach (TalentItem ti in talents)
            {
                pk.WriteUInt32(ti.SpellId);
                pk.WriteUInt8(ti.Status);
                pk.WriteUInt32(ti.Cost);
                pk.WriteUInt16(ti.TalentPoints);
                pk.WriteUInt16(ti.RequiredLevel);
                pk.WriteUInt32(ti.RequiredSkillLine);
                pk.WriteUInt32(ti.RequiredSkillRank);
                pk.WriteUInt32(ti.RequiredSkillStep);

                for (int i = 0; i < 3; i++)
                {
                    pk.WriteUInt16(ti.RequiredAbility[i]);
                }

                pk.WriteUInt32(ti.Usable);
                pk.WriteUInt8(ti.Enabled);
            }

            p.Client.Send(pk);
        }
コード例 #17
0
ファイル: HookGeneral.cs プロジェクト: Binarizer/Plugin_J2
        public static bool JumpTalentPatch(WgTalentTreeController __instance, TalentNode talentNode)
        {
            var  t    = Traverse.Create(__instance);
            bool flag = t.Method("CheckCondition", talentNode).GetValue <bool>();//__instance.CheckCondition(talentNode);
            int  a    = 1;

            if (jumpTalent.Value)
            {
                a    = (flag ? 1 : 5);
                flag = (flag || __instance.talentPoint >= talentNode.NeedPoints * a);
            }
            if (flag)
            {
                StringTableItem stringTableItem = Game.Data.Get <StringTableItem>("UITalentNodeClickDialog");
                string          text            = (stringTableItem != null) ? stringTableItem.StringValue : null;
                text = string.Format(text, talentNode.Item.Name, talentNode.NeedPoints * a);
                Action <bool> onResult = delegate(bool confirm)
                {
                    if (confirm)
                    {
                        talentNode.CurrentState = eSkillNodeType.Clicked;
                        __instance.Model.TalentData.ClickedNodes.Add(talentNode.Item.Id);
                        TalentNode talentNode2 = talentNode;
                        if (talentNode2 == null)
                        {
                            flag = false;
                        }
                        else
                        {
                            TalentItem item = talentNode2.Item;
                            flag = (((item != null) ? item.Values : null) != null);
                        }
                        if (flag)
                        {
                            __instance.Model.TalentData.AddValues(talentNode.Item.Values);
                        }
                        if (talentNode.Item != null && talentNode.Item.PropertyValues != null)
                        {
                            __instance.Model.PropertiesChange(talentNode.Item.PropertyValues, true, false);
                        }
                        Action <string> talentLearned = __instance.Model.TalentData.TalentLearned;
                        if (talentLearned != null)
                        {
                            talentLearned(talentNode.Item.Id);
                        }
                        __instance.talentPoint -= talentNode.NeedPoints * a;
                        Action <int> updateCurrentExp = __instance.UpdateCurrentExp;
                        if (updateCurrentExp != null)
                        {
                            updateCurrentExp(__instance.talentPoint);
                        }
                        __instance.Model.TalentData.NewPoint -= talentNode.NeedPoints * a;
                        t.Method("AdjacentUpdata", talentNode).GetValue();//__instance.AdjacentUpdata(talentNode);
                        Action <string> learnNode = __instance.LearnNode;
                        if (learnNode != null)
                        {
                            learnNode(talentNode.Id);
                        }
                        Action <int> onTalentPointChanged = __instance.OnTalentPointChanged;
                        if (onTalentPointChanged != null)
                        {
                            onTalentPointChanged(__instance.Model.TalentData.NewPoint);
                        }
                        if (talentNode.IsStart)
                        {
                            Action closeOtherStartNodes = __instance.CloseOtherStartNodes;
                            if (closeOtherStartNodes != null)
                            {
                                closeOtherStartNodes();
                            }
                        }
                        if (__instance.talentPoint == 0)
                        {
                            t.Method("UpdateCanClicked").GetValue();//__instance.UpdateCanClicked();
                        }
                        if (!talentNode.Item.OpenNextId.IsNullOrEmpty())
                        {
                            Action <string> openNextNode = __instance.OpenNextNode;
                            if (openNextNode != null)
                            {
                                openNextNode(talentNode.Item.OpenNextId);
                            }
                        }
                        new SoundEffect("LearnTalent").PlayOnce();
                        Heluo.Logger.Log("學會天賦" + talentNode.Item.Id + ". " + talentNode.Item.Name, Heluo.Logger.LogLevel.MESSAGE, "white", "NodeClick", "D:\\JingYong\\Assets\\Script\\UI\\View\\TalentTree\\WgSkillTreeController.cs", 874);
                        return;
                    }
                };
                Game.UI.ShowDialog(string.Empty, text, onResult, false).buttonConfirm.ConfrimSoundEffect = new SoundEffect(GameConfig.MuteSoundID);
            }
            return(false);
        }