Пример #1
0
        public static int GetIdByName(string name)
        {
            int id = 0;

            foreach (var item in Skill_Defs)
            {
                if (item.name == CFormat.ToSimplified(name))
                {
                    id = item.id;
                    break;
                }
            }

            return(id);
        }
Пример #2
0
        public static string Get_Item_itemHelpStr(string name)
        {
            string helpString = "";

            baseFolder = "F:\\SanOL\\合并防挂成145版本";
            string itemHelperFile = baseFolder + "\\" + Item_helper;

            if (!File.Exists(itemHelperFile))
            {
                return(helpString);
            }

            FileStream   _itemHelpfs     = new FileStream(itemHelperFile, FileMode.Open, FileAccess.Read);
            StreamReader _itemHelpReader = new StreamReader(_itemHelpfs, Encoding.GetEncoding(950));

            _itemHelpReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemHelpReader.DiscardBufferedData();
            _itemHelpReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemHelpReader.BaseStream.Position = 0;

            string strLine = "";

            strLine = _itemHelpReader.ReadLine();

            do
            {
                string _strLine = CFormat.ToSimplified(strLine);
                if (_strLine.Contains("item") && _strLine.Contains("="))
                {
                    _strLine = _strLine.Replace(" ", "").Replace("\t", "");
                    string id = _strLine.Split('=')[1].Split(',')[0];
                    if (id == name)
                    {
                        helpString = _strLine.Split('=')[1].Split(',')[1];
                        break;
                    }
                }
                strLine = "";
                strLine = _itemHelpReader.ReadLine();
            } while (strLine != null);

            _itemHelpReader.Close();
            _itemHelpfs.Close();

            return(helpString);
        }
