Example #1
0
    private void RenderAll(FS2RoleDataInfo roleInfo)
    {
        ArrayList itemInBody    = new ArrayList();
        ArrayList itemInBag     = new ArrayList();
        ArrayList itemInStorage = new ArrayList();

        if (roleInfo.ItemList == null || roleInfo.ItemList.Count == 0)
        {
            return;
        }
        foreach (FS2ItemDataInfo itemInfo in roleInfo.ItemList)
        {
            switch (itemInfo.Local)
            {
            case (byte)ItemPosition.PosEquip:
                itemInBody.Add(itemInfo);
                break;

            case (byte)ItemPosition.PosEquiproom:
                itemInBag.Add(itemInfo);
                break;

            case (byte)ItemPosition.PosRepositoryroom:
                itemInStorage.Add(itemInfo);
                break;
            }
        }
        RenderEquipedItem((FS2ItemDataInfo[])itemInBody.ToArray(typeof(FS2ItemDataInfo)));
        RenderItemInfo((FS2ItemDataInfo[])itemInBag.ToArray(typeof(FS2ItemDataInfo)), 1, DivRoleItem);
        RenderItemInfo((FS2ItemDataInfo[])itemInStorage.ToArray(typeof(FS2ItemDataInfo)), 1, DivItemStorage);
    }
Example #2
0
    protected void LinkButtonStorage_Click(object sender, EventArgs e)
    {
        LinkButton linkButton = sender as LinkButton;

        if (linkButton == null)
        {
            return;
        }
        FS2RoleDataInfo roleDataInfo = Session["RoleDataInfo"] as FS2RoleDataInfo;

        if (roleDataInfo.RoleId != _roleId)
        {
            GameServer server = AdminServer.TheInstance.GameServerManager.GetGameServer(_serverId);
            if (server == null)
            {
                return;
            }
            roleDataInfo            = Query(server, _roleId);
            Session["RoleDataInfo"] = roleDataInfo;
        }
        if (roleDataInfo != null)
        {
            RenderAll(roleDataInfo);
            RenderItemInfo((FS2ItemDataInfo[])GetItemList(roleDataInfo, ItemPosition.PosRepositoryroom).ToArray(typeof(FS2ItemDataInfo)), int.Parse(linkButton.ID.Substring(linkButton.ID.Length - 1)), DivItemStorage);
        }
    }
Example #3
0
    protected FS2RoleDataInfo Query(GameServer server, int roleId)
    {
        FS2RoleDataInfo roleInfo  = null;
        ArrayList       paramList = new ArrayList();

        paramList.Add(roleId);
        string selectedFiled = string.Format("{0},{1},{2},{3},{4}",
                                             FS2TableString.RolesfirstFieldMoney, FS2TableString.RolesfirstFieldMoneyInBox,
                                             FS2TableString.RolesfirstFieldItemList, FS2TableString.RolesfirstFieldRoleName,
                                             FS2TableString.RolesfirstFieldId);
        string sqlCmdText = string.Format("SELECT {0} FROM {1} WHERE {2}='?';", selectedFiled,
                                          FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldId);
        SqlCommand cmd = new SqlCommand(sqlCmdText, paramList.ToArray());

        if (!server.IsConnected)
        {
            LabelOpMsg.Visible = true;
            LabelOpMsg.Text    = StringDef.NoConnectionAlert;
            return(null);
        }
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[] {
                SqlDataType.UInt32,
                SqlDataType.UInt32,
                SqlDataType.Blob,
                SqlDataType.String,
                SqlDataType.Int32
            });
            object[] record;
            byte[]   itemData;

            roleInfo = new FS2RoleDataInfo();
            while ((record = result.ReadRecord()) != null)
            {
                if (record != null)
                {
                    roleInfo.Money      = (uint)record[0];
                    roleInfo.MoneyInBox = (uint)record[1];
                    itemData            = (byte[])record[2];
                    if (itemData != null)
                    {
                        roleInfo.ItemList = FS2ItemDataInfo.Parse(itemData);
                        //if (info != null) ItemList.Add(info);
                    }
                    roleInfo.RoleName = record[3] as string;
                    roleInfo.RoleId   = (int)record[4];
                }
            }
            //RenderView(roleInfo);
        }
        return(roleInfo);
    }
Example #4
0
    private Hashtable GetRoleGuid(ArrayList guidList)
    {
        GameServer server = ServerDropDownList.SelectedGameServer;

        if (server == null)
        {
            return(null);
        }
        if (guidList != null && guidList.Count != 0)
        {
            string        sqlCmdText  = "SELECT {0},{1},{2} FROM {3} WHERE {4}";
            StringBuilder guidBuilder = new StringBuilder();
            foreach (string guid in guidList)
            {
                guidBuilder.AppendFormat("{0}='{1}' OR ", FS2TableString.RolesfirstFieldGUID, guid);
            }
            SqlCommand sqlCmd = new SqlCommand(string.Format(sqlCmdText, FS2TableString.RolesfirstFieldId,
                                                             FS2TableString.RolesfirstFieldRoleName, FS2TableString.RolesfirstFieldGUID, FS2TableString.RolesfirstTableName, guidBuilder.ToString(0, guidBuilder.Length - 3)), null);
            if (!server.IsConnected)
            {
                LabelOpMsg.Visible = true;
                LabelOpMsg.Text    = StringDef.NoConnectionAlert;
                return(null);
            }
            SqlResult sqlResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, sqlCmd);
            if (sqlResult != null && sqlResult.Success)
            {
                Hashtable guidHashTable = new Hashtable();
                sqlResult.SetFieldType(new SqlDataType[] {
                    SqlDataType.Int32,
                    SqlDataType.String,
                    SqlDataType.String
                });

                object[]  record    = null;
                ArrayList roleInfos = new ArrayList();
                while ((record = sqlResult.ReadRecord()) != null)
                {
                    FS2RoleDataInfo role = new FS2RoleDataInfo();
                    role.RoleId   = (int)record[0];
                    role.RoleName = record[1] as string;
                    role.RoleGuid = record[2] as string;
                    if (role.RoleGuid != null && role.RoleGuid.Length != 0)
                    {
                        guidHashTable[role.RoleGuid] = role;
                    }
                }
                return(guidHashTable);
            }
        }
        return(null);
    }
Example #5
0
    private void RenderAll(FS2RoleDataInfo roleInfo)
    {
        StringBuilder content = new StringBuilder();

        content.Append("<table class='TN' >");
        for (int index = 0; index != roleInfo.SkillList.Count; ++index)
        {
            FS2SkillDataInfo skillInfo = roleInfo.SkillList[index] as FS2SkillDataInfo;
            if (skillInfo == null)
            {
                return;
            }

            FS2SkillData skillData = FS2GameDataManager.TheInstance.GetSkillData(skillInfo.SkillId);
            if (skillData != null)
            {
                //31,32,33为普通攻击,忽略。
                if (skillData.TemplateId == 31 || skillData.TemplateId == 32 || skillData.TemplateId == 33)
                {
                    continue;
                }
                //SkillSeries为0的是主技能,如异术、玄女等。
                if (skillData.SkillSeries == 0)
                {
                    content.AppendFormat("<tr>");
                    content.AppendFormat("<td class='TCH' align='center'>{0}</td>", skillData.Name);
                    IList <int> subSkills = FS2GameDataManager.TheInstance.GetSubSkill(skillData.TemplateId);
                    if (subSkills != null)
                    {
                        foreach (FS2SkillDataInfo info in roleInfo.SkillList)
                        {
                            if (subSkills.Contains(info.SkillId))
                            {
                                //技能列表中技能包含在此主技能中则显示
                                FS2SkillData subSkillData = FS2GameDataManager.TheInstance.GetSkillData(info.SkillId);
                                //Level用从RoleInfo里面解析出来的
                                if (subSkillData != null)
                                {
                                    content.Append(GameDataRender.RenderSkillCell(subSkillData.Name, info.SkillLevel.ToString(), string.Empty, string.Format("updateRoleSkillInfo(\"{0}\")", subSkillData.TemplateId)));
                                }
                            }
                        }
                    }
                    content.AppendFormat("</tr>");
                }
            }
        }
        content.Append("</table>");
        DivSkillInfo.InnerHtml = content.ToString();
    }
Example #6
0
    private ArrayList GetItemList(FS2RoleDataInfo roleInfo, ItemPosition type)
    {
        //LabelTitle.Text += string.Format("[{0}]物品信息", roleInfo.RoleName);

        ArrayList itemList = new ArrayList();

        foreach (FS2ItemDataInfo itemInfo in roleInfo.ItemList)
        {
            if (itemInfo.Local.Equals((byte)type))
            {
                itemList.Add(itemInfo);
            }
        }
        //if (renderRoleSate) RenderRoleState((FS2ItemDataInfo[])itemInBody.ToArray(typeof(FS2ItemDataInfo)));
        return(itemList);
    }
Example #7
0
    protected FS2RoleDataInfo Query(GameServer server, int roleId)
    {
        FS2RoleDataInfo roleInfo  = null;
        ArrayList       paramList = new ArrayList();

        paramList.Add(roleId);
        string selectedFiled = string.Format("{0},{1}",
                                             FS2TableString.RolesfirstFieldSkillList, FS2TableString.RolesfirstFieldRoleName);
        string sqlCmdText = string.Format("SELECT {0} FROM {1} WHERE {2}='?';", selectedFiled,
                                          FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldId);
        SqlCommand cmd = new SqlCommand(sqlCmdText, paramList.ToArray());

        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return(null);
        }
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[] {
                SqlDataType.Blob,
                SqlDataType.String
            });
            object[] record;

            byte[] skillData;

            roleInfo = new FS2RoleDataInfo();
            while ((record = result.ReadRecord()) != null)
            {
                if (record != null)
                {
                    skillData = (byte[])record[0];
                    if (skillData != null)
                    {
                        roleInfo.SkillList = FS2SkillDataInfo.Parse(skillData);
                    }
                    roleInfo.RoleName = record[1] as string;
                }
            }
        }
        return(roleInfo);
    }
Example #8
0
    protected FS2RoleDataInfo Query(GameServer server, int roleId)
    {
        FS2RoleDataInfo roleInfo = null;
        ArrayList paramList = new ArrayList();
        paramList.Add(roleId);
        string selectedFiled = string.Format("{0},{1}",
            FS2TableString.RolesfirstFieldSkillList, FS2TableString.RolesfirstFieldRoleName);
        string sqlCmdText = string.Format("SELECT {0} FROM {1} WHERE {2}='?';", selectedFiled,
            FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldId);
        SqlCommand cmd = new SqlCommand(sqlCmdText, paramList.ToArray());
        if (!server.IsConnected)
        {
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return null;
        }
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[]{
                SqlDataType.Blob,
                SqlDataType.String
                });
            object[] record;

            byte[] skillData;

            roleInfo = new FS2RoleDataInfo();
            while ((record = result.ReadRecord()) != null)
            {
                if (record != null)
                {
                    skillData = (byte[])record[0];
                    if (skillData != null)
                    {
                        roleInfo.SkillList = FS2SkillDataInfo.Parse(skillData);
                    }
                    roleInfo.RoleName = record[1] as string;
                }
            }
        }
        return roleInfo;
    }
Example #9
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!WebUtil.CheckPrivilege(WebConfig.FunctionGameMasterRoleItemInfo, OpType.READ, Session))
        {
            Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
        }

        if (Request.Params[WebConfig.ParamServerId] != null)
        {
            _serverId = int.Parse(Request.Params[WebConfig.ParamServerId]);
            if (Request.Params[WebConfig.ParamRoleId] != null)
            {
                _roleId = int.Parse(Request.Params[WebConfig.ParamRoleId]);
            }

            if (!IsPostBack)
            {
                GameServer server = AdminServer.TheInstance.GameServerManager.GetGameServer(_serverId);
                if (server == null)
                {
                    return;
                }
                FS2RoleDataInfo info = Query(server, _roleId);
                if (info != null)
                {
                    LabelTitle.Text += string.Format("[{0}]", info.RoleName) + StringDef.ItemInfo;

                    RenderAll(info);
                    Session["RoleDataInfo"] = info;
                }
            }
        }
        else
        {
            Response.Redirect("QueryRole.aspx");
        }
    }
Example #10
0
    private bool CreateSearchRoleResultList(int serverId, FS2RoleDataInfo[] roles)
    {
        if (roles != null && roles.Length > 0)
        {
            FS2RoleDataInfo info = null;
            for (int i = 0; i < roles.Length; i++)
            {
                info = roles[i];
                TableRow row = new TableRow();

                TableCell cell = new TableCell();
                cell.Text = info.RoleId.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                HyperLink link = new HyperLink();
                link.Target      = "_blank";
                link.NavigateUrl = "RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId;
                link.Text        = info.RoleName;
                link.SkinID      = "PlainText";
                cell.Controls.Add(link);
                row.Cells.Add(cell);

                cell      = new TableCell();
                cell.Text = info.AccountName;
                row.Cells.Add(cell);

                cell = new TableCell();
                if (info.TongName != null && info.TongName.Length != 0)
                {
                    cell.Text = info.TongName;
                }
                else
                {
                    cell.Text = StringDef.None;
                }
                row.Cells.Add(cell);

                cell           = new TableCell();
                cell.Font.Bold = true;
                cell.Text      = info.RoleLevel.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                Image sexImage = new Image();
                switch (info.RoleSex)
                {
                case FS2RoleSex.Male:
                    sexImage.ToolTip  = StringDef.Male;
                    sexImage.ImageUrl = "~/Image/male.gif";
                    break;

                case FS2RoleSex.Female:
                    sexImage.ToolTip  = StringDef.Female;
                    sexImage.ImageUrl = "~/Image/female.gif";
                    break;
                }
                cell.Controls.Add(sexImage);
                row.Cells.Add(cell);

                cell = new TableCell();
                string classDescription = string.Empty;
                switch (info.RoleType)
                {
                case FS2RoleType.Jiashi:
                    classDescription = StringDef.Jiashi;
                    break;

                case FS2RoleType.Xuanfeng:
                    classDescription = StringDef.XuanFeng;
                    break;

                case FS2RoleType.Xingtian:
                    classDescription = StringDef.XingTian;
                    break;

                case FS2RoleType.Daoshi:
                    classDescription = StringDef.Daoshi;
                    break;

                case FS2RoleType.Zhenren:
                    classDescription = StringDef.ZhenRen;
                    break;

                case FS2RoleType.Tianshi:
                    classDescription = StringDef.TianShi;
                    break;

                case FS2RoleType.Yiren:
                    classDescription = StringDef.Yiren;
                    break;

                case FS2RoleType.Shoushi:
                    classDescription = StringDef.ShouShi;
                    break;

                case FS2RoleType.Yishi:
                    classDescription = StringDef.YiShi;
                    break;
                }
                cell.Text = classDescription;
                row.Cells.Add(cell);
                cell             = new TableCell();
                cell.Wrap        = false;
                link             = new HyperLink();
                link.Text        = StringDef.ExecuteGMCommand;
                link.SkinID      = "PlainText";
                link.NavigateUrl = "GMCommand.aspx?serverId=" + serverId + "&roleName=" + Server.UrlEncode(info.RoleName);
                link.Width       = new Unit(40, UnitType.Percentage);
                cell.Controls.Add(link);
                link             = new HyperLink();
                link.Text        = StringDef.ExpStatistic;
                link.SkinID      = "PlainText";
                link.NavigateUrl = "~/GameInfo/ExpStatistic.aspx?serverId=" + serverId + "&roleName=" + Server.UrlEncode(info.RoleName);
                link.Width       = new Unit(40, UnitType.Percentage);
                cell.Controls.Add(link);
                row.Cells.Add(cell);

                TableSearchRoleList.Rows.Add(row);
            }

            return(true);
        }

        return(false);
    }
