Permalink
Browse files

- NEW FEATURE: Localization (Translations for Auth server will be pos…

…sible soon)

-- You can add/change Localizations in the Content/Lang/ folder
-- move hardcoded strings to English.xml and add it to the LangKey enum
-- See LocalizerCommand for examples
- added World.Pause()
- fixed World.Paused
- more
  • Loading branch information...
1 parent 3c5c0a9 commit 33875e757aa393aaa0c41368b07b780b474baf90 @Domiii Domiii committed May 29, 2010
Showing with 1,279 additions and 469 deletions.
  1. +2 −2 Addons/WCell.DefaultAddon/Commands/AddonDevCommands.cs
  2. +3 −1 Applications/WCell.RealmServerConsole/Program.cs
  3. +6 −5 Applications/WCell.RealmServerConsole/WCell.RealmServerConsole.csproj
  4. +22 −9 Applications/WCell.RealmServerConsole/app.config
  5. +2 −2 Core/WCell.Constants/Spells/Constants.Spells.cs
  6. +7 −1 Core/WCell.Core/Initialization/InitializationException.cs
  7. +120 −8 Core/WCell.Core/ServerApp.cs
  8. +1 −0 README.txt
  9. +37 −0 Run/Content/Lang/English.xml
  10. +8 −0 Run/Content/Sample.xml
  11. +17 −17 Services/WCell.AuthServer/Commands/AccountCommands.cs
  12. +14 −14 Services/WCell.AuthServer/Commands/AdminCommands.cs
  13. +4 −4 Services/WCell.AuthServer/Commands/IPCCommands.cs
  14. +1 −1 Services/WCell.AuthServer/Commands/RealmCommands.cs
  15. +1 −1 Services/WCell.AuthServer/Privileges/RoleGroupConfig.cs
  16. +1 −1 Services/WCell.RealmServer/Commands/AICommands.cs
  17. +7 −6 Services/WCell.RealmServer/Commands/AddonCommands.cs
  18. +16 −16 Services/WCell.RealmServer/Commands/AdminCommands.cs
  19. +1 −1 Services/WCell.RealmServer/Commands/AuraCommands.cs
  20. +8 −8 Services/WCell.RealmServer/Commands/BattlegroundCommand.cs
  21. +4 −4 Services/WCell.RealmServer/Commands/CharacterCommands.cs
  22. +3 −3 Services/WCell.RealmServer/Commands/DBCommands.cs
  23. +1 −1 Services/WCell.RealmServer/Commands/DOCommands.cs
  24. +13 −13 Services/WCell.RealmServer/Commands/DevCommands.cs
  25. +40 −0 Services/WCell.RealmServer/Commands/Extensions.cs
  26. +9 −9 Services/WCell.RealmServer/Commands/GOCommands.cs
  27. +7 −7 Services/WCell.RealmServer/Commands/GuildCommands.cs
  28. +5 −5 Services/WCell.RealmServer/Commands/InstanceCommand.cs
  29. +11 −11 Services/WCell.RealmServer/Commands/ItemCommands.cs
  30. +63 −0 Services/WCell.RealmServer/Commands/LocalizerCommand.cs
  31. +2 −2 Services/WCell.RealmServer/Commands/MailCommands.cs
  32. +9 −9 Services/WCell.RealmServer/Commands/MiscCommands.cs
  33. +11 −11 Services/WCell.RealmServer/Commands/MovementCommands.cs
  34. +6 −6 Services/WCell.RealmServer/Commands/NPCCommands.cs
  35. +6 −6 Services/WCell.RealmServer/Commands/PlayerCommands.cs
  36. +12 −12 Services/WCell.RealmServer/Commands/QuestCommands.cs
  37. +2 −1 Services/WCell.RealmServer/Commands/RealmCommandHandler.cs
  38. +45 −2 Services/WCell.RealmServer/Commands/RealmServerCommand.cs
  39. +7 −7 Services/WCell.RealmServer/Commands/RegionCommands.cs
  40. +3 −3 Services/WCell.RealmServer/Commands/SkillCommands.cs
  41. +6 −6 Services/WCell.RealmServer/Commands/SpellCommands.cs
  42. +7 −7 Services/WCell.RealmServer/Commands/TaxiCommands.cs
  43. +2 −2 Services/WCell.RealmServer/Commands/TestCommands.cs
  44. +1 −1 Services/WCell.RealmServer/Commands/TicketCommands.cs
  45. +1 −0 Services/WCell.RealmServer/Commands/Triggers.cs
  46. +5 −5 Services/WCell.RealmServer/Commands/UnitCommands.cs
  47. 0 Services/WCell.RealmServer/Content/Lang/Commands/English.xml
  48. +1 −0 Services/WCell.RealmServer/Entities/Character.Fields.cs
  49. +1 −1 Services/WCell.RealmServer/Events/Global/World.cs
  50. +23 −30 Services/WCell.RealmServer/Global/Region.cs
  51. +50 −22 Services/WCell.RealmServer/Global/World.cs
  52. +2 −2 Services/WCell.RealmServer/Instances/InstanceConfigBase.cs
  53. +1 −33 Services/WCell.RealmServer/Lang/{Localizer.cs → ArrayLocalizer.cs}
  54. +37 −0 Services/WCell.RealmServer/Lang/LangKey.cs
  55. +37 −0 Services/WCell.RealmServer/Lang/RealmLocalizer.cs
  56. +1 −0 Services/WCell.RealmServer/Misc/IUser.cs
  57. +10 −0 Services/WCell.RealmServer/RealmServerConfiguration.cs
  58. +5 −2 Services/WCell.RealmServer/WCell.RealmServer.csproj
  59. +1 −1 Utilities/WCell.PacketAnalyzer/Logs/SniffitztLog.cs
  60. +1 −1 Utilities/WCell.PacketAnalyzer/Xml/XmlPacketDefinitions.cs
  61. +3 −2 Utilities/WCell.PostBuild/Docs/CommandDocs.cs
  62. +25 −25 Utilities/WCell.Tools/Commands/PacketAnalyzerCommand.cs
  63. +1 −1 Utilities/WCell.Tools/Commands/WPCommands.cs
  64. +5 −5 Utilities/WCell.Tools/PATools/PATool.cs
  65. +1 −1 Utilities/WCell.Tools/ToolConfig.cs
  66. +88 −77 Utilities/WCell.Util/Commands/BaseCommand.cs
  67. +4 −4 Utilities/WCell.Util/Commands/CmdTrigger.cs
  68. +10 −10 Utilities/WCell.Util/Commands/CommandMgr.cs
  69. +2 −2 Utilities/WCell.Util/Commands/ITriggerer.cs
  70. +1 −1 Utilities/WCell.Util/DB/Xml/BasicTableDefinitions.cs
  71. +1 −1 Utilities/WCell.Util/DB/Xml/LightRecordXmlConfig.cs
  72. +1 −1 Utilities/WCell.Util/DotNetDocs/DotNetDocumentation.cs
  73. +27 −0 Utilities/WCell.Util/Lang/ILocalizer.cs
  74. +227 −0 Utilities/WCell.Util/Lang/Localizer.cs
  75. +20 −0 Utilities/WCell.Util/Lang/TranslatableItem.cs
  76. +18 −0 Utilities/WCell.Util/Lang/TranslatedItem.cs
  77. +85 −0 Utilities/WCell.Util/Lang/Translation.cs
  78. +5 −5 Utilities/WCell.Util/Variables/VariableConfiguration.cs
  79. +7 −2 Utilities/WCell.Util/WCell.Util.csproj
  80. +8 −8 Utilities/WCell.Util/{XmlConfig.cs → XmlFile.cs}
  81. +10 −2 WCell.sln
  82. +1 −0 startcmd.bat
@@ -30,7 +30,7 @@ public class SampleNPCCommand : SubCommand
protected override void Initialize()
{
Init("NPC");
- ParamInfo = "[-f]";
+ EnglishParamInfo = "[-f]";
EnglishDescription = "Adds a sample NPC. -f makes it friendly.";
}
@@ -63,7 +63,7 @@ public class SampleBowCommand : SubCommand
protected override void Initialize()
{
Init("Bow");
- ParamInfo = "[-ea] [<amount>]";
+ EnglishParamInfo = "[-ea] [<amount>]";
EnglishDescription = "Adds a sample Bow." +
"-a switch auto-equips, -e switch only adds if not already present.";
}
@@ -19,6 +19,8 @@
using NLog;
using System.Runtime;
using System.Threading;
+using WCell.RealmServer.Lang;
+using WCell.Util.Lang;
using WCell.Util.NLog;
using System.Text.RegularExpressions;
@@ -29,7 +31,7 @@ internal class Program
private static readonly Logger log = LogManager.GetCurrentClassLogger();
private static void Main(string[] args)
- {
+ {
if (GCSettings.IsServerGC)
{
GCSettings.LatencyMode = GCLatencyMode.Batch;
@@ -155,6 +155,7 @@
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
+ <Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -168,27 +169,27 @@
<ProjectReference Include="..\..\Core\Cell.Core\Cell.Core.csproj">
<Project>{71AB07AD-4D94-4693-8560-47862E5B6E61}</Project>
<Name>Cell.Core</Name>
- <Private>False</Private>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Core\WCell.Core\WCell.Core.csproj">
<Project>{EEA9DEB6-8EA6-46F1-B1B7-AB38D8BBCA6C}</Project>
<Name>WCell.Core</Name>
- <Private>False</Private>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Core\WCell.Intercommunication\WCell.Intercommunication.csproj">
<Project>{5997613F-D2A5-4B86-BEE2-C823BC07D5AF}</Project>
<Name>WCell.Intercommunication</Name>
- <Private>False</Private>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Services\WCell.RealmServer\WCell.RealmServer.csproj">
<Project>{A38FAA6D-86B5-4429-85D0-BC93EB5E2C56}</Project>
<Name>WCell.RealmServer</Name>
- <Private>False</Private>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\Utilities\WCell.Util\WCell.Util.csproj">
<Project>{F753AF28-A251-4C12-9335-07E8236184F2}</Project>
<Name>WCell.Util</Name>
- <Private>False</Private>
+ <Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -1,27 +1,40 @@
<?xml version="1.0"?>
<configuration>
<configSections>
- <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
+ <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<runtime>
- <gcServer enabled="true"/>
+ <gcServer enabled="true" />
</runtime>
<appSettings>
+ <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<nlog autoReload="true">
- <variable name="logDirectory" value="${basedir}\logs"/>
- <variable name="normalRealmServerLog" value="realmServer-${level}.wcelllog"/>
- <variable name="archiveRealmServerLog" value="realmServer-${level}-{#####}.wcelllog"/>
+ <variable name="logDirectory" value="${basedir}\logs" />
+ <variable name="normalRealmServerLog" value="realmServer-${level}.wcelllog" />
+ <variable name="archiveRealmServerLog" value="realmServer-${level}-{#####}.wcelllog" />
<targets>
<target name="console" type="AsyncWrapper">
- <target type="ColoredConsole" layout="(${processtime}) [${level}] ${message} ${exception:format=tostring}"/>
+ <target type="ColoredConsole" layout="(${processtime}) [${level}] ${message} ${exception:format=tostring}" />
</target>
<target name="file" type="AsyncWrapper">
- <target type="File" fileName="${logDirectory}\${normalRealmServerLog}" encoding="utf-8" archiveEvery="ArchiveEveryMode.Day" archiveFileName="${logDirectory}\${archiveRealmServerLog}" archiveNumbering="ArchiveNumberingMode.Rolling" maxArchiveFiles="10000" layout="(${longdate}) [${level}] ${message} ${exception:format=tostring}"/>
+ <target type="File" fileName="${logDirectory}\${normalRealmServerLog}" encoding="utf-8" archiveEvery="ArchiveEveryMode.Day" archiveFileName="${logDirectory}\${archiveRealmServerLog}" archiveNumbering="ArchiveNumberingMode.Rolling" maxArchiveFiles="10000" layout="(${longdate}) [${level}] ${message} ${exception:format=tostring}" />
</target>
</targets>
<rules>
- <logger name="*" minlevel="Debug" writeTo="console,file"/>
+ <logger name="*" minlevel="Debug" writeTo="console,file" />
</rules>
</nlog>
-</configuration>
+ <system.web>
+ <membership defaultProvider="ClientAuthenticationMembershipProvider">
+ <providers>
+ <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
+ </providers>
+ </membership>
+ <roleManager defaultProvider="ClientRoleProvider" enabled="true">
+ <providers>
+ <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
+ </providers>
+ </roleManager>
+ </system.web>
+</configuration>
@@ -614,9 +614,9 @@ public enum SpellAttributesExC : uint
AttrExC_25_0x2000000 = 0x2000000,//25
/// <summary>
- /// Not in the old land or instances
+ /// Not in the old land or instances (probably labeled incorrectly)
/// </summary>
- OnlyInOutlands = 0x4000000,
+ OldOnlyInOutlands = 0x4000000,
AttrExC_27_0x8000000 = 0x8000000,//27
AttrExC_28_0x10000000 = 0x10000000,//28
@@ -15,7 +15,13 @@ public InitializationException(string msg) : base(msg)
{
}
- public InitializationException(string msg, params object[] args) : base(string.Format(msg, args))
+ public InitializationException(string msg, params object[] args)
+ : base(string.Format(msg, args))
+ {
+ }
+
+ public InitializationException(Exception e, string msg, params object[] args)
+ : base(string.Format(msg, args), e)
{
}
}
@@ -51,7 +51,7 @@ static ServerApp()
protected List<IUpdatable> m_updatables;
protected LockfreeQueue<IMessage> m_messageQueue;
- protected Task _updateTask;
+ protected Task _updateTask;
protected int _currentUpdateThreadId;
protected Stopwatch m_queueTimer;
protected long m_updateFrequency, m_lastUpdate;
@@ -96,10 +96,10 @@ public static InitMgr InitMgr
}
}
- /// <summary>
- /// Modify this to the Location of the file whose App-config you want to load.
- /// This is needed specifically for tests, since they don't have an EntryAssembly
- /// </summary>
+ /// <summary>
+ /// Modify this to the Location of the file whose App-config you want to load.
+ /// This is needed specifically for tests, since they don't have an EntryAssembly
+ /// </summary>
[NotVariable]
public static string EntryLocation
{
@@ -155,7 +155,7 @@ public override bool IsRunning
if (value)
{
// start message loop
- _updateTask = Task.Factory.StartNewDelayed((int) m_updateFrequency, QueueUpdateCallback, this);
+ _updateTask = Task.Factory.StartNewDelayed((int)m_updateFrequency, QueueUpdateCallback, this);
}
}
}
@@ -243,6 +243,22 @@ public void UnregisterUpdatable(IUpdatable updatable)
AddMessage(() => m_updatables.Remove(updatable));
}
+
+ /// <summary>
+ /// Registers the given Updatable during the next Region Tick
+ /// </summary>
+ public void RegisterUpdatableLater(IUpdatable updatable)
+ {
+ m_messageQueue.Enqueue(new Message(() => RegisterUpdatable(updatable)));
+ }
+
+ /// <summary>
+ /// Unregisters the given Updatable during the next Region Update
+ /// </summary>
+ public void UnregisterUpdatableLater(IUpdatable updatable)
+ {
+ m_messageQueue.Enqueue(new Message(() => UnregisterUpdatable(updatable)));
+ }
#endregion
#region Task Pool
@@ -305,7 +321,7 @@ protected void QueueUpdateCallback(object state)
{
// get the time at the start of our task processing
var timerStart = m_queueTimer.ElapsedMilliseconds;
- var updateDt = (timerStart - m_lastUpdate)/1000.0f;
+ var updateDt = (timerStart - m_lastUpdate) / 1000.0f;
// run timers!
foreach (var updatable in m_updatables)
@@ -351,11 +367,102 @@ protected void QueueUpdateCallback(object state)
if (_running)
{
// re-register the Update-callback
- _updateTask = Task.Factory.StartNewDelayed((int) callbackTimeout, QueueUpdateCallback, this);
+ _updateTask = Task.Factory.StartNewDelayed((int)callbackTimeout, QueueUpdateCallback, this);
}
}
}
+ #region Waiting
+ /// <summary>
+ /// Ensures execution outside the Region-context.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">thrown if the calling thread is the region thread</exception>
+ public void EnsureNoContext()
+ {
+ if (Thread.CurrentThread.ManagedThreadId == _currentUpdateThreadId)
+ {
+ throw new InvalidOperationException(string.Format("Application Queue context prohibited."));
+ }
+ }
+
+ /// <summary>
+ /// Adds the given message to the region's message queue and does not return
+ /// until the message is processed.
+ /// </summary>
+ /// <remarks>Make sure that the region is running before calling this method.</remarks>
+ /// <remarks>Must not be called from the region context.</remarks>
+ public void AddMessageAndWait(bool allowInstantExecution, Action action)
+ {
+ AddMessageAndWait(allowInstantExecution, new Message(action));
+ }
+
+ /// <summary>
+ /// Adds the given message to the region's message queue and does not return
+ /// until the message is processed.
+ /// </summary>
+ /// <remarks>Make sure that the region is running before calling this method.</remarks>
+ /// <remarks>Must not be called from the region context.</remarks>
+ public void AddMessageAndWait(bool allowInstantExecution, IMessage msg)
+ {
+ if (allowInstantExecution && IsInContext)
+ {
+ msg.Execute();
+ }
+ else
+ {
+ EnsureNoContext();
+
+ // to ensure that we are not exiting in the current message-loop, add an updatable
+ // which again registers the message
+ var updatable = new SimpleUpdatable();
+ updatable.Callback = () => AddMessage(new Message(() =>
+ {
+ msg.Execute();
+ lock (msg)
+ {
+ Monitor.PulseAll(msg);
+ }
+ UnregisterUpdatable(updatable);
+ }));
+
+ lock (msg)
+ {
+ RegisterUpdatableLater(updatable);
+ // int delay = this.GetWaitDelay();
+ Monitor.Wait(msg);
+ // Assert.IsTrue(added, string.Format(debugMsg, args));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Waits for one region tick before returning.
+ /// </summary>
+ /// <remarks>Must not be called from the region context.</remarks>
+ public void WaitOneTick()
+ {
+ AddMessageAndWait(false, new Message(() =>
+ {
+ // do nothing
+ }));
+ }
+
+ /// <summary>
+ /// Waits for the given amount of ticks.
+ /// One tick might take 0 until Region.UpdateSpeed milliseconds.
+ /// </summary>
+ /// <remarks>Make sure that the region is running before calling this method.</remarks>
+ /// <remarks>Must not be called from the region context.</remarks>
+ public void WaitTicks(int ticks)
+ {
+ EnsureNoContext();
+
+ for (int i = 0; i < ticks; i++)
+ {
+ WaitOneTick();
+ }
+ }
+ #endregion
#endregion
#region Start
@@ -365,6 +472,11 @@ protected void QueueUpdateCallback(object state)
/// </summary>
public virtual void Start()
{
+ if (_running)
+ {
+ return;
+ }
+
if (InitMgr.PerformInitialization())
{
var address = Utility.ParseOrResolve(Host);
View
@@ -0,0 +1 @@
+Welcome to WCell
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Translation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Items>
+ <Item Key="Done">
+ <Value>Done.</Value>
+ </Item>
+ <Item Key="Addon">
+ <Value>Addon</Value>
+ </Item>
+ <Item Key="Library">
+ <Value>Library</Value>
+ </Item>
+
+ <Item Key="SubCommandNotFound">
+ <Value>SubCommand not found: {0}</Value>
+ </Item>
+ <Item Key="MustNotUseCommand">
+ <Value>You are not allowed to use the {0}-Command!</Value>
+ </Item>
+
+ <Item Key="CmdLocalizerDescription">
+ <Value>Provides commands to manage the localizer</Value>
+ </Item>
+ <Item Key="CmdLocalizerReloadDescription">
+ <Value>Reloads the language files.</Value>
+ </Item>
+ <Item Key="CmdLocalizerSetLocaleDescription">
+ <Value>Allows you to set your own Locale (use "Cfg Set DefaultLocale" to set the server's locale)</Value>
+ </Item>
+ <Item Key="CmdLocalizerSetLocaleParamInfo">
+ <Value>&lt;locale&gt;</Value>
+ </Item>
+ <Item Key="UnableToSetUserLocale">
+ <Value>Could not change the current user's locale.</Value>
+ </Item>
+ </Items>
+</Translation>
View
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Translation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Items>
+ <TranslatedItemOfLangKey Key="Addon">
+ <Value>Addon</Value>
+ </TranslatedItemOfLangKey>
+ </Items>
+</Translation>
Oops, something went wrong.

1 comment on commit 33875e7

Skizot commented on 33875e7 May 30, 2010

Wave @ Domiii

:D

Please sign in to comment.