Trying to make this bracelet change colors according to the MoonPhase independent of any action, meaning you don't have to equip, dbl-click to change color. When you travel from one facet to another it should auto change color based on the Phase of the Moon.

This compiles fine but the color won't change.

Code:
using System;

namespace Server.Items

{

public class MoonstoneBracelet : BaseBracelet

{

[Constructable]

public MoonstoneBracelet()

: base(0x1F06)

{

this.Name = "Moonstone Bracelet";

this.Weight = 0.1;

}

public MoonstoneBracelet(Serial serial)

: base(serial)

{

}

public virtual bool CheckMoonPhase()

{

MoonPhase phase = Clock.GetMoonPhase(this.Map, this.X, this.Y);

if (Map == Map.Trammel)

{

if (phase == MoonPhase.NewMoon)

this.Hue = 0x2;

else if (phase == MoonPhase.WaxingCrescentMoon)

this.Hue = 0x3;

else if (phase == MoonPhase.FirstQuarter)

this.Hue = 0x4;

else if (phase == MoonPhase.WaxingGibbous)

this.Hue = 0x5;

else if (phase == MoonPhase.FullMoon)

this.Hue = 0x6;

else if (phase == MoonPhase.WaningGibbous)

this.Hue = 0x5;

else if (phase == MoonPhase.LastQuarter)

this.Hue = 0x4;

else if (phase == MoonPhase.WaningCrescent)

this.Hue = 0x3;

}

else if (Map == Map.Felucca)

{

if (phase == MoonPhase.NewMoon)

this.Hue = 0x32;

else if (phase == MoonPhase.WaxingCrescentMoon)

this.Hue = 0x33;

else if (phase == MoonPhase.FirstQuarter)

this.Hue = 0x34;

else if (phase == MoonPhase.WaxingGibbous)

this.Hue = 0x35;

else if (phase == MoonPhase.FullMoon)

this.Hue = 0x36;

else if (phase == MoonPhase.WaningGibbous)

this.Hue = 0x35;

else if (phase == MoonPhase.LastQuarter)

this.Hue = 0x34;

else if (phase == MoonPhase.WaningCrescent)

this.Hue = 0x33;

}

else

{

if (phase == MoonPhase.NewMoon)

this.Hue = 0x902;

else if (phase == MoonPhase.WaxingCrescentMoon)

this.Hue = 0x903;

else if (phase == MoonPhase.FirstQuarter)

this.Hue = 0x904;

else if (phase == MoonPhase.WaxingGibbous)

this.Hue = 0x905;

else if (phase == MoonPhase.FullMoon)

this.Hue = 0x906;

else if (phase == MoonPhase.WaningGibbous)

this.Hue = 0x905;

else if (phase == MoonPhase.LastQuarter)

this.Hue = 0x904;

else if (phase == MoonPhase.WaningCrescent)

this.Hue = 0x903;

}

return true;

}

public override void Serialize(GenericWriter writer)

{

base.Serialize(writer);

writer.Write((int)0); // version

}

public override void Deserialize(GenericReader reader)

{

base.Deserialize(reader);

int version = reader.ReadInt();

}

}
 
Back