Example #11
0
    void Query(int offset)
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            //string tong = TextBoxTong.Text;
            //if (tong.Length > 0)
            //{
            //    if (CheckBoxTong.Checked)
            //    {
            //        searchCondition.Append(string.Format(" AND {0}='?'", FS2TableString.RolesfirstFieldTongGUID));
            //    }
            //    else
            //    {
            //        searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", FS2TableString.RolesfirstFieldTongGUID));
            //    }
            //    paramList.Add(tong);
            //}

            searchCondition.Append(string.Format("{0} = {1}", " WHERE " + FS2TableString.RolesfirstFieldOnline, "1"));

            int sex = ListBoxSex.SelectedIndex - 1;
            if (sex >= 0)
            {
                searchCondition.Append(string.Format(" AND {0}={1}", FS2TableString.RolesfirstFieldRoleSex, sex));
            }

            StringBuilder roleTypeBuilder = new StringBuilder();
            foreach (ListItem item in CheckBoxListRoleType.Items)
            {
                if (item.Selected)
                {
                    string[] conValue = item.Value.Split(',');
                    roleTypeBuilder.AppendFormat("({0}='{1}' AND {2}='{3}') OR ", FS2TableString.RolesfirstFieldRoleType, conValue[0], FS2TableString.RolesfirstFieldSkillSeries, conValue[1]);
                }
            }
            if (roleTypeBuilder.Length != 0)
            {
                searchCondition.AppendFormat(" AND ({0}) ", roleTypeBuilder.ToString(0, roleTypeBuilder.Length - 3));
            }
            else
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleClass);
                return;
            }

            //int roleClass = ListBoxRoleClass.SelectedIndex - 1;
            //if (roleClass >= 0)
            //{
            //    string[] conValue = ListBoxRoleClass.SelectedValue.Split(',');
            //    searchCondition.Append(string.Format(" AND {0}='{1}' AND {2}='{3}'", FS2TableString.RolesfirstFieldRoleType, conValue[0], FS2TableString.RolesfirstFieldSkillSeries, conValue[1]));
            //}

            int startLevel = int.Parse(TextBoxStartLevel.Text);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", FS2TableString.RolesfirstFieldRoleLevel, startLevel));
            }

            int endLevel = int.Parse(TextBoxEndLevel.Text);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", FS2TableString.RolesfirstFieldRoleLevel, endLevel));
            }

            string orderByType = string.Empty;
            switch (ListBoxOrderByType.SelectedIndex)
            {
            case 0:
                orderByType = "ASC";
                break;

            case 1:
                orderByType = "DESC";
                break;
            }

            string orderByStatement = string.Empty;
            switch (ListBoxOrderBy.SelectedIndex)
            {
            case 0:
                orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldId, orderByType);
                break;

            case 1:
                orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleLevel, orderByType);
                break;

            case 2:
                orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleName, orderByType);
                break;
            }

            int    limitCount     = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount + 1);

            SqlCommand cmd    = new SqlCommand("SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries FROM rolesfirst" + searchCondition.ToString() + orderByStatement + limitStatement, paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                Session[WebConfig.SessionQueryLogOffset] = offset;

                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.Int32,
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.Int32
                });

                ArrayList roles  = new ArrayList();
                object[]  record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.RoleId      = (int)record[0];
                    info.AccountName = (string)record[1];
                    info.RoleName    = (string)record[2];
                    info.RoleSex     = (FS2RoleSex)((SByte)record[3]);

                    info.SkillSeries = (int)record[6];
                    switch ((SByte)record[4])
                    {
                    case (SByte)0:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Xuanfeng;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Xingtian;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Jiashi;
                        }
                        break;

                    case (SByte)1:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Zhenren;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Tianshi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Daoshi;
                        }
                        break;

                    case (SByte)2:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Shoushi;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Yishi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Yiren;
                        }
                        break;
                    }

                    info.RoleLevel = (SByte)record[5];

                    roles.Add(info);
                }

                ButtonPreviousPage.Enabled = (offset > 0);
                ButtonFirstPage.Enabled    = (offset > 0);
                ButtonNextPage.Enabled     = (roles.Count > limitCount);

                bool success = CreateSearchRoleResultList(server.Id, (FS2RoleDataInfo[])roles.ToArray(typeof(FS2RoleDataInfo)));
                PanelResult.Visible = success;

                if (!success)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                    return;
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text     = ex.Message;
            PanelResult.Visible = false;
        }
    }
Example #12
0
    private void SetRoleBasicInfo(FS2RoleDataInfo role)
    {
        TextBoxTongName.Text    = role.TongName;
        TextBoxAccountName.Text = role.AccountName;
        TextBoxRoleName.Text    = role.RoleName;
        switch (role.RoleSex)
        {
        case FS2RoleSex.Male:
            TextBoxSex.Text = StringDef.Male;
            break;

        case FS2RoleSex.Female:
            TextBoxSex.Text = StringDef.Female;
            break;
        }
        string classDescription = string.Empty;

        switch (role.RoleType)
        {
        case FS2RoleType.Jiashi:
            classDescription = StringDef.Jiashi;
            break;

        case FS2RoleType.Xuanfeng:
            classDescription = StringDef.XuanFeng;
            break;

        case FS2RoleType.Xingtian:
            classDescription = StringDef.XingTian;
            break;

        case FS2RoleType.Daoshi:
            classDescription = StringDef.Daoshi;
            break;

        case FS2RoleType.Zhenren:
            classDescription = StringDef.ZhenRen;
            break;

        case FS2RoleType.Tianshi:
            classDescription = StringDef.TianShi;
            break;

        case FS2RoleType.Yiren:
            classDescription = StringDef.Yiren;
            break;

        case FS2RoleType.Shoushi:
            classDescription = StringDef.ShouShi;
            break;

        case FS2RoleType.Yishi:
            classDescription = StringDef.YiShi;
            break;
        }
        TextBoxType.Text = classDescription;

        TextBoxLevel.Text             = role.RoleLevel.ToString();
        TextBoxMoney.Text             = GameDataRender.RenderMoney(role.Money);
        TextBoxMoneyInBox.Text        = GameDataRender.RenderMoney(role.MoneyInBox);
        TextBoxPlayedTime.Text        = TimeSpan.FromSeconds(role.PlayedTime).ToString();
        TextBoxCreateDate.Text        = role.CreateDate.ToString();
        TextBoxLastPlayingDate.Text   = role.LastPlayingDate.ToString();
        TextBoxLastPlayingIP.Text     = role.LastPlayingIP.ToString();
        TextBoxNoChatIn.Text          = (role.NoChatIn == 0) ? StringDef.No : StringDef.Yes;
        TextBoxNoLoginIn.Text         = (role.NoLoginIn == 0) ? StringDef.No : StringDef.Yes;
        TextBoxUseRevivePosition.Text = ((role.UseRevivePosition == 0) ? StringDef.No : StringDef.Yes);
        TextBoxReviveID.Text          = role.ReviveID.ToString();
        TextBoxReviveX.Text           = role.ReviveX.ToString();
        TextBoxReviveY.Text           = role.ReviveY.ToString();
        TextBoxEnterMapID.Text        = role.EnterMapId.ToString();
        TextBoxRoleGuid.Text          = role.RoleGuid;
        LabelIsOnline.Text            = role.Online == 0 ? StringDef.No : StringDef.Yes;
        ListBoxSpyLevel.SelectedIndex = role.SpyLevel;

        if (role.TongName != null && role.TongName.Length != 0)
        {
            TextBoxTongName.Text = string.Format("<a href='../GameInfo/ClanMemberStatistic.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>",
                                                 WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamNodeGUID, (string)ViewState[WebConfig.ParamNodeGUID], role.TongName);
            LinkClanInfo.Enabled     = true;
            LinkClanInfo.NavigateUrl = string.Format("~/GameInfo/ClanMemberStatistic.aspx?{0}={1}&{2}={3}",
                                                     WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamNodeGUID, (string)ViewState[WebConfig.ParamNodeGUID], role.TongName);
        }
        else
        {
            LinkClanInfo.Enabled = false;
            TextBoxTongName.Text = StringDef.NotAvailable;
        }

        Page.Title = string.Format("{0} - \"{1}\"", Page.Title, role.RoleName);
    }
    void Query()
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }

            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            string RoleSexQueryText = "SELECT RoleType, RoleSex,TongGUID,SkillSeries FROM rolesfirst {0}";

            int startLevel = int.Parse(TextBoxStartLevel.Text);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", FS2TableString.RolesfirstFieldRoleLevel, startLevel));
            }

            int endLevel = int.Parse(TextBoxEndLevel.Text);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", FS2TableString.RolesfirstFieldRoleLevel, endLevel));
            }

            DateTime activeDate = DateCalendar.SelectedDate;
            if (DropDownListActivePlayer.SelectedIndex != 0 && activeDate == DateTime.MinValue)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgInputParamNotCorrect, StringDef.Date);
                return;
            }
            switch (DropDownListActivePlayer.SelectedIndex)
            {
            case 1:
                //活跃玩家
                searchCondition.AppendFormat(" AND {0}>='{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                break;

            case 2:
                //不活跃玩家
                searchCondition.AppendFormat(" AND {0}<'{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                break;
            }

            if (searchCondition.Length > 0)
            {
                searchCondition.Remove(0, 4);
                searchCondition.Insert(0, " WHERE");
            }

            SqlCommand cmd    = new SqlCommand(string.Format(RoleSexQueryText, searchCondition.Length == 0 ? string.Empty : searchCondition.ToString()), string.Empty);
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.String,
                    SqlDataType.Int32
                });

                object[]         record    = null;
                RoleSexTotalInfo totalInfo = new RoleSexTotalInfo();
                ArrayList        infos     = new ArrayList();
                while ((record = result.ReadRecord()) != null)
                {
                    //RoleType, RoleSex,TongGUID,SkillSeries
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.SkillSeries = (int)record[3];
                    switch ((SByte)record[0])
                    {
                    case (SByte)0:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Xuanfeng;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Xingtian;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Jiashi;
                        }
                        break;

                    case (SByte)1:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Zhenren;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Tianshi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Daoshi;
                        }
                        break;

                    case (SByte)2:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Shoushi;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Yishi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Yiren;
                        }
                        break;
                    }

                    info.RoleSex  = (FS2RoleSex)((SByte)record[1]);
                    info.TongName = record[2] as string;

                    switch (DropDownListSocialRelation.SelectedIndex)
                    {
                    case 0:
                        infos.Add(info);
                        break;

                    case 1:
                        if (info.TongName != null && info.TongName != string.Empty)
                        {
                            infos.Add(info);
                        }
                        break;

                    case 2:
                        if (info.TongName == null || info.TongName == string.Empty)
                        {
                            infos.Add(info);
                        }
                        break;
                        //case 3:
                        //    if (IsInZhuhou(info)) infos.Add(info);
                        //    break;
                        //case 4:
                        //    if (IsInNation(info)) infos.Add(info);
                        //    break;
                    }
                }

                if (infos.Count != 0)
                {
                    PanelResult.Visible = true;
                    _statInfo           = (FS2RoleDataInfo[])infos.ToArray(typeof(FS2RoleDataInfo));
                    CreateSearchRoleSexList((FS2RoleDataInfo[])infos.ToArray(typeof(FS2RoleDataInfo)));
                    LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name, server.Name,
                                                     string.Format(StringDef.LabelRoleLevel, startLevel, endLevel),
                                                     StringDef.ProfessionalSex);
                }
                else
                {
                    PanelResult.Visible = false;
                    LabelOpMsg.Text     = StringDef.NoMatchingRecord;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text     = ex.Message;
            PanelResult.Visible = false;
        }
    }
