예제 #1
0
        public MessagePiece ParseSysMsgZone(Dictionary <string, string> dictionary)
        {
            var zoneId   = uint.Parse(dictionary["zoneName"]);
            var zoneName = SessionManager.MonsterDatabase.GetZoneName(zoneId);
            var txt      = zoneId.ToString();

            if (zoneName != null)
            {
                txt = zoneName;
            }
            var mp = new MessagePiece(txt)
            {
                Type = MessagePieceType.Simple
            };

            return(mp);
        }
예제 #2
0
        public MessagePiece ParseSysMsgCreature(Dictionary <string, string> dictionary)
        {
            var creatureId    = dictionary["creature"];
            var creatureSplit = creatureId.Split('#');
            var zoneId        = uint.Parse(creatureSplit[0]);
            var templateId    = uint.Parse(creatureSplit[1]);

            var txt = creatureId;

            if (SessionManager.MonsterDatabase.TryGetMonster(templateId, zoneId, out var m))
            {
                txt = m.Name;
            }

            var mp = new MessagePiece(txt)
            {
                Type = MessagePieceType.Simple
            };

            return(mp);
        }
예제 #3
0
        public MessagePiece ParseSysMsgItem(Dictionary <string, string> info)
        {
            var id  = ChatUtils.GetId(info, "item");
            var uid = ChatUtils.GetItemUid(info);

            var rawLink = new StringBuilder("1#####");

            rawLink.Append(id.ToString());
            if (uid != 0)
            {
                rawLink.Append("@" + uid.ToString());
            }

            var username = SessionManager.CurrentPlayer.Name;

            if (info.ContainsKey("UserName"))
            {
                username = info["UserName"];
                rawLink.Append("@" + username);
            }
            var mp = new MessagePiece(id.ToString());

            if (SessionManager.ItemsDatabase.Items.TryGetValue(id, out var i))
            {
                var txt = $"<{i.Name}>";
                mp = new MessagePiece(txt)
                {
                    Type = MessagePieceType.Item,
                    //BoundType = i.BoundType,
                    ItemId    = id,
                    ItemUid   = uid,
                    OwnerName = username,
                    RawLink   = rawLink.ToString()
                };
                mp.SetColor(ChatUtils.GetItemColor(i));
            }
            return(mp);
        }