コード例 #1
0
        public void Tick(VMAvatar avatar, VMContext context)
        {
            if (context.Clock.Minutes == LastMinute) return;
            LastMinute = context.Clock.Minutes;

            string category = "Skills";
            string sleepState = (avatar.GetMotiveData(VMMotive.SleepState) == 0)?"Awake":"Asleep";

            int moodSum = 0;

            for (int i = 0; i < 7; i++) {
                if (avatar.IsPet && i == 5) return;
                float lotMul = LotMotives.GetNum(category + "_" + LotMotiveNames[i] + "Weight");
                float frac = 0;
                var motive = avatar.GetMotiveData(DecrementMotives[i]);
                var r_Hunger = (SimMotives.GetNum("HungerDecrementRatio") * (100+avatar.GetMotiveData(VMMotive.Hunger))) * LotMotives.GetNum(category+"_HungerWeight");
                switch (i)
                {
                    case 0:
                        frac = r_Hunger; break;
                    case 1:
                        frac = (SimMotives.GetNum("ComfortDecrementActive") * lotMul); break;
                    case 2:
                        frac = (SimMotives.GetNum("HygieneDecrement" + sleepState) * lotMul); break;
                    case 3:
                        frac = (SimMotives.GetNum("BladderDecrement" + sleepState) * lotMul) + (SimMotives.GetNum("HungerToBladderMultiplier") * r_Hunger); break;
                    case 4:
                        frac = (SimMotives.GetNum("EnergySpan") / (60 * SimMotives.GetNum("WakeHours")));
                        // TODO: wrong but appears to be close? need one which uses energy weight, which is about 2.4 on skills
                        break;
                    case 5:
                        frac = (sleepState == "Asleep") ? 0 : (SimMotives.GetNum("EntDecrementAwake") * lotMul);
                        break;
                    case 6:
                        frac = (SimMotives.GetNum("SocialDecrementBase") + (SimMotives.GetNum("SocialDecrementMultiplier") * (100+motive))) * lotMul;
                        frac /= 2; //make this less harsh right now, til I can work out how multiplayer bonus is meant to work
                        break;
                }

                MotiveFractions[i] += (short)(frac * 1000);
                if (MotiveFractions[i] >= 1000)
                {
                    motive -= (short)(MotiveFractions[i] / 1000);
                    MotiveFractions[i] %= 1000;
                    if (motive < -100) motive = -100;
                    avatar.SetMotiveData(DecrementMotives[i], motive);
                }
                moodSum += motive;
            }
            avatar.SetMotiveData(VMMotive.Mood, (short)(moodSum / 7));
        }
コード例 #2
0
        public void Save(VMAvatar avatar)
        {
            SkinTone     = (byte)avatar.SkinTone;
            DefaultSuits = avatar.DefaultSuits; //todo: clone?
            //if naked or using clothes rack, save in daywear.
            //TODO: store and check simantics outfit category, and restore using that instead.
            var dyn         = avatar.DynamicSuits;
            var bID         = avatar.BodyOutfit.ID;
            var saveDaywear = dyn.Daywear == bID || dyn.Sleepwear == bID || dyn.Swimwear == bID;

            saveDaywear = saveDaywear || (bID == 0x24E0000000D || bID == 0x10000000D);
            BodyOutfit  = (saveDaywear)?avatar.DefaultSuits.Daywear.ID : bID;

            HeadOutfit  = avatar.HeadOutfit.ID;
            Name        = avatar.Name;
            Permissions = avatar.AvatarState.Permissions;
            AvatarFlags = ((VMTSOAvatarState)avatar.TSOState).Flags;
            Budget      = avatar.TSOState.Budget.Value;

            for (int i = 0; i < MotiveData.Length; i++)
            {
                MotiveData[i] = avatar.GetMotiveData((VMMotive)i);
            }
            MotiveData[(int)(VMMotive.SleepState)] = 0;
            for (int i = 0; i < PersonDataMap.Length; i++)
            {
                PersonData[i] = avatar.GetPersonData((VMPersonDataVariable)PersonDataMap[i]);
            }
            SkillLock      = avatar.SkillLocks;
            OnlineJobInfo  = ((VMTSOAvatarState)avatar.TSOState).JobInfo;
            IgnoredAvatars = ((VMTSOAvatarState)avatar.TSOState).IgnoredAvatars;
        }