Example #14
0
    private void SetRoleBasicInfo(FS2RoleDataInfo role)
	{
		TextBoxTongName.Text = role.TongName;
		TextBoxAccountName.Text = role.AccountName;
		TextBoxRoleName.Text = role.RoleName;
		switch (role.RoleSex)
		{
			case FS2RoleSex.Male:
				TextBoxSex.Text = StringDef.Male;
				break;
			case FS2RoleSex.Female:
				TextBoxSex.Text = StringDef.Female;
				break;
		}
        string classDescription = string.Empty;
        switch (role.RoleType)
        {
            case FS2RoleType.Jiashi:
                classDescription = StringDef.Jiashi;
                break;
            case FS2RoleType.Xuanfeng:
                classDescription = StringDef.XuanFeng;
                break;
            case FS2RoleType.Xingtian:
                classDescription = StringDef.XingTian;
                break;
            case FS2RoleType.Daoshi:
                classDescription = StringDef.Daoshi;
                break;
            case FS2RoleType.Zhenren:
                classDescription = StringDef.ZhenRen;
                break;
            case FS2RoleType.Tianshi:
                classDescription = StringDef.TianShi;
                break;
            case FS2RoleType.Yiren:
                classDescription = StringDef.Yiren;
                break;
            case FS2RoleType.Shoushi:
                classDescription = StringDef.ShouShi;
                break;
            case FS2RoleType.Yishi:
                classDescription = StringDef.YiShi;
                break;
        }
        TextBoxType.Text = classDescription;

        TextBoxLevel.Text = role.RoleLevel.ToString();
        TextBoxMoney.Text = GameDataRender.RenderMoney(role.Money);
        TextBoxMoneyInBox.Text = GameDataRender.RenderMoney(role.MoneyInBox);
		TextBoxPlayedTime.Text = TimeSpan.FromSeconds(role.PlayedTime).ToString();
		TextBoxCreateDate.Text = role.CreateDate.ToString();
		TextBoxLastPlayingDate.Text = role.LastPlayingDate.ToString();
		TextBoxLastPlayingIP.Text = role.LastPlayingIP.ToString();
		TextBoxNoChatIn.Text = (role.NoChatIn == 0) ? StringDef.No : StringDef.Yes;
		TextBoxNoLoginIn.Text = (role.NoLoginIn == 0) ? StringDef.No : StringDef.Yes;
		TextBoxUseRevivePosition.Text = ((role.UseRevivePosition == 0) ? StringDef.No : StringDef.Yes);
		TextBoxReviveID.Text = role.ReviveID.ToString();
		TextBoxReviveX.Text = role.ReviveX.ToString();
		TextBoxReviveY.Text = role.ReviveY.ToString();
		TextBoxEnterMapID.Text = role.EnterMapId.ToString();
		TextBoxRoleGuid.Text = role.RoleGuid;
        LabelIsOnline.Text = role.Online == 0 ? StringDef.No : StringDef.Yes;
        ListBoxSpyLevel.SelectedIndex = role.SpyLevel;

        if (role.TongName != null && role.TongName.Length != 0)
        {
            TextBoxTongName.Text = string.Format("<a href='../GameInfo/ClanMemberStatistic.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>",
                WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamNodeGUID, (string)ViewState[WebConfig.ParamNodeGUID], role.TongName);
            LinkClanInfo.Enabled = true;
            LinkClanInfo.NavigateUrl = string.Format("~/GameInfo/ClanMemberStatistic.aspx?{0}={1}&{2}={3}",
                WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamNodeGUID, (string)ViewState[WebConfig.ParamNodeGUID], role.TongName);
        }
        else
        {
            LinkClanInfo.Enabled = false;
            TextBoxTongName.Text = StringDef.NotAvailable;
        }

		Page.Title = string.Format("{0} - \"{1}\"", Page.Title, role.RoleName);
	}
Example #15
0
    private void RenderAll(FS2RoleDataInfo roleInfo)
    {
        StringBuilder content = new StringBuilder();
        content.Append("<table class='TN' >");
        for (int index = 0; index != roleInfo.SkillList.Count;++index )
        {
            FS2SkillDataInfo skillInfo = roleInfo.SkillList[index] as FS2SkillDataInfo;
            if (skillInfo == null) return;

            FS2SkillData skillData = FS2GameDataManager.TheInstance.GetSkillData(skillInfo.SkillId);
            if (skillData != null)
            {
                //31,32,33为普通攻击,忽略。
                if (skillData.TemplateId == 31 || skillData.TemplateId == 32 || skillData.TemplateId == 33) continue;
                //SkillSeries为0的是主技能,如异术、玄女等。
                if (skillData.SkillSeries == 0)
                {
                    content.AppendFormat("<tr>");
                    content.AppendFormat("<td class='TCH' align='center'>{0}</td>", skillData.Name);
                    IList<int> subSkills = FS2GameDataManager.TheInstance.GetSubSkill(skillData.TemplateId);
                    if (subSkills != null)
                    {
                        foreach (FS2SkillDataInfo info in roleInfo.SkillList)
                        {
                            if (subSkills.Contains(info.SkillId))
                            {
                                //技能列表中技能包含在此主技能中则显示
                                FS2SkillData subSkillData = FS2GameDataManager.TheInstance.GetSkillData(info.SkillId);
                                //Level用从RoleInfo里面解析出来的
                                if (subSkillData != null) content.Append(GameDataRender.RenderSkillCell(subSkillData.Name, info.SkillLevel.ToString(), string.Empty, string.Format("updateRoleSkillInfo(\"{0}\")", subSkillData.TemplateId)));
                            }
                        }
                    }
                    content.AppendFormat("</tr>");
                }
            }
        }
        content.Append("</table>");
        DivSkillInfo.InnerHtml = content.ToString();
    }
Example #16
0
    protected FS2RoleDataInfo Query(GameServer server, int roleId)
    {
        FS2RoleDataInfo roleInfo = null;
        ArrayList paramList = new ArrayList();
        paramList.Add(roleId);
        string selectedFiled = string.Format("{0},{1},{2},{3},{4}",
            FS2TableString.RolesfirstFieldMoney,FS2TableString.RolesfirstFieldMoneyInBox,
            FS2TableString.RolesfirstFieldItemList,FS2TableString.RolesfirstFieldRoleName,
            FS2TableString.RolesfirstFieldId);
        string sqlCmdText = string.Format("SELECT {0} FROM {1} WHERE {2}='?';" ,selectedFiled,
            FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldId);
        SqlCommand cmd = new SqlCommand(sqlCmdText, paramList.ToArray());
        if (!server.IsConnected)
        {
            LabelOpMsg.Visible = true;
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return null;
        }
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id,server,cmd);
        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[]{
                SqlDataType.UInt32,
                SqlDataType.UInt32,
                SqlDataType.Blob,
                SqlDataType.String,
                SqlDataType.Int32
                });
            object[] record;
            byte[] itemData;

            roleInfo = new FS2RoleDataInfo();
            while ((record = result.ReadRecord())!=null)
            {
                if (record != null)
                {
                    roleInfo.Money = (uint)record[0];
                    roleInfo.MoneyInBox = (uint)record[1];                    
                    itemData = (byte[])record[2];
                    if (itemData != null)
                    {
                        roleInfo.ItemList = FS2ItemDataInfo.Parse(itemData);
                        //if (info != null) ItemList.Add(info);
                    }
                    roleInfo.RoleName = record[3] as string;
                    roleInfo.RoleId = (int)record[4];
                }
            }
            //RenderView(roleInfo);
        }
        return roleInfo;
    }
    void Query()
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone,StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            
            ArrayList paramList = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            string RoleSexQueryText = "SELECT RoleType, RoleSex,TongGUID,SkillSeries FROM rolesfirst {0}";

            int startLevel = int.Parse(TextBoxStartLevel.Text);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", FS2TableString.RolesfirstFieldRoleLevel, startLevel));
            }

            int endLevel = int.Parse(TextBoxEndLevel.Text);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", FS2TableString.RolesfirstFieldRoleLevel, endLevel));
            }

            DateTime activeDate = DateCalendar.SelectedDate;
            if (DropDownListActivePlayer.SelectedIndex != 0 && activeDate == DateTime.MinValue)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgInputParamNotCorrect, StringDef.Date);
                return;
            }
            switch (DropDownListActivePlayer.SelectedIndex)
            {
                case 1:
                    //活跃玩家
                    searchCondition.AppendFormat(" AND {0}>='{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                    break;
                case 2:
                    //不活跃玩家
                    searchCondition.AppendFormat(" AND {0}<'{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                    break;
            }

            if (searchCondition.Length > 0)
            {
                searchCondition.Remove(0, 4);
                searchCondition.Insert(0, " WHERE");
            }

            SqlCommand cmd = new SqlCommand(string.Format(RoleSexQueryText, searchCondition.Length == 0 ? string.Empty : searchCondition.ToString()), string.Empty);
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                result.SetFieldType(
                        new SqlDataType[] {
                        SqlDataType.SByte,
                        SqlDataType.SByte,
                        SqlDataType.String,
                        SqlDataType.Int32
                    });

                object[] record = null;
                RoleSexTotalInfo totalInfo = new RoleSexTotalInfo();
                ArrayList infos = new ArrayList();
                while ((record = result.ReadRecord()) != null)
                {
                    //RoleType, RoleSex,TongGUID,SkillSeries
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.SkillSeries = (int)record[3];
                    switch ((SByte)record[0])
                    {
                        case (SByte)0:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Xuanfeng;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Xingtian;
                            else info.RoleType = FS2RoleType.Jiashi;
                            break;
                        case (SByte)1:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Zhenren;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Tianshi;
                            else info.RoleType = FS2RoleType.Daoshi;
                            break;
                        case (SByte)2:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Shoushi;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Yishi;
                            else info.RoleType = FS2RoleType.Yiren;
                            break;
                    }

                    info.RoleSex = (FS2RoleSex)((SByte)record[1]);
                    info.TongName = record[2] as string;

                    switch (DropDownListSocialRelation.SelectedIndex)
                    {
                        case 0:
                            infos.Add(info);
                            break;
                        case 1:
                            if (info.TongName != null && info.TongName != string.Empty) infos.Add(info);
                            break;
                        case 2:
                            if (info.TongName == null|| info.TongName==string.Empty) infos.Add(info);
                            break;
                        //case 3:
                        //    if (IsInZhuhou(info)) infos.Add(info);
                        //    break;
                        //case 4:
                        //    if (IsInNation(info)) infos.Add(info);
                        //    break;
                    }
                }

                if (infos.Count != 0)
                {
                    PanelResult.Visible = true;
                    _statInfo = (FS2RoleDataInfo[])infos.ToArray(typeof(FS2RoleDataInfo));
                    CreateSearchRoleSexList((FS2RoleDataInfo[])infos.ToArray(typeof(FS2RoleDataInfo)));
                                        LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name,server.Name,
                                        string.Format(StringDef.LabelRoleLevel, startLevel, endLevel),
                                        StringDef.ProfessionalSex);
                }
                else
                {
                    PanelResult.Visible = false;
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
            PanelResult.Visible = false;
        }
    }
