Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
727af97
Save global settings to a simple csv file
May 21, 2021
0b3d271
Add a MessageManager
May 21, 2021
13898f7
Outlands release
May 13, 2021
94f7227
Add missing mobile flag expressions
Jun 17, 2021
17dac69
Limit object delay to between 50 and 4000 ms
Jun 17, 2021
c2441a2
Removed 25ms delay between commands
Jul 8, 2021
607ff52
Fix Screenshot open Folder access denied problem
Jul 8, 2021
7a5c20c
Handle packet indicating a dead bonded pet
Jul 15, 2021
b7da597
Implement a rename command
Jun 22, 2021
cc32f82
Add a setskill command
Jun 22, 2021
489a197
Make dclicktype, findtype, and targettype much more flexible
Jun 22, 2021
68478cf
Add name expression
Jul 1, 2021
c541b61
Add noto command
Jul 1, 2021
82b4c42
Add a findlayer expression
Jun 25, 2021
b4257c4
Add additional args to lifttype
Jul 3, 2021
3199137
Fix bug when processing 'as' operators in while loops
Jul 8, 2021
bd441cc
FindLayer improvements
Jul 7, 2021
f97d155
Add recursive container search in relevant expressions
Jul 8, 2021
9638f6e
Respect quiet operator for several commands
Jul 8, 2021
fdce7d6
Ignore list
Jul 7, 2021
8864258
Add a dead expression
Jul 12, 2021
ad85bbe
fix findtype by id for mobile
Jul 12, 2021
0f485a1
Resolve getlabel name parameter as a string only
Jul 12, 2021
a0cdd47
Correctly handle target cancel during setvar command
Jul 12, 2021
38f4a65
implement other screenshots method
Jul 14, 2021
f1439d8
fix line stuck in editor mode
Jul 14, 2021
d30a202
filter out corpse from src
Jul 14, 2021
6c8cce8
Implement a find expression
Jul 15, 2021
6807af6
Add find expression
Jul 4, 2021
fb24fff
Handle backward compatibility with 'true' parameter in findtype
Jul 15, 2021
6abcc5a
Targetexist fixes
Jul 16, 2021
8cde0c6
Failed serial conversions no longer throw exceptions
Jul 20, 2021
c16da0e
Add range to lifetype
Jul 20, 2021
6f9bc17
Correctly resolve variables in pushlist
Jul 20, 2021
9b6fb8d
Change @setvar to mean quiet mode again
Jul 20, 2021
4fe75fe
Remove unused item/mobile serialization
Jul 23, 2021
07db6e9
Remove object property list support
Jul 24, 2021
e0af773
Remove dead packet handlers
Jul 24, 2021
02f783e
Remove dead code in Item/Mobile/UOEntity
Jul 24, 2021
ff6bb62
Gump scripting improvements
Jul 16, 2021
568d2a4
Add maxweight, diffweight, diffhits, diffstam, diffmana
Jul 26, 2021
007a3ad
Screenshot fixes
Jul 26, 2021
f36f82a
Add counttype expression
Jul 27, 2021
fa0f058
fix several gumps bugs
Jul 31, 2021
26398a0
add mobile to ignore filter
Jul 29, 2021
c0b89ee
Gump ID is now a uint
Aug 6, 2021
1e2525f
System Message improvements
Aug 6, 2021
d208ce4
remove restriction on item id above 0x4000
Aug 7, 2021
08c55f3
fix getLabel infinity loop
Aug 11, 2021
6b74956
add varexist expression
Aug 12, 2021
93fc692
add missing intellisense
Aug 13, 2021
4b27adc
counttype now correctly works on stacks
Aug 13, 2021
bc4f503
Several buy agent fixes
Aug 14, 2021
d35353c
Fix merge issue
Aug 19, 2021
8a9f60e
change list where skills was taked
Aug 7, 2021
164e65b
Fixed exception where enumerator was modified while enumerating, lead…
Nov 5, 2021
22cf4dd
Fixed bug where previous natural target would be lost if a script fir…
Nov 11, 2021
7fa87c7
Fixed bug where the last target would consume an intercepted target b…
Nov 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions FastColoredTextBox/SyntaxHighlighter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,17 @@ protected void InitRazorRegex()

