CODE |
using System; using Server; using Server.Items; namespace Server.Misc { public class Xmas2006 : GiftGiver { public static void Initialize() { GiftGiving.Register( new Xmas2006() ); } public override DateTime Start{ get{ return new DateTime( 2006, 8, 16 ); } } public override DateTime Finish{ get{ return new DateTime( 2006, 8, 30 ); } } public override void GiveGift( Mobile mob ) { XmasBag bag = new XmasBag(); bag.DropItem( new Eggnog() ); bag.DropItem( new Champagne() ); bag.DropItem( new BunchOfDates() ); bag.DropItem( new FruitCake() ); bag.DropItem( new PileSnow() ); bag.DropItem( new RedChampagneGlass() ); bag.DropItem( new GreenChampagneGlass() ); bag.DropItem( new WristWatch() ); SeasonsGreetings greetings = new SeasonsGreetings(); greetings.Name = "Seasons Greetings from " + mob.Name; bag.DropItem( greetings ); switch ( GiveGift( mob, bag ) ) { case GiftResult.Backpack: mob.SendMessage( 0x482, "Seasons Greetings from the team! Gift items have been placed in your backpack." ); break; case GiftResult.BankBox: mob.SendMessage( 0x482, "Seasons Greetings from the team! Gift items have been placed in your bank box." ); break; } } } } |
QUOTE |
private static void EventSink_Login( LoginEventArgs e ) { Account acct = e.Mobile.Account as Account; if ( acct == null ) return; DateTime now = DateTime.Now; for ( int i = 0; i < m_Givers.Count; ++i ) { GiftGiver giver = m_Givers[i]; if ( now < giver.Start || now >= giver.Finish ) continue; // not in the correct timefream if ( acct.Created > (giver.Start - giver.MinimumAge) ) continue; // newly created account // ARTEGORDONMOD // add support for multiple gifts per account if ( acct.LastLogin >= giver.Start && !giver.CanGiveMultipleGifts(e.Mobile)) continue; // already got one giver.DelayGiveGift( TimeSpan.FromSeconds( 5.0 ), e.Mobile ); } acct.LastLogin = now; } } public abstract class GiftGiver { public virtual TimeSpan MinimumAge{ get{ return TimeSpan.FromDays( 30.0 ); } } public abstract DateTime Start{ get; } public abstract DateTime Finish{ get; } public abstract void GiveGift( Mobile mob ); // ARTEGORDONMOD // add support for multiple gifts per account // by default only allow one gift per account public virtual bool CanGiveMultipleGifts(Mobile mob) { return false; } public virtual void DelayGiveGift( TimeSpan delay, Mobile mob ) { Timer.DelayCall( delay, new TimerStateCallback( DelayGiveGift_Callback ), mob ); } |
QUOTE |
using System; using Server; using Server.Items; using Server.Engines.XmlSpawner2; namespace Server.Misc { public class Xmas2006 : GiftGiver { public static void Initialize() { GiftGiving.Register(new Xmas2006()); } public override DateTime Start { get { return new DateTime(2006, 8, 16); } } public override DateTime Finish { get { return new DateTime(2006, 8, 30); } } // ARTEGORDONMOD // add support for multiple gifts per account public override bool CanGiveMultipleGifts(Mobile mob) { // check to see if they have already been given the gift return XmlAttach.FindAttachment(mob, typeof(XmlData), "Xmas2006") == null; } public override void GiveGift(Mobile mob) { XmasBag bag = new XmasBag(); bag.DropItem(new Eggnog()); bag.DropItem(new Champagne()); bag.DropItem(new BunchOfDates()); bag.DropItem(new FruitCake()); bag.DropItem(new PileSnow()); bag.DropItem(new RedChampagneGlass()); bag.DropItem(new GreenChampagneGlass()); bag.DropItem(new WristWatch()); SeasonsGreetings greetings = new SeasonsGreetings(); greetings.Name = "Seasons Greetings from " + mob.Name; bag.DropItem(greetings); switch (GiveGift(mob, bag)) { case GiftResult.Backpack: mob.SendMessage(0x482, "Seasons Greetings from the team! Gift items have been placed in your backpack."); break; case GiftResult.BankBox: mob.SendMessage(0x482, "Seasons Greetings from the team! Gift items have been placed in your bank box."); break; } // ARTEGORDONMOD // flag the mob as having been given the gift XmlAttach.AttachTo(mob, new XmlData("Xmas2006","",43200)); } } } |
QUOTE (Erica @ December 27, 2006 11:32 pm) |
So what your saying is once i edit those 2 scripts each account that has 6 characters will get gifts am i correct if not explain a little more Thanks. |