Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Scripts/XUIC/XUiC_OfferQuestPopupRebirth.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

142 lines
5.0 KiB
C#

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");
}
}