Upload from upload_mods.ps1
This commit is contained in:
57
Scripts/Dialog/DialogActionOpenDialogRebirth.cs
Normal file
57
Scripts/Dialog/DialogActionOpenDialogRebirth.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
public class DialogActionOpenDialogRebirth : DialogActionAddBuff
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
|
||||
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
||||
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction START");
|
||||
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction ID: " + ID);
|
||||
|
||||
if (ID.ToLower().Contains("quest_"))
|
||||
{
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 1");
|
||||
Quest newQuest = QuestClass.CreateQuest(ID);
|
||||
if (newQuest == null)
|
||||
{
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 2");
|
||||
return;
|
||||
}
|
||||
|
||||
if (newQuest != null)
|
||||
{
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 3");
|
||||
QuestClass questClass = newQuest.QuestClass;
|
||||
if (questClass != null)
|
||||
{
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 4");
|
||||
|
||||
for (int i = 0; i < player.QuestJournal.quests.Count; i++)
|
||||
{
|
||||
////Log.Out("QUEST ID: " + player.QuestJournal.quests[i].ID);
|
||||
////Log.Out("QUEST STATE: " + player.QuestJournal.quests[i].CurrentState);
|
||||
if (player.QuestJournal.quests[i].CurrentState == Quest.QuestState.InProgress)
|
||||
{
|
||||
if (player.QuestJournal.quests[i].ID.ToLower() == ID.ToLower())
|
||||
{
|
||||
GameManager.ShowTooltip((EntityPlayerLocal)player, Localization.Get("ttAlreadyHaveActiveQuest"));
|
||||
//Log.Out("YOU ALREADY HAVE THIS QUEST");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("DialogActionOpenDialogRebirth-PerformAction 5");
|
||||
}
|
||||
}
|
||||
|
||||
uiforPlayer.windowManager.Open("OfferQuestRebirth", true, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiforPlayer.windowManager.Open(ID, true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user