RazorCommandRegex =
new Regex(
@"\b(attack|cast|dress|undress|dressconfig|target|targettype|targetloc|targetrelloc|dress|drop|waitfortarget|wft|dclick|dclicktype|dclickvar|usetype|useobject|droprelloc|lift|lifttype|waitforgump|gumpresponse|gumpclose|menu|menuresponse|waitformenu|promptresponse|waitforprompt|hotkey|say|msg|overhead|sysmsg|wait|pause|waitforstat|setability|setlasttarget|lasttarget|setvar|skill|useskill|walk|script|useonce|organizer|organize|org|restock|scav|scavenger|potion|clearsysmsg|clearjournal|whisper|yell|guild|alliance|emote|waitforsysmsg|wfsysmsg|clearall|virtue)\b",
@"\b(attack|cast|dress|undress|dressconfig|target|targettype|targetloc|targetrelloc|dress|drop|waitfortarget|wft|dclick|dclicktype|dclickvar|usetype|useobject|droprelloc|lift|lifttype|waitforgump|gumpresponse|gumpclose|menu|menuresponse|waitformenu|promptresponse|waitforprompt|hotkey|say|msg|overhead|sysmsg|wait|pause|waitforstat|setability|setlasttarget|lasttarget|setvar|skill|useskill|walk|script|useonce|organizer|organize|org|restock|scav|scavenger|potion|clearsysmsg|clearjournal|whisper|yell|guild|alliance|emote|waitforsysmsg|wfsysmsg|clearall|virtue|rename|setskill|ignore|clearignore|poplist|pushlist|removelist|createlist|clearlist|settimer|removetimer|createtimer|settimer|removetimer|getlabel|unsetvar)\b",
RegexCompiledOption);

RazorLayerRegex =
RazorLayerRegex =
new Regex(
@"\b(RightHand|LeftHand|Shoes|Pants|Shirt|Head|Gloves|Ring|Talisman|Neck|Hair|Waist|InnerTorso|Bracelet|FacialHair|MiddleTorso|Earrings|Arms|Cloak|Backpack|OuterTorso|OuterLegs|InnerLegs|backpack|true|false|criminal|enemy|friend|friendly|grey|gray|innocent|murderer|red|blue|nonfriendly|cancel|clear)\b",
RegexCompiledOption);

RazorExpressionRegex =
new Regex(
@"\b(queued|position|insysmsg|insysmessage|findtype|findbuff|finddebuff|stam|maxstam|hp|maxhp|maxhits|hits|mana|maxmana|str|dex|int|poisoned|hidden|mounted|rhandempty|lhandempty|skill|count|counter|weight|dead|closest|close|rand|random|next|prev|previous|human|humanoid|monster)\b",
@"\b(queued|position|insysmsg|insysmessage|findtype|findbuff|finddebuff|stam|maxstam|hp|maxhp|maxhits|hits|mana|maxmana|str|dex|int|poisoned|hidden|mounted|rhandempty|lhandempty|skill|count|counter|weight|dead|closest|close|rand|random|next|prev|previous|human|humanoid|monster|findlayer|dead|find|counttype|listexists|list|inlist|timer|timerexists|followers|hue|name|maxweight|diffweight|diffhits|diffstam|diffmana|paralyzed|invul|noto|dead|gumpexists|ingump|targetexists|counttype)\b",
RegexCompiledOption);
}