Example #18
0
    private Hashtable GetRoleGuid(ArrayList guidList)
    {
        GameServer server = ServerDropDownList.SelectedGameServer;
        if (server == null) return null;
        if (guidList != null && guidList.Count != 0)
        {
            string sqlCmdText = "SELECT {0},{1},{2} FROM {3} WHERE {4}";
            StringBuilder guidBuilder = new StringBuilder();
            foreach (string guid in guidList)
            {
                guidBuilder.AppendFormat("{0}='{1}' OR ", FS2TableString.RolesfirstFieldGUID, guid);
            }
            SqlCommand sqlCmd = new SqlCommand(string.Format(sqlCmdText, FS2TableString.RolesfirstFieldId,
                FS2TableString.RolesfirstFieldRoleName, FS2TableString.RolesfirstFieldGUID, FS2TableString.RolesfirstTableName, guidBuilder.ToString(0, guidBuilder.Length - 3)), null);
            if (!server.IsConnected)
            {
                LabelOpMsg.Visible = true;
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return null;
            }
            SqlResult sqlResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, sqlCmd);
            if (sqlResult != null && sqlResult.Success)
            {
                Hashtable guidHashTable = new Hashtable();
                sqlResult.SetFieldType(new SqlDataType[]{
                                        SqlDataType.Int32,
                                        SqlDataType.String,
                                        SqlDataType.String
                                        });

                object[] record = null;
                ArrayList roleInfos = new ArrayList();
                while ((record = sqlResult.ReadRecord()) != null)
                {
                    FS2RoleDataInfo role = new FS2RoleDataInfo();
                    role.RoleId = (int)record[0];
                    role.RoleName = record[1] as string;
                    role.RoleGuid = record[2] as string;
                    if (role.RoleGuid != null && role.RoleGuid.Length != 0) guidHashTable[role.RoleGuid] = role;
                }
                return guidHashTable;
            }
        }
        return null;
    }
    bool CreateSearchRoleSexList(FS2RoleDataInfo[] infos)
    {
        RoleSexTotalInfo totalInfo = null;
        if (infos != null)
        {
            totalInfo = new RoleSexTotalInfo();
            foreach (FS2RoleDataInfo info in infos)
            {
                totalInfo.infos[Convert.ToInt16(info.RoleType)].num[(int)info.RoleSex]++;
            }
        }

        if (totalInfo != null)
        {
            int totalMale = 0;
            int totalFemale = 0;
            int totalMaleJia = 0;
            int totalFemaleJia = 0;
            int totalMaleDao = 0;
            int totalFemaleDao = 0;
            int totalMaleYi = 0;
            int totalFemaleYi = 0;

            int rowNum = 0;
            foreach (RoleSexStatisticInfo info in totalInfo.infos)
            {
                ++rowNum;
                totalMale += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                totalFemale += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                TableRow row = new TableRow();

                //三类职业行标头
                TableCell headerCell = new TableCell();
                headerCell.RowSpan = 3;                
                switch(rowNum) 
                {   
                    case 1:
                        headerCell.Text = StringDef.Jiashi;
                        row.Cells.Add(headerCell);
                        break;
                    case 4:
                        headerCell.Text = StringDef.Daoshi;
                        row.Cells.Add(headerCell);
                        break;
                    case 7:
                        headerCell.Text = StringDef.Yiren;
                        row.Cells.Add(headerCell);
                        break;                    
                }

                TableCell cell1 = new TableCell();

                string classDescription = string.Empty;
                switch (info.roleType)
                {
                    case FS2RoleType.Jiashi:
                        classDescription = StringDef.Jiashi + string.Format("[{0}]", StringDef.ProfessionalNotChoose);
                        totalMaleJia += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleJia += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Xuanfeng:
                        classDescription = StringDef.XuanFeng;
                        totalMaleJia += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleJia += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Xingtian:
                        classDescription = StringDef.XingTian;
                        totalMaleJia += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleJia += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Daoshi:
                        classDescription = StringDef.Daoshi + string.Format("[{0}]", StringDef.ProfessionalNotChoose);
                        totalMaleDao += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleDao += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Zhenren:
                        classDescription = StringDef.ZhenRen;
                        totalMaleDao += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleDao += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Tianshi:
                        classDescription = StringDef.TianShi;
                        totalMaleDao += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleDao += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Yiren:
                        classDescription = StringDef.Yiren + string.Format("[{0}]", StringDef.ProfessionalNotChoose);
                        totalMaleYi += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleYi += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Shoushi:
                        classDescription = StringDef.ShouShi;
                        totalMaleYi += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleYi += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                    case FS2RoleType.Yishi:
                        classDescription = StringDef.YiShi;
                        totalMaleYi += info.num[Convert.ToInt16(FS2RoleSex.Male)];
                        totalFemaleYi += info.num[Convert.ToInt16(FS2RoleSex.Female)];
                        break;
                }
                cell1.Text = classDescription;
                TableCell cell2 = new TableCell();
                if (info.num[Convert.ToInt16(FS2RoleSex.Male)] != 0)
                {
                    cell2.Text = string.Format("{0} ({1}%)",
                                               info.num[Convert.ToInt16(FS2RoleSex.Male)].ToString(),
                                               Decimal.Round((decimal)info.num[Convert.ToInt16(FS2RoleSex.Male)] / info.TotalNum * 100, 2).ToString());
                }
                else
                { cell2.Text = "0"; }
                TableCell cell3 = new TableCell();
                if (info.num[Convert.ToInt16(FS2RoleSex.Female)] != 0)
                {
                    cell3.Text = string.Format("{0} ({1}%)",
                                              info.num[Convert.ToInt16(FS2RoleSex.Female)].ToString(),
                                              Decimal.Round((decimal)info.num[Convert.ToInt16(FS2RoleSex.Female)] / info.TotalNum * 100, 2).ToString());
                }
                else
                { cell3.Text = "0"; }
                TableCell cell4 = new TableCell();
                //cell4.Text = string.Format("{0} (100%)", info.TotalNum);
                row.Cells.Add(cell1);
                row.Cells.Add(cell2);
                row.Cells.Add(cell3);
                row.Cells.Add(cell4);

                TableCell tailCell = new TableCell();
                tailCell.RowSpan = 3;                
                switch (rowNum)
                {
                    case 1:
                    case 4:
                    case 7:
                        row.Cells.Add(tailCell);
                        break;
                }

                TableSearchRoleSexStatistic.Rows.Add(row);
            }

            //九种职业统计
            for (int totalInfoIndex = 0; totalInfoIndex != totalInfo.infos.Length; ++totalInfoIndex)
            {
                RoleSexStatisticInfo info = totalInfo.infos[totalInfoIndex] as RoleSexStatisticInfo;
                if (info != null)
                {
                    switch (info.roleType)
                    {
                        case FS2RoleType.Jiashi:
                            if ((totalMaleJia + totalFemaleJia) != 0)
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[4].Text = string.Format("{0} ({1}%)",
                                    info.TotalNum,
                                    Decimal.Round((decimal)info.TotalNum / (totalMaleJia + totalFemaleJia) * 100, 2).ToString());
                            }
                            else
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[4].Text = "0";
                            }
                            break;
                        case FS2RoleType.Xuanfeng:
                        case FS2RoleType.Xingtian:
                            if ((totalMaleJia + totalFemaleJia) != 0)
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[3].Text = string.Format("{0} ({1}%)",
                                    info.TotalNum,
                                    Decimal.Round((decimal)info.TotalNum / (totalMaleJia + totalFemaleJia) * 100, 2).ToString());
                            }
                            else
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[3].Text = "0";
                            }
                            break;
                        case FS2RoleType.Daoshi:
                            if ((totalMaleDao + totalFemaleDao) != 0)
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[4].Text = string.Format("{0} ({1}%)",
                                    info.TotalNum,
                                    Decimal.Round((decimal)info.TotalNum / (totalMaleDao + totalFemaleDao) * 100, 2).ToString());
                            }
                            else
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[4].Text = "0";
                            }
                            break;
                        case FS2RoleType.Zhenren:
                        case FS2RoleType.Tianshi:
                            if ((totalMaleDao + totalFemaleDao) != 0)
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[3].Text = string.Format("{0} ({1}%)",
                                    info.TotalNum,
                                    Decimal.Round((decimal)info.TotalNum / (totalMaleDao + totalFemaleDao) * 100, 2).ToString());
                            }
                            else
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[3].Text = "0 (0%)";
                            }
                            break;
                        case FS2RoleType.Yiren:
                            if ((totalMaleYi + totalFemaleYi) != 0)
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[4].Text = string.Format("{0} ({1}%)",
                                    info.TotalNum,
                                    Decimal.Round((decimal)info.TotalNum / (totalMaleYi + totalFemaleYi) * 100, 2).ToString());
                            }
                            else
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[4].Text = "0 (0%)";
                            }
                            break;
                        case FS2RoleType.Shoushi:
                        case FS2RoleType.Yishi:
                            if ((totalMaleYi + totalFemaleYi) != 0)
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[3].Text = string.Format("{0} ({1}%)",
                                    info.TotalNum,
                                    Decimal.Round((decimal)info.TotalNum / (totalMaleYi + totalFemaleYi) * 100, 2).ToString());
                            }
                            else
                            {
                                TableSearchRoleSexStatistic.Rows[totalInfoIndex + 1].Cells[3].Text = "0 (0%)";
                            }
                            break;
                    }                    
                }
            }

            //三类职业总统计
            string typeStat = "{0}<br/>" + StringDef.Male + StringDef.Colon + "{1} {2}<br/>" + StringDef.Female + StringDef.Colon + "{3} {4}<br/>"+StringDef.Count+StringDef.Colon+" {5}";
            TableSearchRoleSexStatistic.Rows[1].Cells[5].Text = string.Format(typeStat,
                                    StringDef.Jiashi,
                                    totalMaleJia,
                                    totalMaleJia + totalFemaleJia == 0 ? string.Empty : string.Format("({0}%)", Decimal.Round((decimal)totalMaleJia / (totalMaleJia + totalFemaleJia) * 100, 2)),
                                    totalFemaleJia,
                                    totalMaleJia + totalFemaleJia == 0 ? string.Empty : string.Format("({0}%)", Decimal.Round((decimal)totalFemaleJia / (totalMaleJia + totalFemaleJia) * 100, 2)),
                                    totalMaleJia + totalFemaleJia);
            
            TableSearchRoleSexStatistic.Rows[4].Cells[5].Text = string.Format(typeStat,
                                    StringDef.Daoshi,
                                    totalMaleDao,
                                    totalMaleDao + totalFemaleDao == 0 ? string.Empty : string.Format("({0}%)", Decimal.Round((decimal)totalMaleDao / (totalMaleDao + totalFemaleDao) * 100, 2)),
                                    totalFemaleDao,
                                    totalMaleDao + totalFemaleDao == 0 ? string.Empty : string.Format("({0}%)", Decimal.Round((decimal)totalFemaleDao / (totalMaleDao + totalFemaleDao) * 100, 2)),
                                    totalMaleDao + totalFemaleDao);

            TableSearchRoleSexStatistic.Rows[7].Cells[5].Text = string.Format(typeStat,
                                    StringDef.Yiren,
                                    totalMaleYi,
                                    totalMaleYi + totalFemaleYi == 0 ? string.Empty : string.Format("({0}%)", Decimal.Round((decimal)totalMaleYi / (totalMaleYi + totalFemaleYi) * 100, 2)),
                                    totalFemaleYi,
                                    totalMaleYi + totalFemaleYi == 0 ? string.Empty : string.Format("({0}%)", Decimal.Round((decimal)totalFemaleYi / (totalMaleYi + totalFemaleYi) * 100, 2)),
                                    totalMaleYi + totalFemaleYi);

            TableRow rowTotal = new TableRow();
            rowTotal.Font.Bold = true;
            TableCell cell = new TableCell();
            cell.ColumnSpan = 2;
            cell.Text = StringDef.Total;
            rowTotal.Cells.Add(cell);
            cell = new TableCell();
            if(totalMale!=0)
            {
                cell.Text = string.Format("{0} ({1}%)", totalMale, Decimal.Round((decimal)totalMale / (totalMale + totalFemale) * 100, 2));
            }
            else 
            {cell.Text = "0";}
            rowTotal.Cells.Add(cell);
            cell = new TableCell();
            if (totalFemale != 0)
            {
                cell.Text = string.Format("{0} ({1}%)", totalFemale, Decimal.Round((decimal)totalFemale / (totalMale + totalFemale) * 100, 2));
            }
            else
            { cell.Text = "0"; }
            rowTotal.Cells.Add(cell);
            cell = new TableCell();
            cell.ColumnSpan = 2;
            if ((totalMale + totalFemale) != 0)
            {
                cell.Text = string.Format("{0} (100%)", totalMale + totalFemale);
            }
            else { cell.Text = "0"; }
            rowTotal.Cells.Add(cell);
            TableSearchRoleSexStatistic.Rows.Add(rowTotal);
        }
        return true;
    }
Example #20
0
    private bool CreateSearchRoleResultList(int serverId, FS2RoleDataInfo[] roles)
    {
        if (roles != null && roles.Length > 0)
        {
            for (int i = 0; i < roles.Length; i++)
            {
                FS2RoleDataInfo info = roles[i];
                TableRow row = new TableRow();

                TableCell cell = new TableCell();
                HyperLink link = new HyperLink();
                link.Target = "_blank";
                link.NavigateUrl = "~/GameMaster/RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId.ToString();
                link.Text = info.RoleName;
                link.SkinID = "PlainText";
                cell.Controls.Add(link);
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = info.AccountName;
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = info.RoleLevel.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                string classDescription = string.Empty;
                switch (info.RoleType)
                {
                    case FS2RoleType.Jiashi:
                        classDescription = StringDef.Jiashi;
                        break;
                    case FS2RoleType.Xuanfeng:
                        classDescription = StringDef.XuanFeng;
                        break;
                    case FS2RoleType.Xingtian:
                        classDescription = StringDef.XingTian;
                        break;
                    case FS2RoleType.Daoshi:
                        classDescription = StringDef.Daoshi;
                        break;
                    case FS2RoleType.Zhenren:
                        classDescription = StringDef.ZhenRen;
                        break;
                    case FS2RoleType.Tianshi:
                        classDescription = StringDef.TianShi;
                        break;
                    case FS2RoleType.Yiren:
                        classDescription = StringDef.Yiren;
                        break;
                    case FS2RoleType.Shoushi:
                        classDescription = StringDef.ShouShi;
                        break;
                    case FS2RoleType.Yishi:
                        classDescription = StringDef.YiShi;
                        break;
                }
                cell.Text = classDescription;
                row.Cells.Add(cell);

                cell = new TableCell();

                TableSearchRoleList.Rows.Add(row);
            }
            return true;
        }

        
        return false;
    }
Example #21
0
    void Query(int offset)
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList paramList = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            StringBuilder roleTypeBuilder = new StringBuilder();
            foreach (ListItem item in CheckBoxListRoleType.Items)
            {
                if (item.Selected)
                {
                    string[] conValue = item.Value.Split(',');
                    roleTypeBuilder.AppendFormat("({0}='{1}' AND {2}='{3}') OR ", FS2TableString.RolesfirstFieldRoleType, conValue[0], FS2TableString.RolesfirstFieldSkillSeries, conValue[1]);
                }
            }
            if (roleTypeBuilder.Length != 0)
            {
                searchCondition.AppendFormat(" AND ({0}) ", roleTypeBuilder.ToString(0, roleTypeBuilder.Length - 3));
            }
            else
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleClass);
                return;
            }

            int startLevel = int.Parse(TextBoxStartLevel.Text);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", FS2TableString.RolesfirstFieldRoleLevel, startLevel));
            }

            int endLevel = int.Parse(TextBoxEndLevel.Text);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", FS2TableString.RolesfirstFieldRoleLevel, endLevel));
            }

            DateTime activeDate = CalendarDate.SelectedDate;
            if (activeDate == DateTime.MinValue)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgInputParamNotCorrect, StringDef.Date);
                return;
            }
            switch (StatisticType.SelectedIndex)
            {
                case -1:
                    LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.Statistic + StringDef.Type);
                    return;
                case 0:
                    //活跃玩家
                    searchCondition.AppendFormat(" AND {0}>='{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                    break;
                case 1:
                    //不活跃玩家
                    searchCondition.AppendFormat(" AND {0}<'{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                    break;
                case 2:
                    //流失玩家
                    searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<'{2}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan).AddDays(-WebConfig.ActivePlayerDayValue), activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                    break;
            }

            if (searchCondition.Length > 0)
            {
                searchCondition.Remove(0, 4);
                searchCondition.Insert(0, " WHERE");
            }

            string orderByType = string.Empty;
            switch (ListBoxOrderByType.SelectedIndex)
            {
                case 0:
                    orderByType = "ASC";
                    break;
                case 1:
                    orderByType = "DESC";
                    break;
            }

            string orderByStatement = string.Empty;
            switch (ListBoxOrderBy.SelectedIndex)
            {
                case 0:
                    orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleName, orderByType);
                    break;
                case 1:
                    orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleLevel, orderByType);
                    break;
            }

            int limitCount = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount);

            string cmdText = "SELECT {0} FROM {1} {2} {3} {4}";
            string cmdFieldText = "Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries";

            SqlCommand cmd = new SqlCommand(string.Format(cmdText, cmdFieldText, FS2TableString.RolesfirstTableName,
                            searchCondition.ToString(), orderByStatement, limitStatement));
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                Session[WebConfig.SessionQueryLogOffset] = offset;

                result.SetFieldType(
                new SqlDataType[] {
                            SqlDataType.Int32,
							SqlDataType.String,
							SqlDataType.String,
							SqlDataType.SByte,
							SqlDataType.SByte,
							SqlDataType.SByte,
                            SqlDataType.Int32
						});

                ArrayList roleList = new ArrayList();
                object[] record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo role = new FS2RoleDataInfo();
                    role.RoleId = (int)record[0];
                    role.AccountName = record[1] as string;
                    role.RoleName = record[2] as string;
                    role.RoleLevel = (SByte)record[5];
                    role.SkillSeries = (int)record[6];
                    switch ((SByte)record[4])
                    {
                        case (SByte)0:
                            if (role.SkillSeries == 0) role.RoleType = FS2RoleType.Xuanfeng;
                            else if (role.SkillSeries == 1) role.RoleType = FS2RoleType.Xingtian;
                            else role.RoleType = FS2RoleType.Jiashi;
                            break;
                        case (SByte)1:
                            if (role.SkillSeries == 0) role.RoleType = FS2RoleType.Zhenren;
                            else if (role.SkillSeries == 1) role.RoleType = FS2RoleType.Tianshi;
                            else role.RoleType = FS2RoleType.Daoshi;
                            break;
                        case (SByte)2:
                            if (role.SkillSeries == 0) role.RoleType = FS2RoleType.Shoushi;
                            else if (role.SkillSeries == 1) role.RoleType = FS2RoleType.Yishi;
                            else role.RoleType = FS2RoleType.Yiren;
                            break;
                    }

                    roleList.Add(role);
                }

                ButtonPreviousPage.Enabled = (offset > 0);
                ButtonFirstPage.Enabled = (offset > 0);
                ButtonNextPage.Enabled = (roleList.Count >= limitCount);

                bool success = CreateSearchRoleResultList(server.Id, (FS2RoleDataInfo[])roleList.ToArray(typeof(FS2RoleDataInfo)));
                PanelResult.Visible = success;

                if (!success)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                }
                else
                {
                    LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name, server.Name,
                                            string.Format(StringDef.LabelRoleLevel, startLevel, endLevel),
                                            StatisticType.SelectedItem.Text);
                }
            }
            else
            {
                if (result == null)
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                else
                    LabelOpMsg.Text = StringDef.OperationFail;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
            PanelResult.Visible = false;
        }
    }
