Beispiel #1
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);
    }
Beispiel #2
0
    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();
    }
Beispiel #3
0
    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();
    }
Beispiel #4
0
    protected 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 seller = TextBoxSeller.Text.Trim();
            if (seller.Length != 0)
            {
                if (CheckBoxSeller.Checked)
                {
                    searchCondition.Append(string.Format(" AND {0}='?'", FS2TableString.AuctionFieldSellerName));
                }
                else
                {
                    searchCondition.Append(string.Format(" AND {0} LIKE '%?%'", FS2TableString.AuctionFieldSellerName));
                }
                paramList.Add(seller);
            }

            string buyer = TextBoxBuyer.Text.Trim();
            if (buyer.Length != 0)
            {
                if (CheckBoxBuyer.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", FS2TableString.AuctionFieldBuyerName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", FS2TableString.AuctionFieldBuyerName);
                }
                paramList.Add(buyer);
            }

            string itemName = TextBoxItemName.Text.Trim();
            if (itemName.Length != 0)
            {
                if (CheckBoxItemName.Checked)
                {
                    searchCondition.AppendFormat(" AND {0}='?'", FS2TableString.AuctionFieldGoodsName);
                }
                else
                {
                    searchCondition.AppendFormat(" AND {0} LIKE '%?%'", FS2TableString.AuctionFieldGoodsName);
                }
                paramList.Add(itemName);
            }

            //if (StartDate.Selected)
            //{
            //    searchCondition.AppendFormat(" AND {0}>='{1}'", FS2TableString.LogFieldLogTime, StartDate.SelectedDate);
            //}
            //if (EndDate.Selected)
            //{
            //    searchCondition.AppendFormat(" AND {0}<'{1}'", FS2TableString.LogFieldLogTime, EndDate.SelectedDate.AddDays(1));
            //}

            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.AuctionFieldCurrentPrice, orderByType);
                break;

            case 1:
                orderByStatement = string.Format(" ORDER BY {0} {1}", FS2TableString.AuctionFieldPassPrice, 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 = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}",
                                                FS2TableString.AuctionFieldSellerName,
                                                FS2TableString.AuctionFieldGoodsName,
                                                FS2TableString.AuctionFieldBuyerName,
                                                FS2TableString.AuctionFieldStartTime,
                                                FS2TableString.AuctionFieldFinishTime,
                                                FS2TableString.AuctionFieldCurrentPrice,
                                                FS2TableString.AuctionFieldPassPrice,
                                                FS2TableString.AuctionFieldItemData);

            SqlCommand cmd    = new SqlCommand(string.Format(cmdText, cmdFieldText, FS2TableString.AuctionTableName, searchCondition.ToString(), orderByStatement, limitStatement), paramList.ToArray());
            SqlResult  result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                result.SetFieldType(new SqlDataType[] {
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.DateTime,
                    SqlDataType.DateTime,
                    SqlDataType.UInt32,
                    SqlDataType.UInt32,
                    SqlDataType.Blob
                });

                object[]  record = null;
                ArrayList infos  = new ArrayList();

                while ((record = result.ReadRecord()) != null)
                {
                    AuctionRoomItem info = new AuctionRoomItem();
                    info.SellerName   = record[0] as string;
                    info.GoodsName    = record[1] as string;
                    info.BuyerName    = record[2] as string;
                    info.StartTime    = (DateTime)record[3];
                    info.FinishTime   = (DateTime)record[4];
                    info.CurrentPrice = (uint)record[5];
                    info.PassPrice    = (uint)record[6];
                    info.ItemData     = FS2ItemDataInfo.ParseItem((byte[])record[7]);

                    infos.Add(info);
                }

                ViewState[WebConfig.SessionQueryLogOffset] = offset;

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

                ViewState[WebConfig.ParamServerId] = server.Id;
                if (infos.Count != 0)
                {
                    DataGridAuctionItem.DataSource = CreateDataSource(infos);
                    DataGridAuctionItem.DataBind();
                    PanelResult.Visible = true;
                }
                else
                {
                    LabelOpMsg.Text     = StringDef.NoMatchingRecord;
                    PanelResult.Visible = false;
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
                PanelResult.Visible = false;
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text     = ex.Message;
            PanelResult.Visible = false;
        }
    }
Beispiel #5
0
    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();
    }