Expand Down
32 changes: 13 additions & 19 deletions Razor/Agents/BuyAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ namespace Assistant.Agents
{
public class BuyAgent : Agent
{
// For Outlands user don not have to have money in backpack
private static bool EnableGoldCheck = false;

public class BuyEntry
{
public BuyEntry(ushort id, ushort amount)
Expand Down Expand Up @@ -136,14 +139,11 @@ private static void DisplayBuy(PacketReader p, PacketHandlerEventArgs args)
{
return;
}

pack.Contains.Sort(ItemXYComparer.Instance);


int total = 0;
int cost = 0;
List<VendorBuyItem> buyList = new List<VendorBuyItem>();
Dictionary<ushort, int> found = new Dictionary<ushort, int>();
bool lowGoldWarn = false;
for (int i = 0; i < pack.Contains.Count; i++)
{
Item item = (Item) pack.Contains[i];
Expand Down Expand Up @@ -221,9 +221,8 @@ private static void DisplayBuy(PacketReader p, PacketHandlerEventArgs args)
}
}

if (cost > World.Player.Gold && cost < 2000 && buyList.Count > 0)
if (cost > World.Player.Gold && cost > 2000 && buyList.Count > 0 && !EnableGoldCheck)
{
lowGoldWarn = true;
do
{
VendorBuyItem vbi = (VendorBuyItem) buyList[0];
Expand All @@ -250,18 +249,14 @@ private static void DisplayBuy(PacketReader p, PacketHandlerEventArgs args)
} while (cost > World.Player.Gold && buyList.Count > 0);
}

if (buyList.Count > 0)
{
args.Block = true;
BuyLists[serial] = buyList;
Client.Instance.SendToServer(new VendorBuyResponse(serial, buyList));
World.Player.SendMessage(MsgLevel.Force, LocString.BuyTotals, total, cost);
}
if (buyList.Count <= 0)
return;

args.Block = true;
BuyLists[serial] = buyList;
Client.Instance.SendToServer(new VendorBuyResponse(serial, buyList));
World.Player.SendMessage(MsgLevel.Force, LocString.BuyTotals, total, cost);

if (lowGoldWarn)
{
World.Player.SendMessage(MsgLevel.Force, LocString.BuyLowGold);
}
}

private static readonly Dictionary<uint, List<VendorBuyItem>> BuyLists = new Dictionary<uint, List<VendorBuyItem>>();
Expand All @@ -281,7 +276,6 @@ private static void ExtBuyInfo(PacketReader p, PacketHandlerEventArgs args)
"Buy Agent Warning: Contains Count {0} does not match ExtInfo {1}.", pack.Contains.Count, count);
}

pack.Contains.Sort(ItemXYComparer.Instance);

for (int i = count - 1; i >= 0; i--)
{
Expand Down Expand Up @@ -471,7 +465,7 @@ public void Add(BuyEntry entry)
{
m_Items?.Add(entry);

m_SubList?.Items.Add(entry);
Engine.MainWindow.SafeAction(_ => m_SubList?.Items.Add(entry));

World.Player?.SendMessage(MsgLevel.Force, LocString.ItemAdded);
}
Expand Down
54 changes: 16 additions & 38 deletions Razor/Agents/IgnoreAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml;
using Assistant.Core;
using Assistant.UI;

namespace Assistant.Agents
Expand All @@ -33,6 +34,21 @@ public class IgnoreAgent : Agent
public static void Initialize()
{
Agent.Add(Instance = new IgnoreAgent());

MessageManager.OnMobileMessage += HandleMobileMessage;
}

public static void HandleMobileMessage(Packet p, PacketHandlerEventArgs args, Serial source, ushort graphic,
MessageType type, ushort hue, ushort font, string lang, string sourceName,
string text)
{
if (Instance == null)
return;

if (Instance.IsSerialIgnored(source))
{
args.Block = true;
}
}

public static bool IsIgnored(Serial ser)
Expand All @@ -55,8 +71,6 @@ public IgnoreAgent()

HotKey.Add(HKCategory.Targets, LocString.AddToIgnore, new HotKeyCallback(AddToIgnoreList));
HotKey.Add(HKCategory.Targets, LocString.RemoveFromIgnore, new HotKeyCallback(RemoveFromIgnoreList));

Agent.OnMobileCreated += new MobileCreatedEventHandler(OPLCheckIgnore);
}