Example #22
0
    private bool CreateSearchRoleResultList(int serverId, FS2RoleDataInfo[] roles)
    {
        if (roles != null && roles.Length > 0)
        {
            FS2RoleDataInfo info = null;
            for (int i = 0; i < roles.Length; i++)
            {
                info = roles[i];
                TableRow row = new TableRow();

                TableCell cell = new TableCell();
                cell.Text = info.RoleId.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                HyperLink link = new HyperLink();
                link.Target = "_blank";
                link.NavigateUrl = "RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId;
                link.Text = info.RoleName;
                link.SkinID = "PlainText";
                cell.Controls.Add(link);
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Text = info.AccountName;
                row.Cells.Add(cell);

                cell = new TableCell();
                if (info.TongName != null && info.TongName.Length != 0)
                {
                    cell.Text = info.TongName;
                }
                else
                {
                    cell.Text = StringDef.None;
                }
                row.Cells.Add(cell);

                cell = new TableCell();
                cell.Font.Bold = true;
                cell.Text = info.RoleLevel.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                Image sexImage = new Image();
                switch (info.RoleSex)
                {
                    case FS2RoleSex.Male:
                        sexImage.ToolTip = StringDef.Male;
                        sexImage.ImageUrl = "~/Image/male.gif";
                        break;
                    case FS2RoleSex.Female:
                        sexImage.ToolTip = StringDef.Female;
                        sexImage.ImageUrl = "~/Image/female.gif";
                        break;

                }
                cell.Controls.Add(sexImage);
                row.Cells.Add(cell);

                cell = new TableCell();
                string classDescription = string.Empty;
                switch (info.RoleType)
                {
                    case FS2RoleType.Jiashi:
                        classDescription = StringDef.Jiashi;
                        break;
                    case FS2RoleType.Xuanfeng:
                        classDescription = StringDef.XuanFeng;
                        break;
                    case FS2RoleType.Xingtian:
                        classDescription = StringDef.XingTian;
                        break;
                    case FS2RoleType.Daoshi:
                        classDescription = StringDef.Daoshi;
                        break;
                    case FS2RoleType.Zhenren:
                        classDescription = StringDef.ZhenRen;
                        break;
                    case FS2RoleType.Tianshi:
                        classDescription = StringDef.TianShi;
                        break;
                    case FS2RoleType.Yiren:
                        classDescription = StringDef.Yiren;
                        break;
                    case FS2RoleType.Shoushi:
                        classDescription = StringDef.ShouShi;
                        break;
                    case FS2RoleType.Yishi:
                        classDescription = StringDef.YiShi;
                        break;
                }
                cell.Text = classDescription;
                row.Cells.Add(cell);
                cell = new TableCell();
                cell.Wrap = false;
                link = new HyperLink();
                link.Text = StringDef.ExecuteGMCommand;
                link.SkinID = "PlainText";
                link.NavigateUrl = "GMCommand.aspx?serverId=" + serverId + "&roleName=" + Server.UrlEncode(info.RoleName);
                link.Width = new Unit(40,UnitType.Percentage);
                cell.Controls.Add(link);
                link = new HyperLink();
                link.Text = StringDef.ExpStatistic;
                link.SkinID = "PlainText";
                link.NavigateUrl = "~/GameInfo/ExpStatistic.aspx?serverId=" + serverId + "&roleName=" + Server.UrlEncode(info.RoleName);
                link.Width = new Unit(40, UnitType.Percentage);
                cell.Controls.Add(link);
                row.Cells.Add(cell);

                TableSearchRoleList.Rows.Add(row);
            }

            return true;
        }

        return false;
    }
    void QueryRole(int serverId, string NodeGUID)
    {
        try
        {
            GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverId);
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }

            ArrayList paramList = new ArrayList();
            string    cmdText   = "SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries,NoChatIn,NoLoginIn,Online FROM rolesfirst WHERE {0}='?' ORDER BY RoleName";
            paramList.Add(NodeGUID);

            SqlCommand cmd    = new SqlCommand(string.Format(cmdText, FS2TableString.RolesfirstFieldTongGUID), paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

            if (result != null && result.Success)
            {
                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.Int32,
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.Int32,
                    SqlDataType.Int32,
                    SqlDataType.Int32,
                    SqlDataType.Int32
                });

                ArrayList roles  = new ArrayList();
                object[]  record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.RoleId      = (int)record[0];
                    info.AccountName = (string)record[1];
                    info.RoleName    = (string)record[2];
                    info.RoleSex     = (FS2RoleSex)(SByte)record[3];
                    info.SkillSeries = (int)record[6];
                    switch ((SByte)record[4])
                    {
                    case (SByte)0:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Xuanfeng;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Xingtian;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Jiashi;
                        }
                        break;

                    case (SByte)1:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Zhenren;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Tianshi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Daoshi;
                        }
                        break;

                    case (SByte)2:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Shoushi;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Yishi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Yiren;
                        }
                        break;
                    }
                    info.RoleLevel = (SByte)record[5];
                    info.NoChatIn  = (int)record[7];
                    info.NoLoginIn = (int)record[8];
                    info.Online    = (int)record[9];

                    roles.Add(info);
                }

                DataGridRole.DataSource = CreateDataSource(roles, server.Id);
                DataGridRole.DataBind();

                if (roles == null || roles.Count != 0)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                }
            }
            else
            {
                LabelOpMsg.Text = StringDef.Query + StringDef.Failure;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
        }
    }
Example #24
0
    void Query(int offset)
    {
        try
        {            
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList paramList = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            //string tong = TextBoxTong.Text;
            //if (tong.Length > 0)
            //{
            //    if (CheckBoxTong.Checked)
            //    {
            //        searchCondition.Append(string.Format(" AND {0}='?'", FS2TableString.RolesfirstFieldTongGUID));
            //    }
            //    else
            //    {
            //        searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", FS2TableString.RolesfirstFieldTongGUID));
            //    }
            //    paramList.Add(tong);
            //}

            searchCondition.Append(string.Format("{0} = {1}", " WHERE " + FS2TableString.RolesfirstFieldOnline, "1"));

            int sex = ListBoxSex.SelectedIndex - 1;
            if (sex >= 0)
            {
                searchCondition.Append(string.Format(" AND {0}={1}", FS2TableString.RolesfirstFieldRoleSex, sex));
            }

            StringBuilder roleTypeBuilder = new StringBuilder();
            foreach (ListItem item in CheckBoxListRoleType.Items)
            {
                if (item.Selected)
                {
                    string[] conValue = item.Value.Split(',');
                    roleTypeBuilder.AppendFormat("({0}='{1}' AND {2}='{3}') OR ", FS2TableString.RolesfirstFieldRoleType, conValue[0], FS2TableString.RolesfirstFieldSkillSeries, conValue[1]);
                }
            }
            if (roleTypeBuilder.Length != 0)
            {
                searchCondition.AppendFormat(" AND ({0}) ", roleTypeBuilder.ToString(0, roleTypeBuilder.Length - 3));
            }
            else
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleClass);
                return;
            }    

            //int roleClass = ListBoxRoleClass.SelectedIndex - 1;
            //if (roleClass >= 0)
            //{
            //    string[] conValue = ListBoxRoleClass.SelectedValue.Split(',');
            //    searchCondition.Append(string.Format(" AND {0}='{1}' AND {2}='{3}'", FS2TableString.RolesfirstFieldRoleType, conValue[0], FS2TableString.RolesfirstFieldSkillSeries, conValue[1]));
            //}

            int startLevel = int.Parse(TextBoxStartLevel.Text);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", FS2TableString.RolesfirstFieldRoleLevel, startLevel));
            }

            int endLevel = int.Parse(TextBoxEndLevel.Text);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", FS2TableString.RolesfirstFieldRoleLevel, endLevel));
            }

            string orderByType = string.Empty;
            switch (ListBoxOrderByType.SelectedIndex)
            {
                case 0:
                    orderByType = "ASC";
                    break;
                case 1:
                    orderByType = "DESC";
                    break;
            }

            string orderByStatement = string.Empty;
            switch (ListBoxOrderBy.SelectedIndex)
            {
                case 0:
                    orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldId, orderByType);
                    break;
                case 1:
                    orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleLevel, orderByType);
                    break;
                case 2:
                    orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleName, orderByType);
                    break;
            }

            int limitCount = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount + 1);

            SqlCommand cmd = new SqlCommand("SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries FROM rolesfirst" + searchCondition.ToString() + orderByStatement + limitStatement, paramList.ToArray());
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                Session[WebConfig.SessionQueryLogOffset] = offset;

                result.SetFieldType(
                        new SqlDataType[] {
						SqlDataType.Int32,
						SqlDataType.String,
						SqlDataType.String,
						SqlDataType.SByte,
						SqlDataType.SByte,
						SqlDataType.SByte,
                        SqlDataType.Int32
					});

                ArrayList roles = new ArrayList();
                object[] record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.RoleId = (int)record[0];
                    info.AccountName = (string)record[1];
                    info.RoleName = (string)record[2];
                    info.RoleSex = (FS2RoleSex)((SByte)record[3]);

                    info.SkillSeries = (int)record[6];
                    switch ((SByte)record[4])
                    {
                        case (SByte)0:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Xuanfeng;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Xingtian;
                            else info.RoleType = FS2RoleType.Jiashi;
                            break;
                        case (SByte)1:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Zhenren;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Tianshi;
                            else info.RoleType = FS2RoleType.Daoshi;
                            break;
                        case (SByte)2:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Shoushi;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Yishi;
                            else info.RoleType = FS2RoleType.Yiren;
                            break;
                    }

                    info.RoleLevel = (SByte)record[5];

                    roles.Add(info);
                }

                ButtonPreviousPage.Enabled = (offset > 0);
                ButtonFirstPage.Enabled = (offset > 0);
                ButtonNextPage.Enabled = (roles.Count > limitCount);

                bool success = CreateSearchRoleResultList(server.Id, (FS2RoleDataInfo[])roles.ToArray(typeof(FS2RoleDataInfo)));
                PanelResult.Visible = success;

                if (!success)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                    return;
                }
            }
            else
            {
                if (result == null)
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                else
                    LabelOpMsg.Text = StringDef.OperationFail;
            }	
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
            PanelResult.Visible = false;
        }
    }
Example #25
0
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!WebUtil.CheckPrivilege(WebConfig.FunctionGameMasterRoleDetail, OpType.READ, Session))
		{
			Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
		}

		try
		{
			ClearMessage();

			if (!IsPostBack)
			{
				if (Request.Params[WebConfig.ParamServerId] != null)
				{
					int serverId = int.Parse(Request.Params[WebConfig.ParamServerId]);
                    ViewState[WebConfig.ParamServerId] = serverId;

					object queryRoleArg = null;
					if (Request.Params[WebConfig.ParamRoleId] != null)
					{
						queryRoleArg = int.Parse(Request.Params[WebConfig.ParamRoleId]);
					}
					else if (Request.Params[WebConfig.ParamRoleName] != null)
					{
                        //传RoleName时需要对其编码, 否则中文名有时不正常。
						queryRoleArg = Server.UrlDecode(Request.Params[WebConfig.ParamRoleName]);
					}

					_server = AdminServer.TheInstance.GameServerManager.GetGameServer(serverId);

					if (_server == null)
						return;

                    if (!WebUtil.CheckPrivilege(_server.SecurityObject, OpType.READ, Session))
                    {
                        Response.Redirect(WebConfig.PageNotEnoughPrivilege);
                    }

					_role = SetRoleData(_server, queryRoleArg);
                    if (_role == null) throw new Exception();

					Session["role"] = _role;
					Session["server"] = _server;

                    LinkRoleItemInfo.NavigateUrl = string.Format("RoleItemInfo.aspx?{0}={1}&{2}={3}",
                        WebConfig.ParamServerId, serverId, WebConfig.ParamRoleId, _role.RoleId);
                    LinkRoleSkillInfo.NavigateUrl = string.Format("RoleSkillInfo.aspx?{0}={1}&{2}={3}",
                        WebConfig.ParamServerId, serverId, WebConfig.ParamRoleId, _role.RoleId);
                    LinkExpStatistic.NavigateUrl = string.Format("~/GameInfo/ExpStatistic.aspx?{0}={1}&{2}={3}",
                        WebConfig.ParamServerId, serverId, WebConfig.ParamRoleName, Server.UrlEncode(_role.RoleName));
                    LinkExecuteGMCommand.NavigateUrl = string.Format("GMCommand.aspx?{0}={1}&{2}={3}",
                        WebConfig.ParamServerId, serverId, WebConfig.ParamRoleName, Server.UrlEncode(_role.RoleName));

					LinkDownloadData.NavigateUrl = string.Format("GameMasterHandler.ashx?{0}={1}&{2}={3}&{4}={5}", WebConfig.ParamRoleId, _role.RoleId, WebConfig.ParamServerId, serverId, WebConfig.ParamOperation, "GetRoleDataSql");
                    LinkViewAccountInfo.NavigateUrl = string.Format("~/Paysys/AccountInfo.aspx?{0}={1}",
                                WebConfig.ParamAccount, _role.AccountName);

					SetRoleBasicInfo(_role);	
				
                    //操作的LinkButton的Text
                    LinkButtonTalk.Text = _role.NoChatIn == 0 ? StringDef.ChatDisable : StringDef.ChatEnable;
                    LinkButtonFreeze.Text = _role.NoLoginIn == 0 ? StringDef.Freeze : StringDef.Unfreeze;
                    LinkButtonSave.Text = StringDef.SaveByForce;
                    LinkButtonQuit.Text = StringDef.QuitByForce;
                    LinkClanInfo.Text = StringDef.Clan + StringDef.Information;
                    if (_role.Online == 0)
                    {
                        LinkButtonSave.Enabled = false;
                        LinkButtonQuit.Enabled = false;
                    }
				}
				else
				{
					Response.Redirect("QueryRole.aspx");
				}
			}
			else
			{
                _role = Session["role"] as FS2RoleDataInfo;
				_server = Session["server"] as GameServer;
			}
		}
		catch (Exception)
		{
			Response.Redirect("QueryRole.aspx");
		}

	}
