Beispiel #1
0
        public static void ResetWorld()
        {
            ConsoleTrack.possibleTabs = "Example: `reset world`";
            ConsoleTrack.helpText     = "Reset the entire world, losing any progress made.";

            if (ConsoleTrack.activate)
            {
                WorldScene      scene    = (WorldScene)Systems.scene;
                CampaignState   campaign = scene.campaign;
                StartNodeFormat start    = scene.worldData.start;

                // Adjust Campaign Level Status
                campaign.levelStatus = new Dictionary <byte, Dictionary <string, CampaignLevelStatus> >();

                // Reload Campaign State
                campaign.SetWorld(campaign.worldId);
                campaign.SetZone(campaign.zoneId);
                campaign.SetPosition(campaign.curX, campaign.curY, campaign.lastDir);
                campaign.SetLives(campaign.lives);
                campaign.SetWounds(campaign.health, campaign.armor);
                campaign.SetHead(campaign.head);
                campaign.SetUpgrades(campaign.suit, campaign.hat, campaign.shoes, campaign.powerAtt, campaign.powerMob, campaign.health, campaign.armor);
                campaign.SetLevelStatus(campaign.levelStatus);

                // Update Campaign Positions
                campaign.lastDir = (byte)DirCardinal.None;
                campaign.curX    = start.x;
                campaign.curY    = start.y;
                campaign.zoneId  = start.zoneId;

                // Update Character
                scene.character.SetCharacter(campaign);
            }
        }
Beispiel #2
0
        public async Task <bool> ActivateNode()
        {
            // Verify the Node is ready.
            if (!await RunNodeReadiness())
            {
                return(false);
            }

            // Get Current Tile Data
            byte[] wtData = this.worldContent.GetWorldTileData(this.currentZone, this.character.curX, this.character.curY);

            // Identify Level Data at this node:
            int    coordId = Coords.MapToInt(this.character.curX, this.character.curY);
            string levelId = this.currentZone.nodes.ContainsKey(coordId.ToString()) ? this.currentZone.nodes[coordId.ToString()] : "";

            // If the level is valid, we can enter the level.
            bool isWon = this.campaign.IsLevelWon(this.campaign.zoneId, levelId);

            // Grant Character Their World Equipment On Casual or Beaten Nodes (after scene generated)
            if (!isWon && (wtData[5] != (byte)OTerrainObjects.NodeCasual && wtData[5] != (byte)OTerrainObjects.NodeWon))
            {
                CampaignState campaign = Systems.handler.campaignState;
                campaign.SetUpgrades(0, 0, 0, 0, 0, 0, 0);
                campaign.SaveCampaign();
            }

            SceneTransition.ToLevel(this.worldData.id, levelId, true);
            return(true);
        }