public virtual Mobile GetEscorter() { if (!Controlled) { return(null); } Mobile master = ControlMaster; if (master == null) { return(null); } if (master.Deleted || master.Map != Map || !master.InRange(Location, 30) || !master.Alive) { StopFollow(); TimeSpan lastSeenDelay = DateTime.UtcNow - m_LastSeenEscorter; if (lastSeenDelay >= TimeSpan.FromMinutes(2.0)) { master.SendLocalizedMessage(1042473); // You have lost the person you were escorting. Say(1005653); // Hmmm. I seem to have lost my master. SetControlMaster(null); EscortTable.Remove(master); Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); return(null); } else { ControlOrder = OrderType.Stay; return(master); } } if (ControlOrder != OrderType.Follow) { StartFollow(master); } m_LastSeenEscorter = DateTime.UtcNow; return(master); }
public override Mobile GetEscorter() { if (!Controlled) { return(null); } Mobile master = ControlMaster; if (master == null) { return(null); } if (master.Deleted || master.Map != this.Map || !master.InRange(Location, 30) || !master.Alive) { StopFollow(); TimeSpan lastSeenDelay = DateTime.Now - LastSeenEscorter; if (lastSeenDelay >= TimeSpan.FromMinutes(2.0)) { master.SendMessage("You have lost the restless soul you were guiding"); Say("Oh no I have lost the mortal guiding me...I will roam this world forever..."); SetControlMaster(null); EscortTable.Remove(master); Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); return(null); } else { ControlOrder = OrderType.Stay; return(master); } } if (ControlOrder != OrderType.Follow) { StartFollow(master); } LastSeenEscorter = DateTime.Now; return(master); }
public virtual bool CheckAtDestination() { EDI dest = GetDestination(); if (dest == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (dest.Contains(Location)) { Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. // not going anywhere m_Destination = null; m_DestinationString = null; Container cont = escorter.Backpack; if (cont == null) { cont = escorter.BankBox; } Gold gold = new Gold(500, 1000); if (!cont.TryDropItem(escorter, gold, false)) { if (escorter.Map != null && escorter.Map != Map.Internal) { gold.MoveToWorld(escorter.Location, escorter.Map); } else { gold.Delete(); } } StopFollow(); SetControlMaster(null); EscortTable.Remove(escorter); BeginDelete(); Misc.Titles.AwardFame(escorter, 10, true); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 times in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, IsPrisoner ? 400 : 200, ref gainedPath)) { if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } return(true); } return(false); }
public override bool CheckAtDestination() { EDI dest = GetDestination(); if (dest == null) { return(false); } Mobile escorter = GetEscorter(); if (escorter == null) { return(false); } if (dest.Contains(Location)) { Say("You have brought me home, I thank thee mortal and I hope this token of my appreciation helps you, now farewell!", escorter.Name); // not going anywhere Destination = null; //DestinationString = null; escorter.AddToBackpack(new SpiritGem()); StopFollow(); SetControlMaster(null); EscortTable.Remove(escorter); BeginDelete(); Misc.Titles.AwardFame(escorter, 10, true); bool gainedPath = false; PlayerMobile pm = escorter as PlayerMobile; if (pm != null) { if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; } if (pm.CompassionGains >= 5) // have already gained 5 points in one day, can gain no more { pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. } else if (VirtueHelper.Award(pm, VirtueName.Compassion, 1, ref gainedPath)) { if (gainedPath) { pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! } else { pm.SendLocalizedMessage(1053002); // You have gained in compassion. } pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; } else { pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. } } return(true); } return(false); }