Example #26
0
 private void RenderAll(FS2RoleDataInfo roleInfo)
 {
     ArrayList itemInBody = new ArrayList();
     ArrayList itemInBag = new ArrayList();
     ArrayList itemInStorage = new ArrayList();
     if (roleInfo.ItemList == null || roleInfo.ItemList.Count == 0) return;
     foreach (FS2ItemDataInfo itemInfo in roleInfo.ItemList)
     {
         switch (itemInfo.Local)
         {
             case (byte)ItemPosition.PosEquip:
                 itemInBody.Add(itemInfo);
                 break;
             case (byte)ItemPosition.PosEquiproom:
                 itemInBag.Add(itemInfo);
                 break;
             case (byte)ItemPosition.PosRepositoryroom:
                 itemInStorage.Add(itemInfo);
                 break;
         }
     }
     RenderEquipedItem((FS2ItemDataInfo[])itemInBody.ToArray(typeof(FS2ItemDataInfo)));
     RenderItemInfo((FS2ItemDataInfo[])itemInBag.ToArray(typeof(FS2ItemDataInfo)), 1,DivRoleItem);
     RenderItemInfo((FS2ItemDataInfo[])itemInStorage.ToArray(typeof(FS2ItemDataInfo)), 1, DivItemStorage);
 }
Example #27
0
    private FS2RoleDataInfo SetRoleData(GameServer server, object arg)
    {
        if (server != null)
        {
            SqlCommand cmd = null;
            if (arg.GetType() == typeof(int))
            {
                cmd = new SqlCommand(
                    string.Format("SELECT {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{24},{25} FROM {22} WHERE {23}='?'",
                                  FS2TableString.RolesfirstFieldId,
                                  FS2TableString.RolesfirstFieldTongGUID,
                                  FS2TableString.RolesfirstFieldAccountName,
                                  FS2TableString.RolesfirstFieldRoleName,
                                  FS2TableString.RolesfirstFieldRoleSex,
                                  FS2TableString.RolesfirstFieldRoleType,
                                  FS2TableString.RolesfirstFieldRoleLevel,
                                  FS2TableString.RolesfirstFieldMoney,
                                  FS2TableString.RolesfirstFieldMoneyInBox,
                                  FS2TableString.RolesfirstFieldPlayedTime,
                                  FS2TableString.RolesfirstFieldCreateDate,
                                  FS2TableString.RolesfirstFieldLastPlayingDate,
                                  FS2TableString.RolesfirstFieldLastPlayingIP,
                                  FS2TableString.RolesfirstFieldNoChatIn,
                                  FS2TableString.RolesfirstFieldNoLoginIn,
                                  FS2TableString.RolesfirstFieldUseRevivePosition,
                                  FS2TableString.RolesfirstFieldReviveID,
                                  FS2TableString.RolesfirstFieldReviveX,
                                  FS2TableString.RolesfirstFieldReviveY,
                                  FS2TableString.RolesfirstFieldEnterMapID,
                                  FS2TableString.RolesfirstFieldGUID,
                                  FS2TableString.RolesfirstFieldOnline,
                                  FS2TableString.RolesfirstTableName,
                                  FS2TableString.RolesfirstFieldId,
                                  FS2TableString.RolesfirstFieldSkillSeries,
                                  FS2TableString.RolesfirstFieldSpyLevel),
                    arg
                    );
            }
            else if (arg.GetType() == typeof(string))
            {
                cmd = new SqlCommand(
                    string.Format("SELECT {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{24},{25} FROM {22} WHERE {23}='?'",
                                  FS2TableString.RolesfirstFieldId,
                                  FS2TableString.RolesfirstFieldTongGUID,
                                  FS2TableString.RolesfirstFieldAccountName,
                                  FS2TableString.RolesfirstFieldRoleName,
                                  FS2TableString.RolesfirstFieldRoleSex,
                                  FS2TableString.RolesfirstFieldRoleType,
                                  FS2TableString.RolesfirstFieldRoleLevel,
                                  FS2TableString.RolesfirstFieldMoney,
                                  FS2TableString.RolesfirstFieldMoneyInBox,
                                  FS2TableString.RolesfirstFieldPlayedTime,
                                  FS2TableString.RolesfirstFieldCreateDate,
                                  FS2TableString.RolesfirstFieldLastPlayingDate,
                                  FS2TableString.RolesfirstFieldLastPlayingIP,
                                  FS2TableString.RolesfirstFieldNoChatIn,
                                  FS2TableString.RolesfirstFieldNoLoginIn,
                                  FS2TableString.RolesfirstFieldUseRevivePosition,
                                  FS2TableString.RolesfirstFieldReviveID,
                                  FS2TableString.RolesfirstFieldReviveX,
                                  FS2TableString.RolesfirstFieldReviveY,
                                  FS2TableString.RolesfirstFieldEnterMapID,
                                  FS2TableString.RolesfirstFieldGUID,
                                  FS2TableString.RolesfirstFieldOnline,
                                  FS2TableString.RolesfirstTableName,
                                  FS2TableString.RolesfirstFieldRoleName,
                                  FS2TableString.RolesfirstFieldSkillSeries,
                                  FS2TableString.RolesfirstFieldSpyLevel),
                    arg
                    );
            }

            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return(null);
            }
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null)
            {
                if (result.Success)
                {
                    result.SetFieldType(
                        new SqlDataType[] {
                        SqlDataType.Int32,
                        SqlDataType.String,
                        SqlDataType.String,
                        SqlDataType.String,
                        SqlDataType.SByte,
                        SqlDataType.SByte,
                        SqlDataType.SByte,
                        SqlDataType.UInt32,
                        SqlDataType.UInt32,
                        SqlDataType.UInt32,
                        SqlDataType.DateTime,
                        SqlDataType.DateTime,
                        SqlDataType.Int64,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.Byte,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.String,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.Int32
                    });

                    object[] record = result.ReadRecord();
                    if (record != null)
                    {
                        FS2RoleDataInfo role = new FS2RoleDataInfo();
                        role.RoleId      = (int)record[0];
                        role.TongName    = (string)record[1];
                        role.AccountName = (string)record[2];
                        role.RoleName    = (string)record[3];
                        role.RoleSex     = (FS2RoleSex)(int.Parse(record[4].ToString()));
                        role.SkillSeries = (int)record[22];
                        switch ((SByte)record[5])
                        {
                        case (SByte)0:
                            if (role.SkillSeries == 0)
                            {
                                role.RoleType = FS2RoleType.Xuanfeng;
                            }
                            else if (role.SkillSeries == 1)
                            {
                                role.RoleType = FS2RoleType.Xingtian;
                            }
                            else
                            {
                                role.RoleType = FS2RoleType.Jiashi;
                            }
                            break;

                        case (SByte)1:
                            if (role.SkillSeries == 0)
                            {
                                role.RoleType = FS2RoleType.Zhenren;
                            }
                            else if (role.SkillSeries == 1)
                            {
                                role.RoleType = FS2RoleType.Tianshi;
                            }
                            else
                            {
                                role.RoleType = FS2RoleType.Daoshi;
                            }
                            break;

                        case (SByte)2:
                            if (role.SkillSeries == 0)
                            {
                                role.RoleType = FS2RoleType.Shoushi;
                            }
                            else if (role.SkillSeries == 1)
                            {
                                role.RoleType = FS2RoleType.Yishi;
                            }
                            else
                            {
                                role.RoleType = FS2RoleType.Yiren;
                            }
                            break;
                        }
                        role.RoleLevel         = int.Parse(record[6].ToString());
                        role.Money             = (uint)record[7];
                        role.MoneyInBox        = (uint)record[8];
                        role.PlayedTime        = (uint)record[9];
                        role.CreateDate        = (DateTime)record[10];
                        role.LastPlayingDate   = (DateTime)record[11];
                        role.LastPlayingIP     = new System.Net.IPAddress((Int64)record[12]);
                        role.NoChatIn          = (int)record[13];
                        role.NoLoginIn         = (int)record[14];
                        role.UseRevivePosition = (byte)record[15];
                        role.ReviveID          = (int)record[16];
                        role.ReviveX           = (int)record[17];
                        role.ReviveY           = (int)record[18];
                        role.EnterMapId        = (int)record[19];
                        role.RoleGuid          = (string)record[20];
                        role.Online            = (int)record[21];
                        role.SpyLevel          = (int)record[23];

                        //查询氏族名称
                        if (role.TongName != null && role.TongName.Length != 0)
                        {
                            SqlCommand tongNameCmd = new SqlCommand(string.Format("SELECT {0} FROM {1} WHERE {2}='?'",
                                                                                  FS2TableString.SocialrelationFieldNodeName, FS2TableString.SocialrelationTableName,
                                                                                  FS2TableString.SocialrelationFieldNodeGUID), role.TongName);
                            SqlResult tongNameResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, tongNameCmd);
                            if (tongNameResult != null && tongNameResult.Success)
                            {
                                tongNameResult.SetFieldType(new SqlDataType[] {
                                    SqlDataType.String
                                });
                                object[] tongNameRecord = tongNameResult.ReadRecord();
                                if (tongNameRecord != null && tongNameRecord.Length > 0)
                                {
                                    ViewState[WebConfig.ParamNodeGUID] = role.TongName;
                                    role.TongName = tongNameRecord[0] as string;
                                    //ViewState[WebConfig.ParamNodeGUID] 在role.TongName被改变后不变?!
                                }
                            }
                        }

                        return(role);
                    }
                }
            }
        }

        return(null);
    }
Example #28
0
    private ArrayList GetItemList(FS2RoleDataInfo roleInfo, ItemPosition type)
    {
        //LabelTitle.Text += string.Format("[{0}]物品信息", roleInfo.RoleName);

        ArrayList itemList = new ArrayList();

        foreach (FS2ItemDataInfo itemInfo in roleInfo.ItemList)
        {
            if(itemInfo.Local.Equals((byte)type))
            {
                itemList.Add(itemInfo);                
            }
        }
        //if (renderRoleSate) RenderRoleState((FS2ItemDataInfo[])itemInBody.ToArray(typeof(FS2ItemDataInfo)));
        return itemList;
    }
