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(); }
private void RenderItemInfo(FS2ItemDataInfo[] itemInfos, int pageNum, HtmlGenericControl div) { StringBuilder content = new StringBuilder(); content.Append("<table border='0' cellspacing='0' cellpadding='0' background='../Resources/Images/FS2Objects/itemCell.gif'>"); for (int rowIndex = 0; rowIndex != FS2MacroDef.ItemRowNumPerBag; ++rowIndex) { content.Append("<tr height='38px'>"); for (int colIndex = 0; colIndex != FS2MacroDef.ItemColNumPerBag; ++colIndex) { bool hasItem = false; foreach (FS2ItemDataInfo item in itemInfos) { //如果找到 if (item.Y == rowIndex + (pageNum - 1) * FS2MacroDef.ItemRowNumPerBag && item.X == colIndex) { FS2ItemData itemData = FS2GameDataManager.TheInstance.GetItemData(item.TemplateId); //没有资源,先显示默认图标。 content.Append(GameDataRender.RenderItemCell(item.ItemCount.ToString(), itemData == null ? string.Empty : (itemData.Image + "_man_small_normal.jpg"), string.Format("updateRoleItemInfo(\"{0}\")", item.TemplateId), string.Format("onclick='window.location=\"../GameMaster/ItemFlow.aspx?{0}={1}&{2}={3}\"'", WebConfig.ParamServerId, _serverId, WebConfig.ParamRoleGuid, item.GUID))); hasItem = true; break; } } if (!hasItem) { content.Append("<td width='38px'></td>"); } } content.Append("</tr>"); } content.Append("</table>"); div.InnerHtml = content.ToString(); }
private void RenderEquipedItem(FS2ItemDataInfo[] itemInfos) { int rowNum = 3; int colNum = 3; FS2ItemDataInfo[] equipedSequence = new FS2ItemDataInfo[10]; foreach (FS2ItemDataInfo item in itemInfos) { switch ((ItemPart)item.X) { case ItemPart.Amulet: equipedSequence[0] = item; break; case ItemPart.Helm: equipedSequence[1] = item; break; case ItemPart.Shoulder: equipedSequence[2] = item; break; case ItemPart.Weapon: equipedSequence[3] = item; break; case ItemPart.Armor: equipedSequence[4] = item; break; case ItemPart.Pendant: equipedSequence[5] = item; break; case ItemPart.Ring: equipedSequence[6] = item; break; case ItemPart.Boots: equipedSequence[7] = item; break; case ItemPart.Cuff: equipedSequence[8] = item; break; case ItemPart.Talisman: equipedSequence[9] = item; break; } } StringBuilder content = new StringBuilder(); content.Append("<table cellspacing='5px' cellpadding='0' border='0' >"); content.Append("<tr><td>"); //法宝 content.Append("<table cellspacing='0px' cellpadding='0' border='0' background='../Resources/Images/FS2Objects/itemCell.gif'>"); content.Append("<tr height='38px'>"); if (equipedSequence[9] != null) { content.Append(GameDataRender.RenderItemCell("1", string.Empty, string.Format("updateRoleItemInfo(\"{0}\")", equipedSequence[9].TemplateId), string.Empty)); } else { content.Append("<td width='38px'></td>"); } content.Append("</tr>"); content.Append("</table>"); content.Append("</td><td>"); //装备 content.Append("<table cellspacing='0' cellpadding='0' border='0' background='../Resources/Images/FS2Objects/itemCell.gif'>"); for (int rowIndex = 0; rowIndex != rowNum; ++rowIndex) { content.Append("<tr height='38px'>"); for (int colIndex = 0; colIndex != colNum; ++colIndex) { FS2ItemDataInfo itemSeq = equipedSequence[rowIndex * colNum + colIndex]; if (itemSeq != null) { FS2ItemData itemData = FS2GameDataManager.TheInstance.GetItemData(itemSeq.TemplateId); content.Append(GameDataRender.RenderItemCell("1", itemData == null ? string.Empty : (itemData.Image + "_man_small_normal.jpg"), string.Format("updateRoleItemInfo(\"{0}\")", itemSeq.TemplateId), string.Empty)); //content.Append(GameDataRender.RenderItemCell("1",itemData == null ? string.Empty : itemData.Image, string.Format("updateRoleItemInfo(\"{0}\")", itemSeq.TemplateId),string.Empty)); } else { content.Append("<td width='38px' ></td>"); } } } content.Append("</table>"); content.Append("</td></tr></table>"); DivRoleState.InnerHtml = content.ToString(); }
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); }
ICollection CreateDataSource(ArrayList itemList) { try { DataTable dataTable = new DataTable(); DataRow dataRow; dataTable.Columns.Add(new DataColumn("Seller", typeof(String))); dataTable.Columns.Add(new DataColumn("Goods", typeof(String))); dataTable.Columns.Add(new DataColumn("Buyer", typeof(String))); dataTable.Columns.Add(new DataColumn("StartTime", typeof(String))); dataTable.Columns.Add(new DataColumn("FinishTime", typeof(String))); dataTable.Columns.Add(new DataColumn("CurrentPrice", typeof(String))); dataTable.Columns.Add(new DataColumn("PassPrice", typeof(String))); if (itemList != null && itemList.Count != 0) { foreach (AuctionRoomItem item in itemList) { dataRow = dataTable.NewRow(); dataRow[0] = string.Format("<a href='../GameMaster/RoleDetail.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>", WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamRoleName, HttpUtility.UrlEncode(item.SellerName), item.SellerName); if (item.ItemData != null) { dataRow[1] = string.Format("<div onmouseover='updateRoleItemInfo(\"{0}\")'>{1}</div>", item.ItemData.TemplateId, item.GoodsName); } else { dataRow[1] = item.GoodsName; } if (item.BuyerName != null && item.BuyerName.Length != 0) { dataRow[2] = string.Format("<a href='../GameMaster/RoleDetail.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>", WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamRoleName, HttpUtility.UrlEncode(item.BuyerName), item.BuyerName); } else { dataRow[2] = StringDef.NotAvailable; } dataRow[3] = item.StartTime.ToString("yyyy-MM-dd HH:mm:ss"); dataRow[4] = item.FinishTime.ToString("yyyy-MM-dd HH:mm:ss"); dataRow[5] = GameDataRender.RenderMoney(item.CurrentPrice); dataRow[6] = GameDataRender.RenderMoney(item.PassPrice); dataTable.Rows.Add(dataRow); } return(new DataView(dataTable)); } return(null); } catch (Exception) { return(null); } }
void CreateTopPlutocratList() { 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) { LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer); return; } if (!server.IsConnected) { LabelOpMsg.Text = StringDef.NoConnectionAlert; return; } SqlCommand cmd = new SqlCommand("SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,Money,MoneyInBox,SkillSeries FROM rolesfirst ORDER BY Money+MoneyInBox 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.UInt32, SqlDataType.UInt32, 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[8]; 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.Money = (uint)record[6]; info.MoneyInBox = (uint)record[7]; 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.Text = GameDataRender.RenderMoney(info.Money + info.MoneyInBox); 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(); 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); TableTopPlutocrat.Rows.Add(row); } TableTopPlutocrat.Visible = true; } } else { if (result == null) { LabelOpMsg.Text = StringDef.QueryTimeOut; } else { LabelOpMsg.Text = StringDef.OperationFail; } } } catch (Exception ex) { LabelOpMsg.Text = ex.Message; } }