Skip to content

Commit

Permalink
Merge pull request #74 from hybrasyl/develop
Browse files Browse the repository at this point in the history
Hybrasyl Server 0.5.5 "Devlin" release
  • Loading branch information
baughj committed Dec 20, 2016
2 parents 73a0ca4 + 29279b6 commit b572025
Show file tree
Hide file tree
Showing 43 changed files with 2,172 additions and 1,548 deletions.
404 changes: 275 additions & 129 deletions .gitignore

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\hybrasyl"
],
"SelectedNode": "\\hybrasyl\\Hybrasyl.sln",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@
generally add fairly significant features, whereas ones without are primarily
for bugfixing and other updates.*

# Hybrasyl Server 0.5.5 ("Devlin")

*Released: December 20, 2016* - [View this release on GitHub](https://github.com/hybrasyl/server/releases/tag/0.5.5)

### Features

* Spell targeting implemented
* Cast lines for castables supported
* Creatures and players can now die and have OnDeath events
* Basic player status support (such as poison, sleep, etc) implemented
* Monster spawning support implemented (regularly spawning new creatures in an area, using spawngroups)
* Castable support is mostly implemented; 0.5.6 will complete the implementation (NPC learning / forgetting skills, proper directional usage, etc)
* Skills and spells are now movable on the client pane
* Use skill / use spell handlers implemented

### Bug Fixes

* National support for spawn locations fixed / updated
* Two-handed equipment should now properly prevent a shield from being equipped
* Two-handed flags on items should work as expected
* Items allowing negative stats / HP / MP now fixed
* Assail now properly uses the sound from the first assail in your list

### Known Issues

* Server socket state can sometimes get a little wonky which can require a restart. We're working on it.
* Client sometimes cannot login again after logging off.
* Packet throttling is disabled pending reimplementation. This means you can spam attack things at the moment, and also is related to the socket state issues.

Required SDK Version: at least 0.5.5.17

# Hybrasyl Server 0.5.2 ("Dar")

*Released: June 6, 2016* - [View this release on GitHub](https://github.com/hybrasyl/server/releases/tag/0.5.2)
Expand Down Expand Up @@ -97,3 +128,4 @@

* Poor, long-suffering Riona in Mileth, critically wounded in a prior release,
will now respond to Aislings again.
x
3 changes: 0 additions & 3 deletions hybrasyl/Board.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using Microsoft.Scripting.Interpreter;
using Newtonsoft.Json;

namespace Hybrasyl
Expand Down
41 changes: 18 additions & 23 deletions hybrasyl/Book.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using Hybrasyl.Castables;
using log4net;
using Hybrasyl.Castables;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hybrasyl
{
Expand All @@ -21,12 +18,11 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
var output = new object[book.Size];
for (byte i = 0; i < book.Size; i++)
{
var itemInfo = new string[book.Size];
if (book[i] != null)
{
itemInfo[i] = book[i].Name.ToLower();
output[i] = itemInfo;
}
dynamic itemInfo = new JObject();
if (book[i] == null) continue;
itemInfo.Name = book[i].Name.ToLower();
itemInfo.Level = book[i].CastableLevel;
output[i] = itemInfo;
}
var ja = JArray.FromObject(output);
serializer.Serialize(writer, ja);
Expand All @@ -35,18 +31,18 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{

JArray jArray = JArray.Load(reader);
var jArray = JArray.Load(reader);
if (objectType.Name == "SkillBook")
{
var book = new SkillBook();

for (byte i = 0; i < jArray.Count; i++)
{
string[] item;
if (TryGetValue(jArray[i], out item))
{
book[i] = Game.World.Skills.SingleOrDefault(x => x.Value.Name.ToLower() == item[i]).Value;
}
dynamic item;
if (!TryGetValue(jArray[i], out item)) continue;
book[i] = Game.World.WorldData.Values<Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name);
var castable = book[i];
if (castable != null) castable.CastableLevel = (byte)item.Level;
}
return book;
}
Expand All @@ -56,12 +52,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist

for (byte i = 0; i < jArray.Count; i++)
{
string[] item;
if (TryGetValue(jArray[i], out item))
{
book[i] =
Game.World.Spells.SingleOrDefault(x => x.Value.Name.ToLower() == item[i]).Value;
}
dynamic item;
if (!TryGetValue(jArray[i], out item)) continue;
book[i] = Game.World.WorldData.Values<Castable>().SingleOrDefault(x => x.Name.ToLower() == (string)item.Name);
var castable = book[i];
if (castable != null) castable.CastableLevel = (byte)item.Level;
}
return book;
}
Expand All @@ -74,12 +69,12 @@ public override bool CanConvert(Type objectType)
return objectType == typeof(Inventory);
}

public bool TryGetValue(JToken token, out string[] item)
public bool TryGetValue(JToken token, out dynamic item)
{
item = null;
if (!token.HasValues) return false;

item = token.ToObject<string[]>();
item = token.ToObject<dynamic>();
return true;
}
}
Expand Down
3 changes: 0 additions & 3 deletions hybrasyl/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
* Kyle Speck <kojasou@hybrasyl.com>
*/

using System.Runtime.Serialization;
using IronPython.Modules;
using log4net;
using System;
using System.Collections.Concurrent;
Expand All @@ -31,7 +29,6 @@
using System.Net.Sockets;
using System.Text;
using System.Threading;
using IronPython.Compiler;
using Microsoft.Scripting.Utils;

namespace Hybrasyl
Expand Down
1 change: 1 addition & 0 deletions hybrasyl/Dialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Hybrasyl.Scripting;