コード例 #3
0
        public void Tick(VMAvatar avatar)
        {
            Ticked = true;
            if (PerHourChange != 0)
            {
                double rate = (PerHourChange / 60.0) / (30.0 * 5.0); //timed for 5 second minutes
                fractional += rate;
                if (Math.Abs(fractional) >= 1)
                {
                    var motive = avatar.GetMotiveData(Motive);
                    if (((rate > 0) && (motive > MaxValue)) || ((rate < 0) && (motive < MaxValue)))
                    {
                        return;
                    }                                                                                           //we're already over, do nothing. (do NOT clamp)
                    motive     += (short)(fractional);
                    fractional %= 1.0;

                    if (((rate > 0) && (motive > MaxValue)) || ((rate < 0) && (motive < MaxValue)))
                    {
                        motive = MaxValue;
                    }
                    //DO NOT CLEAR MOTIVE WHEN IT HITS MAX VALUE! fixes pet, maybe shower.
                    avatar.SetMotiveData(Motive, motive);
                }
            }
        }
コード例 #4
0
        public void Save(VMAvatar avatar)
        {
            SkinTone     = (byte)avatar.SkinTone;
            DefaultSuits = avatar.DefaultSuits; //todo: clone?
            //if naked, save in daywear.
            BodyOutfit = (avatar.BodyOutfit.ID == 0x24E0000000D || avatar.BodyOutfit.ID == 0x10000000D)?avatar.DefaultSuits.Daywear.ID : avatar.BodyOutfit.ID;

            HeadOutfit  = avatar.HeadOutfit.ID;
            Name        = avatar.Name;
            Permissions = ((VMTSOAvatarState)avatar.TSOState).Permissions;
            AvatarFlags = ((VMTSOAvatarState)avatar.TSOState).Flags;
            Budget      = avatar.TSOState.Budget.Value;

            for (int i = 0; i < MotiveData.Length; i++)
            {
                MotiveData[i] = avatar.GetMotiveData((VMMotive)i);
            }
            MotiveData[(int)(VMMotive.SleepState)] = 0;
            for (int i = 0; i < PersonDataMap.Length; i++)
            {
                PersonData[i] = avatar.GetPersonData((VMPersonDataVariable)PersonDataMap[i]);
            }
            SkillLock      = avatar.SkillLocks;
            OnlineJobInfo  = ((VMTSOAvatarState)avatar.TSOState).JobInfo;
            IgnoredAvatars = ((VMTSOAvatarState)avatar.TSOState).IgnoredAvatars;
        }
コード例 #5
0
 private void UpdateMotives()
 {
     MotiveDisplay.MotiveValues[0] = SelectedAvatar.GetMotiveData(VMMotive.Hunger);
     MotiveDisplay.MotiveValues[1] = SelectedAvatar.GetMotiveData(VMMotive.Comfort);
     MotiveDisplay.MotiveValues[2] = SelectedAvatar.GetMotiveData(VMMotive.Hygiene);
     MotiveDisplay.MotiveValues[3] = SelectedAvatar.GetMotiveData(VMMotive.Bladder);
     MotiveDisplay.MotiveValues[4] = SelectedAvatar.GetMotiveData(VMMotive.Energy);
     MotiveDisplay.MotiveValues[5] = SelectedAvatar.GetMotiveData(VMMotive.Fun);
     MotiveDisplay.MotiveValues[6] = SelectedAvatar.GetMotiveData(VMMotive.Social);
     MotiveDisplay.MotiveValues[7] = SelectedAvatar.GetMotiveData(VMMotive.Room);
 }
コード例 #6
0
        public void Tick(VMAvatar avatar)
        {
            if (PerHourChange != 0)
            {
                double rate = (PerHourChange/60.0)/30.0;     //remember to fix when we implement the clock! right now assumes time for an hour is a realtime minute
                fractional += rate;
                if (Math.Abs(fractional) >= 1)
                {
                    var motive = avatar.GetMotiveData(Motive);
                    motive += (short)(fractional);
                    fractional %= 1.0;

                    if (((rate > 0) && (motive > MaxValue)) || ((rate < 0) && (motive < MaxValue))) { motive = MaxValue; Clear(); }
                    avatar.SetMotiveData(Motive, motive);
                }
            }
        }
