Exemplo n.º 1
0
        public void FinalizeDataHolder()
        {
            QuestTemplate template = QuestMgr.GetTemplate(QuestId);

            if (template == null)
            {
                ContentMgr.OnInvalidDBData(
                    GetType().Name + " (QuestGiverId: {0}) referred to invalid QuestId: " + QuestId,
                    (object)QuestGiverId);
            }
            else
            {
                ObjectTemplate objectTemplate = ObjectTemplate;
                if (objectTemplate == null)
                {
                    ContentMgr.OnInvalidDBData(
                        GetType().Name + " (QuestId: {0}) referred to invalid QuestGiverId: " +
                        QuestGiverId, (object)QuestId);
                }
                else
                {
                    QuestHolderInfo questHolderInfo = objectTemplate.QuestHolderInfo;
                    bool            flag            = questHolderInfo == null;
                    if (flag)
                    {
                        objectTemplate.QuestHolderInfo = questHolderInfo = new QuestHolderInfo();
                    }
                    switch (RelationType)
                    {
                    case QuestGiverRelationType.Starter:
                        questHolderInfo.QuestStarts.Add(template);
                        template.Starters.Add(objectTemplate);
                        if (!flag)
                        {
                            break;
                        }
                        ++QuestMgr._questStarterCount;
                        break;

                    case QuestGiverRelationType.Finisher:
                        questHolderInfo.QuestEnds.Add(template);
                        template.Finishers.Add(objectTemplate);
                        if (!flag)
                        {
                            break;
                        }
                        ++QuestMgr._questFinisherCount;
                        break;

                    default:
                        ContentMgr.OnInvalidDBData(
                            GetType().Name +
                            " (Quest: {0}, QuestGiver: {1}) had invalid QuestGiverRelationType: " +
                            RelationType, (object)QuestId, (object)QuestGiverId);
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void FinalizeDataHolder()
        {
            var template = QuestMgr.GetTemplate(QuestId);

            if (template == null)
            {
                ContentMgr.OnInvalidDBData(GetType().Name + " (QuestGiverId: {0}) referred to invalid QuestId: " +
                                           QuestId, QuestGiverId);
            }
            else
            {
                var entry = ObjectTemplate;
                if (entry == null)
                {
                    ContentMgr.OnInvalidDBData(GetType().Name + " (QuestId: {0}) referred to invalid QuestGiverId: " +
                                               QuestGiverId, QuestId);
                }
                else
                {
                    var qgEntry = entry.QuestHolderInfo;
                    var newQg   = qgEntry == null;
                    if (newQg)
                    {
                        entry.QuestHolderInfo = qgEntry = new QuestHolderInfo();
                    }

                    switch (RelationType)
                    {
                    case QuestGiverRelationType.Starter:
                    {
                        qgEntry.QuestStarts.Add(template);
                        template.Starters.Add(entry);
                        if (newQg)
                        {
                            QuestMgr._questStarterCount++;
                        }
                        break;
                    }

                    case QuestGiverRelationType.Finisher:
                    {
                        qgEntry.QuestEnds.Add(template);
                        template.Finishers.Add(entry);
                        if (newQg)
                        {
                            QuestMgr._questFinisherCount++;
                        }
                        break;
                    }

                    default:
                        ContentMgr.OnInvalidDBData(GetType().Name + " (Quest: {0}, QuestGiver: {1}) had invalid QuestGiverRelationType: " +
                                                   RelationType, QuestId, QuestGiverId);
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
		public void FinalizeDataHolder()
		{
			var template = QuestMgr.GetTemplate(QuestId);

			if (template == null)
			{
				ContentMgr.OnInvalidDBData(GetType().Name + " (QuestGiverId: {0}) referred to invalid QuestId: " +
					QuestId, QuestGiverId);
			}
			else
			{
				var entry = ObjectTemplate;
				if (entry == null)
				{
					ContentMgr.OnInvalidDBData(GetType().Name + " (QuestId: {0}) referred to invalid QuestGiverId: " +
						QuestGiverId, QuestId);
				}
				else
				{
					var qgEntry = entry.QuestHolderInfo;
					var newQg = qgEntry == null;
					if (newQg)
					{
						entry.QuestHolderInfo = qgEntry = new QuestHolderInfo();
					}

					switch (RelationType)
					{
						case QuestGiverRelationType.Starter:
							{
								qgEntry.QuestStarts.Add(template);
								template.Starters.Add(entry);
								if (newQg)
								{
									QuestMgr._questStarterCount++;
								}
								break;
							}
						case QuestGiverRelationType.Finisher:
							{
								qgEntry.QuestEnds.Add(template);
								template.Finishers.Add(entry);
								if (newQg)
								{
									QuestMgr._questFinisherCount++;
								}
								break;
							}
						default:
							ContentMgr.OnInvalidDBData(GetType().Name + " (Quest: {0}, QuestGiver: {1}) had invalid QuestGiverRelationType: " +
														 RelationType, QuestId, QuestGiverId);
							break;
					}
				}
			}
		}