Example #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtil.CheckPrivilege(WebConfig.FunctionGameMasterRoleDetail, OpType.READ, Session))
        {
            Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
        }

        try
        {
            ClearMessage();

            if (!IsPostBack)
            {
                if (Request.Params[WebConfig.ParamServerId] != null)
                {
                    int serverId = int.Parse(Request.Params[WebConfig.ParamServerId]);
                    ViewState[WebConfig.ParamServerId] = serverId;

                    object queryRoleArg = null;
                    if (Request.Params[WebConfig.ParamRoleId] != null)
                    {
                        queryRoleArg = int.Parse(Request.Params[WebConfig.ParamRoleId]);
                    }
                    else if (Request.Params[WebConfig.ParamRoleName] != null)
                    {
                        //传RoleName时需要对其编码, 否则中文名有时不正常。
                        queryRoleArg = Server.UrlDecode(Request.Params[WebConfig.ParamRoleName]);
                    }

                    _server = AdminServer.TheInstance.GameServerManager.GetGameServer(serverId);

                    if (_server == null)
                    {
                        return;
                    }

                    if (!WebUtil.CheckPrivilege(_server.SecurityObject, OpType.READ, Session))
                    {
                        Response.Redirect(WebConfig.PageNotEnoughPrivilege);
                    }

                    _role = SetRoleData(_server, queryRoleArg);
                    if (_role == null)
                    {
                        throw new Exception();
                    }

                    Session["role"]   = _role;
                    Session["server"] = _server;

                    LinkRoleItemInfo.NavigateUrl = string.Format("RoleItemInfo.aspx?{0}={1}&{2}={3}",
                                                                 WebConfig.ParamServerId, serverId, WebConfig.ParamRoleId, _role.RoleId);
                    LinkRoleSkillInfo.NavigateUrl = string.Format("RoleSkillInfo.aspx?{0}={1}&{2}={3}",
                                                                  WebConfig.ParamServerId, serverId, WebConfig.ParamRoleId, _role.RoleId);
                    LinkExpStatistic.NavigateUrl = string.Format("~/GameInfo/ExpStatistic.aspx?{0}={1}&{2}={3}",
                                                                 WebConfig.ParamServerId, serverId, WebConfig.ParamRoleName, Server.UrlEncode(_role.RoleName));
                    LinkExecuteGMCommand.NavigateUrl = string.Format("GMCommand.aspx?{0}={1}&{2}={3}",
                                                                     WebConfig.ParamServerId, serverId, WebConfig.ParamRoleName, Server.UrlEncode(_role.RoleName));

                    LinkDownloadData.NavigateUrl    = string.Format("GameMasterHandler.ashx?{0}={1}&{2}={3}&{4}={5}", WebConfig.ParamRoleId, _role.RoleId, WebConfig.ParamServerId, serverId, WebConfig.ParamOperation, "GetRoleDataSql");
                    LinkViewAccountInfo.NavigateUrl = string.Format("~/Paysys/AccountInfo.aspx?{0}={1}",
                                                                    WebConfig.ParamAccount, _role.AccountName);

                    SetRoleBasicInfo(_role);

                    //操作的LinkButton的Text
                    LinkButtonTalk.Text   = _role.NoChatIn == 0 ? StringDef.ChatDisable : StringDef.ChatEnable;
                    LinkButtonFreeze.Text = _role.NoLoginIn == 0 ? StringDef.Freeze : StringDef.Unfreeze;
                    LinkButtonSave.Text   = StringDef.SaveByForce;
                    LinkButtonQuit.Text   = StringDef.QuitByForce;
                    LinkClanInfo.Text     = StringDef.Clan + StringDef.Information;
                    if (_role.Online == 0)
                    {
                        LinkButtonSave.Enabled = false;
                        LinkButtonQuit.Enabled = false;
                    }
                }
                else
                {
                    Response.Redirect("QueryRole.aspx");
                }
            }
            else
            {
                _role   = Session["role"] as FS2RoleDataInfo;
                _server = Session["server"] as GameServer;
            }
        }
        catch (Exception)
        {
            Response.Redirect("QueryRole.aspx");
        }
    }
    void Query(int offset)
    {
        try
        {
            GameServer server = ServerDropDownList.SelectedGameServer;
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            ArrayList     paramList       = new ArrayList();
            StringBuilder searchCondition = new StringBuilder();

            StringBuilder roleTypeBuilder = new StringBuilder();
            foreach (ListItem item in CheckBoxListRoleType.Items)
            {
                if (item.Selected)
                {
                    string[] conValue = item.Value.Split(',');
                    roleTypeBuilder.AppendFormat("({0}='{1}' AND {2}='{3}') OR ", FS2TableString.RolesfirstFieldRoleType, conValue[0], FS2TableString.RolesfirstFieldSkillSeries, conValue[1]);
                }
            }
            if (roleTypeBuilder.Length != 0)
            {
                searchCondition.AppendFormat(" AND ({0}) ", roleTypeBuilder.ToString(0, roleTypeBuilder.Length - 3));
            }
            else
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.RoleClass);
                return;
            }

            int startLevel = int.Parse(TextBoxStartLevel.Text);
            if (startLevel > 1)
            {
                searchCondition.Append(string.Format(" AND {0}>={1}", FS2TableString.RolesfirstFieldRoleLevel, startLevel));
            }

            int endLevel = int.Parse(TextBoxEndLevel.Text);
            if (endLevel < FS2GameDataManager.MaxLevel)
            {
                searchCondition.Append(string.Format(" AND {0}<={1}", FS2TableString.RolesfirstFieldRoleLevel, endLevel));
            }

            DateTime activeDate = CalendarDate.SelectedDate;
            if (activeDate == DateTime.MinValue)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgInputParamNotCorrect, StringDef.Date);
                return;
            }
            switch (StatisticType.SelectedIndex)
            {
            case -1:
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.Statistic + StringDef.Type);
                return;

            case 0:
                //活跃玩家
                searchCondition.AppendFormat(" AND {0}>='{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                break;

            case 1:
                //不活跃玩家
                searchCondition.AppendFormat(" AND {0}<'{1}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                break;

            case 2:
                //流失玩家
                searchCondition.AppendFormat(" AND {0}>='{1}' AND {0}<'{2}' ", FS2TableString.RolesfirstFieldLastPlayingDate, activeDate.AddDays(-WebConfig.ActivePlayerDaySpan).AddDays(-WebConfig.ActivePlayerDayValue), activeDate.AddDays(-WebConfig.ActivePlayerDaySpan));
                break;
            }

            if (searchCondition.Length > 0)
            {
                searchCondition.Remove(0, 4);
                searchCondition.Insert(0, " WHERE");
            }

            string orderByType = string.Empty;
            switch (ListBoxOrderByType.SelectedIndex)
            {
            case 0:
                orderByType = "ASC";
                break;

            case 1:
                orderByType = "DESC";
                break;
            }

            string orderByStatement = string.Empty;
            switch (ListBoxOrderBy.SelectedIndex)
            {
            case 0:
                orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleName, orderByType);
                break;

            case 1:
                orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.RolesfirstFieldRoleLevel, orderByType);
                break;
            }

            int    limitCount     = _recordPerPage;
            string limitStatement = string.Format(" LIMIT {0},{1}", offset, limitCount);

            string cmdText      = "SELECT {0} FROM {1} {2} {3} {4}";
            string cmdFieldText = "Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries";

            SqlCommand cmd = new SqlCommand(string.Format(cmdText, cmdFieldText, FS2TableString.RolesfirstTableName,
                                                          searchCondition.ToString(), orderByStatement, limitStatement));
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                Session[WebConfig.SessionQueryLogOffset] = offset;

                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.Int32,
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.Int32
                });

                ArrayList roleList = new ArrayList();
                object[]  record   = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo role = new FS2RoleDataInfo();
                    role.RoleId      = (int)record[0];
                    role.AccountName = record[1] as string;
                    role.RoleName    = record[2] as string;
                    role.RoleLevel   = (SByte)record[5];
                    role.SkillSeries = (int)record[6];
                    switch ((SByte)record[4])
                    {
                    case (SByte)0:
                        if (role.SkillSeries == 0)
                        {
                            role.RoleType = FS2RoleType.Xuanfeng;
                        }
                        else if (role.SkillSeries == 1)
                        {
                            role.RoleType = FS2RoleType.Xingtian;
                        }
                        else
                        {
                            role.RoleType = FS2RoleType.Jiashi;
                        }
                        break;

                    case (SByte)1:
                        if (role.SkillSeries == 0)
                        {
                            role.RoleType = FS2RoleType.Zhenren;
                        }
                        else if (role.SkillSeries == 1)
                        {
                            role.RoleType = FS2RoleType.Tianshi;
                        }
                        else
                        {
                            role.RoleType = FS2RoleType.Daoshi;
                        }
                        break;

                    case (SByte)2:
                        if (role.SkillSeries == 0)
                        {
                            role.RoleType = FS2RoleType.Shoushi;
                        }
                        else if (role.SkillSeries == 1)
                        {
                            role.RoleType = FS2RoleType.Yishi;
                        }
                        else
                        {
                            role.RoleType = FS2RoleType.Yiren;
                        }
                        break;
                    }

                    roleList.Add(role);
                }

                ButtonPreviousPage.Enabled = (offset > 0);
                ButtonFirstPage.Enabled    = (offset > 0);
                ButtonNextPage.Enabled     = (roleList.Count >= limitCount);

                bool success = CreateSearchRoleResultList(server.Id, (FS2RoleDataInfo[])roleList.ToArray(typeof(FS2RoleDataInfo)));
                PanelResult.Visible = success;

                if (!success)
                {
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;
                }
                else
                {
                    LabelResult.Text = string.Format(StringDef.LabelStatisticResult, server.Group.Name, server.Name,
                                                     string.Format(StringDef.LabelRoleLevel, startLevel, endLevel),
                                                     StatisticType.SelectedItem.Text);
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text     = ex.Message;
            PanelResult.Visible = false;
        }
    }
Example #31
0
    void CreateTopPlayerList()
    {
        try
        {
            int        serverId = ServerDropDownList.SelectedServerId;
            GameServer server   = ServerDropDownList.SelectedGameServer;
            //需要在该游戏服务器的Execute权限
            //if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.EXECUTE, Session))
            //{
            //    Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            //}
            if (server != null)
            {
                SqlCommand cmd = new SqlCommand("SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries FROM rolesfirst ORDER BY RoleLevel DESC LIMIT 10;");
                if (!server.IsConnected)
                {
                    LabelOpMsg.Text = StringDef.NoConnectionAlert;
                    return;
                }
                SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
                if (result != null && result.Success)
                {
                    result.SetFieldType(
                        new SqlDataType[] {
                        SqlDataType.Int32,
                        SqlDataType.String,
                        SqlDataType.String,
                        SqlDataType.SByte,
                        SqlDataType.SByte,
                        SqlDataType.SByte,
                        SqlDataType.Int32
                    });

                    ArrayList roles  = new ArrayList();
                    object[]  record = null;
                    while ((record = result.ReadRecord()) != null)
                    {
                        FS2RoleDataInfo info = new FS2RoleDataInfo();
                        info.RoleId      = (int)record[0];
                        info.AccountName = (string)record[1];
                        info.RoleName    = (string)record[2];
                        info.RoleSex     = (FS2RoleSex)((SByte)record[3]);
                        info.SkillSeries = (int)record[6];
                        switch ((SByte)record[4])
                        {
                        case (SByte)0:
                            if (info.SkillSeries == 0)
                            {
                                info.RoleType = FS2RoleType.Xuanfeng;
                            }
                            else if (info.SkillSeries == 1)
                            {
                                info.RoleType = FS2RoleType.Xingtian;
                            }
                            else
                            {
                                info.RoleType = FS2RoleType.Jiashi;
                            }
                            break;

                        case (SByte)1:
                            if (info.SkillSeries == 0)
                            {
                                info.RoleType = FS2RoleType.Zhenren;
                            }
                            else if (info.SkillSeries == 1)
                            {
                                info.RoleType = FS2RoleType.Tianshi;
                            }
                            else
                            {
                                info.RoleType = FS2RoleType.Daoshi;
                            }
                            break;

                        case (SByte)2:
                            if (info.SkillSeries == 0)
                            {
                                info.RoleType = FS2RoleType.Shoushi;
                            }
                            else if (info.SkillSeries == 1)
                            {
                                info.RoleType = FS2RoleType.Yishi;
                            }
                            else
                            {
                                info.RoleType = FS2RoleType.Yiren;
                            }
                            break;
                        }
                        info.RoleLevel = (SByte)record[5];

                        roles.Add(info);
                    }

                    FS2RoleDataInfo[] rolesInfo = (FS2RoleDataInfo[])roles.ToArray(typeof(FS2RoleDataInfo));
                    if (roles != null && rolesInfo.Length > 0)
                    {
                        FS2RoleDataInfo info = null;
                        for (int i = 0; i < rolesInfo.Length; i++)
                        {
                            info = rolesInfo[i];
                            TableRow row = new TableRow();

                            TableCell cell = new TableCell();
                            cell.Text = (i + 1).ToString();
                            row.Cells.Add(cell);

                            cell           = new TableCell();
                            cell.Font.Bold = true;
                            cell.Text      = info.RoleLevel.ToString();
                            row.Cells.Add(cell);

                            cell = new TableCell();
                            HyperLink link = new HyperLink();
                            link.Target      = "_blank";
                            link.NavigateUrl = "~/GameMaster/RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId;
                            link.Text        = info.RoleName;
                            link.SkinID      = "PlainText";
                            cell.Controls.Add(link);
                            row.Cells.Add(cell);

                            cell      = new TableCell();
                            cell.Text = info.AccountName;
                            row.Cells.Add(cell);

                            //cell = new TableCell();
                            //if (info.TongName != null && info.TongName.Length != 0)
                            //{
                            //    cell.Text = info.TongName;
                            //}
                            //else
                            //{
                            //    cell.Text = StringDef.None;
                            //}
                            //row.Cells.Add(cell);

                            cell = new TableCell();
                            Image sexImage = new Image();
                            switch (info.RoleSex)
                            {
                            case FS2RoleSex.Male:
                                sexImage.ToolTip  = StringDef.Male;
                                sexImage.ImageUrl = "~/Image/male.gif";
                                break;

                            case FS2RoleSex.Female:
                                sexImage.ToolTip  = StringDef.Female;
                                sexImage.ImageUrl = "~/Image/female.gif";
                                break;
                            }
                            cell.Controls.Add(sexImage);
                            row.Cells.Add(cell);

                            cell = new TableCell();
                            string classDescription = string.Empty;
                            switch (info.RoleType)
                            {
                            case FS2RoleType.Jiashi:
                                classDescription = StringDef.Jiashi;
                                break;

                            case FS2RoleType.Xuanfeng:
                                classDescription = StringDef.XuanFeng;
                                break;

                            case FS2RoleType.Xingtian:
                                classDescription = StringDef.XingTian;
                                break;

                            case FS2RoleType.Daoshi:
                                classDescription = StringDef.Daoshi;
                                break;

                            case FS2RoleType.Zhenren:
                                classDescription = StringDef.ZhenRen;
                                break;

                            case FS2RoleType.Tianshi:
                                classDescription = StringDef.TianShi;
                                break;

                            case FS2RoleType.Yiren:
                                classDescription = StringDef.Yiren;
                                break;

                            case FS2RoleType.Shoushi:
                                classDescription = StringDef.ShouShi;
                                break;

                            case FS2RoleType.Yishi:
                                classDescription = StringDef.YiShi;
                                break;
                            }
                            cell.Text = classDescription;
                            row.Cells.Add(cell);

                            TableTopPlayer.Rows.Add(row);
                        }

                        TableTopPlayer.Visible = true;
                    }
                }
                else
                {
                    if (result == null)
                    {
                        LabelOpMsg.Text = StringDef.QueryTimeOut;
                    }
                    else
                    {
                        LabelOpMsg.Text = StringDef.OperationFail;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
        }
    }
    private bool CreateSearchRoleResultList(int serverId, FS2RoleDataInfo[] roles)
    {
        if (roles != null && roles.Length > 0)
        {
            for (int i = 0; i < roles.Length; i++)
            {
                FS2RoleDataInfo info = roles[i];
                TableRow        row  = new TableRow();

                TableCell cell = new TableCell();
                HyperLink link = new HyperLink();
                link.Target      = "_blank";
                link.NavigateUrl = "~/GameMaster/RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId.ToString();
                link.Text        = info.RoleName;
                link.SkinID      = "PlainText";
                cell.Controls.Add(link);
                row.Cells.Add(cell);

                cell      = new TableCell();
                cell.Text = info.AccountName;
                row.Cells.Add(cell);

                cell      = new TableCell();
                cell.Text = info.RoleLevel.ToString();
                row.Cells.Add(cell);

                cell = new TableCell();
                string classDescription = string.Empty;
                switch (info.RoleType)
                {
                case FS2RoleType.Jiashi:
                    classDescription = StringDef.Jiashi;
                    break;

                case FS2RoleType.Xuanfeng:
                    classDescription = StringDef.XuanFeng;
                    break;

                case FS2RoleType.Xingtian:
                    classDescription = StringDef.XingTian;
                    break;

                case FS2RoleType.Daoshi:
                    classDescription = StringDef.Daoshi;
                    break;

                case FS2RoleType.Zhenren:
                    classDescription = StringDef.ZhenRen;
                    break;

                case FS2RoleType.Tianshi:
                    classDescription = StringDef.TianShi;
                    break;

                case FS2RoleType.Yiren:
                    classDescription = StringDef.Yiren;
                    break;

                case FS2RoleType.Shoushi:
                    classDescription = StringDef.ShouShi;
                    break;

                case FS2RoleType.Yishi:
                    classDescription = StringDef.YiShi;
                    break;
                }
                cell.Text = classDescription;
                row.Cells.Add(cell);

                cell = new TableCell();

                TableSearchRoleList.Rows.Add(row);
            }
            return(true);
        }


        return(false);
    }
Example #33
0
    void QueryRole(int serverId, string NodeGUID)
    {
        try
        {
            GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverId);
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }

            ArrayList paramList = new ArrayList();
            string cmdText = "SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries,NoChatIn,NoLoginIn,Online FROM rolesfirst WHERE {0}='?' ORDER BY RoleName";
            paramList.Add(NodeGUID);

            SqlCommand cmd = new SqlCommand(string.Format(cmdText, FS2TableString.RolesfirstFieldTongGUID), paramList.ToArray());
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);

            if (result != null && result.Success)
            {
                result.SetFieldType(
                        new SqlDataType[] {
						SqlDataType.Int32,
						SqlDataType.String,
						SqlDataType.String,
						SqlDataType.SByte,
						SqlDataType.SByte,
						SqlDataType.SByte,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.Int32,
                        SqlDataType.Int32
					});

                ArrayList roles = new ArrayList();
                object[] record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.RoleId = (int)record[0];
                    info.AccountName = (string)record[1];
                    info.RoleName = (string)record[2];
                    info.RoleSex = (FS2RoleSex)(SByte)record[3];
                    info.SkillSeries = (int)record[6];
                    switch ((SByte)record[4])
                    {
                        case (SByte)0:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Xuanfeng;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Xingtian;
                            else info.RoleType = FS2RoleType.Jiashi;
                            break;
                        case (SByte)1:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Zhenren;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Tianshi;
                            else info.RoleType = FS2RoleType.Daoshi;
                            break;
                        case (SByte)2:
                            if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Shoushi;
                            else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Yishi;
                            else info.RoleType = FS2RoleType.Yiren;
                            break;
                    }
                    info.RoleLevel = (SByte)record[5];
                    info.NoChatIn = (int)record[7];
                    info.NoLoginIn = (int)record[8];
                    info.Online = (int)record[9];

                    roles.Add(info);
                }

                DataGridRole.DataSource = CreateDataSource(roles, server.Id);
                DataGridRole.DataBind();

                if (roles == null || roles.Count != 0)
                    LabelOpMsg.Text = StringDef.NoMatchingRecord;                
            }
            else
            {
                LabelOpMsg.Text = StringDef.Query + StringDef.Failure;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
        }
    }