コード例 #7
0
        public void Tick(VMAvatar avatar)
        {
            if (PerHourChange != 0)
            {
                double rate = (PerHourChange / 60.0) / 30.0;     //remember to fix when we implement the clock! right now assumes time for an hour is a realtime minute
                fractional += rate;
                if (Math.Abs(fractional) >= 1)
                {
                    var motive = avatar.GetMotiveData(Motive);
                    motive     += (short)(fractional);
                    fractional %= 1.0;

                    if (((rate > 0) && (motive > MaxValue)) || ((rate < 0) && (motive < MaxValue)))
                    {
                        motive = MaxValue; Clear();
                    }
                    avatar.SetMotiveData(Motive, motive);
                }
            }
        }
コード例 #8
0
        public void Tick(VMAvatar avatar)
        {
            Ticked = true;
            if (PerHourChange != 0)
            {
                double rate = (PerHourChange/60.0)/(30.0*5.0); //timed for 5 second minutes
                fractional += rate;
                if (Math.Abs(fractional) >= 1)
                {
                    var motive = avatar.GetMotiveData(Motive);
                    if (((rate > 0) && (motive > MaxValue)) || ((rate < 0) && (motive < MaxValue))) { return; } //we're already over, do nothing. (do NOT clamp)
                    motive += (short)(fractional);
                    fractional %= 1.0;

                    if (((rate > 0) && (motive > MaxValue)) || ((rate < 0) && (motive < MaxValue))) { motive = MaxValue; }
                    //DO NOT CLEAR MOTIVE WHEN IT HITS MAX VALUE! fixes pet, maybe shower.
                    avatar.SetMotiveData(Motive, motive);
                }
            }
        }
コード例 #9
0
        public void Tick(VMAvatar avatar, VMContext context)
        {
            var roomScore = context.GetRoomScore(context.GetRoomAt(avatar.Position));

            avatar.SetMotiveData(VMMotive.Room, roomScore);
            if (context.Clock.Minutes == LastMinute)
            {
                return;
            }
            if (avatar.GetPersonData(VMPersonDataVariable.Cheats) > 0)
            {
                return;
            }
            LastMinute = context.Clock.Minutes;

            UpdateCategory(context);
            int sleepState = (avatar.GetMotiveData(VMMotive.SleepState) == 0)?1:0;

            int moodSum = 0;

            for (int i = 0; i < 7; i++)
            {
                int lotMul   = LotMuls[i];
                int frac     = 0;
                var motive   = avatar.GetMotiveData(DecrementMotives[i]);
                var r_Hunger = FracMul(FlatSimMotives[0] * (100 + avatar.GetMotiveData(VMMotive.Hunger)), LotMuls[0]);
                switch (i)
                {
                case 0:
                    frac = r_Hunger; break;

                case 1:
                    frac = FracMul(FlatSimMotives[1], lotMul); break;

                case 2:
                    frac = FracMul(FlatSimMotives[2 + sleepState], lotMul); break;

                case 3:
                    frac = FracMul(FlatSimMotives[4 + sleepState], lotMul) + FracMul(r_Hunger, FlatSimMotives[6]); break;

                case 4:
                    frac = (FlatSimMotives[7] / (60 * FlatSimMotives[8]));
                    // TODO: wrong but appears to be close? need one which uses energy weight, which is about 2.4 on skills
                    break;

                case 5:
                    frac = (sleepState == 0) ? 0 : FracMul(FlatSimMotives[9], lotMul);
                    break;

                case 6:
                    frac = FlatSimMotives[10] +
                           FracMul((FlatSimMotives[11] * (100 + motive)), lotMul);
                    frac /= 2;     //make this less harsh right now, til I can work out how multiplayer bonus is meant to work
                    break;
                }

                MotiveFractions[i] += (short)frac;
                if (MotiveFractions[i] >= 1000)
                {
                    motive             -= (short)(MotiveFractions[i] / 1000);
                    MotiveFractions[i] %= 1000;
                    if (motive < -100)
                    {
                        motive = -100;
                    }
                    avatar.SetMotiveData(DecrementMotives[i], motive);
                }
                moodSum += motive;
            }
            moodSum += roomScore;

            avatar.SetMotiveData(VMMotive.Mood, (short)(moodSum / 8));
        }
