protected override void OnTarget(Mobile from, object targeted) { if (m_AContract.Completed == false) { if (targeted is Corpse) { if (((Corpse)targeted).Owner is PlayerMobile) { if (((Corpse)targeted).Killer == m_AContract.m_Owner) { m = ((Corpse)targeted).Owner as PlayerMobile; if (m.RawName == m_AContract.m_Target) { if (m.GameTime - TimeSpan.FromHours((m_AContract.m_Expiration * 24) - m_AContract.m_TimeLeft) > TimeSpan.FromSeconds(1)) { m_AContract.m_Completed = true; } else { from.SendMessage("Date is younger"); } } else { from.SendMessage("That does not seem to be the target."); } } else { from.SendMessage("You did not kill that being."); } } else { from.SendMessage("That corpse does not belong to a player."); } } else { from.SendMessage("That is not a corpse."); } from.SendGump(new AContractGump(m_AContract.m_Target, m_AContract.m_Issuer, m_AContract.m_Owner, m_AContract.m_Copper, m_AContract.m_Expiration, from, m_AContract)); } else { if (targeted == m_AContract.m_Issuer) { from.Say(m_AContract.m_Owner.Name + " , your services have been completed."); from.SendMessage("Your reward has been placed in your pack."); m_AContract.Delete(); from.AddToBackpack(new BankCheck(m_AContract.m_Copper)); } else { from.SendMessage("This is not the person who signed the contract."); from.SendGump(new AContractGump(m_AContract.m_Target, m_AContract.m_Issuer, m_AContract.m_Owner, m_AContract.m_Copper, m_AContract.m_Expiration, from, m_AContract)); } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { if (info.ButtonID == 1) { m_ToPlayer.AddToBackpack(m_AContract); m_ToPlayer.SendMessage("The contract of service has been completed. A copy has been placed in your backpack."); } if (info.ButtonID == 2) { m_AContract.Delete(); m_From.SendMessage(m_ToPlayer.Name + " has denied your contract."); } }
protected override void OnTick() { m_AContract.m_TimeLeft = m_AContract.m_TimeLeft - 1; if (m_AContract.m_TimeLeft > 0) { m_ContractTimer = new ExpireContractTimer(m_AContract.m_TimeLeft, m_AContract); m_ContractTimer.Start(); } else { if (m_AContract.m_Issuer != null) { BankBox box = m_AContract.m_Issuer.BankBox; if (box != null) { m_AContract.Delete(); int deposited = 0; int toAdd = m_AContract.m_Copper; Copper copper; while (toAdd > 10) { copper = new Copper(10); if (box.TryDropItem(m_AContract.m_Issuer, copper, false)) { toAdd -= 10; deposited += 10; } else { copper.Delete(); m_AContract.m_Issuer.AddToBackpack(new BankCheck(toAdd)); toAdd = 0; break; } } if (toAdd > 0) { copper = new Copper(toAdd); if (box.TryDropItem(m_AContract.m_Issuer, copper, false)) { deposited += toAdd; } else { copper.Delete(); m_AContract.m_Issuer.AddToBackpack(new BankCheck(toAdd)); } } // Gold was deposited in your account: m_AContract.m_Issuer.SendLocalizedMessage(1042672, true, " " + deposited.ToString()); } /*else * { * //from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it. * }*/ } m_AContract.m_Expired = true; } }