Пример #1
0
    public static string GetItemQualityWebStyleColor(FS2ItemData item, bool isInTip)
    {
        string colorStr = isInTip ? "White" : "Black";

        if (item != null)
        {
            switch (item.Quality)
            {
            case FS2ItemQuality.Blue:
                colorStr = "#3165FF";
                break;

            case FS2ItemQuality.Green:
                colorStr = "#00FB00";
                break;

            case FS2ItemQuality.Yellow:
                colorStr = "Yellow";
                break;

            case FS2ItemQuality.Orange:
                colorStr = "#F8952C";
                break;
            }
        }
        return(colorStr);
    }
Пример #2
0
    public static string RenderChatItem(string originalData)
    {
        try
        {
            string[] datas  = originalData.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            int      hashId = int.Parse(datas[0]);

            int kind    = (hashId & 0x7ff00000) >> 20;
            int special = (hashId & 0xffc00) >> 10;
            int detail  = hashId & 0x3ff;
            int min     = int.Parse(datas[1]);

            string      returnStr = string.Empty;
            FS2ItemData item      = FS2GameDataManager.TheInstance.GetItemData(string.Concat(kind, ',', special, ',', detail, ',', min));
            if (item == null)
            {
                returnStr = datas[3];
            }
            else
            {
                string colorStr = string.Empty;
                switch (item.Quality)
                {
                case FS2ItemQuality.White:
                    colorStr = "White";
                    break;

                case FS2ItemQuality.Blue:
                    colorStr = "#3165FF";
                    break;

                case FS2ItemQuality.Green:
                    colorStr = "#00FB00";
                    break;

                case FS2ItemQuality.Yellow:
                    colorStr = "Yellow";
                    break;

                case FS2ItemQuality.Orange:
                    colorStr = "#F8952C";
                    break;
                }
                returnStr = string.Format("<span onclick='{0}' style='color:{1};cursor:hand;'>{2}</span>",
                                          string.Format("updateRoleItemInfo(\"{0}\")", item.TemplateId),
                                          colorStr,
                                          datas[3]);
            }

            return(returnStr);
        }
        catch (Exception)
        {
            return(originalData);
        }
    }
Пример #3
0
    ICollection CreateDataSource(ArrayList statInfos)
    {
        DataTable dataTable = new DataTable();
        DataRow   dataRow;

        dataTable.Columns.Add(new DataColumn("Item", typeof(String)));
        dataTable.Columns.Add(new DataColumn("Count", typeof(UInt32)));
        dataTable.Columns.Add(new DataColumn("TemplateId", typeof(String)));

        foreach (ItemBankStatInfo info in statInfos)
        {
            dataRow = dataTable.NewRow();
            FS2ItemData item = FS2GameDataManager.TheInstance.GetItemData(info.ItemTemplateId);
            if (item != null)
            {
                string colorStr = string.Empty;
                switch (item.Quality)
                {
                case FS2ItemQuality.White:
                    colorStr = "Black";
                    break;

                case FS2ItemQuality.Blue:
                    colorStr = "#3165FF";
                    break;

                case FS2ItemQuality.Green:
                    colorStr = "#00FB00";
                    break;

                case FS2ItemQuality.Yellow:
                    colorStr = "Yellow";
                    break;

                case FS2ItemQuality.Orange:
                    colorStr = "#F8952C";
                    break;
                }
                dataRow[0] = string.Format("<span onmouseover='{0}' style='color:{1};'>{2}</span>",
                                           string.Format("updateRoleItemInfo(\"{0}\")", item.TemplateId),
                                           colorStr,
                                           item.Name);
            }
            else
            {
                dataRow[0] = info.ItemTemplateId;
            }
            dataRow[1] = info.Count;
            dataRow[2] = info.ItemTemplateId;

            dataTable.Rows.Add(dataRow);
        }
        return(new DataView(dataTable));
    }
Пример #4
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();
    }
Пример #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();
    }
