XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

DeathMod

【Terraria】DeathMod (now aka Soul Harvest)

公开
关注 0 Fork 0 Star 0
UTF-8
using SoulHarvest.Common;
using SoulHarvest.Items;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;

namespace SoulHarvest.Commands;

public sealed class ReaperDebugItemsCommand : ModCommand
{
    public override string Command => "reaperdebugitems";
    public override CommandType Type => CommandType.World;
    public override string Usage => "/reaperdebugitems";
    public override string Description => Language.GetTextValue("Mods.SoulHarvest.Commands.ItemsDescription");

    public override void Action(CommandCaller caller, string input, string[] args)
    {
        if (!ReaperDebugMode.TryGetPlayer(caller, out Player player))
            return;

        int spawnedItemTypes = 0;
        foreach (ModItem modItem in Mod.GetContent<ModItem>())
        {
            // DeathDomain is an altar-only virtual entry. Soul Seal items mirror an
            // authoritative character ledger and must be issued through its service.
            if (modItem is DeathDomain or ReaperSoulSealItem)
                continue;

            player.QuickSpawnItem(
                player.GetSource_Misc("SoulHarvest:DebugAllItems"),
                modItem.Type);
            spawnedItemTypes++;
        }

        int grantedSealPoints = 0;
        for (ReaperStage stage = ReaperStage.StageI; stage <= ReaperStage.StageIII; stage++)
        {
            if (ReaperProgressionSoulSealService.TryGrant(player, stage))
                grantedSealPoints++;
        }

        caller.Reply(Language.GetTextValue(
                "Mods.SoulHarvest.Commands.ItemsSuccess",
                spawnedItemTypes,
                grantedSealPoints),
            new Color(115, 225, 190));
    }
}