Пример #3
0
        static public item_attr Get_Attr_ByName(string name, out bool done)
        {
            item_attr attr = new item_attr();

            attr.code  = "item_" + name;
            baseFolder = "F:\\SanOL\\合并防挂成145版本";
            string itemDataFile = baseFolder + "\\" + Item_data;

            if (!File.Exists(itemDataFile))
            {
                done = false;
                return(attr);
            }

            FileStream   _itemDatafs     = new FileStream(itemDataFile, FileMode.Open, FileAccess.Read);
            StreamReader _itemDataReader = new StreamReader(_itemDatafs, Encoding.GetEncoding(950));

            _itemDataReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemDataReader.DiscardBufferedData();
            _itemDataReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemDataReader.BaseStream.Position = 0;

            string strLine = "";

            strLine = _itemDataReader.ReadLine();
            bool get_it = false;

            do
            {
                string _strLine = CFormat.ToSimplified(strLine);
                _strLine = _strLine.Split('/')[0].Replace("\t", "").Replace(" ", "");
                if (get_it && _strLine == "[item]")
                {
                    break;
                }
                if (_strLine.Contains("item_" + name))
                {
                    get_it = true;
                }
                if (get_it)
                {
                    string _type = _strLine.Split('=')[0];
                    if (_type == "code")
                    {
                        attr.code = "item_" + name;
                    }
                    else if (_type == "name")
                    {
                        attr.name = _strLine.Split('=')[1];
                    }
                    else if (_type == "help_string")
                    {
                        attr.help_string = _strLine.Split('=')[1];
                    }
                    else if (_type == "type")
                    {
                        attr.type = _strLine.Split('=')[1];
                    }
                    else if (_type == "super_type")
                    {
                        attr.super_type = _strLine.Split('=')[1];
                    }
                    else if (_type == "type2")
                    {
                        attr.type2 = _strLine.Split('=')[1];
                    }
                    else if (_type == "wait_type")
                    {
                        attr.wait_type = _strLine.Split('=')[1];
                    }
                    else if (_type == "attack_range")
                    {
                        attr.attack_range = _strLine.Split('=')[1];
                    }
                    else if (_type == "effect_range")
                    {
                        attr.effect_range = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attack_power")
                    {
                        attr.add_attack_power = _strLine.Split('=')[1];
                    }
                    else if (_type == "attack_speed")
                    {
                        attr.attack_speed = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_weapon_hit")
                    {
                        attr.add_weapon_hit = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attr_mind")
                    {
                        attr.add_attr_mind = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_magic_power")
                    {
                        attr.add_magic_power = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attr_con")
                    {
                        attr.add_attr_con = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attackx2_ratio")
                    {
                        attr.add_attackx2_ratio = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attr_int")
                    {
                        attr.add_attr_int = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attr_str")
                    {
                        attr.add_attr_str = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attr_dex")
                    {
                        attr.add_attr_dex = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_hp")
                    {
                        attr.add_hp = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_mp")
                    {
                        attr.add_mp = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_attr_leader")
                    {
                        attr.add_attr_leader = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_defense")
                    {
                        attr.add_defense = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_weapon_misshit")
                    {
                        attr.add_weapon_misshit = _strLine.Split('=')[1];
                    }
                    else if (_type == "move")
                    {
                        attr.move = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_st")
                    {
                        attr.add_st = _strLine.Split('=')[1];
                    }
                    else if (_type == "add_loyalty")
                    {
                        attr.add_loyalty = _strLine.Split('=')[1];
                    }
                    else if (_type == "light")
                    {
                        attr.light = _strLine.Split('=')[1];
                    }
                    else if (_type == "eq_magic_attack_type")
                    {
                        if (attr.eq_magic_attack_type != null && attr.eq_magic_attack_type != "")
                        {
                            attr.eq_magic_attack_type += ";" + _strLine.Split('=')[1];
                        }
                        else
                        {
                            attr.eq_magic_attack_type = _strLine.Split('=')[1];
                        }
                    }
                    else if (_type == "limit_level")
                    {
                        attr.limit_level = _strLine.Split('=')[1];
                    }
                    else if (_type == "weight")
                    {
                        attr.weight = _strLine.Split('=')[1];
                    }
                    else if (_type == "cost")
                    {
                        attr.cost = _strLine.Split('=')[1];
                    }
                    else if (_type == "sell")
                    {
                        attr.sell = _strLine.Split('=')[1];
                    }
                    else if (_type == "cost_level")
                    {
                        attr.cost_level = _strLine.Split('=')[1];
                    }
                    else if (_type == "icon")
                    {
                        attr.icon = _strLine.Split('=')[1];
                    }
                    else if (_type == "sfx_hit")
                    {
                        attr.sfx_hit = _strLine.Split('=')[1];
                    }
                    else if (_type == "sfx_attack")
                    {
                        attr.sfx_attack = _strLine.Split('=')[1];
                    }
                    else if (_type == "comp_times")
                    {
                        attr.comp_times = _strLine.Split('=')[1];
                    }
                    else if (_type == "limit_job")
                    {
                        attr.limit_job = _strLine.Split('=')[1];
                    }
                    else if (_type == "wid")
                    {
                        attr.wid = _strLine.Split('=')[1];
                    }
                    else if (_type == "sp_effect")
                    {
                        attr.sp_effect = _strLine.Split('=')[1];
                    }
                    else if (_type == "soul_times")
                    {
                        attr.soul_times = _strLine.Split('=')[1];
                    }
                    else if (_type == "function")
                    {
                        if (attr.function != null && attr.function != "")
                        {
                            attr.function += ";" + _strLine.Split('=')[1];
                        }
                        else
                        {
                            attr.function = _strLine.Split('=')[1];
                        }
                    }
                    else if (_type == "anti_status_ratio")
                    {
                        if (attr.anti_status_ratio != null && attr.anti_status_ratio != "")
                        {
                            attr.anti_status_ratio += ";" + _strLine.Split('=')[1];
                        }
                        else
                        {
                            attr.anti_status_ratio = _strLine.Split('=')[1];
                        }
                    }
                    else if (_type == "limit_str")
                    {
                        attr.limit_str = _strLine.Split('=')[1];
                    }
                    else if (_type == "limit_mind")
                    {
                        attr.limit_mind = _strLine.Split('=')[1];
                    }
                    else if (_type == "limit_dex")
                    {
                        attr.limit_dex = _strLine.Split('=')[1];
                    }
                    else if (_type == "limit_int")
                    {
                        attr.limit_int = _strLine.Split('=')[1];
                    }
                    else if (_type == "limit_leader")
                    {
                        attr.limit_leader = _strLine.Split('=')[1];
                    }
                    else if (_type == "new_exp")
                    {
                        attr.new_exp = _strLine.Split('=')[1];
                    }
                    else if (_type == "new_explevel")
                    {
                        attr.new_explevel = _strLine.Split('=')[1];
                    }
                    else if (_type == "kill")
                    {
                        attr.kill = _strLine.Split('=')[1];
                    }
                    else if (_type == "drop_id")
                    {
                        attr.drop_id = _strLine.Split('=')[1];
                    }
                    else if (_type == "use_magic_id")
                    {
                        attr.use_magic_id = _strLine.Split('=')[1];
                    }
                    else if (_type == "drop_num")
                    {
                        attr.drop_num = _strLine.Split('=')[1];
                    }
                    else if (_type == "eq_magic_resist")
                    {
                        if (attr.eq_magic_resist != null && attr.eq_magic_resist != "")
                        {
                            attr.eq_magic_resist += ";" + _strLine.Split('=')[1];
                        }
                        else
                        {
                            attr.eq_magic_resist = _strLine.Split('=')[1];
                        }
                    }
                    else if (_type == "limit_sex")
                    {
                        attr.limit_sex = _strLine.Split('=')[1];
                    }
                    else if (_type == "engineer_type")
                    {
                        attr.engineer_type = _strLine.Split('=')[1];
                    }
                    else if (_type == "duedate_only")
                    {
                        attr.duedate_only = _strLine.Split('=')[1];
                    }
                    else if (_type == "use_duedate")
                    {
                        attr.use_duedate = _strLine.Split('=')[1];
                    }
                    else if (_type == "sfx_run")
                    {
                        attr.sfx_run = _strLine.Split('=')[1];
                    }
                    else if (_type == "sfx_walk")
                    {
                        attr.sfx_walk = _strLine.Split('=')[1];
                    }
                    else if (_type == "horse_height")
                    {
                        attr.horse_height = _strLine.Split('=')[1];
                    }
                    else if (_type == "wawa_only")
                    {
                        attr.wawa_only = _strLine.Split('=')[1];
                    }
                    else if (_type == "no_attack")
                    {
                        attr.no_attack = _strLine.Split('=')[1];
                    }
                    else if (_type == "other_wid")
                    {
                        attr.other_wid = _strLine.Split('=')[1];
                    }
                    else if (_type == "use_magic_time")
                    {
                        attr.use_magic_time = _strLine.Split('=')[1];
                    }
                    else if (_type == "use_magic_level")
                    {
                        attr.use_magic_level = _strLine.Split('=')[1];
                    }
                    else if (_type == "tp_map_code")
                    {
                        attr.tp_map_code = _strLine.Split('=')[1];
                    }
                    else if (_type == "tp_pos")
                    {
                        attr.tp_pos = _strLine.Split('=')[1];
                    }
                    else if (_type == "letto_gold")
                    {
                        attr.letto_gold = _strLine.Split('=')[1];
                    }
                    else if (_type == "resurrect_soldier")
                    {
                        attr.resurrect_soldier = _strLine.Split('=')[1];
                    }
                    else if (_type == "recommand_soldier")
                    {
                        attr.recommand_soldier = _strLine.Split('=')[1];
                    }
                }
                strLine = "";
                strLine = _itemDataReader.ReadLine();
            } while (strLine != null);

            _itemDataReader.Close();
            _itemDatafs.Close();

            done = true;
            return(attr);
        }
Пример #4
0
        private void FreezeCheck()
        {
            //读取loginserverlog,获取非法信息列表
            List <Illegal> nameList = GetIllegalList();

            int FreezeCount = 0;
            int IllCount    = 0;

            //更新列表
            lstv_GtList.Items.Clear();
            foreach (var name in nameList)
            {
                //过滤
                if (m_FreezeFilterList != null)
                {
                    bool   filter     = false;
                    String PureAcount = CFormat.PureString(name.account);
                    foreach (var item in m_FreezeFilterList)
                    {
                        if (PureAcount == item)
                        {
                            filter = true;
                            break;
                        }
                    }
                    if (filter)
                    {
                        continue;
                    }
                }
                IllCount++;
                ListViewItem lvi = new ListViewItem();

                lvi.Text = CFormat.PureString(name.account);
                //lvi.SubItems.Add(_id);
                lvi.SubItems.Add(CFormat.ToSimplified(CFormat.PureString(name.name)));
                lvi.SubItems.Add(name.time_str);

                if (cbx_AutoFreeze.Checked)
                {
                    string acc = CFormat.PureString(name.account);
                    //封号
                    try
                    {
                        string log = CSGHelper.FreezeAccount(acc, 1, "非法登录或者使用外挂!", "GM");
                        lvi.SubItems.Add(log);
                        if (log == "冻结成功")
                        {
                            FreezeCount++;
                        }
                        LogHelper.WriteLog(System.AppDomain.CurrentDomain.BaseDirectory, acc + ":" + log, new StackTrace(new StackFrame(true)));
                    }
                    catch (Exception ex)
                    {
                        LogHelper.WriteLog(System.AppDomain.CurrentDomain.BaseDirectory, acc + ":" + ex.Message, new StackTrace(new StackFrame(true)));
                    }
                }
                lstv_GtList.Items.Add(lvi);
            }
            lstv_GtList.EndUpdate();

            lbl_IllCount.Text    = IllCount.ToString();
            lbl_FreezeCount.Text = FreezeCount.ToString();
        }
Пример #5
0
        public static string load_Skill_Defines(string baseFolder)
        {
            string allSkillDefines = "";

            Skill_Defs.Clear();
            //baseFolder = "F:\\SanOL\\合并防挂成145版本";
            string itemHFile = baseFolder + "\\" + "MAGIC.H";

            if (!File.Exists(itemHFile))
            {
                return(allSkillDefines);
            }

            FileStream   _itemHfs     = new FileStream(itemHFile, FileMode.Open, FileAccess.Read);
            StreamReader _itemHReader = new StreamReader(_itemHfs, Encoding.GetEncoding(950));

            _itemHReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemHReader.DiscardBufferedData();
            _itemHReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemHReader.BaseStream.Position = 0;

            Skills_Def_Str def;
            string         strLine = "";

            strLine = _itemHReader.ReadLine();

            do
            {
                strLine = strLine.Split('/')[0];
                if (strLine.Contains("#define"))
                {
                    //ToSimplified
                    string _strLine = CFormat.ToSimplified(strLine);
                    string _nameNum = _strLine.Split(new string[] { "magic_" }, StringSplitOptions.RemoveEmptyEntries)[1];
                    string name     = _nameNum.Split(' ')[0].Split('\t')[0];
                    string id       = _nameNum.Replace(" ", "").Replace("\\t", "").Replace(name, "");

                    allSkillDefines += name + "," + id + ";";
                    def.name         = name;
                    def.id           = Int32.Parse(id);
                    Skill_Defs.Add(def);
                }

                strLine = "";
                strLine = _itemHReader.ReadLine();
            } while (strLine != null);

            _itemHReader.Close();
            _itemHfs.Close();

            //--------------------------------------------------------------------------------------------------
            itemHFile = baseFolder + "\\" + "MAGIC_EXP.H";
            if (!File.Exists(itemHFile))
            {
                return(allSkillDefines);
            }

            _itemHfs     = new FileStream(itemHFile, FileMode.Open, FileAccess.Read);
            _itemHReader = new StreamReader(_itemHfs, Encoding.GetEncoding(950));
            _itemHReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemHReader.DiscardBufferedData();
            _itemHReader.BaseStream.Seek(0, SeekOrigin.Begin);
            _itemHReader.BaseStream.Position = 0;

            strLine = "";
            strLine = _itemHReader.ReadLine();

            do
            {
                strLine = strLine.Split('/')[0];
                if (strLine.Contains("#define"))
                {
                    //ToSimplified
                    string _strLine = CFormat.ToSimplified(strLine);
                    string _nameNum = _strLine.Split(new string[] { "magic_" }, StringSplitOptions.RemoveEmptyEntries)[1];
                    string name     = _nameNum.Split(' ')[0].Split('\t')[0];
                    string id       = _nameNum.Replace(" ", "").Replace("\\t", "").Replace(name, "");

                    allSkillDefines += name + "," + id + ";";
                    def.name         = name;
                    def.id           = Int32.Parse(id);
                    Skill_Defs.Add(def);
                }

                strLine = "";
                strLine = _itemHReader.ReadLine();
            } while (strLine != null);

            _itemHReader.Close();
            _itemHfs.Close();

            return(allSkillDefines.Replace("\t", ""));
        }