initial unit testing work and a few tweaks to stuff relating to items
This commit is contained in:
parent
727ae2322b
commit
ffd0471326
4 changed files with 49 additions and 12 deletions
|
|
@ -1945,9 +1945,12 @@ namespace TShockAPI
|
|||
args.Player.SendMessage("Missing item name/id", Color.Red);
|
||||
return;
|
||||
}
|
||||
int itemAmount = 0;
|
||||
int.TryParse( args.Parameters[args.Parameters.Count - 1 ], out itemAmount );
|
||||
var items = Tools.GetItemByIdOrName(args.Parameters[0]);
|
||||
args.Parameters.RemoveAt(0);
|
||||
int itemAmount = 0;
|
||||
if( args.Parameters.Count > 0 )
|
||||
int.TryParse( args.Parameters[0], out itemAmount );
|
||||
|
||||
if (items.Count == 0)
|
||||
{
|
||||
args.Player.SendMessage("Invalid item type!", Color.Red);
|
||||
|
|
@ -1998,8 +2001,13 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
int itemAmount = 0;
|
||||
int.TryParse(args.Parameters[args.Parameters.Count - 1], out itemAmount);
|
||||
var items = Tools.GetItemByIdOrName(args.Parameters[0]);
|
||||
args.Parameters.RemoveAt(0);
|
||||
string plStr = args.Parameters[0];
|
||||
args.Parameters.RemoveAt(0);
|
||||
if( args.Parameters.Count > 0 )
|
||||
int.TryParse(args.Parameters[args.Parameters.Count - 1], out itemAmount);
|
||||
|
||||
|
||||
if (items.Count == 0)
|
||||
{
|
||||
|
|
@ -2014,7 +2022,6 @@ namespace TShockAPI
|
|||
var item = items[0];
|
||||
if (item.type >= 1 && item.type < Main.maxItemTypes)
|
||||
{
|
||||
string plStr = args.Parameters[1];
|
||||
var players = Tools.FindPlayer(plStr);
|
||||
if (players.Count == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,19 +60,25 @@ namespace TShockAPI.DB
|
|||
File.Delete(file2);
|
||||
File.Move(file, file2);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateItemBans();
|
||||
}
|
||||
|
||||
public void UpdateItemBans()
|
||||
{
|
||||
ItemBans.Clear();
|
||||
using (var com = database.CreateCommand())
|
||||
{
|
||||
com.CommandText = "SELECT * FROM ItemBans";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
while (reader!=null&&reader.Read())
|
||||
ItemBans.Add(reader.Get<string>("ItemName"));
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddNewBan(string itemname = "")
|
||||
{
|
||||
try
|
||||
|
|
@ -82,6 +88,7 @@ namespace TShockAPI.DB
|
|||
com.CommandText = "INSERT INTO ItemBans (ItemName) VALUES (@itemname);";
|
||||
com.AddParameter("@itemname", Tools.GetItemByName(itemname)[0].name);
|
||||
com.ExecuteNonQuery();
|
||||
ItemBans.Add(itemname);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -99,6 +106,7 @@ namespace TShockAPI.DB
|
|||
com.CommandText = "DELETE FROM ItemBans WHERE ItemName=@itemname;";
|
||||
com.AddParameter("@itemname", Tools.GetItemByName(itemname)[0].name);
|
||||
com.ExecuteNonQuery();
|
||||
ItemBans.Remove(itemname);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@
|
|||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
|
||||
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
|||
22
Terraria.sln
22
Terraria.sln
|
|
@ -3,7 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 11.00
|
|||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TShockAPI", "TShockAPI\TShockAPI.csproj", "{49606449-072B-4CF5-8088-AA49DA586694}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{F3742F51-D7BF-4754-A68A-CD944D2A21FF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{755F5B05-0924-47E9-9563-26EB20FE3F67}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Local.testsettings = Local.testsettings
|
||||
Terraria.vsmdi = Terraria.vsmdi
|
||||
TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TestCaseManagementSettings) = postSolution
|
||||
CategoryFile = Terraria.vsmdi
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
|
|
@ -23,6 +35,16 @@ Global
|
|||
{49606449-072B-4CF5-8088-AA49DA586694}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{49606449-072B-4CF5-8088-AA49DA586694}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{49606449-072B-4CF5-8088-AA49DA586694}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{F3742F51-D7BF-4754-A68A-CD944D2A21FF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue