Skip to content

Commit

Permalink
Merge pull request #15 from cesare-montresor/UOSFix
Browse files Browse the repository at this point in the history
- UOS syntax error now useful
- editor catch output
- multiline summary support
- play from editor fixed
  • Loading branch information
cesare-montresor authored Jan 24, 2024
2 parents 1b8287c + 6c286fd commit c3383c9
Show file tree
Hide file tree
Showing 14 changed files with 316 additions and 153 deletions.
36 changes: 22 additions & 14 deletions Razor/Client/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Mono.Options;
using System.Security.RightsManagement;
using System.Security.Cryptography;
using System.Runtime.InteropServices.ComTypes;

namespace Assistant
{
Expand Down Expand Up @@ -174,18 +175,34 @@ internal static RazorEnhanced.Shard SelectShard(string[] args)
return selected;
}

internal static void EnsureDirectoriesExist()
{
System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Profiles"));
System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Backup"));
System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Scripts"));
}

internal virtual bool Init(RazorEnhanced.Shard selected)
{
if (selected.ClientFolder != null && Directory.Exists(selected.ClientFolder))
{
Ultima.Files.SetMulPath(selected.ClientFolder);
}
else
{
MessageBox.Show("Unable to find the Data Folder " + selected.ClientFolder, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false);
return false;
}

RazorEnhanced.Config.LoadAll();

RazorEnhanced.Journal.GlobalJournal.Clear(); // really just force it to be instantiated


System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Profiles"));
System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Backup"));
System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Scripts"));
EnsureDirectoriesExist();

List<string> locations = ValidFileLocations();
RazorEnhanced.Skills.InitData();

// Setup AutoUpdater Parameters
// AutoUpdater
Expand Down Expand Up @@ -224,16 +241,7 @@ internal void Start(RazorEnhanced.Shard selected)
return;
}

if (dataDir != null && Directory.Exists(dataDir))
{
Ultima.Files.SetMulPath(dataDir);
}
else
{
MessageBox.Show("Unable to find the Data Folder " + dataDir, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false);
return;
}


Language.LoadCliLoc();

Expand Down
4 changes: 2 additions & 2 deletions Razor/Client/UOAssist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static int OnUOAMessage(MainForm razor, int Msg, int wParam, int lParam)
{
try
{
return GlobalAddAtom(((SkillName)wParam).ToString());
return GlobalAddAtom(RazorEnhanced.Skills.GetSkillName(wParam));
}
catch
{
Expand Down Expand Up @@ -394,7 +394,7 @@ public static void PostMapChange(int map)
public static void PostSkillUpdate(int skill, int val)
{
PostToWndReg((uint)UOAMessage.SKILL_LEVEL, (IntPtr)skill, (IntPtr)val);
if (skill == (int)SkillName.Magery)
if (skill == RazorEnhanced.Skills.GetSkillId("Magery"))
PostToWndReg((uint)UOAMessage.MAGERY_LEVEL, (IntPtr)((int)(val / 10)), (IntPtr)(val % 10));
}

Expand Down
1 change: 1 addition & 0 deletions Razor/Core/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public static void Main(string[] args)
return;
}

Client.EnsureDirectoriesExist();
RazorEnhanced.Shard shardSelected = Client.SelectShard(args);
if (shardSelected != null)
{
Expand Down
66 changes: 2 additions & 64 deletions Razor/Core/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal enum MsgLevel

internal class Skill
{
internal static int Count = 58;
internal static int Count = Math.Max(58, Ultima.Skills.SkillEntries.Count);

private LockType m_Lock;
private ushort m_Value;
Expand Down Expand Up @@ -110,73 +110,11 @@ public enum StatName
Dexterity = 1,
Intelligence = 2,
};

public enum SkillName
{
Alchemy = 0,
Anatomy = 1,
AnimalLore = 2,
ItemID = 3,
ArmsLore = 4,
Parry = 5,
Begging = 6,
Blacksmith = 7,
Fletching = 8,
Peacemaking = 9,
Camping = 10,
Carpentry = 11,
Cartography = 12,
Cooking = 13,
DetectHidden = 14,
Discordance = 15,
EvalInt = 16,
Healing = 17,
Fishing = 18,
Forensics = 19,
Herding = 20,
Hiding = 21,
Provocation = 22,
Inscribe = 23,
Lockpicking = 24,
Magery = 25,
MagicResist = 26,
Tactics = 27,
Snooping = 28,
Musicianship = 29,
Poisoning = 30,
Archery = 31,
SpiritSpeak = 32,
Stealing = 33,
Tailoring = 34,
AnimalTaming = 35,
TasteID = 36,
Tinkering = 37,
Tracking = 38,
Veterinary = 39,
Swords = 40,
Macing = 41,
Fencing = 42,
Wrestling = 43,
Lumberjacking = 44,
Mining = 45,
Meditation = 46,
Stealth = 47,
RemoveTrap = 48,
Necromancy = 49,
Focus = 50,
Chivalry = 51,
Bushido = 52,
Ninjitsu = 53,
SpellWeaving = 54,
Mysticism = 55,
Imbuing = 56,
Throwing = 57
}



internal class PlayerData : Mobile
{

internal class MoveEntry
{
//public byte Seq;
Expand Down
6 changes: 3 additions & 3 deletions Razor/Network/Handlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private static void ClientTextCommand(PacketReader p, PacketHandlerEventArgs arg
if (World.Player != null)
World.Player.LastSkill = skillIndex;

if ((skillIndex == (int)SkillName.Stealth && !World.Player.Visible) || skillIndex == (int)SkillName.Hiding)
if ((skillIndex == RazorEnhanced.Skills.GetSkillId("Stealth") && !World.Player.Visible) || skillIndex == RazorEnhanced.Skills.GetSkillId("Hiding"))
StealthSteps.Hide();
break;
}
Expand Down Expand Up @@ -1088,7 +1088,7 @@ private static void Skills(PacketReader p, PacketHandlerEventArgs args)
Engine.MainWindow.SafeAction(s => s.UpdateSkill(skill));

if (RazorEnhanced.Settings.General.ReadBool("DisplaySkillChanges") && skill.FixedBase != old)
World.Player.SendMessage(MsgLevel.Force, LocString.SkillChanged, (SkillName)i, skill.Delta > 0 ? "+" : "", skill.Delta, skill.Value, skill.FixedBase - old > 0 ? "+" : "", ((double)(skill.FixedBase - old)) / 10.0);
World.Player.SendMessage(MsgLevel.Force, LocString.SkillChanged, RazorEnhanced.Skills.GetSkillName(i), skill.Delta > 0 ? " + " : "", skill.Delta, skill.Value, skill.FixedBase - old > 0 ? "+" : "", ((double)(skill.FixedBase - old)) / 10.0);
Assistant.UOAssist.PostSkillUpdate(i, skill.FixedBase);
}
break;
Expand All @@ -1112,7 +1112,7 @@ private static void Skills(PacketReader p, PacketHandlerEventArgs args)
skill.FixedCap = 100;
Engine.MainWindow.UpdateSkill(skill);
if (RazorEnhanced.Settings.General.ReadBool("DisplaySkillChanges") && skill.FixedBase != old)
World.Player.SendMessage(MsgLevel.Force, LocString.SkillChanged, (SkillName)i, skill.Delta > 0 ? "+" : "", skill.Delta, skill.Value, ((double)(skill.FixedBase - old)) / 10.0, skill.FixedBase - old > 0 ? "+" : "");
World.Player.SendMessage(MsgLevel.Force, LocString.SkillChanged, RazorEnhanced.Skills.GetSkillName(i), skill.Delta > 0 ? " + " : "", skill.Delta, skill.Value, ((double)(skill.FixedBase - old)) / 10.0, skill.FixedBase - old > 0 ? "+" : "");
Assistant.UOAssist.PostSkillUpdate(i, skill.FixedBase);
}
break;
Expand Down
5 changes: 0 additions & 5 deletions Razor/Network/Packets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,11 +766,6 @@ internal UseSkill(int sk)
Write((byte)0x24);
WriteAsciiNull(cmd);
}

internal UseSkill(SkillName sk)
: this((int)sk)
{
}
}

internal sealed class TrackingArrow : Packet
Expand Down
2 changes: 1 addition & 1 deletion Razor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("0.8.2.106")]
[assembly: AssemblyVersion("0.8.2.110")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
Expand Down
1 change: 1 addition & 0 deletions Razor/Razor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@
<Compile Include="RazorEnhanced\PathFinding.cs" />
<Compile Include="RazorEnhanced\Multi.cs" />
<Compile Include="RazorEnhanced\SeasonManager.cs" />
<Compile Include="RazorEnhanced\Skills.cs" />
<Compile Include="RazorEnhanced\Sound.cs" />
<Compile Include="RazorEnhanced\SpellGrid.cs">
<SubType>Component</SubType>
Expand Down
2 changes: 1 addition & 1 deletion Razor/RazorEnhanced/HotKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ private static void ProcessSkills(string function)
if (World.Player.LastSkill != -1)
{
Assistant.Client.Instance.SendToServer(new UseSkill(World.Player.LastSkill));
if ((World.Player.LastSkill == (int)SkillName.Stealth && !World.Player.Visible) || World.Player.LastSkill == (int)SkillName.Hiding) // Trigger stealth step counter
if ((World.Player.LastSkill == RazorEnhanced.Skills.GetSkillId("Stealth") && !World.Player.Visible) || World.Player.LastSkill == RazorEnhanced.Skills.GetSkillId("Hiding")) // Trigger stealth step counter
StealthSteps.Hide();
}
}
Expand Down
Loading

0 comments on commit c3383c9

Please sign in to comment.