public override void Clear()
Expand Down Expand Up @@ -167,18 +181,6 @@ public override void OnButtonPress(int num)
if (MessageBox.Show(Language.GetString(LocString.Confirm), Language.GetString(LocString.ClearList),
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
foreach (Serial s in m_Chars)
{
Mobile m = World.FindMobile(s);
if (m != null)
{
if (m.ObjPropList.Remove(Language.GetString(LocString.RazorIgnored)))
{
m.OPLChanged();
}
}
}

m_Chars.Clear();
m_SubList.Items.Clear();
}
Expand All @@ -195,14 +197,6 @@ public override void OnButtonPress(int num)
}
}

private void OPLCheckIgnore(Mobile m)
{
if (IsIgnored(m.Serial))
{
m.ObjPropList.Add(Language.GetString(LocString.RazorIgnored));
}
}

private void OnAddTarget(bool location, Serial serial, Point3D loc, ushort gfx)
{
Engine.MainWindow.SafeAction(s => s.ShowMe());
Expand All @@ -215,13 +209,6 @@ private void OnAddTarget(bool location, Serial serial, Point3D loc, ushort gfx)
m_Chars.Add(serial);

Add2List(serial);

Mobile m = World.FindMobile(serial);
if (m != null)
{
m.ObjPropList.Add(Language.GetString(LocString.RazorIgnored));
m.OPLChanged();
}
}
}
}
Expand Down Expand Up @@ -273,15 +260,6 @@ private void OnRemoveTarget(bool location, Serial serial, Point3D loc, ushort gf
}

m_SubList.EndUpdate();

Mobile m = World.FindMobile(serial);
if (m != null)
{
if (m.ObjPropList.Remove(Language.GetString(LocString.RazorIgnored)))
{
m.OPLChanged();
}
}
}
}

Expand Down
31 changes: 0 additions & 31 deletions Razor/Agents/OrganizerAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ public OrganizerAgent(int num)
$"{Language.GetString(LocString.SetOrganizerHB)}-{Number:D2}",
new HotKeyCallback(SetHotBag));
PacketHandler.RegisterClientToServerViewer(0x09, new PacketViewerCallback(OnSingleClick));

Agent.OnItemCreated += new ItemCreatedEventHandler(CheckContOPL);
}

public void CheckContOPL(Item item)
{
if (item.Serial == m_Cont)
{
item.ObjPropList.Add(Language.Format(LocString.OrganizerHBA1, Number));
}
}

private void OnSingleClick(PacketReader pvSrc, PacketHandlerEventArgs args)
Expand Down Expand Up @@ -170,13 +160,6 @@ public override void OnButtonPress(int num)
if (MessageBox.Show(Language.GetString(LocString.Confirm), Language.GetString(LocString.ClearList),
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Item bag = World.FindItem(m_Cont);
if (bag != null)
{
bag.ObjPropList.Remove(Language.Format(LocString.OrganizerHBA1, Number));
bag.OPLChanged();
}

m_SubList.Items.Clear();
m_Items.Clear();
m_Cont = 0;
Expand Down Expand Up @@ -305,13 +288,6 @@ private void OnTargetBag(bool location, Serial serial, Point3D loc, ushort gfx)

if (!location && serial > 0 && serial <= 0x7FFFFF00)
{
Item bag = World.FindItem(m_Cont);
if (bag != null && bag.ObjPropList != null)
{
bag.ObjPropList.Remove(Language.Format(LocString.OrganizerHBA1, Number));
bag.OPLChanged();
}

m_Cont = serial;
if (m_BagBTN != null)
{
Expand All @@ -322,13 +298,6 @@ private void OnTargetBag(bool location, Serial serial, Point3D loc, ushort gfx)
{
World.Player.SendMessage(MsgLevel.Force, LocString.ContSet);
}

bag = World.FindItem(m_Cont);
if (bag != null && bag.ObjPropList != null)
{
bag.ObjPropList.Add(Language.Format(LocString.OrganizerHBA1, Number));
bag.OPLChanged();
}
}
}

Expand Down
30 changes: 2 additions & 28 deletions Razor/Agents/RestockAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ public RestockAgent(int num)
$"{Language.GetString(LocString.SetRestockHB)}-{Number:D2}",
new HotKeyCallback(SetHB));
PacketHandler.RegisterClientToServerViewer(0x09, new PacketViewerCallback(OnSingleClick));

Agent.OnItemCreated += new ItemCreatedEventHandler(CheckHBOPL);
}

