public static void OnHandlerChanged(Mobile old, Mobile value, PageEntry entry) { if (old != null && _handlerDictionary.ContainsKey(old)) { _handlerDictionary.Remove(old); } if (value != null) { if (IsHandling(value)) { value.SendMessage("You cannot handle more than one page at a time."); return; } else { _handlerDictionary.Add(value, entry); } } entry.WriteLine("### ---"); entry.WriteLine(String.Format("Page handler changed from {0} to {1}.", old == null ? "(-null-)" : old.RawName, value == null ? "(-null-)" : value.RawName)); entry.WriteLine("---###"); entry.WriteLine(); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Player handler = _handler as Player; string comments = info.GetTextEntry(0).Text; int points = 0; if (handler == null) { return; } if (info.IsSwitched(1)) { points = 2; } else if (info.IsSwitched(2)) { points = 1; } else if (info.IsSwitched(3)) { points = 0; } else if (info.IsSwitched(4)) { points = -1; } else if (info.IsSwitched(5)) { points = -2; } if (points > 0) { handler.RepGood += points; } else { handler.RepBad += points; } if (_entry != null) { try { _entry.WriteLine(); _entry.WriteLine(String.Format("### --- Vote: {0} --- ###", points.ToString())); _entry.WriteLine("### --- Comments: --- ###"); _entry.WriteLine(comments); } catch { } } }
public static void OnHandlerChanged( Mobile old, Mobile value, PageEntry entry ) { if( old != null && _handlerDictionary.ContainsKey( old ) ) _handlerDictionary.Remove( old ); if( value != null ) { if( IsHandling( value ) ) { value.SendMessage( "You cannot handle more than one page at a time." ); return; } else _handlerDictionary.Add( value, entry ); } entry.WriteLine( "### ---" ); entry.WriteLine( String.Format( "Page handler changed from {0} to {1}.", old == null ? "(-null-)" : old.RawName, value == null ? "(-null-)" : value.RawName ) ); entry.WriteLine( "---###" ); entry.WriteLine(); }
protected void WriteToFile(Mobile m, string text) { string safeText = Utility.FixHtml(String.Format("{0}{1}: {2}", (m == _handler ? FormatAccessLevel(m) + " " : ""), m.RawName, text)); using (StreamWriter writer = new StreamWriter(GetFileName(_sender, _handler), true)) { writer.WriteLine(safeText); } if (_entry != null) { _entry.WriteLine(String.Format("({0}) " + safeText, ((Server.Accounting.Account)m.Account).Username)); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile m = state.Mobile; switch (info.ButtonID) { default: case 0: { if (_entry.Handler != state.Mobile) { PageQueueGump g = new PageQueueGump(); g.SendTo(state); } break; } case 1: //go to sender { if (_entry.Sender.Deleted) { m.SendMessage("That character no longer exists."); } else if (_entry.Sender.Map == null || _entry.Sender.Map == Map.Internal) { m.SendMessage("That character is not in this world."); } else { m.MoveToWorld(_entry.Sender.Location, _entry.Sender.Map); m.SendMessage("You have been teleported to that page's sender."); Resend(state); } break; } case 2: //go to handler { Mobile h = _entry.Handler; if (h != null) { if (h.Deleted) { m.SendMessage("That character no longer exists."); } else if (h.Map == null || h.Map == Map.Internal) { m.SendMessage("That character is not in this world."); } else { m.MoveToWorld(h.Location, h.Map); m.SendMessage("You have been teleported to that page's handler."); Resend(state); } } break; } case 3: //go to page location { if (_entry.OriginMap == null || _entry.OriginMap == Map.Internal) { m.SendMessage("That location is not in this world."); } else { m.MoveToWorld(_entry.OriginLocation, _entry.OriginMap); m.SendMessage("You have been teleported to the original page location."); Resend(state); } break; } case 4: //handle page { if (_entry.Handler == null) { _entry.Handler = m; m.SendMessage("You are now handling this page."); ChatGump.SendTo(_entry.Sender, _entry.Sender, m, false, _entry); ChatGump.SendTo(m, _entry.Sender, m, true, _entry); _entry.WriteLine("##############################"); _entry.WriteLine(String.Format("--------Page Type: {0}--------", PageQueue.GetPageTypeName(_entry.Type))); _entry.WriteLine(String.Format("--- Description: {0} ---", _entry.Message)); _entry.WriteLine("##############################"); _entry.WriteLine(); } else { m.SendMessage("{0} is already handling this page.", _entry.Handler.RawName); } break; } case 5: //delete page { if (_entry.Handler == null) { PageQueue.Remove(_entry); m.SendMessage("You delete the page."); PageQueueGump g = new PageQueueGump(); g.SendTo(state); } else { m.SendMessage("Someone is handling that page, and it cannot be deleted."); Resend(state); } break; } case 6: //abandon page { if (_entry.Handler == state.Mobile) { m.SendMessage("You have abandoned the page."); ChatGump.Close(_entry.Sender); ChatGump.Close(m); _entry.Handler = null; } else { m.SendMessage("You are not handling that page."); } Resend(state); break; } case 7: //page handled { if (_entry.Handler == state.Mobile) { PageQueue.Remove(_entry); if (_entry.Sender.HasGump(typeof(ChatGump))) { m.SendMessage(0x35, String.Format("{0} still has the chat gump open.", _entry.Sender.RawName)); Resend(state); } _entry.Handler = null; m.SendMessage("You mark the page as handled, and remove it from the queue."); PageQueueGump g = new PageQueueGump(); g.SendTo(state); } else { m.SendMessage("You are not handling that page."); Resend(state); } break; } case 8: //send message { TextRelay text = info.GetTextEntry(0); if (text != null) { _entry.Sender.SendGump(new MessageSentGump(_entry.Sender, m, text.Text)); } Resend(state); break; } case 9: //view speech log { if (_entry.SpeechLog != null) { m.SendGump(new Server.Engines.Help.SpeechLogGump(_entry.Sender, _entry.SpeechLog)); } Resend(state); break; } } }