コード例 #10
0
        public void Tick(VMAvatar avatar, VMContext context)
        {
            if (context.Clock.Minutes == LastMinute)
            {
                return;
            }
            LastMinute = context.Clock.Minutes;

            string category   = "Skills";
            string sleepState = (avatar.GetMotiveData(VMMotive.SleepState) == 0)?"Awake":"Asleep";

            int moodSum = 0;

            for (int i = 0; i < 7; i++)
            {
                if (avatar.IsPet && i == 5)
                {
                    return;
                }
                float lotMul   = LotMotives.GetNum(category + "_" + LotMotiveNames[i] + "Weight");
                float frac     = 0;
                var   motive   = avatar.GetMotiveData(DecrementMotives[i]);
                var   r_Hunger = (SimMotives.GetNum("HungerDecrementRatio") * (100 + avatar.GetMotiveData(VMMotive.Hunger))) * LotMotives.GetNum(category + "_HungerWeight");
                switch (i)
                {
                case 0:
                    frac = r_Hunger; break;

                case 1:
                    frac = (SimMotives.GetNum("ComfortDecrementActive") * lotMul); break;

                case 2:
                    frac = (SimMotives.GetNum("HygieneDecrement" + sleepState) * lotMul); break;

                case 3:
                    frac = (SimMotives.GetNum("BladderDecrement" + sleepState) * lotMul) + (SimMotives.GetNum("HungerToBladderMultiplier") * r_Hunger); break;

                case 4:
                    frac = (SimMotives.GetNum("EnergySpan") / (60 * SimMotives.GetNum("WakeHours")));
                    // TODO: wrong but appears to be close? need one which uses energy weight, which is about 2.4 on skills
                    break;

                case 5:
                    frac = (sleepState == "Asleep") ? 0 : (SimMotives.GetNum("EntDecrementAwake") * lotMul);
                    break;

                case 6:
                    frac  = (SimMotives.GetNum("SocialDecrementBase") + (SimMotives.GetNum("SocialDecrementMultiplier") * (100 + motive))) * lotMul;
                    frac /= 2;     //make this less harsh right now, til I can work out how multiplayer bonus is meant to work
                    break;
                }

                MotiveFractions[i] += (short)(frac * 1000);
                if (MotiveFractions[i] >= 1000)
                {
                    motive             -= (short)(MotiveFractions[i] / 1000);
                    MotiveFractions[i] %= 1000;
                    if (motive < -100)
                    {
                        motive = -100;
                    }
                    avatar.SetMotiveData(DecrementMotives[i], motive);
                }
                moodSum += motive;
            }
            avatar.SetMotiveData(VMMotive.Mood, (short)(moodSum / 7));
        }
コード例 #11
0
        public void Tick(VMAvatar avatar, VMContext context)
        {
            var roomScore = context.GetRoomScore(context.GetRoomAt(avatar.Position));

            avatar.SetMotiveData(VMMotive.Room, roomScore);
            if (context.Clock.Minutes / 2 == LastMinute)
            {
                return;
            }
            LastMinute = context.Clock.Minutes / 2;
            var sleeping = (avatar.GetMotiveData(VMMotive.SleepState) != 0);

            int moodSum = 0;

            for (int i = 0; i < 7; i++)
            {
                int frac = 0;
                var dm   = DecrementMotives[i];
                if (avatar.HasMotiveChange(dm) && dm != VMMotive.Energy)
                {
                    continue;
                }
                var motive   = avatar.GetMotiveData(dm);
                var r_Hunger = ToFixed1000(Constants[5]) * (100 + avatar.GetMotiveData(VMMotive.Hunger));
                switch (i)
                {
                case 0:
                    frac = r_Hunger; break;

                case 1:
                    var active = avatar.GetPersonData(VMPersonDataVariable.ActivePersonality);
                    if (active > 666)
                    {
                        frac = ToFixed1000(Constants[14]);
                    }
                    else if (active < 666)
                    {
                        frac = ToFixed1000(Constants[15]);
                    }
                    else
                    {
                        frac = ToFixed1000(Constants[16]);
                    }
                    break;

                case 2:
                    frac = ToFixed1000(Constants[sleeping ? 11 : 10]); break;

                case 3:
                    frac = ToFixed1000(Constants[sleeping ? 13 : 12]) + FracMul(r_Hunger, ToFixed1000(Constants[4])); break;

                case 4:
                    if (sleeping)
                    {
                        frac = (context.Clock.Hours >= Constants[2]) ? ToFixed1000(Constants[3]) : 0;
                    }
                    else
                    {
                        frac = (ToFixed1000(Constants[0]) / (30 * (int)Constants[1]));
                    }
                    //energy span over wake hours. small energy drift applied if asleep during the day.
                    break;

                case 5:
                    frac = (sleeping)?0:ToFixed1000(Constants[8]);
                    break;

                case 6:
                    frac = ToFixed1000(Constants[6]) +
                           ToFixed1000(Constants[7]) * avatar.GetPersonData(VMPersonDataVariable.OutgoingPersonality);
                    break;
                }

                MotiveFractions[i] += (short)frac;
                if (MotiveFractions[i] >= 1000)
                {
                    motive             -= (short)(MotiveFractions[i] / 1000);
                    MotiveFractions[i] %= 1000;
                    if (motive < -100)
                    {
                        motive = -100;
                    }
                    avatar.SetMotiveData(DecrementMotives[i], motive);
                }
                moodSum += motive;
            }
            moodSum += roomScore;

            avatar.SetMotiveData(VMMotive.Mood, (short)(moodSum / 8));
        }