public void CheckHBOPL(Item item)
{
if (item.Serial == m_HotBag)
{
item.ObjPropList.Add(Language.Format(LocString.RestockHBA1, Number));
}
}

private void OnSingleClick(PacketReader pvSrc, PacketHandlerEventArgs args)
Expand Down Expand Up @@ -247,15 +237,6 @@ private void OnHBTarget(bool location, Serial serial, Point3D loc, ushort gfx)
{
Engine.MainWindow.SafeAction(s => s.ShowMe());

Item hb = World.FindItem(m_HotBag);
if (hb != null)
{
if (hb.ObjPropList.Remove(Language.Format(LocString.RestockHBA1, Number)))
{
hb.OPLChanged();
}
}

if (!location && serial.IsItem)
{
m_HotBag = serial;
Expand All @@ -265,13 +246,6 @@ private void OnHBTarget(bool location, Serial serial, Point3D loc, ushort gfx)
m_HotBag = Serial.Zero;
}

hb = World.FindItem(m_HotBag);
if (hb != null)
{
hb.ObjPropList.Add(Language.Format(LocString.RestockHBA1, Number));
hb.OPLChanged();
}

SetHBText();
}

Expand Down Expand Up @@ -416,7 +390,7 @@ private void OnItemTarget(bool location, Serial serial, Point3D loc, ushort gfx)
gfx = item.ItemID;
}

if (gfx == 0 || gfx >= 0x4000)
if (gfx == 0)
{
return;
}
Expand Down Expand Up @@ -446,7 +420,7 @@ public void Add(RestockItem item)
}

m_Items.Add(item);
m_SubList.Items.Add(item);
Engine.MainWindow.SafeAction(m => m_SubList.Items.Add(item));

World.Player?.SendMessage(MsgLevel.Force, LocString.ItemAdded);
}
Expand Down
22 changes: 0 additions & 22 deletions Razor/Agents/ScavengerAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public ScavengerAgent()
HotKey.Add(HKCategory.Agents, LocString.ScavengerAddTarget, new HotKeyCallback(OnAddToHotBag));

PacketHandler.RegisterClientToServerViewer(0x09, new PacketViewerCallback(OnSingleClick));

Agent.OnItemCreated += new ItemCreatedEventHandler(CheckBagOPL);
}

public void ToggleEnabled()
Expand Down Expand Up @@ -113,14 +111,6 @@ public void OnSetHotBag()
Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(OnTargetBag));
}

private void CheckBagOPL(Item item)
{
if (item.Serial == m_Bag)
{
item.ObjPropList.Add(Language.GetString(LocString.ScavengerHB));
}
}

private void OnSingleClick(PacketReader pvSrc, PacketHandlerEventArgs args)
{
Serial serial = pvSrc.ReadUInt32();
Expand Down Expand Up @@ -288,20 +278,8 @@ private void OnTargetBag(bool location, Serial serial, Point3D loc, ushort gfx)
m_BagRef = World.FindItem(m_Bag);
}

if (m_BagRef != null)
{
m_BagRef.ObjPropList.Remove(Language.GetString(LocString.ScavengerHB));
m_BagRef.OPLChanged();
}

DebugLog("Set bag to {0}", serial);
m_Bag = serial;
m_BagRef = World.FindItem(m_Bag);
if (m_BagRef != null)
{
m_BagRef.ObjPropList.Add(Language.GetString(LocString.ScavengerHB));
m_BagRef.OPLChanged();
}

World.Player.SendMessage(MsgLevel.Force, LocString.ContSet, m_Bag);
}
Expand Down
Loading