76 lines
2.4 KiB
C#
76 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
|
|
public class MinEventActionPermadeathRebirth : MinEventActionRemoveBuff
|
|
{
|
|
public override void Execute(MinEventParams _params)
|
|
{
|
|
if (GameManager.IsDedicatedServer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var player = _params.Self as EntityPlayerLocal;
|
|
|
|
player.Buffs.AddBuff("FuriousRamsayPermadeath");
|
|
|
|
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
|
var playerInventory = uiforPlayer.xui.PlayerInventory;
|
|
|
|
playerInventory.Backpack.Clear();
|
|
playerInventory.Toolbelt.Clear();
|
|
|
|
int numIndex;
|
|
|
|
for (numIndex = 0; numIndex < player.equipment.GetSlotCount(); numIndex++)
|
|
{
|
|
player.equipment.SetSlotItem(numIndex, ItemValue.None.Clone(), true);
|
|
}
|
|
|
|
player.Buffs.SetCustomVar("$LastPlayerLevel", 1);
|
|
player.Buffs.SetCustomVar("$PlayerLevelBonus", 1);
|
|
|
|
player.Progression.Level = 1;
|
|
player.Progression.ResetProgression(true);
|
|
player.Progression.ExpToNextLevel = player.Progression.GetExpForNextLevel();
|
|
player.Progression.SkillPoints = 0;
|
|
player.Progression.ExpDeficit = 0;
|
|
List<Recipe> recipes = CraftingManager.GetRecipes();
|
|
for (int i = 0; i < recipes.Count; i++)
|
|
{
|
|
if (recipes[i].IsLearnable)
|
|
{
|
|
player.Buffs.SetCustomVar(recipes[i].GetName(), 0f);
|
|
}
|
|
}
|
|
|
|
player.classMaxHealth = 100;
|
|
player.classMaxStamina = 100;
|
|
player.classMaxFood = 100;
|
|
player.classMaxWater = 100;
|
|
|
|
player.Health = 100;
|
|
player.Stamina = 100;
|
|
player.Water = 100;
|
|
|
|
List<ProgressionValue> skills = new List<ProgressionValue>();
|
|
player.Progression.GetDict().CopyValuesTo(skills);
|
|
foreach (ProgressionValue progressionValue in skills)
|
|
{
|
|
if (progressionValue.Name == "furiousramsayperkchoiceismine")
|
|
{
|
|
progressionValue.Level = 1;
|
|
}
|
|
else
|
|
{
|
|
progressionValue.Level = 0;
|
|
}
|
|
//Log.Out("progressionValue: " + progressionValue.Name + ", Level: " + progressionValue.Level);
|
|
}
|
|
|
|
string ID = "PermadeathRebirth";
|
|
|
|
player.Buffs.AddBuff("FuriousRamsayGiveClassBook");
|
|
|
|
uiforPlayer.windowManager.Open(ID, true, false, true);
|
|
}
|
|
} |