Upload from upload_mods.ps1
This commit is contained in:
142
Scripts/XUIC/XUiC_OfferQuestPopupRebirth.cs
Normal file
142
Scripts/XUIC/XUiC_OfferQuestPopupRebirth.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
internal class XUiC_OfferQuestPopupRebirth : XUiController
|
||||
{
|
||||
public XUiV_Label LabelQuestName;
|
||||
public XUiV_Label LabelQuestOffer;
|
||||
public XUiV_Panel Panel;
|
||||
string strQuestID = "";
|
||||
|
||||
private Quest quest;
|
||||
|
||||
public Quest Quest
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.quest;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.quest = value;
|
||||
this.IsDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int QuestGiverID { get; private set; }
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-Init START");
|
||||
|
||||
base.Init();
|
||||
Panel = (XUiV_Panel)GetChildById("Popup").ViewComponent;
|
||||
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnCancel")).OnPressed += BtnCancel_OnPressed;
|
||||
((XUiC_SimpleButton)Panel.Controller.GetChildById("btnConfirm")).OnPressed += BtnConfirm_OnPressed;
|
||||
LabelQuestName = (XUiV_Label)Panel.Controller.GetChildById("questName").ViewComponent;
|
||||
LabelQuestOffer = (XUiV_Label)Panel.Controller.GetChildById("questOffer").ViewComponent;
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-Init END");
|
||||
}
|
||||
|
||||
public override void OnOpen()
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen START");
|
||||
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
|
||||
var entityID = 0;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
|
||||
if (entityID == 0)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 1");
|
||||
return;
|
||||
}
|
||||
|
||||
var myEntity = player.world.GetEntity(entityID) as EntityAlive;
|
||||
if (myEntity == null)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 2");
|
||||
return;
|
||||
}
|
||||
|
||||
float questNumber = 0;
|
||||
if (player.Buffs.HasCustomVar("$varFuriousRamsayQuestNumber"))
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 3");
|
||||
questNumber = (float)player.Buffs.GetCustomVar("$varFuriousRamsayQuestNumber");
|
||||
}
|
||||
player.Buffs.SetCustomVar("$varFuriousRamsayQuestNumber", 0f);
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen questNumber: " + questNumber);
|
||||
|
||||
if (questNumber == 1)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 4");
|
||||
strQuestID = "quest_FuriousRamsayEventNanos";
|
||||
this.Quest = QuestClass.CreateQuest(strQuestID);
|
||||
LabelQuestName.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Name);
|
||||
LabelQuestOffer.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Offer);
|
||||
}
|
||||
if (questNumber == 2)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 4");
|
||||
strQuestID = "quest_FuriousRamsayMissionBrownPaste";
|
||||
this.Quest = QuestClass.CreateQuest(strQuestID);
|
||||
LabelQuestName.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Name);
|
||||
LabelQuestOffer.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Offer);
|
||||
}
|
||||
if (questNumber == 3)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 4");
|
||||
strQuestID = "quest_FuriousRamsayMissionChickenCoop";
|
||||
this.Quest = QuestClass.CreateQuest(strQuestID);
|
||||
LabelQuestName.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Name);
|
||||
LabelQuestOffer.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Offer);
|
||||
}
|
||||
if (questNumber == 4)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen 4");
|
||||
strQuestID = "quest_FuriousRamsayMissionAmmoMachine";
|
||||
this.Quest = QuestClass.CreateQuest(strQuestID);
|
||||
LabelQuestName.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Name);
|
||||
LabelQuestOffer.Text = this.Quest.GetParsedText(this.Quest.QuestClass.Offer);
|
||||
}
|
||||
base.OnOpen();
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnOpen END");
|
||||
}
|
||||
|
||||
private void BtnConfirm_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-BtnConfirm_OnPressed START");
|
||||
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
player.QuestJournal.AddQuest(this.Quest);
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-BtnConfirm_OnPressed END");
|
||||
}
|
||||
|
||||
private void BtnCancel_OnPressed(XUiController _sender, int _mouseButton)
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-BtnCancel_OnPressed START");
|
||||
|
||||
EntityPlayer player = xui.playerUI.entityPlayer;
|
||||
Panel.IsVisible = false;
|
||||
xui.playerUI.windowManager.Close(windowGroup.ID);
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-BtnCancel_OnPressed END");
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnClose START");
|
||||
|
||||
if (xui.playerUI.windowManager.HasWindow("dialog") && xui.playerUI.windowManager.IsWindowOpen("dialog"))
|
||||
xui.playerUI.windowManager.Close("dialog");
|
||||
base.OnClose();
|
||||
|
||||
//Log.Out("XUiC_OfferQuestPopupRebirth-OnClose END");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user