public static void SendCastBarGump(PlayerMobile user) { if (!CMOptions.ModuleEnabled || user == null || !user.IsOnline()) { return; } var o = EnsureState(user); if (o == null || !o.Enabled) { return; } var e = new CastBarRequestEventArgs(user, o.Offset); if (OnCastBarRequest != null) { OnCastBarRequest(e); } if (e.Gump == null) { CastBarRequestHandler(e); } if (e.Gump != null) { e.Gump.Refresh(true); } }
private static void CastBarRequestHandler(CastBarRequestEventArgs e) { if (!CMOptions.ModuleEnabled || e.User == null || !e.User.IsOnline() || e.Gump != null) { return; } SpellCastBar cb; if (!Instances.TryGetValue(e.User, out cb) || cb.IsDisposed) { Instances[e.User] = cb = new SpellCastBar(e.User, e.Location.X, e.Location.Y); } else { cb.X = e.Location.X; cb.Y = e.Location.Y; } cb.Preview = false; e.Gump = cb; if (CMOptions.ModuleDebug) { CMOptions.ToConsole( "Request: {0} casting {1}, using {2} ({3}) at {4}", e.User, e.User.Spell, cb, cb.Preview ? "Prv" : "Std", e.Location); } }
private static void CastBarRequestHandler(CastBarRequestEventArgs e) { if (e.User == null || e.User.Deleted || e.User.NetState == null || e.Gump != null) { return; } SpellCastBar cb; if (Instances.TryGetValue(e.User, out cb) && !cb.IsDisposed) { cb.X = e.Location.X; cb.Y = e.Location.Y; } else { cb = new SpellCastBar(e.User, e.Location.X, e.Location.Y); if (Instances.ContainsKey(e.User)) { Instances[e.User] = cb; } else { Instances.Add(e.User, cb); } } cb.Preview = false; e.Gump = cb; if (CMOptions.ModuleDebug) { CMOptions.ToConsole( "Request: {0} casting {1}, using {2} ({3}) at {4}", e.User, e.User.Spell, cb, cb.Preview ? "Prv" : "Std", e.Location); } }
public static void HandlePositionCommand(PlayerMobile user) { if (!CMOptions.ModuleEnabled || user == null || !user.IsOnline()) { return; } var e = new CastBarRequestEventArgs(user, GetOffset(user)); if (OnCastBarRequest != null) { OnCastBarRequest(e); } if (e.Gump == null) { CastBarRequestHandler(e); } if (e.Gump == null) { return; } e.Gump.Preview = true; new OffsetSelectorGump( user, e.Gump.Refresh(true), e.Location, (ui, oldValue) => { SetOffset(user, ui.Value); ui.User.SendMessage(0x55, "Cast-Bar position set to X({0:#,0}), Y({1:#,0}).", ui.Value.X, ui.Value.Y); e.Gump.X = ui.Value.X; e.Gump.Y = ui.Value.Y; e.Gump.Refresh(true); }).Send(); }
public static void HandlePositionCommand(PlayerMobile user) { if (user == null || user.Deleted || user.NetState == null || !CMOptions.ModuleEnabled) { return; } var e = new CastBarRequestEventArgs(user, GetOffset(user)); if (OnCastBarRequest != null) { OnCastBarRequest(e); } if (e.Gump == null) { CastBarRequestHandler(e); } if (e.Gump == null) { return; } e.Gump.Preview = true; SuperGump.Send( new OffsetSelectorGump( user, e.Gump.Refresh(true), e.Location, (self, oldValue) => { SetOffset(self.User, self.Value); self.User.SendMessage(0x55, "Cast-Bar position set to X({0:#,0}), Y({1:#,0}).", self.Value.X, self.Value.Y); e.Gump.X = self.Value.X; e.Gump.Y = self.Value.Y; e.Gump.Refresh(true); })); }
public static void SendCastBarGump(PlayerMobile user) { if (user == null || user.Deleted || user.NetState == null) { return; } var e = new CastBarRequestEventArgs(user, GetOffset(user)); if (OnCastBarRequest != null) { OnCastBarRequest(e); } if (e.Gump == null) { CastBarRequestHandler(e); } if (e.Gump != null) { e.Gump.Refresh(true); } }