少年修仙传客户端代码仓库
client_linchunjie
2019-03-11 ddbf782ddd4e00be1ac9b0d27ef3cacda0c9d624
3335 修改聊天发送装备
2个文件已修改
84 ■■■■ 已修改文件
System/Chat/ChatCtrl.cs 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Message/RichTableEvent.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatCtrl.cs
@@ -164,6 +164,8 @@
        get { return ModelCenter.Instance.GetModel<FriendsModel>(); }
    }
    EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
    public Dictionary<ChatInfoType, List<string>> achievementRandoms = new Dictionary<ChatInfoType, List<string>>();
    private ChatCtrl()
@@ -766,23 +768,22 @@
                data.richText.Append(content.Substring(index, matchArray[i].Index - index));
                index = matchArray[i].Index + matchArray[i].Length;
                string detail = matchArray[i].Groups[1].Value;
                string[] strarray = detail.Split('|');
                int itemID = 0;
                if (int.TryParse(strarray[0], out itemID))
                var chatSendItem = LitJson.JsonMapper.ToObject<ChatSendItem>(detail);
                if (chatSendItem.itemId != 0)
                {
                    ItemConfig cfg = ItemConfig.Get(itemID);
                    if (cfg != null)
                    ItemConfig itemConfig = ItemConfig.Get(chatSendItem.itemId);
                    if (itemConfig != null)
                    {
                        try
                        {
                            string append = string.Format("<a><Word info=item id={0} userdata={4} chatsend=1/>|showitem={0} isbind={1} itemcnt={2} stone={3} userdata={4} suitLv={5} suitCnt={6} place={7} equipwash={8}</a>",
                                      strarray[0], strarray[1], strarray[2], strarray[3], strarray[4], strarray[5], strarray[6], strarray[7], strarray[8]);
                            append = UIHelper.AppendStringColor(cfg.ItemColor, append);
                            string append = string.Format("<a><Word info=item id={0} chatsenditem={1} chatsend=1/>|showitem={0} chatsenditem={1}</a>",
                                      chatSendItem.itemId, detail);
                            append = UIHelper.AppendStringColor(itemConfig.ItemColor, append);
                            data.richText.Append(append);
                        }
                        catch (Exception e)
                        {
                            data.richText.Append(cfg.ItemName);
                            data.richText.Append(itemConfig.ItemName);
                            DebugEx.Log(e.Message);
                        }
                    }
@@ -857,41 +858,21 @@
                if (cfg.ItemName == matchArray[i].Groups[1].Value)
                {
                    bool equip = itemPlaceList[i].packType == PackType.Equip;
                    uint[] stones = equip ? PlayerStoneData.Instance.GetStoneInfo(itemPlaceList[i].itemPlace) : null;
                    _textBuilder.Append(StringUtility.Contact("#item#", itemPlaceList[i].itemId,
                                                              "|", itemPlaceList[i].isBind,
                                                              "|", itemPlaceList[i].count,
                                                              "|", stones != null ? LitJson.JsonMapper.ToJson(stones) :
                                                              LitJson.JsonMapper.ToJson(new uint[0]),
                                                              "|"));
                    if (itemPlaceList[i].useDataDict != null && itemPlaceList[i].useDataDict.Count > 0)
                    List<EquipGem> equipGems = null;
                    if (equip)
                    {
                        foreach (int key in itemPlaceList[i].useDataDict.Keys)
                        {
                            List<int> intarray = itemPlaceList[i].useDataDict[key];
                            var _array = intarray.ToArray();
                            _textBuilder.Append(StringUtility.Contact("'", key, "':", _array != null ? LitJson.JsonMapper.ToJson(_array) :
                                                              LitJson.JsonMapper.ToJson(new int[0])));
                            _textBuilder.Append(",");
                        }
                        equipGemModel.TryGetEquipGems(itemPlaceList[i].itemPlace, out equipGems);
                    }
                    _textBuilder.Append("|");
                    _textBuilder.Append(itemPlaceList[i].itemPlace);
                    _textBuilder.Append("|");
                    var _wash = ModelCenter.Instance.GetModel<EquipWashModel>().GetWashEquipInfo(itemPlaceList[i].itemPlace);
                    if (_wash != null && equip)
                    _textBuilder.Append("#item#");
                    var chatSendItem = new ChatSendItem()
                    {
                        _textBuilder.Append("{");
                        int[] _array = _wash.proValuelist == null ? new int[0] : new int[_wash.proValuelist.Length];
                        for (int k = 0; k < _array.Length; k++)
                        {
                            _array[k] = (int)_wash.proValuelist[k].XLAttrValue;
                        }
                        _textBuilder.Append(StringUtility.Contact("\"LV\":", _wash.XLAttrLV, ",\"Place\":", _wash.EquipPlace,
                            ",\"Value\":", LitJson.JsonMapper.ToJson(_array)));
                        _textBuilder.Append("}");
                    }
                        itemId = (int)itemPlaceList[i].itemId,
                        isBind = (int)itemPlaceList[i].isBind,
                        count = (int)itemPlaceList[i].count,
                        equipGems = equipGems,
                        useData = itemPlaceList[i].itemInfo.userData,
                    };
                    _textBuilder.Append(LitJson.JsonMapper.ToJson(chatSendItem));
                    _textBuilder.Append("#item#");
                    if (_recently != null)
                    {
@@ -1159,6 +1140,15 @@
        return RedPointState.None;
    }
    #endregion
    public struct ChatSendItem
    {
        public int itemId;
        public int isBind;
        public int count;
        public List<EquipGem> equipGems;
        public string useData;
    }
}
public struct ChatExtraData
{
System/Message/RichTableEvent.cs
@@ -506,6 +506,18 @@
            }
        }
        if (hrefInfo.mSplits.ContainsKey("chatsenditem"))
        {
            var chatSendItem = LitJson.JsonMapper.ToObject<ChatCtrl.ChatSendItem>(hrefInfo.mSplits["chatsenditem"]);
            itemId = chatSendItem.itemId;
            itemCount = chatSendItem.count;
            isBind = chatSendItem.isBind;
            if (!string.IsNullOrEmpty(chatSendItem.useData))
            {
                userdatadic = ConfigParse.Analysis(chatSendItem.useData);
            }
        }
        ItemAttrData attrData = new ItemAttrData(itemId, false, (ulong)itemCount, -1, isBind, false, PackType.Deleted,
            "", userdatadic);
        attrData.SetGemModel(stone);