public static MessagePiece BuildSysMsgAchiGrade(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "AchievementGradeInfo"); var txt = id.ToString(); var col = "fcb06f"; if (SessionManager.DB.AchievementGradeDatabase.Grades.TryGetValue(id, out var g)) { txt = g; if (id == 104) { col = "38bde5"; //TODO: use resources } if (id == 105) { col = "ff264b"; } } var ret = new MessagePiece(txt) { Type = MessagePieceType.Simple }; ret.SetColor(col); return(ret); }
public static MessagePiece BuildSysMsgGuildQuest(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "GuildQuest"); var questName = id.ToString(); if (SessionManager.DB.GuildQuestDatabase.GuildQuests.TryGetValue(id, out var q)) { questName = q.Title; } return(new MessagePiece(questName) { Type = MessagePieceType.Simple }); }
public static MessagePiece BuildSysMsgAccBenefit(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "accountBenefit"); var txt = id.ToString(); if (SessionManager.DB.AccountBenefitDatabase.Benefits.TryGetValue(id, out var ab)) { txt = ab; } return(new MessagePiece(txt) { Type = MessagePieceType.Simple }); }
public static MessagePiece BuildSysMsgDungeon(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "dungeon"); var txt = id.ToString(); if (SessionManager.DB.DungeonDatabase.Dungeons.TryGetValue(id, out var dung)) { txt = dung.Name; } return(new MessagePiece(txt) { Type = MessagePieceType.Simple }); }
public static MessagePiece BuildSysMsgQuest(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "quest"); var txt = id.ToString(); if (SessionManager.QuestDatabase.Quests.TryGetValue(id, out var q)) { txt = q; } return(new MessagePiece(txt) { Type = MessagePieceType.Simple }); }
public static MessagePiece BuildSysMsgAchi(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "achievement"); var achiName = id.ToString(); if (SessionManager.DB.AchievementDatabase.Achievements.TryGetValue(id * 1000 + 1, out var g2)) { achiName = $"[{g2}]"; } return(new MessagePiece(achiName) { Type = MessagePieceType.Simple, }); }
public static MessagePiece BuildSysMsgItem(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "item"); var uid = ChatUtils.GetItemUid(dictionary); var rawLink = new StringBuilder("1#####"); rawLink.Append(id.ToString()); if (uid != 0) { rawLink.Append("@" + uid); } if (dictionary.TryGetValue("UserName", out var username)) { rawLink.Append("@" + username); } else { username = SessionManager.CurrentPlayer.Name; } var name = $"Unknown item [{id}]"; var grade = RareGrade.Common; if (SessionManager.DB.ItemsDatabase.Items.TryGetValue(id, out var i)) { name = i.Name; grade = i.RareGrade; } var mp = new MessagePiece($"<{name}>") { Type = MessagePieceType.Item, //BoundType = i.BoundType, ItemId = id, ItemUid = uid, OwnerName = username, RawLink = rawLink.ToString() }; mp.SetColor(ChatUtils.GradeToColorString(grade)); return(mp); }
public static MessagePiece BuildSysMsgItem(string msgText) { var dictionary = ChatUtils.BuildParametersDictionary(msgText); var id = ChatUtils.GetId(dictionary, "item"); var uid = ChatUtils.GetItemUid(dictionary); var rawLink = new StringBuilder("1#####"); rawLink.Append(id.ToString()); if (uid != 0) { rawLink.Append("@" + uid.ToString()); } var username = SessionManager.CurrentPlayer.Name; if (dictionary.ContainsKey("UserName")) { username = dictionary["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); }