Пример #6
0
    bool CreateSearchResultList(NpcDropItem[] infos, uint total)
    {
        if (infos != null && infos.Length != 0)
        {
            foreach (NpcDropItem info in infos)
            {
                TableRow  row  = new TableRow();
                TableCell cell = new TableCell();
                if (info.itemTemplateId != null && info.itemTemplateId.Length != 0)
                {
                    FS2ItemData itemData = FS2GameDataManager.TheInstance.GetItemData(info.itemTemplateId);
                    if (itemData != null)
                    {
                        string colorStr = "Black";
                        switch (itemData.Quality)
                        {
                        case FS2ItemQuality.White:
                            colorStr = "Black";
                            break;

                        case FS2ItemQuality.Blue:
                            colorStr = "#3165FF";
                            break;

                        case FS2ItemQuality.Green:
                            colorStr = "#00FB00";
                            break;

                        case FS2ItemQuality.Yellow:
                            colorStr = "Yellow";
                            break;

                        case FS2ItemQuality.Orange:
                            colorStr = "#F8952C";
                            break;
                        }

                        cell.Text = string.Format("<span onmouseover='{0}' style='color:{1};'>{2}</span>",
                                                  string.Format("updateRoleItemInfo(\"{0}\")", itemData.TemplateId), colorStr,
                                                  itemData.Name);
                    }
                    else
                    {
                        cell.Text = info.itemTemplateId;
                    }
                }
                row.Cells.Add(cell);

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

                cell = new TableCell();
                if (total != 0)
                {
                    cell.Text = Decimal.Round((decimal)info.num / total, 3) * 100 + "%";
                }
                else
                {
                    cell.Text = "0";
                }
                row.Cells.Add(cell);
                TableSearchNpc.Rows.Add(row);
            }
            TableRow  rowTail  = new TableRow();
            TableCell cellTail = new TableCell();
            cellTail.ColumnSpan = 3;
            cellTail.Font.Bold  = true;
            FS2NpcData NpcData = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(TextBoxNpcId.Text));
            if (NpcData != null)
            {
                cellTail.Text = string.Format("[{0}]{1}", NpcData.Name, StringDef.DropItem);
            }
            cellTail.Text += StringDef.Total + StringDef.Colon + total;
            rowTail.Cells.Add(cellTail);
            TableSearchNpc.Rows.Add(rowTail);
        }
        return(true);
    }
Пример #7
0
    bool CreateSearchResultList(SearchItemInfo[] infos, uint totalNum)
    {
        if (infos != null)
        {
            foreach (SearchItemInfo info in infos)
            {
                TableRow row = new TableRow();

                TableCell   cell = new TableCell();
                FS2ItemData item = FS2GameDataManager.TheInstance.GetItemData(info.id);
                if (item != null)
                {
                    string colorStr = "Black";
                    switch (item.Quality)
                    {
                    case FS2ItemQuality.White:
                        colorStr = "Black";
                        break;

                    case FS2ItemQuality.Blue:
                        colorStr = "#3165FF";
                        break;

                    case FS2ItemQuality.Green:
                        colorStr = "#00FB00";
                        break;

                    case FS2ItemQuality.Yellow:
                        colorStr = "Yellow";
                        break;

                    case FS2ItemQuality.Orange:
                        colorStr = "#F8952C";
                        break;
                    }

                    cell.Text = string.Format("<span onmouseover='{0}' style='color:{1}'>{2}</span>",
                                              string.Format("updateRoleItemInfo(\"{0}\")", item.TemplateId), colorStr,
                                              item.Name);
                }
                else
                {
                    cell.Text = info.id;
                }
                row.Cells.Add(cell);

                cell = new TableCell();
                switch (info.way)
                {
                case LogEvent.BuyStatistic:
                    cell.Text = StringDef.NotAvailable;
                    break;

                case LogEvent.NpcDropStatistic:
                    FS2NpcData npc = FS2GameDataManager.TheInstance.GetNpcData(int.Parse(info.sourceId));
                    if (npc != null)
                    {
                        cell.Text = string.Format("{0}[{1}]", npc.Name, npc.TemplateId);
                    }
                    else
                    {
                        cell.Text = StringDef.NotAvailable;
                    }
                    break;
                }
                row.Cells.Add(cell);

                cell = new TableCell();
                switch (info.way)
                {
                case LogEvent.BuyStatistic:
                    cell.Text = StringDef.Buy;
                    break;

                case LogEvent.NpcDropStatistic:
                    cell.Text = StringDef.Drop;
                    break;
                }
                row.Cells.Add(cell);

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

                cell = new TableCell();
                if (totalNum != 0)
                {
                    cell.Text = Decimal.Round((decimal)info.count / totalNum * 100, 3).ToString() + "%";
                }
                else
                {
                    cell.Text = info.count.ToString();
                }
                row.Cells.Add(cell);

                TableSearchItem.Rows.Add(row);
            }
            TableRow rowHead = new TableRow();
            rowHead.Font.Bold = true;
            TableCell cellHead = new TableCell();
            cellHead.ColumnSpan = 5;
            cellHead.Text       = string.Format("{0} : {1}", StringDef.Total, totalNum);
            rowHead.Cells.Add(cellHead);
            TableSearchItem.Rows.Add(rowHead);

            return(true);
        }
        return(false);
    }
Пример #8
0
 public static string GetItemQualityWebStyleColor(FS2ItemData item, bool isInTip)
 {
     string colorStr = isInTip ? "White" : "Black";
     if (item != null)
     {
         switch (item.Quality)
         {
             case FS2ItemQuality.Blue:
                 colorStr = "#3165FF";
                 break;
             case FS2ItemQuality.Green:
                 colorStr = "#00FB00";
                 break;
             case FS2ItemQuality.Yellow:
                 colorStr = "Yellow";
                 break;
             case FS2ItemQuality.Orange:
                 colorStr = "#F8952C";
                 break;
         }
     }
     return colorStr;
 }