public override void OnDoubleClick(Mobile from) { if (m_Town == null) { return; } Faction faction = Faction.Find(from); if (faction == null && from.AccessLevel < AccessLevel.GameMaster) { return; // TODO: Message? } if (m_Town.Owner == null || (from.AccessLevel < AccessLevel.GameMaster && faction != m_Town.Owner)) { from.SendLocalizedMessage(1010332); // Your faction does not control this town } else if (!m_Town.Owner.IsCommander(from)) { from.SendLocalizedMessage(1005242); // Only faction Leaders can use townstones } else if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (from is PlayerMobile) { from.SendGump(new TownStoneGump((PlayerMobile)from, m_Town.Owner, m_Town)); } }
public override void VendorBuy(Mobile from) { if (this.Faction == null || Faction.Find(from, true) != this.Faction) { PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042201, from.NetState); // You are not in my faction, I cannot sell you a horse! } else if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (from is PlayerMobile) { from.SendGump(new HorseBreederGump((PlayerMobile)from, this.Faction)); } }
public override void OnDoubleClick(Mobile from) { if (m_Faction == null) { return; } if (!from.InRange(GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (from is PlayerMobile) { Faction existingFaction = Faction.Find(from); if (existingFaction == m_Faction || from.AccessLevel >= AccessLevel.GameMaster) { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.IsLeaving) { from.SendLocalizedMessage(1005051); // You cannot use the faction stone until you have finished quitting your current faction } else { from.SendGump(new FactionStoneGump((PlayerMobile)from, m_Faction)); } } else if (existingFaction != null) { // TODO: Validate from.SendLocalizedMessage(1005053); // This is not your faction stone! } else { from.SendGump(new JoinStoneGump((PlayerMobile)from, m_Faction)); } } }
public override void OnDoubleClick(Mobile from) { if (m_Faction == null) { return; } if (!from.InRange(GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (Faction.Find(from) == null && from is PlayerMobile) { from.SendGump(new JoinStoneGump((PlayerMobile)from, m_Faction)); } }
private static void EventSink_Speech(SpeechEventArgs e) { Mobile from = e.Mobile; int[] keywords = e.Keywords; for (int i = 0; i < keywords.Length; ++i) { switch (keywords[i]) { case 0x00E4: // *i wish to access the city treasury* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsFinance(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null && from is PlayerMobile) { from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x0ED: // *i am sheriff* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsSheriff(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null) { from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x00EF: // *you are fired* { Town town = Town.FromRegion(from.Region); if (town == null) { break; } if (town.IsFinance(from) || town.IsSheriff(from)) { town.BeginOrderFiring(from); } break; } case 0x00E5: // *i wish to resign as finance minister* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Finance != null) { pl.Finance.Finance = null; from.SendLocalizedMessage(1005081); // You have been fired as Finance Minister } break; } case 0x00EE: // *i wish to resign as sheriff* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Sheriff != null) { pl.Sheriff.Sheriff = null; from.SendLocalizedMessage(1010270); // You have been fired as Sheriff } break; } case 0x00E9: // *what is my faction term status* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.IsLeaving) { if (Faction.CheckLeaveTimer(from)) { break; } TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.UtcNow; if (remaining.TotalDays >= 1) { from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0")); // Your term of service will come to an end in ~1_DAYS~ days. } else if (remaining.TotalHours >= 1) { from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0")); // Your term of service will come to an end in ~1_HOURS~ hours. } else { from.SendLocalizedMessage(1042742); // Your term of service will come to an end in less than one hour. } } else if (pl != null) { from.SendLocalizedMessage(1042233); // You are not in the process of quitting the faction. } break; } case 0x00EA: // *message faction* { Faction faction = Faction.Find(from); if (faction == null || !faction.IsCommander(from)) { break; } if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady) { from.SendLocalizedMessage(1010264); // The required time has not yet passed since the last message was sent } else { faction.BeginBroadcast(from); } break; } case 0x00EC: // *showscore* { PlayerState pl = PlayerState.Find(from); if (pl != null) { Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl); } break; } case 0x0178: // i honor your leadership { Faction faction = Faction.Find(from); if (faction != null) { faction.BeginHonorLeadership(from); } break; } } } }