This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
forked from Unowndeveloper/PokeMod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PokeModRed.cs
135 lines (129 loc) · 3.41 KB
/
PokeModRed.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using PokeModRed.NPCs;
namespace PokeModRed
{
public partial class PokeModRed : Mod
{
public static byte pokeSpawns = 1;
public static IDictionary<int, float> originalSpawnPool;
private double pressedSpawnToggleHotKeyTime;
public override void SetModInfo(out string name, ref ModProperties properties)
{
name = "PokeModRed";
properties.Autoload = true;
properties.AutoloadGores = true;
properties.AutoloadSounds = true;
}
public override void Load()
{
Pokedex.DoNothing();
RegisterHotKey("Activate/Deactivate Pokemon Spawns", "P");
}
<<<<<<< HEAD
public override void ChatInput(string text)
{
if (text[0] != '/')
{
return;
}
text = text.Substring(1);
int index = text.IndexOf(' ');
string command;
string[] args;
if (index < 0)
{
command = text;
args = new string[0];
}
else
{
command = text.Substring(0, index);
args = text.Substring(index + 1).Split(' ');
}
if (command == "pokedex")
{
PokedexCommand(args);
}
=======
public override void ChatInput(string text)
{
if (text[0] != '/')
{
return;
}
text = text.Substring(1);
int index = text.IndexOf(' ');
string command;
string[] args;
if (index < 0)
{
command = text;
args = new string[0];
}
else
{
command = text.Substring(0, index);
args = text.Substring(index + 1).Split(' ');
}
if (command == "pokedex")
{
PokedexCommand(args);
}
>>>>>>> refs/remotes/Unowndeveloper/master
if (command == "gift")
{
GiftCommand(args);
}
}
public override void HotKeyPressed(string name)
{
if (name == "Activate/Deactivate Pokemon Spawns")
{
if(Math.Abs(Main.time - pressedSpawnToggleHotKeyTime) > 60)
{
pressedSpawnToggleHotKeyTime = Main.time;
if (pokeSpawns == 1)
{
pokeSpawns = 2;
Main.NewText("Only Mod NPCs Spawn");
}
else if (pokeSpawns == 2)
{
pokeSpawns = 3;
Main.NewText("Only Normal NPCs Spawn");
}
else if (pokeSpawns == 3)
{
pokeSpawns = 1;
Main.NewText("All NPCs Spawn");
}
}
}
}
private void PokedexCommand(string[] args)
{
int id;
if (args.Length == 0 || !Int32.TryParse(args[0], out id))
{
Main.NewText("Usage: /pokedex [number]");
Main.NewText("Input the number as the National Pokedex number");
return;
} else {
PokedexEntry entry;
if (Pokedex.pokedex.TryGetValue((float)id, out entry))
{
Main.NewText(entry.Print());
} else {
Main.NewText("No Pokemon found by that ID");
}
}
}
}
}