コード例 #1
0
        public static PlantPigment Mix(Mobile from, PlantHue hue1, PlantHue hue2)
        {
            if (PlantHueInfo.IsSaturated(hue2))
            {
                // This pigment is saturated and cannot be mixed further.
                from.SendLocalizedMessage(1112125);
            }
            else if (hue1 == hue2)
            {
                // You decide not to waste pigments by mixing two identical colors.
                from.SendLocalizedMessage(1112242);
            }
            else if (PlantHueInfo.GetNotBright(hue1) == PlantHueInfo.GetNotBright(hue2))
            {
                // You decide not to waste pigments by mixing variations of the same hue.
                from.SendLocalizedMessage(1112243);
            }
            else
            {
                PlantHue resultant = (hue1 | hue2);

                if ((resultant & PlantHue.Plain & ~PlantHue.Crossable) != 0)
                {
                    if ((resultant & (PlantHue.Black | PlantHue.White)) != 0)
                    {
                        /* Mixing plain pigments with the white and black mutant color
                         * pigments will turn them into the new hues, which are saturated. */
                        resultant |= PlantHue.Saturated;
                    }
                    else
                    {
                        /* Mixing plain pigments with the normal color pigments will turn
                         * them into the matching bright color pigment. */
                        resultant &= ~PlantHue.Plain;
                        resultant |= PlantHue.Bright | PlantHue.Crossable;
                    }
                }
                else if ((resultant & PlantHue.White) != 0)
                {
                    resultant &= ~PlantHue.White & ~PlantHue.Bright;
                    resultant |= PlantHue.Ice;
                }
                else if ((resultant & PlantHue.Black) != 0)
                {
                    resultant &= ~PlantHue.Black & ~PlantHue.Bright;
                    resultant |= PlantHue.Dark;
                }

                return(new PlantPigment(resultant));
            }

            return(null);
        }
コード例 #2
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!IsChildOf(from.Backpack))
     {
         // You must have the object in your backpack to use it.
         from.SendLocalizedMessage(1042010);
     }
     else if (PlantHueInfo.IsSaturated(m_PlantHue))
     {
         // This pigment is saturated and cannot be mixed further.
         from.SendLocalizedMessage(1112125);
     }
     else
     {
         // Which plant pigment do you wish to mix this with?
         from.SendLocalizedMessage(1112123);
         from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(Target));
     }
 }