public void EndClaimList(Mobile from, BaseCreature pet) { if (pet == null || pet.Deleted || pet.GetFlag(CreatureFlags.StableHold) || from.Map != this.Map || !from.InRange(this, 14) || !from.Stabled.Contains(pet) || !from.CheckAlive()) { return; } if ((from.Followers + pet.ControlSlots) <= from.FollowersMax) { pet.SetControlMaster(from); if (pet.Summoned) { pet.SummonMaster = from; } pet.ControlTarget = from; pet.ControlOrder = OrderType.Follow; pet.MoveToWorld(from.Location, from.Map); pet.IsStabled = false; from.Stabled.Remove(pet); pet.LastStableChargeTime = DateTime.MinValue; // When set to MinValue, we don't serialize SayTo(from, 1042559); // Here you go... and good day to you! } else { SayTo(from, 1049612, pet.Name); // ~1_NAME~ remained in the stables because you have too many followers. } }
public void Claim(Mobile from) { if (Deleted || !from.CheckAlive()) { return; } bool claimed = false; int stabled = 0; for (int i = 0; i < from.Stabled.Count; ++i) { BaseCreature pet = from.Stabled[i] as BaseCreature; if (pet == null) { from.Stabled.RemoveAt(i); --i; continue; } if (pet.Deleted) { pet.IsStabled = false; pet.LastStableChargeTime = DateTime.MinValue; // When set to MinValue, we don't serialize from.Stabled.RemoveAt(i); --i; continue; } // tell the player they need to pay the back stable fees if (pet.GetFlag(CreatureFlags.StableHold)) { // charge the player back stable fees if ((from.BankBox != null && from.BankBox.ConsumeTotal(typeof(Gold), pet.StableBackFees) == true)) { Server.Commands.LogHelper Logger = new Server.Commands.LogHelper("PetHoldFromStables.log", false, true); Logger.Log(string.Format("{0} gold was taken from {2}'s bank to cover late stable fees for {1}.", pet.StableBackFees, pet.Name, from)); Logger.Finish(); SayTo(from, "{0} gold was taken from your bank cover late stable fees for {1}.", pet.StableBackFees, pet.Name); pet.StableBackFees = 0; pet.SetFlag(CreatureFlags.StableHold, false); goto add_pet; } else { SayTo(from, "You will need {0} gold in your bank to cover late stable fees for {1}.", pet.StableBackFees, pet.Name); continue; } } add_pet: ++stabled; if ((from.Followers + pet.ControlSlots) <= from.FollowersMax) { pet.SetControlMaster(from); if (pet.Summoned) { pet.SummonMaster = from; } pet.ControlTarget = from; pet.ControlOrder = OrderType.Follow; pet.MoveToWorld(from.Location, from.Map); pet.IsStabled = false; from.Stabled.RemoveAt(i); pet.LastStableChargeTime = DateTime.MinValue; // When set to MinValue, we don't serialize --i; claimed = true; } else { SayTo(from, 1049612, pet.Name); // ~1_NAME~ remained in the stables because you have too many followers. } } if (claimed) { SayTo(from, 1042559); // Here you go... and good day to you! } else if (stabled == 0) { SayTo(from, 502671); // But I have no animals stabled with me at the moment! } }
public void BeginClaimList(Mobile from) { if (Deleted || !from.CheckAlive()) { return; } ArrayList list = new ArrayList(); for (int i = 0; i < from.Stabled.Count; ++i) { BaseCreature pet = from.Stabled[i] as BaseCreature; if (pet == null) { from.Stabled.RemoveAt(i); --i; continue; } if (pet.Deleted) { pet.IsStabled = false; pet.LastStableChargeTime = DateTime.MinValue; // When set to MinValue, we don't serialize from.Stabled.RemoveAt(i); --i; continue; } // tell the player they need to pay the back stable fees if (pet.GetFlag(CreatureFlags.StableHold)) { // charge the player back stable fees if ((from.BankBox != null && from.BankBox.ConsumeTotal(typeof(Gold), pet.StableBackFees) == true)) { Server.Commands.LogHelper Logger = new Server.Commands.LogHelper("PetHoldFromStables.log", false, true); Logger.Log(string.Format("{0} gold was taken from {2}'s bank to cover late stable fees for {1}.", pet.StableBackFees, pet.Name, from)); Logger.Finish(); SayTo(from, "{0} gold was taken from your bank cover late stable fees for {1}.", pet.StableBackFees, pet.Name); pet.StableBackFees = 0; pet.SetFlag(CreatureFlags.StableHold, false); goto add_pet; } else { SayTo(from, "You will need {0} gold in your bank to cover late stable fees for {1}.", pet.StableBackFees, pet.Name); continue; } } add_pet: list.Add(pet); } if (list.Count > 0) { from.SendGump(new ClaimListGump(this, from, list)); } else { SayTo(from, 502671); // But I have no animals stabled with me at the moment! } }