namespace Hybrasyl
{
Expand Down
5 changes: 3 additions & 2 deletions hybrasyl/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public enum WeaponObjectType
#endregion

[Flags]
public enum PlayerCondition : byte
public enum PlayerCondition : int
{
Alive = 0x01,
Frozen = 0x02,
Expand All @@ -348,7 +348,8 @@ public enum PlayerCondition : byte
InExchange = 0x20,
InDialog = 0x40,
InComa = 0x80,
Casting = 0xCA,
Casting = 0x100,
Pvp = 0x200,
AliveExchange = (Alive | InExchange)
}

Expand Down
2 changes: 0 additions & 2 deletions hybrasyl/FormulaParser.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hybrasyl.Castables;
using Hybrasyl.Objects;

Expand Down
41 changes: 25 additions & 16 deletions hybrasyl/Hybrasyl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">.\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -28,7 +29,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand All @@ -42,7 +42,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>true</UseVSHostingProcess>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
Expand All @@ -67,8 +67,8 @@
<Reference Include="FastMember">
<HintPath>packages\FastMember.1.0.0.11\lib\net40\FastMember.dll</HintPath>
</Reference>
<Reference Include="Hybrasyl.XML, Version=0.5.5.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Hybrasyl.XML.0.5.5.8\lib\net452\Hybrasyl.XML.dll</HintPath>
<Reference Include="Hybrasyl.XML, Version=0.5.5.17, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Hybrasyl.XML.0.5.5.17\lib\net452\Hybrasyl.XML.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IronPython, Version=2.7.5.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
Expand Down Expand Up @@ -107,18 +107,19 @@
<HintPath>packages\IronPython.2.7.5\lib\Net45\Microsoft.Scripting.Metadata.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="StackExchange.Redis, Version=1.0.316.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\StackExchange.Redis.1.0.488\lib\net45\StackExchange.Redis.dll</HintPath>
<Reference Include="StackExchange.Redis, Version=1.1.608.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\StackExchange.Redis.1.1.608\lib\net45\StackExchange.Redis.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Windows.Forms" />
Expand Down Expand Up @@ -146,6 +147,15 @@
<Compile Include="Objects\WorldObject.cs" />
<Compile Include="PlayerStatus.cs" />
<Compile Include="Legend.cs" />
<Compile Include="Scripting\HybrasylDialog.cs" />
<Compile Include="Scripting\HybrasylDialogSequence.cs" />
<Compile Include="Scripting\HybrasylMap.cs" />
<Compile Include="Scripting\HybrasylUser.cs" />
<Compile Include="Scripting\HybrasylWorld.cs" />
<Compile Include="Scripting\HybrasylWorldObject.cs" />
<Compile Include="Scripting\Script.cs" />
<Compile Include="Scripting\ScriptInvocation.cs" />
<Compile Include="Scripting\ScriptProcessor.cs" />
<Compile Include="Time.cs" />
<Compile Include="Client.cs" />
<Compile Include="Connection.cs" />
Expand All @@ -169,16 +179,15 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Pursuit.cs" />
<Compile Include="QuadTree.cs" />
<Compile Include="Scripting.cs" />
<Compile Include="Server.cs" />
<Compile Include="ServerPacketStructures.cs" />
<Compile Include="Template.cs" />
<Compile Include="Objects\User.cs" />
<Compile Include="UserGroup.cs" />
<Compile Include="Utility.cs" />
<Compile Include="World.cs" />
<Compile Include="WorldDataStore.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
Expand Down Expand Up @@ -228,11 +237,11 @@
</Target>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
24 changes: 13 additions & 11 deletions hybrasyl/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,35 +357,37 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
var output = new object[inventory.Size];
for (byte i = 0; i < inventory.Size; i++)
{
var itemInfo = new Dictionary<string, object>();
dynamic itemInfo = new JObject();
if (inventory[i] != null)
{
itemInfo["Name"] = inventory[i].Name;
itemInfo["Count"] = inventory[i].Count;
itemInfo.Name = inventory[i].Name;
itemInfo.Count = inventory[i].Count;
itemInfo.Id = inventory[i].TemplateId;
output[i] = itemInfo;
}
}
Newtonsoft.Json.Linq.JArray ja = Newtonsoft.Json.Linq.JArray.FromObject(output);
var ja = JArray.FromObject(output);
serializer.Serialize(writer, ja);
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
JArray jArray = JArray.Load(reader);
Inventory inv = new Inventory(jArray.Count);
var inv = new Inventory(jArray.Count);

for (byte i = 0; i < jArray.Count; i++)
{
Item itmType = null;
Dictionary<string, object> item;
dynamic item;
if (TryGetValue(jArray[i], out item))
{
itmType = World.Items.Where(x => x.Value.Name == (string)item.FirstOrDefault().Value).FirstOrDefault().Value;
{
itmType = Game.World.WorldData.Get<Item>(item.Id);
//itmType = Game.World.WorldData.Values<Item>().Where(x => x.Name == (string)item.FirstOrDefault().Value).FirstOrDefault().Name;
if (itmType != null)
{
inv[i] = new ItemObject(itmType.Id, Game.World)
{
Count = item.ContainsKey("Count") ? Convert.ToInt32(item["Count"]) : 1
Count = item.Count ?? 1
};
//this will need to be expanded later based on ItemObject properties being saved back to the database.
}
Expand All @@ -401,12 +403,12 @@ public override bool CanConvert(Type objectType)
return objectType == typeof(Inventory);
}

public bool TryGetValue(Newtonsoft.Json.Linq.JToken token, out Dictionary<string, object> item)
public bool TryGetValue(JToken token, out dynamic item)
{
item = null;
if (!token.HasValues) return false;

item = token.ToObject<Dictionary<string, object>>();
item = token.ToObject<dynamic>();
return true;
}
}
Expand Down

0 comments on commit b572025

Please sign in to comment.