1.0.0 commit
This commit is contained in:
commit
b6df623f02
261
.gitignore
vendored
Normal file
261
.gitignore
vendored
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# DNX
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
#*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignoreable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
node_modules/
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
109
Biomes.cs
Normal file
109
Biomes.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// CREDITS
|
||||||
|
/// Thanks to d-Dice for his biomes class.
|
||||||
|
/// https://github.com/d-Dice/BTitles-1.4.3/blob/1.4.4/BiomeTitlesMod.cs
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Terraria;
|
||||||
|
|
||||||
|
namespace tTP
|
||||||
|
{
|
||||||
|
internal class Biomes
|
||||||
|
{
|
||||||
|
public static string GetBiome(Player p)
|
||||||
|
{
|
||||||
|
if (p.ZoneMeteor) return "Meteor Crash Site";
|
||||||
|
if (p.ZoneGraveyard) return "Graveyard";
|
||||||
|
if (p.ZoneHive) return "Hive";
|
||||||
|
if (p.ZoneShimmer) return "Aether";
|
||||||
|
|
||||||
|
// Small
|
||||||
|
if (p.ZoneDungeon) return "The Dungeon";
|
||||||
|
if (p.ZoneLihzhardTemple) return "The Temple";
|
||||||
|
|
||||||
|
// Rare
|
||||||
|
if (p.ZoneTowerNebula) return "Nebula Pillar";
|
||||||
|
if (p.ZoneTowerSolar) return "Solar Pillar";
|
||||||
|
if (p.ZoneTowerStardust) return "Stardust Pillar";
|
||||||
|
if (p.ZoneTowerVortex) return "Vortex Pillar";
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
if (p.ZoneGranite) return "Granite Cave";
|
||||||
|
if (p.ZoneMarble) return "Marble Cave";
|
||||||
|
|
||||||
|
if (p.ZoneDirtLayerHeight || p.ZoneRockLayerHeight)
|
||||||
|
{
|
||||||
|
if (p.ZoneGlowshroom) return "Underground Glowing Mushroom";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p.ZoneGlowshroom) return "Glowing Mushroom";
|
||||||
|
|
||||||
|
if (p.ZoneDirtLayerHeight || p.ZoneRockLayerHeight)
|
||||||
|
{
|
||||||
|
// Underground infection-independent
|
||||||
|
if (p.ZoneJungle) return "Underground Jungle";
|
||||||
|
|
||||||
|
// Underground infectable biomes
|
||||||
|
if (p.ZoneDesert)
|
||||||
|
{
|
||||||
|
if (p.ZoneCorrupt) return "Corrupt Cave Desert";
|
||||||
|
if (p.ZoneCrimson) return "Crimson Cave Desert";
|
||||||
|
if (p.ZoneHallow) return "Hallow Cave Desert";
|
||||||
|
return "Cave Desert";
|
||||||
|
}
|
||||||
|
else if (p.ZoneSnow)
|
||||||
|
{
|
||||||
|
if (p.ZoneCorrupt) return "Corrupt Ice Caves";
|
||||||
|
if (p.ZoneCrimson) return "Crimson Ice Caves";
|
||||||
|
if (p.ZoneHallow) return "Hallow Ice Caves";
|
||||||
|
return "Ice Caves";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p.ZoneCorrupt) return "Underground Corruption";
|
||||||
|
if (p.ZoneCrimson) return "Underground Crimson";
|
||||||
|
if (p.ZoneHallow) return "Underground Hallow";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Layer-independent
|
||||||
|
if (p.ZoneBeach) return "Ocean";
|
||||||
|
|
||||||
|
// Layers
|
||||||
|
if (p.ZoneSkyHeight) return "Sky";
|
||||||
|
if (p.ZoneDirtLayerHeight) return "Underground";
|
||||||
|
if (p.ZoneRockLayerHeight) return "Caverns";
|
||||||
|
if (p.ZoneUnderworldHeight) return "Hell";
|
||||||
|
|
||||||
|
// Non-underground infection-independent
|
||||||
|
if (p.ZoneJungle) return "Jungle";
|
||||||
|
|
||||||
|
// Non-underground infectable biomes
|
||||||
|
if (p.ZoneDesert)
|
||||||
|
{
|
||||||
|
if (p.ZoneCorrupt) return "Corrupt Desert";
|
||||||
|
if (p.ZoneCrimson) return "Crimson Desert";
|
||||||
|
if (p.ZoneHallow) return "Hallow Desert";
|
||||||
|
return "Desert";
|
||||||
|
}
|
||||||
|
else if (p.ZoneSnow)
|
||||||
|
{
|
||||||
|
return "Tundra";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p.ZoneCorrupt) return "Corruption";
|
||||||
|
if (p.ZoneCrimson) return "Crimson";
|
||||||
|
if (p.ZoneHallow) return "Hallow";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... other Terraria biome checks ...
|
||||||
|
|
||||||
|
return "Forest";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
50
Common/Systems/ModPlayerOnEnterWorld.cs
Normal file
50
Common/Systems/ModPlayerOnEnterWorld.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.Localization;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
using Terraria;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using Terraria.Map;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace tTP.Common.Systems
|
||||||
|
{
|
||||||
|
internal class ModPlayerOnEnterWorld
|
||||||
|
{
|
||||||
|
public class ModPlayerOnEnterWorldPlayer : ModPlayer
|
||||||
|
{
|
||||||
|
public override void OnEnterWorld()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("tTP")) { Directory.CreateDirectory("tTP"); }
|
||||||
|
tTP.worldName = Main.worldName;
|
||||||
|
|
||||||
|
if (!File.Exists($"tTP/{tTP.worldName}.json"))
|
||||||
|
{
|
||||||
|
string prepjson = @"{ ""tp"": " + '[' + ']' + " }";
|
||||||
|
File.WriteAllText($"tTP/{tTP.worldName}.json", prepjson);
|
||||||
|
}
|
||||||
|
|
||||||
|
string json = File.ReadAllText($"tTP/{tTP.worldName}.json");
|
||||||
|
dynamic jo = JsonConvert.DeserializeObject(json);
|
||||||
|
JArray jar = jo["tp"];
|
||||||
|
if (jar.Count == 0)
|
||||||
|
{
|
||||||
|
tTP.table.Columns.Add("name", typeof(String));
|
||||||
|
tTP.table.Columns.Add("x", typeof(Int64));
|
||||||
|
tTP.table.Columns.Add("y", typeof(Int64));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
DataSet ds = JsonConvert.DeserializeObject<DataSet>(File.ReadAllText($"tTP/{tTP.worldName}.json"));
|
||||||
|
tTP.table = ds.Tables["tp"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
Common/UI/TeleportMapLayer.cs
Normal file
65
Common/UI/TeleportMapLayer.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using Terraria;
|
||||||
|
using Terraria.DataStructures;
|
||||||
|
using Terraria.GameContent;
|
||||||
|
using Terraria.Localization;
|
||||||
|
using Terraria.Map;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.UI;
|
||||||
|
using Terraria.ID;
|
||||||
|
|
||||||
|
namespace tTP.Common.UI
|
||||||
|
{
|
||||||
|
// ModMapLayers are used to draw icons and other things over the map. Pylons and spawn/bed icons are examples of vanilla map layers. This example adds an icon over the dungeon.
|
||||||
|
public class TeleportMapLayer : ModMapLayer
|
||||||
|
{
|
||||||
|
|
||||||
|
public override void Draw(ref MapOverlayDrawContext context, ref string text) {
|
||||||
|
Player p = Main.LocalPlayer;
|
||||||
|
// Here we define the scale that we wish to draw the icon when hovered and not hovered.
|
||||||
|
const float scaleIfNotSelected = 1f;
|
||||||
|
const float scaleIfSelected = scaleIfNotSelected * 2f;
|
||||||
|
|
||||||
|
// Here we retrieve the texture of the Skeletron boss head so that we can draw it. Remember that not all textures are loaded by default, so you might need to do something like `Main.instance.LoadItem(ItemID.BoneKey);` in your code to ensure the texture is loaded.
|
||||||
|
var dungeonTexture = TextureAssets.Item[ModContent.ItemType<Content.Items.Placeable.PersonalTeleporter>()];
|
||||||
|
|
||||||
|
foreach (DataRow row in tTP.table.Rows)
|
||||||
|
{
|
||||||
|
Int64 tpx = Convert.ToInt64(row["x"]);
|
||||||
|
Int64 tpy = Convert.ToInt64(row["y"]);
|
||||||
|
if (context.Draw((Texture2D)dungeonTexture, new Vector2(Convert.ToSingle(tpx), Convert.ToSingle(tpy)), Color.White, new SpriteFrame(1, 1, 0, 0), scaleIfNotSelected, scaleIfSelected, Alignment.Center).IsMouseOver)
|
||||||
|
{
|
||||||
|
text = Language.GetTextValue(row["name"].ToString());
|
||||||
|
if (ItemSlot.ShiftInUse)
|
||||||
|
{
|
||||||
|
IngameFancyUI.Close();
|
||||||
|
p.Teleport(new Vector2(Convert.ToSingle(tpx * 16), Convert.ToSingle((tpy * 16)-10)),TeleportationStyleID.Portal, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The MapOverlayDrawContext.Draw method used here handles many of the small details for drawing an icon and should be used if possible. It'll handle scaling, alignment, culling, framing, and accounting for map zoom. Handling these manually is a lot of work.
|
||||||
|
// Note that the `position` argument expects tile coordinates expressed as a Vector2. Don't scale tile coordinates to world coordinates by multiplying by 16.
|
||||||
|
// The return of MapOverlayDrawContext.Draw has a field that indicates if the mouse is currently over our icon.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The game doesn't send Main.dungeonX or Main.dungeonY to multiplayer clients.
|
||||||
|
// This ModSystem will ensure that they are synced allowing ExampleMapLayer to work in multiplayer.
|
||||||
|
public class TeleportLayerSystem : ModSystem
|
||||||
|
{
|
||||||
|
public override void NetSend(BinaryWriter writer) {
|
||||||
|
writer.Write(Main.dungeonX);
|
||||||
|
writer.Write(Main.dungeonY);
|
||||||
|
}
|
||||||
|
public override void NetReceive(BinaryReader reader) {
|
||||||
|
Main.dungeonX = reader.ReadInt32();
|
||||||
|
Main.dungeonY = reader.ReadInt32();
|
||||||
|
}
|
||||||
|
}
|
39
Content/Items/Placeable/PersonalTeleporter.cs
Normal file
39
Content/Items/Placeable/PersonalTeleporter.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using Terraria;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace tTP.Content.Items.Placeable
|
||||||
|
{
|
||||||
|
public class PersonalTeleporter : ModItem
|
||||||
|
{
|
||||||
|
public override void SetDefaults()
|
||||||
|
{
|
||||||
|
Item.CloneDefaults(ItemID.ArmorStatue);
|
||||||
|
Item.createTile = ModContent.TileType<Tiles.PersonalTeleporter>();
|
||||||
|
Item.placeStyle = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddRecipes()
|
||||||
|
{
|
||||||
|
Recipe recipe = CreateRecipe();
|
||||||
|
if (ModLoader.TryGetMod("tMx", out Mod tMxft) && tMxft.TryFind<ModItem>("FrozenTablet", out ModItem FrozenTablet))
|
||||||
|
{
|
||||||
|
recipe.AddIngredient(FrozenTablet.Type, 1);
|
||||||
|
}
|
||||||
|
if (ModLoader.TryGetMod("tMx", out Mod tMxst) && tMxst.TryFind<ModItem>("SandTablet", out ModItem SandTablet))
|
||||||
|
{
|
||||||
|
recipe.AddIngredient(SandTablet.Type, 1);
|
||||||
|
}
|
||||||
|
if (ModLoader.TryGetMod("tMx", out Mod tMxtt) && tMxtt.TryFind<ModItem>("ToxicTablet", out ModItem ToxicTablet))
|
||||||
|
{
|
||||||
|
recipe.AddIngredient(ToxicTablet.Type, 1);
|
||||||
|
}
|
||||||
|
if (ModLoader.TryGetMod("tMx", out Mod tMxmt) && tMxmt.TryFind<ModItem>("MoltenTablet", out ModItem MoltenTablet))
|
||||||
|
{
|
||||||
|
recipe.AddIngredient(MoltenTablet.Type, 1);
|
||||||
|
}
|
||||||
|
recipe.AddTile(TileID.WorkBenches);
|
||||||
|
recipe.Register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Content/Items/Placeable/PersonalTeleporter.png
Normal file
BIN
Content/Items/Placeable/PersonalTeleporter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
Content/Items/Placeable/PersonalTeleporter.psd
Normal file
BIN
Content/Items/Placeable/PersonalTeleporter.psd
Normal file
Binary file not shown.
125
Content/Tiles/PersonalTeleporter.cs
Normal file
125
Content/Tiles/PersonalTeleporter.cs
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using Terraria;
|
||||||
|
using Terraria.Audio;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.Localization;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.ObjectData;
|
||||||
|
using System.IO;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
using System;
|
||||||
|
using Terraria.DataStructures;
|
||||||
|
using Terraria.UI;
|
||||||
|
|
||||||
|
namespace tTP.Content.Tiles
|
||||||
|
{
|
||||||
|
public class PersonalTeleporter : ModTile
|
||||||
|
{
|
||||||
|
public override void SetStaticDefaults()
|
||||||
|
{
|
||||||
|
Main.tileFrameImportant[Type] = true;
|
||||||
|
Main.tileObsidianKill[Type] = true;
|
||||||
|
Main.tileLighted[Type] = true;
|
||||||
|
TileID.Sets.DisableSmartCursor[Type] = true;
|
||||||
|
|
||||||
|
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
|
||||||
|
TileObjectData.addTile(Type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||||
|
{
|
||||||
|
Tile tile = Main.tile[i, j];
|
||||||
|
|
||||||
|
// If the torch is on
|
||||||
|
if (tile.TileFrameX < 66)
|
||||||
|
{
|
||||||
|
int style = TileObjectData.GetTileStyle(Main.tile[i, j]);
|
||||||
|
// Make it emit the following light.
|
||||||
|
if (style == 0)
|
||||||
|
{
|
||||||
|
r = 0.9f;
|
||||||
|
g = 0.9f;
|
||||||
|
b = 0.9f;
|
||||||
|
}
|
||||||
|
else if (style == 1)
|
||||||
|
{
|
||||||
|
r = 0.5f;
|
||||||
|
g = 1.5f;
|
||||||
|
b = 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void MouseOver(int i, int j)
|
||||||
|
{
|
||||||
|
Player player = Main.LocalPlayer;
|
||||||
|
player.noThrow = 2;
|
||||||
|
player.cursorItemIconEnabled = true;
|
||||||
|
|
||||||
|
int style = TileObjectData.GetTileStyle(Main.tile[i, j]);
|
||||||
|
player.cursorItemIconID = TileLoader.GetItemDropFromTypeAndStyle(Type, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool RightClick(int i, int j)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PlaceInWorld(int i, int j, Item item)
|
||||||
|
{
|
||||||
|
Player p = Main.LocalPlayer;
|
||||||
|
tTP.table.Rows.Add(Biomes.GetBiome(p), i, j);
|
||||||
|
Main.NewText($"[tTP] Added new TP: {Biomes.GetBiome(p)} x{i} y{j} ", Color.Aqua);
|
||||||
|
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
|
||||||
|
Dictionary<string, object> row;
|
||||||
|
foreach (DataRow dr in tTP.table.Rows)
|
||||||
|
{
|
||||||
|
row = new Dictionary<string, object>();
|
||||||
|
foreach (DataColumn col in tTP.table.Columns)
|
||||||
|
{
|
||||||
|
row.Add(col.ColumnName, dr[col]);
|
||||||
|
}
|
||||||
|
rows.Add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
string output = JsonConvert.SerializeObject(rows, Formatting.Indented);
|
||||||
|
string prepjson = @"{ ""tp"":" + output + "}";
|
||||||
|
File.WriteAllText($"tTP/{tTP.worldName}.json", prepjson);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem)
|
||||||
|
{
|
||||||
|
Player p = Main.LocalPlayer;
|
||||||
|
Main.NewText($"[tTP] Removed a TP: {Biomes.GetBiome(p)} x{i} y{j} ", Color.Aqua);
|
||||||
|
tTP.table.AcceptChanges();
|
||||||
|
foreach (DataRow tprow in tTP.table.Rows)
|
||||||
|
{
|
||||||
|
if (Convert.ToInt64(tprow["x"]) == i && Convert.ToInt64(tprow["y"]) == j)
|
||||||
|
{
|
||||||
|
tprow.Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tTP.table.AcceptChanges();
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
|
||||||
|
Dictionary<string, object> row;
|
||||||
|
foreach (DataRow dr in tTP.table.Rows)
|
||||||
|
{
|
||||||
|
row = new Dictionary<string, object>();
|
||||||
|
foreach (DataColumn col in tTP.table.Columns)
|
||||||
|
{
|
||||||
|
row.Add(col.ColumnName, dr[col]);
|
||||||
|
}
|
||||||
|
rows.Add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
string output = JsonConvert.SerializeObject(rows, Formatting.Indented);
|
||||||
|
string prepjson = @"{ ""tp"":" + output + "}";
|
||||||
|
File.WriteAllText($"tTP/{tTP.worldName}.json", prepjson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Content/Tiles/PersonalTeleporter.png
Normal file
BIN
Content/Tiles/PersonalTeleporter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
23
DB.cs
Normal file
23
DB.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace tTP
|
||||||
|
{
|
||||||
|
internal class DB
|
||||||
|
{
|
||||||
|
public static void CreateDB()
|
||||||
|
{
|
||||||
|
/*SQLitePCL.raw.SetProvider(new SQLitePCLRaw.provider.e_sqlite3);
|
||||||
|
using (var connection = new SqliteConnection("Data Source=tTP.db"))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
var command = connection.CreateCommand();
|
||||||
|
command.CommandText = @" CREATE TABLE teleporter ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL )";
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
Localization/en-US_Mods.tTP.hjson
Normal file
18
Localization/en-US_Mods.tTP.hjson
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# This file will automatically update with entries for new content after a build and reload.
|
||||||
|
|
||||||
|
Items: {
|
||||||
|
SwordOfTP: {
|
||||||
|
DisplayName: Sword Of T P
|
||||||
|
Tooltip:
|
||||||
|
'''
|
||||||
|
Template of an item
|
||||||
|
Replacing this tooltip is duty
|
||||||
|
It's snowing on Mt.Fuji
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
|
||||||
|
PersonalTeleporter: {
|
||||||
|
DisplayName: Personal Teleporter
|
||||||
|
Tooltip: ""
|
||||||
|
}
|
||||||
|
}
|
16
Properties/launchSettings.json
Normal file
16
Properties/launchSettings.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"Terraria": {
|
||||||
|
"commandName": "Executable",
|
||||||
|
"executablePath": "$(DotNetName)",
|
||||||
|
"commandLineArgs": "$(tMLPath)",
|
||||||
|
"workingDirectory": "$(tMLSteamPath)"
|
||||||
|
},
|
||||||
|
"TerrariaServer": {
|
||||||
|
"commandName": "Executable",
|
||||||
|
"executablePath": "$(DotNetName)",
|
||||||
|
"commandLineArgs": "$(tMLServerPath)",
|
||||||
|
"workingDirectory": "$(tMLSteamPath)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## tTP
|
||||||
|
**Author** mikx\
|
||||||
|
**Dependencies** tMx\
|
||||||
|
tTP is a teleporter mod for tModLoader.\
|
||||||
|
You need to collect 1 of each Tablets from tMx to craft it.\
|
||||||
|
Addind a **Personal Teleporter** to the world add an icon on your map.\
|
||||||
|
Hover over one of the **Personal Teleporter** icon on your map to teleport to it!
|
5
build.txt
Normal file
5
build.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
displayName = tTP
|
||||||
|
author = mikx
|
||||||
|
version = 1.0.0
|
||||||
|
modReferences = tMx
|
||||||
|
dllReferences = Newtonsoft.Json
|
1
description.txt
Normal file
1
description.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Modify this file with a description of your mod.
|
BIN
lib/Newtonsoft.Json.dll
Normal file
BIN
lib/Newtonsoft.Json.dll
Normal file
Binary file not shown.
31
tTP.cs
Normal file
31
tTP.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Terraria;
|
||||||
|
using Terraria.GameContent.UI;
|
||||||
|
using Terraria.Graphics;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace tTP
|
||||||
|
{
|
||||||
|
public class tTP : Mod
|
||||||
|
{
|
||||||
|
public static DataTable table = new DataTable();
|
||||||
|
public static string worldName = "";
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Unload()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
tTP.csproj
Normal file
27
tTP.csproj
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<!-- Import tModLoader mod properties -->
|
||||||
|
<Import Project="..\tModLoader.targets" />
|
||||||
|
|
||||||
|
<!-- General -->
|
||||||
|
<PropertyGroup>
|
||||||
|
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="MySql.Data">
|
||||||
|
<HintPath>lib\MySql.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="SQLite-net">
|
||||||
|
<HintPath>lib\SQLite-net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite">
|
||||||
|
<HintPath>lib\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- References -->
|
||||||
|
|
||||||
|
</Project>
|
22
tTP.sln
Normal file
22
tTP.sln
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.12.35707.178 d17.12
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tTP", "tTP.csproj", "{F19FACA2-F80C-437E-AD8C-D05B98503B46}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F19FACA2-F80C-437E-AD8C-D05B98503B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F19FACA2-F80C-437E-AD8C-D05B98503B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F19FACA2-F80C-437E-AD8C-D05B98503B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F19FACA2-F80C-437E-AD8C-D05B98503B46}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Loading…
x
Reference in New Issue
Block a user