XmdsVirtual_Player.Quest.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. 
  2. using CommonAI.Zone.Helper;
  3. using CommonAI.Zone.Instance;
  4. using CommonLang;
  5. using System.Collections.Generic;
  6. using XmdsCommon.Plugin;
  7. using XmdsCommonServer.Plugin.Scene;
  8. namespace XmdsCommonServer.Plugin
  9. {
  10. public partial class XmdsVirtual_Player
  11. {
  12. #region 任务相关.
  13. private void InitQuestData()
  14. {
  15. if (mProp.ServerData.Tasks == null) { return; }
  16. List<QuestData> tasks = new List<QuestData>();
  17. foreach (XmdsQuestData var in mProp.ServerData.Tasks)
  18. {
  19. QuestData qData = new QuestData(var.TaskID);
  20. if (var.TaskState == "1")
  21. {
  22. //已接受
  23. qData.State = QuestState.Accepted;
  24. }
  25. foreach (QuestAttribute attr in var.Attributes)
  26. {
  27. qData.Attributes.Add(attr.Key, attr.Value);
  28. }
  29. tasks.Add(qData);
  30. }
  31. if (mUnit is InstancePlayer)
  32. {
  33. (mUnit as InstancePlayer).InitQuestData(tasks);
  34. }
  35. }
  36. #endregion
  37. /*
  38. private HashMap<string, string> mQuestFlags = new HashMap<string, string>();
  39. private void InitQuestFlags()
  40. {
  41. mQuestFlags.Clear();
  42. if (mUnit is InstancePlayer)
  43. {
  44. foreach (XmdsQuestFlag e in mProp.ServerData.QuestFlags)
  45. {
  46. if (!string.IsNullOrEmpty(e.FlagName) && !string.IsNullOrEmpty(e.FlagValue))
  47. {
  48. mQuestFlags.Add(e.FlagName, e.FlagValue);
  49. if (!mProp.ServerData.PlayerEntered)
  50. {
  51. mUnit.Parent.queueTask((z) =>
  52. {
  53. (mUnit.Parent as XmdsServerScene).GS_OnInitZonePlayerQuestFlagR2B(mUnit as InstancePlayer, e.FlagName, e.FlagValue);
  54. });
  55. }
  56. }
  57. }
  58. }
  59. }
  60. internal void SetQuestFlag(string key, string value)
  61. {
  62. if (key != null)
  63. {
  64. if (value == null)
  65. {
  66. mQuestFlags.Remove(key);
  67. }
  68. else
  69. {
  70. mQuestFlags.Put(key, value);
  71. }
  72. }
  73. }
  74. internal string GetQuestFlag(string key)
  75. {
  76. return mQuestFlags.Get(key);
  77. }
  78. */
  79. }
  80. }