コード例 #12
0
        public void Tick(VMAvatar avatar, VMContext context)
        {
            var roomScore = context.GetRoomScore(context.GetRoomAt(avatar.Position));

            avatar.SetMotiveData(VMMotive.Room, roomScore);
            if (context.Clock.Minutes == LastMinute)
            {
                return;
            }
            LastMinute = context.Clock.Minutes;

            string category   = CategoryNames[context.VM.TSOState.PropertyCategory];
            string sleepState = (avatar.GetMotiveData(VMMotive.SleepState) == 0)?"Awake":"Asleep";

            int moodSum = 0;

            for (int i = 0; i < 7; i++)
            {
                int lotMul   = ToFixed1000(LotMotives.GetNum(category + "_" + LotMotiveNames[i] + "Weight"));
                int frac     = 0;
                var motive   = avatar.GetMotiveData(DecrementMotives[i]);
                var r_Hunger = FracMul(ToFixed1000(SimMotives.GetNum("HungerDecrementRatio")) * (100 + avatar.GetMotiveData(VMMotive.Hunger)), ToFixed1000(LotMotives.GetNum(category + "_HungerWeight")));
                switch (i)
                {
                case 0:
                    frac = r_Hunger; break;

                case 1:
                    frac = FracMul(ToFixed1000(SimMotives.GetNum("ComfortDecrementActive")), lotMul); break;

                case 2:
                    frac = FracMul(ToFixed1000(SimMotives.GetNum("HygieneDecrement" + sleepState)), lotMul); break;

                case 3:
                    frac = FracMul(ToFixed1000(SimMotives.GetNum("BladderDecrement" + sleepState)), lotMul) + FracMul(r_Hunger, ToFixed1000(SimMotives.GetNum("HungerToBladderMultiplier"))); break;

                case 4:
                    frac = (ToFixed1000(SimMotives.GetNum("EnergySpan")) / (60 * (int)SimMotives.GetNum("WakeHours")));
                    // TODO: wrong but appears to be close? need one which uses energy weight, which is about 2.4 on skills
                    break;

                case 5:
                    frac = (sleepState == "Asleep") ? 0 : FracMul(ToFixed1000(SimMotives.GetNum("EntDecrementAwake")), lotMul);
                    break;

                case 6:
                    frac = ToFixed1000(SimMotives.GetNum("SocialDecrementBase")) +
                           FracMul((ToFixed1000(SimMotives.GetNum("SocialDecrementMultiplier")) * (100 + motive)), lotMul);
                    frac /= 2;     //make this less harsh right now, til I can work out how multiplayer bonus is meant to work
                    break;
                }

                MotiveFractions[i] += (short)frac;
                if (MotiveFractions[i] >= 1000)
                {
                    motive             -= (short)(MotiveFractions[i] / 1000);
                    MotiveFractions[i] %= 1000;
                    if (motive < -100)
                    {
                        motive = -100;
                    }
                    avatar.SetMotiveData(DecrementMotives[i], motive);
                }
                moodSum += motive;
            }
            moodSum += roomScore;

            avatar.SetMotiveData(VMMotive.Mood, (short)(moodSum / 8));
        }