示例#1
0
 public void Deserialize(BinaryReader reader)
 {
     PerHourChange = reader.ReadInt16();
     MaxValue = reader.ReadInt16();
     Motive = (VMMotive)reader.ReadByte();
     fractional = reader.ReadDouble();
 }
示例#2
0
 public static int ScaleRate(VM vm, int rate, VMMotive type)
 {
     if (vm.TS1)
     {
         if (type == VMMotive.Energy)
         {
             rate *= (int)VMTS1MotiveDecay.Constants[0] / (24 - (int)VMTS1MotiveDecay.Constants[1]);
         }
         return(rate);
     }
     else
     {
         if (LotMotives == null)
         {
             LotMotives = Content.Content.Get().GlobalTuning.EntriesByName["lotmotives"];
         }
         if (vm.TSOState.PropertyCategory == 4 && type > 0)
         {
             rate = (rate * 3) / 2;                                                //1.5x gain multiplier on services lots
         }
         if (VMMotive.Comfort == type)
         {
             return(rate);
         }
         var ind = Array.IndexOf(VMAvatarMotiveDecay.DecrementMotives, type);
         var cat = vm.TSOState.PropertyCategory;
         if (cat == 255)
         {
             cat = 0;
         }
         string category = VMAvatarMotiveDecay.CategoryNames[cat];
         var    weight   = ToFixed1000(LotMotives.Value.GetNum(category + "_" + VMAvatarMotiveDecay.LotMotiveNames[ind] + "Weight"));
         return((rate * 1000) / weight);
     }
 }
示例#3
0
 public void Deserialize(BinaryReader reader)
 {
     PerHourChange = reader.ReadInt16();
     MaxValue      = reader.ReadInt16();
     Motive        = (VMMotive)reader.ReadByte();
     fractional    = reader.ReadDouble();
 }
示例#4
0
        public virtual void SetMotiveChange(VMMotive motive, short PerHourChange, short MaxValue)
        {
            var temp = MotiveChanges[(int)motive];

            temp.PerHourChange = PerHourChange;
            temp.MaxValue      = MaxValue;
        }
示例#5
0
 public short GetLimit(VMMotive motive)
 {
     if (MotiveOverfill.TryGetValue((int)motive, out var result))
     {
         return((short)result);
     }
     return(100);
 }
 public virtual short GetMotiveData(VMMotive variable) //needs special conditions for ones like Mood.
 {
     if ((ushort)variable > 15)
     {
         throw new Exception("Motive Data out of bounds!");
     }
     return(MotiveData[(ushort)variable]);
 }
 public virtual bool SetMotiveData(VMMotive variable, short value)
 {
     if ((ushort)variable > 15)
     {
         throw new Exception("Motive Data out of bounds!");
     }
     MotiveData[(ushort)variable] = (short)Math.Max(Math.Min((int)value, 100), -100);
     return(true);
 }
示例#8
0
 public virtual bool SetMotiveData(VMMotive variable, short value)
 {
     if ((ushort)variable > 15)
     {
         throw new Exception("Motive Data out of bounds!");
     }
     MotiveData[(ushort)variable] = value;
     return(true);
 }
        public void Read(byte[] bytes)
        {
            using (var io = IoBuffer.FromBytes(bytes, ByteOrder.LITTLE_ENDIAN)){
                DeltaOwner = (VMVariableScope)io.ReadByte();
                MaxOwner   = (VMVariableScope)io.ReadByte();
                Motive     = (VMMotive)io.ReadByte();
                Flags      = (VMSetMotiveChangeFlags)io.ReadByte();

                DeltaData = io.ReadUInt16();
                MaxData   = io.ReadUInt16();
            }
        }
示例#10
0
 public virtual short GetMotiveData(VMMotive variable) //needs special conditions for ones like Mood.
 {
     switch (variable)
     {
     case VMMotive.Mood:
         return(50);    //always happy!! really!! it's not a front :(
     }
     if ((ushort)variable > 15)
     {
         throw new Exception("Motive Data out of bounds!");
     }
     return(MotiveData[(ushort)variable]);
 }
        public void Read(byte[] bytes)
        {
            using (var io = IoBuffer.FromBytes(bytes, ByteOrder.LITTLE_ENDIAN)){

                DeltaOwner = (VMVariableScope)io.ReadByte();
                MaxOwner = (VMVariableScope)io.ReadByte();
                Motive = (VMMotive)io.ReadByte();
                Flags = (VMSetMotiveChangeFlags)io.ReadByte();

                DeltaData = io.ReadUInt16();
                MaxData = io.ReadUInt16();
            }
        }
示例#12
0
        public static int ScaleRate(VM vm, int rate, VMMotive type)
        {
            if (vm.TSOState.PropertyCategory == 4 && type > 0)
            {
                rate = (rate * 3) / 2;                                                //1.5x gain multiplier on services lots
            }
            if (VMMotive.Comfort == type)
            {
                return(rate);
            }
            var    ind      = Array.IndexOf(VMAvatarMotiveDecay.DecrementMotives, type);
            string category = VMAvatarMotiveDecay.CategoryNames[vm.TSOState.PropertyCategory];
            var    weight   = ToFixed1000(LotMotives.GetNum(category + "_" + VMAvatarMotiveDecay.LotMotiveNames[ind] + "Weight"));

            return((rate * 1000) / weight);
        }
示例#13
0
 public virtual bool SetMotiveData(VMMotive variable, short value)
 {
     if ((ushort)variable > 15) throw new Exception("Motive Data out of bounds!");
     MotiveData[(ushort)variable] = value;
     return true;
 }
示例#14
0
 public bool HasMotiveChange(VMMotive motive)
 {
     return(MotiveChanges[(int)motive].PerHourChange != 0);
 }
示例#15
0
 public virtual bool SetMotiveData(VMMotive variable, short value)
 {
     if ((ushort)variable > 15) throw new Exception("Motive Data out of bounds!");
     MotiveData[(ushort)variable] = (short)Math.Max(Math.Min((int)value, 100), -100);
     return true;
 }
示例#16
0
 public virtual void SetMotiveChange(VMMotive motive, short PerHourChange, short MaxValue)
 {
     var temp = MotiveChanges[(int)motive];
     temp.PerHourChange = PerHourChange;
     temp.MaxValue = MaxValue;
 }
示例#17
0
 //needs special conditions for ones like Mood.
 public virtual short GetMotiveData(VMMotive variable)
 {
     switch (variable){
         case VMMotive.Mood:
             return 50; //always happy!! really!! it's not a front :(
     }
     if ((ushort)variable > 15) throw new Exception("Motive Data out of bounds!");
     return MotiveData[(ushort)variable];
 }
示例#18
0
 public static short ScaleMax(VM vm, short oldMax, VMMotive type)
 {
     return((short)((oldMax - 100) + vm.TuningCache.GetLimit(type)));
 }
示例#19
0
 //needs special conditions for ones like Mood.
 public virtual short GetMotiveData(VMMotive variable)
 {
     if ((ushort)variable > 15) throw new Exception("Motive Data out of bounds!");
     return MotiveData[(ushort)variable];
 }