Example #34
0
	void CreateTopPlayerList()
	{
		try
		{			
			int serverId = ServerDropDownList.SelectedServerId;
			GameServer server = ServerDropDownList.SelectedGameServer;
            //需要在该游戏服务器的Execute权限
			//if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.EXECUTE, Session))
			//{
			//    Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
			//}         
			if (server != null)
			{
                SqlCommand cmd = new SqlCommand("SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,SkillSeries FROM rolesfirst ORDER BY RoleLevel DESC LIMIT 10;");
                if (!server.IsConnected)
                {
                    LabelOpMsg.Text = StringDef.NoConnectionAlert;
                    return;
                }
                SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id,server, cmd);
                if (result != null && result.Success)
                {
                    result.SetFieldType(
                            new SqlDataType[] {
							SqlDataType.Int32,
							SqlDataType.String,
							SqlDataType.String,
							SqlDataType.SByte,
							SqlDataType.SByte,
							SqlDataType.SByte,
                            SqlDataType.Int32
						});

                    ArrayList roles = new ArrayList();
                    object[] record = null;
                    while ((record = result.ReadRecord()) != null)
                    {
                        FS2RoleDataInfo info = new FS2RoleDataInfo();
                        info.RoleId = (int)record[0];
                        info.AccountName = (string)record[1];
                        info.RoleName = (string)record[2];
                        info.RoleSex = (FS2RoleSex)((SByte)record[3]);
                        info.SkillSeries = (int)record[6];
                        switch ((SByte)record[4])
                        {
                            case (SByte)0:
                                if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Xuanfeng;
                                else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Xingtian;
                                else info.RoleType = FS2RoleType.Jiashi;
                                break;
                            case (SByte)1:
                                if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Zhenren;
                                else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Tianshi;
                                else info.RoleType = FS2RoleType.Daoshi;
                                break;
                            case (SByte)2:
                                if (info.SkillSeries == 0) info.RoleType = FS2RoleType.Shoushi;
                                else if (info.SkillSeries == 1) info.RoleType = FS2RoleType.Yishi;
                                else info.RoleType = FS2RoleType.Yiren;
                                break;
                        }
                        info.RoleLevel = (SByte)record[5];

                        roles.Add(info);
                    }

                    FS2RoleDataInfo[] rolesInfo = (FS2RoleDataInfo[])roles.ToArray(typeof(FS2RoleDataInfo));
                    if (roles != null && rolesInfo.Length > 0)
                    {
                        FS2RoleDataInfo info = null;
                        for (int i = 0; i < rolesInfo.Length; i++)
                        {
                            info = rolesInfo[i];
                            TableRow row = new TableRow();

                            TableCell cell = new TableCell();
                            cell.Text = (i + 1).ToString();
                            row.Cells.Add(cell);

                            cell = new TableCell();
                            cell.Font.Bold = true;
                            cell.Text = info.RoleLevel.ToString();
                            row.Cells.Add(cell);

                            cell = new TableCell();
                            HyperLink link = new HyperLink();
                            link.Target = "_blank";
                            link.NavigateUrl = "~/GameMaster/RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId;
                            link.Text = info.RoleName;
                            link.SkinID = "PlainText";
                            cell.Controls.Add(link);
                            row.Cells.Add(cell);

                            cell = new TableCell();
                            cell.Text = info.AccountName;
                            row.Cells.Add(cell);

                            //cell = new TableCell();
                            //if (info.TongName != null && info.TongName.Length != 0)
                            //{
                            //    cell.Text = info.TongName;
                            //}
                            //else
                            //{
                            //    cell.Text = StringDef.None;
                            //}
                            //row.Cells.Add(cell);

                            cell = new TableCell();
                            Image sexImage = new Image();
                            switch (info.RoleSex)
                            {
                                case FS2RoleSex.Male:
                                    sexImage.ToolTip = StringDef.Male;
                                    sexImage.ImageUrl = "~/Image/male.gif";
                                    break;
                                case FS2RoleSex.Female:
                                    sexImage.ToolTip = StringDef.Female;
                                    sexImage.ImageUrl = "~/Image/female.gif";
                                    break;
                            }
                            cell.Controls.Add(sexImage);
                            row.Cells.Add(cell);

                            cell = new TableCell();
                            string classDescription = string.Empty;
                            switch (info.RoleType)
                            {
                                case FS2RoleType.Jiashi:
                                    classDescription = StringDef.Jiashi;
                                    break;
                                case FS2RoleType.Xuanfeng:
                                    classDescription = StringDef.XuanFeng;
                                    break;
                                case FS2RoleType.Xingtian:
                                    classDescription = StringDef.XingTian;
                                    break;
                                case FS2RoleType.Daoshi:
                                    classDescription = StringDef.Daoshi;
                                    break;
                                case FS2RoleType.Zhenren:
                                    classDescription = StringDef.ZhenRen;
                                    break;
                                case FS2RoleType.Tianshi:
                                    classDescription = StringDef.TianShi;
                                    break;
                                case FS2RoleType.Yiren:
                                    classDescription = StringDef.Yiren;
                                    break;
                                case FS2RoleType.Shoushi:
                                    classDescription = StringDef.ShouShi;
                                    break;
                                case FS2RoleType.Yishi:
                                    classDescription = StringDef.YiShi;
                                    break;
                            }
                            cell.Text = classDescription;
                            row.Cells.Add(cell);

                            TableTopPlayer.Rows.Add(row);
                        }

                        TableTopPlayer.Visible = true;

                    }
                }
                else
                {
                    if (result == null)
                        LabelOpMsg.Text = StringDef.QueryTimeOut;
                    else
                        LabelOpMsg.Text = StringDef.OperationFail;
                }
			}
		}
		catch (Exception ex)
		{
            LabelOpMsg.Text = ex.Message;
		}
	}
Example #35
0
    private FS2RoleDataInfo SetRoleData(GameServer server, object arg)
	{		
		if (server != null)
		{
			SqlCommand cmd = null;
			if (arg.GetType() == typeof(int))
			{
				cmd = new SqlCommand(
                    string.Format("SELECT {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{24},{25} FROM {22} WHERE {23}='?'",
						FS2TableString.RolesfirstFieldId,
						FS2TableString.RolesfirstFieldTongGUID,
						FS2TableString.RolesfirstFieldAccountName,
						FS2TableString.RolesfirstFieldRoleName,
						FS2TableString.RolesfirstFieldRoleSex,
						FS2TableString.RolesfirstFieldRoleType,
						FS2TableString.RolesfirstFieldRoleLevel,
						FS2TableString.RolesfirstFieldMoney,
						FS2TableString.RolesfirstFieldMoneyInBox,
						FS2TableString.RolesfirstFieldPlayedTime,
						FS2TableString.RolesfirstFieldCreateDate,
						FS2TableString.RolesfirstFieldLastPlayingDate,
						FS2TableString.RolesfirstFieldLastPlayingIP,
						FS2TableString.RolesfirstFieldNoChatIn,
						FS2TableString.RolesfirstFieldNoLoginIn,
						FS2TableString.RolesfirstFieldUseRevivePosition,
						FS2TableString.RolesfirstFieldReviveID,
						FS2TableString.RolesfirstFieldReviveX,
						FS2TableString.RolesfirstFieldReviveY,
						FS2TableString.RolesfirstFieldEnterMapID,
						FS2TableString.RolesfirstFieldGUID,
                        FS2TableString.RolesfirstFieldOnline,
						FS2TableString.RolesfirstTableName,
						FS2TableString.RolesfirstFieldId,
                        FS2TableString.RolesfirstFieldSkillSeries,
                        FS2TableString.RolesfirstFieldSpyLevel),
					 arg
					);
			}
			else if (arg.GetType() == typeof(string))
			{
				cmd = new SqlCommand(
					string.Format("SELECT {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{24},{25} FROM {22} WHERE {23}='?'",
						FS2TableString.RolesfirstFieldId,
						FS2TableString.RolesfirstFieldTongGUID,
						FS2TableString.RolesfirstFieldAccountName,
						FS2TableString.RolesfirstFieldRoleName,
						FS2TableString.RolesfirstFieldRoleSex,
						FS2TableString.RolesfirstFieldRoleType,
						FS2TableString.RolesfirstFieldRoleLevel,
						FS2TableString.RolesfirstFieldMoney,
						FS2TableString.RolesfirstFieldMoneyInBox,
						FS2TableString.RolesfirstFieldPlayedTime,
						FS2TableString.RolesfirstFieldCreateDate,
						FS2TableString.RolesfirstFieldLastPlayingDate,
						FS2TableString.RolesfirstFieldLastPlayingIP,
						FS2TableString.RolesfirstFieldNoChatIn,
						FS2TableString.RolesfirstFieldNoLoginIn,
						FS2TableString.RolesfirstFieldUseRevivePosition,
						FS2TableString.RolesfirstFieldReviveID,
						FS2TableString.RolesfirstFieldReviveX,
						FS2TableString.RolesfirstFieldReviveY,
						FS2TableString.RolesfirstFieldEnterMapID,
						FS2TableString.RolesfirstFieldGUID,                        
                        FS2TableString.RolesfirstFieldOnline,
						FS2TableString.RolesfirstTableName,
						FS2TableString.RolesfirstFieldRoleName,
                        FS2TableString.RolesfirstFieldSkillSeries,
                        FS2TableString.RolesfirstFieldSpyLevel),
					 arg
					);
			}

            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return null;
            }
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
			if (result != null)
			{
				if (result.Success)
				{
					result.SetFieldType(
						new SqlDataType[] {
							SqlDataType.Int32,
							SqlDataType.String,
							SqlDataType.String,
							SqlDataType.String,
							SqlDataType.SByte,
							SqlDataType.SByte,
							SqlDataType.SByte,
							SqlDataType.UInt32,
							SqlDataType.UInt32,
							SqlDataType.UInt32,
							SqlDataType.DateTime,
							SqlDataType.DateTime,
							SqlDataType.Int64,
							SqlDataType.Int32,
							SqlDataType.Int32,
							SqlDataType.Byte,
							SqlDataType.Int32,
							SqlDataType.Int32,
							SqlDataType.Int32,
							SqlDataType.Int32,
							SqlDataType.String,
                            SqlDataType.Int32,
                            SqlDataType.Int32,
                            SqlDataType.Int32
						});

					object[] record = result.ReadRecord();
					if (record != null)
					{
                        FS2RoleDataInfo role = new FS2RoleDataInfo();
						role.RoleId = (int)record[0];
						role.TongName = (string)record[1];
						role.AccountName = (string)record[2];
						role.RoleName = (string)record[3];
						role.RoleSex = (FS2RoleSex)(int.Parse(record[4].ToString()));
                        role.SkillSeries = (int)record[22];
                        switch ((SByte)record[5])
                        {
                            case (SByte)0:
                                if (role.SkillSeries == 0) role.RoleType = FS2RoleType.Xuanfeng;
                                else if (role.SkillSeries == 1) role.RoleType = FS2RoleType.Xingtian;
                                else role.RoleType = FS2RoleType.Jiashi;
                                break;
                            case (SByte)1:
                                if (role.SkillSeries == 0) role.RoleType = FS2RoleType.Zhenren;
                                else if (role.SkillSeries == 1) role.RoleType = FS2RoleType.Tianshi;
                                else role.RoleType = FS2RoleType.Daoshi;
                                break;
                            case (SByte)2:
                                if (role.SkillSeries == 0) role.RoleType = FS2RoleType.Shoushi;
                                else if (role.SkillSeries == 1) role.RoleType = FS2RoleType.Yishi;
                                else role.RoleType = FS2RoleType.Yiren;
                                break;
                        }
						role.RoleLevel = int.Parse(record[6].ToString());
						role.Money = (uint)record[7];
						role.MoneyInBox = (uint)record[8];
						role.PlayedTime = (uint)record[9];
						role.CreateDate = (DateTime)record[10];
						role.LastPlayingDate = (DateTime)record[11];
						role.LastPlayingIP = new System.Net.IPAddress((Int64)record[12]);
						role.NoChatIn = (int)record[13];
						role.NoLoginIn = (int)record[14];
						role.UseRevivePosition = (byte)record[15];
						role.ReviveID = (int)record[16];
						role.ReviveX = (int)record[17];
						role.ReviveY = (int)record[18];
						role.EnterMapId = (int)record[19];
						role.RoleGuid = (string)record[20];
                        role.Online = (int)record[21];                        
                        role.SpyLevel = (int)record[23];

                        //查询氏族名称
                        if (role.TongName != null && role.TongName.Length != 0)
                        {
                            SqlCommand tongNameCmd = new SqlCommand(string.Format("SELECT {0} FROM {1} WHERE {2}='?'",
                                FS2TableString.SocialrelationFieldNodeName,FS2TableString.SocialrelationTableName,
                                FS2TableString.SocialrelationFieldNodeGUID),role.TongName);
                            SqlResult tongNameResult = WebUtil.QueryGameServerDb(CurrentUser.Id, server, tongNameCmd);
                            if (tongNameResult != null && tongNameResult.Success)
                            {
                                tongNameResult.SetFieldType(new SqlDataType[]{
                                    SqlDataType.String
                                });
                                object[] tongNameRecord = tongNameResult.ReadRecord();
                                if (tongNameRecord != null && tongNameRecord.Length > 0)
                                {                                    
                                    ViewState[WebConfig.ParamNodeGUID] = role.TongName;
                                    role.TongName = tongNameRecord[0] as string;
                                    //ViewState[WebConfig.ParamNodeGUID] 在role.TongName被改变后不变?!
                                }
                            }
                        }

                        return role;
					}
				}
			}
		}

		return null;
	}