2018-12-21 05:34:08 +08:00
using System.Collections.Generic ;
2018-12-25 04:00:58 +08:00
using System.IO ;
2018-12-30 18:00:05 +08:00
using Microsoft.Xna.Framework ;
using PyTK.Extensions ;
using PyTK.Types ;
2019-01-10 10:05:03 +08:00
using Revitalize.Framework ;
2018-12-25 14:02:25 +08:00
using Revitalize.Framework.Crafting ;
2018-12-30 18:00:05 +08:00
using Revitalize.Framework.Environment ;
using Revitalize.Framework.Graphics ;
using Revitalize.Framework.Graphics.Animations ;
2018-12-26 11:48:45 +08:00
using Revitalize.Framework.Illuminate ;
2018-12-30 18:00:05 +08:00
using Revitalize.Framework.Objects ;
2018-12-29 15:28:21 +08:00
using Revitalize.Framework.Player ;
2018-12-30 18:00:05 +08:00
using StardewModdingAPI ;
using StardewValley ;
using StardewValley.Objects ;
2018-12-21 05:34:08 +08:00
namespace Revitalize
{
2018-12-30 18:00:05 +08:00
// TODO:
// -Multiple Lights On Object
// -Illumination Colors
// Furniture:
// -rugs
// -tables
// -lamps
// -chairs
// -dressers/other storage containers
// -fun interactables
// -More crafting tables
// -Machines
// !=Energy
// -Furnace
// -Seed Maker
// -Stone Quarry
// -Materials
// -Tin/Bronze/Alluminum/Silver?Platinum/Etc
// -Crafting Menu
// -Item Grab Menu (Extendable)
// -Gift Boxes
// Magic!
// -Alchemy Bags
// -Transmutation
// -Effect Crystals
// -Spell books
// -Potions!
// -Magic Meter
2019-01-06 14:25:22 +08:00
// -Connected chests much like Project EE2 from MC
/ /
/ /
/ /
// -Bigger chests
/ /
2018-12-30 18:00:05 +08:00
// Festivals
// -Firework festival?
// Stargazing???
// -Moon Phases+DarkerNight
// Bigger/Better Museum?
// More Crops?
// More Food?
//
// Equippables!
// -accessories that provide buffs/regen/friendship
2019-01-06 14:25:22 +08:00
// -braclets/rings/broaches....more crafting for these???
2018-12-30 18:00:05 +08:00
//
// Music???
// -IDK maybe add in instruments???
//
// More buildings????
//
// More Animals???
//
// Readable Books?
//
// Custom NPCs for shops???
//
// Frisbee Minigame?
//
// HorseRace Minigame/Betting?
//
// Locations:
// -Small Island Home?
//
// More crops
2019-01-06 14:25:22 +08:00
/ /
// More monsters
// -boss fights
/ /
// More dungeons??
2018-12-25 15:34:38 +08:00
2018-12-21 05:34:08 +08:00
public class ModCore : Mod
{
public static IModHelper ModHelper ;
public static IMonitor ModMonitor ;
public static Dictionary < string , CustomObject > customObjects ;
2018-12-29 15:28:21 +08:00
public static PlayerInfo playerInfo ;
2018-12-21 05:34:08 +08:00
public override void Entry ( IModHelper helper )
{
ModHelper = helper ;
2018-12-30 18:00:05 +08:00
ModMonitor = this . Monitor ;
2018-12-25 04:00:58 +08:00
2018-12-30 18:00:05 +08:00
this . createDirectories ( ) ;
this . initailizeComponents ( ) ;
2018-12-25 04:00:58 +08:00
2018-12-30 18:00:05 +08:00
ModHelper . Events . GameLoop . SaveLoaded + = this . GameLoop_SaveLoaded ;
ModHelper . Events . GameLoop . TimeChanged + = this . GameLoop_TimeChanged ;
ModHelper . Events . GameLoop . UpdateTicked + = this . GameLoop_UpdateTicked ;
2018-12-29 15:28:21 +08:00
playerInfo = new PlayerInfo ( ) ;
2019-01-09 14:15:58 +08:00
Framework . Graphics . TextureManager . TextureManagers . Add ( "Furniture" , new TextureManager ( ) ) ;
TextureManager . TextureManagers [ "Furniture" ] . addTexture ( "Oak Chair" , new Texture2DExtended ( this . Helper , this . ModManifest , Path . Combine ( "Content" , "Graphics" , "Furniture" , "Chairs" , "OakChair.png" ) ) ) ;
2018-12-25 04:00:58 +08:00
}
private void createDirectories ( )
{
Directory . CreateDirectory ( Path . Combine ( this . Helper . DirectoryPath , "Configs" ) ) ;
2019-01-09 14:15:58 +08:00
Directory . CreateDirectory ( Path . Combine ( this . Helper . DirectoryPath , "Content" ) ) ;
Directory . CreateDirectory ( Path . Combine ( this . Helper . DirectoryPath , "Content" , "Graphics" ) ) ;
Directory . CreateDirectory ( Path . Combine ( this . Helper . DirectoryPath , "Content" , "Graphics" , "Furniture" ) ) ;
Directory . CreateDirectory ( Path . Combine ( this . Helper . DirectoryPath , "Content" , "Graphics" , "Furniture" , "Chairs" ) ) ;
2018-12-25 04:00:58 +08:00
}
private void initailizeComponents ( )
{
DarkerNight . InitializeConfig ( ) ;
}
2018-12-25 04:36:03 +08:00
private void GameLoop_UpdateTicked ( object sender , StardewModdingAPI . Events . UpdateTickedEventArgs e )
{
DarkerNight . SetDarkerColor ( ) ;
2018-12-29 15:28:21 +08:00
playerInfo . update ( ) ;
2018-12-25 04:36:03 +08:00
}
2018-12-25 04:00:58 +08:00
private void GameLoop_TimeChanged ( object sender , StardewModdingAPI . Events . TimeChangedEventArgs e )
{
2018-12-25 04:36:03 +08:00
DarkerNight . CalculateDarkerNightColor ( ) ;
2018-12-21 05:34:08 +08:00
}
private void GameLoop_SaveLoaded ( object sender , StardewModdingAPI . Events . SaveLoadedEventArgs e )
{
2019-01-10 10:05:03 +08:00
2018-12-30 18:00:05 +08:00
MultiTiledComponent obj = new MultiTiledComponent ( new BasicItemInformation ( "CoreObjectTest" , "YAY FUN!" , "Omegasis.Revitalize.MultiTiledComponent" , Color . White , - 300 , 0 , false , 100 , Vector2 . Zero , true , true , "Omegasis.TEST1" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , Game1 . objectSpriteSheet , Color . White , 0 , true , typeof ( MultiTiledComponent ) , null , new AnimationManager ( new Texture2DExtended ( Game1 . objectSpriteSheet ) , new Animation ( new Rectangle ( 0 , 0 , 16 , 16 ) ) ) , Color . Red , true , null , null ) ) ;
MultiTiledComponent obj2 = new MultiTiledComponent ( new BasicItemInformation ( "CoreObjectTest2" , "SomeFun" , "Omegasis.Revitalize.MultiTiledComponent" , Color . White , - 300 , 0 , false , 100 , Vector2 . Zero , true , true , "Omegasis.TEST1" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , Game1 . objectSpriteSheet , Color . White , 0 , true , typeof ( MultiTiledComponent ) , null , new AnimationManager ( new Texture2DExtended ( Game1 . objectSpriteSheet ) , new Animation ( new Rectangle ( 0 , 16 , 16 , 16 ) ) ) , Color . Red , false , null , null ) ) ;
MultiTiledComponent obj3 = new MultiTiledComponent ( new BasicItemInformation ( "CoreObjectTest3" , "NoFun" , "Omegasis.Revitalize.MultiTiledComponent" , Color . White , - 300 , 0 , false , 100 , Vector2 . Zero , true , true , "Omegasis.TEST1" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , Game1 . objectSpriteSheet , Color . White , 0 , true , typeof ( MultiTiledComponent ) , null , new AnimationManager ( new Texture2DExtended ( Game1 . objectSpriteSheet ) , new Animation ( new Rectangle ( 0 , 32 , 16 , 16 ) ) ) , Color . Red , false , null , null ) ) ;
2018-12-21 05:34:08 +08:00
2018-12-26 11:48:45 +08:00
obj . info . lightManager . addLight ( new Vector2 ( Game1 . tileSize ) , new LightSource ( 4 , new Vector2 ( 0 , 0 ) , 2.5f , Color . Orange . Invert ( ) ) , obj ) ;
2018-12-30 18:00:05 +08:00
MultiTiledObject bigObject = new MultiTiledObject ( new BasicItemInformation ( "MultiTest" , "A really big object" , "Omegasis.Revitalize.MultiTiledObject" , Color . Blue , - 300 , 0 , false , 100 , Vector2 . Zero , true , true , "Omegasis.BigTiledTest" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , Game1 . objectSpriteSheet , Color . White , 0 , true , typeof ( MultiTiledObject ) , null , new AnimationManager ( ) , Color . White , false , null , null ) ) ;
2018-12-23 16:53:43 +08:00
bigObject . addComponent ( new Vector2 ( 0 , 0 ) , obj ) ;
bigObject . addComponent ( new Vector2 ( 1 , 0 ) , obj2 ) ;
bigObject . addComponent ( new Vector2 ( 2 , 0 ) , obj3 ) ;
2018-12-21 05:34:08 +08:00
2018-12-25 14:02:25 +08:00
Recipe pie = new Recipe ( new Dictionary < Item , int > ( )
{
[bigObject] = 1
2019-01-10 10:05:03 +08:00
} , new KeyValuePair < Item , int > ( new Furniture ( 3 , Vector2 . Zero ) , 1 ) , new StatCost ( 100 , 50 , 0 , 0 ) ) ;
2018-12-25 14:02:25 +08:00
2018-12-23 16:53:43 +08:00
2019-01-09 14:15:58 +08:00
Framework . Objects . Furniture . ChairTileComponent chairTop = new Framework . Objects . Furniture . ChairTileComponent ( new BasicItemInformation ( "Oak Chair" , "A basic wooden chair" , "Chairs" , Color . Brown , - 300 , 0 , false , 100 , Vector2 . Zero , true , true , "Omegasis.Revitalize.Furniture.Basic.OakChair" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , Framework . Graphics . TextureManager . TextureManagers [ "Furniture" ] . getTexture ( "Oak Chair" ) . texture , Color . White , 0 , false , typeof ( Framework . Objects . Furniture . ChairTileComponent ) , null , new AnimationManager ( TextureManager . TextureManagers [ "Furniture" ] . getTexture ( "Oak Chair" ) , new Animation ( new Rectangle ( 0 , 0 , 16 , 16 ) ) , new Dictionary < string , List < Animation > > ( ) {
{ "Default_" + ( int ) Framework . Enums . Direction . Down , new List < Animation > ( )
{
new Animation ( new Rectangle ( 0 , 0 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Down , new List < Animation > ( )
{
new Animation ( new Rectangle ( 0 , 0 , 16 , 16 ) )
}
} ,
{ "Default_" + ( int ) Framework . Enums . Direction . Right , new List < Animation > ( )
{
new Animation ( new Rectangle ( 16 , 0 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Right , new List < Animation > ( )
{
new Animation ( new Rectangle ( 16 , 0 , 16 , 16 ) )
}
} ,
{ "Default_" + ( int ) Framework . Enums . Direction . Up , new List < Animation > ( )
{
new Animation ( new Rectangle ( 32 , 0 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Up , new List < Animation > ( )
{
new Animation ( new Rectangle ( 32 , 32 , 16 , 32 ) )
}
} ,
{ "Default_" + ( int ) Framework . Enums . Direction . Left , new List < Animation > ( )
{
new Animation ( new Rectangle ( 48 , 0 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Left , new List < Animation > ( )
{
new Animation ( new Rectangle ( 48 , 0 , 16 , 16 ) )
}
}
2019-01-10 10:05:03 +08:00
} , "Default_" + ( int ) Framework . Enums . Direction . Down ) , Color . White , true , new Framework . Utilities . InventoryManager ( ) , new LightManager ( ) ) , new Framework . Objects . InformationFiles . Furniture . ChairInformation ( false ) ) ;
2019-01-09 14:15:58 +08:00
Framework . Objects . Furniture . ChairTileComponent chairBottom = new Framework . Objects . Furniture . ChairTileComponent ( new BasicItemInformation ( "Oak Chair" , "A basic wooden chair" , "Chairs" , Color . Brown , - 300 , 0 , false , 100 , Vector2 . Zero , true , true , "Omegasis.Revitalize.Furniture.Basic.OakChair" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , Framework . Graphics . TextureManager . TextureManagers [ "Furniture" ] . getTexture ( "Oak Chair" ) . texture , Color . White , 0 , false , typeof ( Framework . Objects . Furniture . ChairTileComponent ) , null , new AnimationManager ( TextureManager . TextureManagers [ "Furniture" ] . getTexture ( "Oak Chair" ) , new Animation ( new Rectangle ( 0 , 16 , 16 , 16 ) ) , new Dictionary < string , List < Animation > > ( ) {
{ "Default_" + ( int ) Framework . Enums . Direction . Down , new List < Animation > ( )
{
new Animation ( new Rectangle ( 0 , 16 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Down , new List < Animation > ( )
{
new Animation ( new Rectangle ( 0 , 16 , 16 , 16 ) )
}
} ,
{ "Default_" + ( int ) Framework . Enums . Direction . Right , new List < Animation > ( )
{
new Animation ( new Rectangle ( 16 , 16 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Right , new List < Animation > ( )
{
new Animation ( new Rectangle ( 16 , 16 , 16 , 16 ) )
}
} ,
{ "Default_" + ( int ) Framework . Enums . Direction . Up , new List < Animation > ( )
{
new Animation ( new Rectangle ( 32 , 16 , 16 , 16 ) )
}
} ,
{ "Sitting_" + ( int ) Framework . Enums . Direction . Up , new List < Animation > ( )
{
new Animation ( new Rectangle ( 48 , 32 , 16 , 32 ) )
}
} ,
{ "Default_" + ( int ) Framework . Enums . Direction . Left , new List < Animation > ( )
{
new Animation ( new Rectangle ( 48 , 16 , 16 , 16 ) )
}
} ,
{ "Sitting" + ( int ) Framework . Enums . Direction . Left , new List < Animation > ( )
{
new Animation ( new Rectangle ( 48 , 16 , 16 , 16 ) )
}
}
2019-01-10 10:05:03 +08:00
} , "Default_" + ( int ) Framework . Enums . Direction . Down ) , Color . White , false , new Framework . Utilities . InventoryManager ( ) , new LightManager ( ) ) , new Framework . Objects . InformationFiles . Furniture . ChairInformation ( true ) ) ;
2019-01-09 14:15:58 +08:00
2019-01-10 10:05:03 +08:00
Framework . Objects . Furniture . ChairMultiTiledObject oakChair = new Framework . Objects . Furniture . ChairMultiTiledObject ( new BasicItemInformation ( "Oak Chair" , "A wood chair you can place anywhere." , "Chair" , Color . White , - 300 , 0 , true , 100 , Vector2 . Zero , true , true , "Omegasis.Revitalize.Furniture.OakChair" , "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" , TextureManager . TextureManagers [ "Furniture" ] . getTexture ( "Oak Chair" ) . texture , Color . White , 0 , true , typeof ( Revitalize . Framework . Objects . Furniture . ChairMultiTiledObject ) , null , new AnimationManager ( ) , Color . White , false , new Framework . Utilities . InventoryManager ( ) , new LightManager ( ) ) ) ;
2019-01-09 14:15:58 +08:00
oakChair . addComponent ( new Vector2 ( 0 , 0 ) , chairTop ) ;
oakChair . addComponent ( new Vector2 ( 0 , 1 ) , chairBottom ) ;
Game1 . player . addItemToInventory ( oakChair ) ;
2018-12-30 18:00:05 +08:00
new InventoryItem ( bigObject , 100 , 1 ) . addToNPCShop ( "Gus" ) ;
2018-12-23 16:53:43 +08:00
Game1 . player . addItemToInventory ( bigObject ) ;
2018-12-30 18:00:05 +08:00
2019-01-06 15:25:50 +08:00
if ( pie . PlayerCanCraft ( ) )
{
2019-01-09 14:15:58 +08:00
//pie.craft();
2019-01-06 15:25:50 +08:00
}
2019-01-10 10:05:03 +08:00
2018-12-21 05:34:08 +08:00
}
2019-01-10 10:05:03 +08:00
2018-12-21 05:34:08 +08:00
public static void log ( object message )
{
ModMonitor . Log ( message . ToString ( ) ) ;
}
2019-01-10 10:05:03 +08:00
public static string generatePlaceholderString ( )
{
return "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048" ;
}
2018-12-21 05:34:08 +08:00
}
}