当前位置: 首页>>代码示例>>C#>>正文


C# Sim.ModifyFunds方法代码示例

本文整理汇总了C#中Sim.ModifyFunds方法的典型用法代码示例。如果您正苦于以下问题:C# Sim.ModifyFunds方法的具体用法?C# Sim.ModifyFunds怎么用?C# Sim.ModifyFunds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sim的用法示例。


在下文中一共展示了Sim.ModifyFunds方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryDeductFunds

 private bool TryDeductFunds(TattooChair ths, Sim giver, Sim receiver)
 {
     if (giver == receiver)
     {
         if (giver.FamilyFunds >= Tattooing.kCostTattooSelf)
         {
             receiver.ModifyFunds(-Tattooing.kCostTattooSelf);
             return true;
         }
         return false;
     }
     if (giver == ths.GetTattooArtist())
     {
         if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromTattooArtist, true))
         {
             return false;
         }
         return true;
     }
     if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromSim, true))
     {
         return false;
     }
     return true;
 }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:25,代码来源:GiveTattooEx.cs

示例2: OnAccepted

        public static void OnAccepted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                int funds = RandomUtil.GetInt(NRaas.Careers.Settings.mMaxShakedown / 2, NRaas.Careers.Settings.mMaxShakedown);

                if (funds > target.FamilyFunds)
                {
                    funds = target.FamilyFunds;
                }

                if (funds <= 0) return;

                target.ModifyFunds(-funds);

                actor.ModifyFunds(funds);

                if (actor.IsSelectable)
                {
                    Common.Notify(actor, Common.Localize("Shakedown:Notice", actor.IsFemale, target.IsFemale, new object[] { actor, target, funds }));
                }

                Relationship relation = Relationship.Get(actor, target, true);
                if (relation != null)
                {
                    relation.LTR.UpdateLiking(NRaas.Careers.Settings.mShakedownRelationChange);
                }

                OmniCareer actorCareer = actor.Occupation as OmniCareer;
                if (actorCareer != null)
                {
                    actorCareer.AddShakedownFunds(funds);
                }
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:39,代码来源:Shakedown.cs

示例3: OnAccept

        public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                VaccinationSessionSituation situation = VaccinationSessionSituation.GetVaccinationSessionSituation(actor);
                if (situation != null)
                {
                    situation.NumVaccinations++;
                    situation.AddToIgnoreList(target);
                    situation.BringRandomSimsToSession(0x1);
                }
                else
                {
                    FreeClinicSessionSituation freeClinicSessionSituation = FreeClinicSessionSituation.GetFreeClinicSessionSituation(actor);
                    if (freeClinicSessionSituation != null)
                    {
                        freeClinicSessionSituation.NumVaccinations++;
                        freeClinicSessionSituation.AddToIgnoreList(target);
                        freeClinicSessionSituation.BringRandomSimsToSession(0x1);
                    }
                }

                Medical medical = actor.Occupation as Medical;
                if ((medical != null) && (medical.Level >= 3))
                {
                    string vectors = null;

                    List<VectorBooter.Item> items = new List<VectorBooter.Item>();

                    int cost = 0;

                    foreach (VectorBooter.Data vector in VectorBooter.Vectors)
                    {
                        if (VectorControl.Inoculate(target.SimDescription, vector, true, true))
                        {
                            vectors += Common.NewLine + " " + vector.GetLocalizedName(target.IsFemale);

                            cost += (vector.InoculationCost / 25);
                        }
                    }

                    if (string.IsNullOrEmpty(vectors))
                    {
                        if (situation == null)
                        {
                            Common.Notify(target, Common.Localize("Inoculate:None", target.IsFemale, new object[] { target }));
                        }
                    }
                    else
                    {
                        string paid = null;
                        if (cost > target.FamilyFunds)
                        {
                            cost = target.FamilyFunds;
                        }

                        target.ModifyFunds(-cost);

                        if (target.Household != actor.Household)
                        {
                            actor.ModifyFunds(cost);

                            if (cost > 0)
                            {
                                paid += Common.NewLine + Common.NewLine + Common.Localize("Inoculate:Paid", target.IsFemale, new object[] { cost });
                            }
                        }
                        else
                        {
                            if (cost > 0)
                            {
                                paid += Common.NewLine + Common.NewLine + Common.Localize("Inoculate:Charged", target.IsFemale, new object[] { cost });
                            }
                        }

                        Common.Notify(target, Common.Localize("Inoculate:Success", target.IsFemale, new object[] { target }) + vectors + paid);
                    }
                }
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:88,代码来源:Vaccinate.cs

示例4: GetPaid

        public static void GetPaid(Sim actor, Lot lot, int payment, bool notify)
        {
            if (payment > 0)
            {
                Household house = lot.Household;
                if (house != null)
                {
                    if (payment > house.FamilyFunds)
                    {
                        payment = house.FamilyFunds;
                        if ((payment == 0) && (notify))
                        {
                            if (actor.Household == Household.ActiveHousehold)
                            {
                                ObjectGuid guid = ObjectGuid.InvalidObjectGuid;
                                if (house.Sims.Count > 0)
                                {
                                    guid = house.Sims[0].ObjectId;
                                }

                                Common.Notify(Common.Localize("Repairman:UnableToPay"), guid);
                            }
                        }
                    }

                    house.ModifyFamilyFunds(-payment);
                }

                actor.ModifyFunds(payment);

                SkillBasedCareerBooter.UpdateExperience(actor, SkillNames.Handiness, payment);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:33,代码来源:Repairman.cs

示例5: PayWages

        public static void PayWages(Sim clerck, StoreSetRegister register, float startTime, float endTime)
        {
            int pay = register.Info.HourlyWage * ((int)(endTime - startTime));

            //  CMStoreSet.PrintMessage(this.Actor.FullName + " pay : " + pay);

            SimDescription owner = null;

            if (register.Info.OwnerId != 0uL)
                CMStoreSet.ReturnSim(register.Info.OwnerId);

            if (owner == null)
            {
                if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && clerck.Household.IsActive))
                    clerck.ModifyFunds(pay);
            }
            else if (owner != null && clerck.Household.HouseholdId != owner.Household.HouseholdId)
            {
                if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && clerck.Household.IsActive))
                    clerck.ModifyFunds(pay);

                if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && owner.Household.IsActive))
                    owner.ModifyFunds(-pay);
            }
        }
开发者ID:Chain-Reaction,项目名称:NRaas,代码行数:25,代码来源:CMStoreSet.cs

示例6: CollectAccrued

        protected static bool CollectAccrued(Sim sim, Sim target)
        {
            Dictionary<ulong, float> funds;
            if (!sAccrued.TryGetValue(sim.SimDescription.SimDescriptionId, out funds))
            {
                return true;
            }

            float cash = 0;

            bool success = true;

            Dictionary<ulong,float> replace = new Dictionary<ulong,float>();
            foreach (KeyValuePair<ulong, float> value in funds)
            {
                if (value.Value >= 1)
                {
                    Household house = Household.Find(value.Key);
                    if (house == null)
                    {
                        replace.Add(value.Key, 0);
                    }
                    else
                    {
                        int remains = (int)value.Value;
                        if (remains > house.FamilyFunds)
                        {
                            remains = house.FamilyFunds;

                            replace.Add(value.Key, value.Value - remains);

                            if ((target != null) && (target.Household == house))
                            {
                                success = true;
                            }
                        }

                        cash += remains;

                        house.ModifyFamilyFunds(-remains);
                    }
                }
            }

            foreach (KeyValuePair<ulong, float> value in replace)
            {
                funds.Remove(value.Key);

                if (value.Value > 0)
                {
                    funds.Add(value.Key, value.Value);
                }
            }


            sim.ModifyFunds((int)cash);

            SkillBasedCareerBooter.UpdateExperience(sim, SkillNames.MartialArts, (int)cash);

            return success;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:61,代码来源:MartialArtist.cs

示例7: makeEmployeePay

        private void makeEmployeePay(Sim theSim)
        {
            theSim.ModifyFunds(payPerDay);
            Lot roleLot = getRoleLot();
            Household houseHold = Household.ActiveHousehold;
            if (roleLot == houseHold.LotHome)
            {
                houseHold.ModifyFamilyFunds(-payPerDay);
            }

            StyledNotification.Format format = new StyledNotification.Format("I earned §" + payPerDay + " today", theSim.ObjectId, ObjectGuid.InvalidObjectGuid, StyledNotification.NotificationStyle.kSimTalking);
            StyledNotification.Show(format);
        }
开发者ID:markmanching,项目名称:virtual-artisan-s3mods,代码行数:13,代码来源:HomeBartender.cs

示例8: HandleCost

            public bool HandleCost(Sim sim)
            {
                if (sim != null && sim.SimDescription.ChildOrAbove && mDoorCost > 0)
                {
                    if (GoHere.Settings.mGlobalIgnoreDoorCostFilterOption.Count > 0)
                    {
                        if (FilterHelper.DoesSimMatchFilters(sim.SimDescription.SimDescriptionId, GoHere.Settings.mGlobalIgnoreDoorCostFilterOption, false))
                        {
                            return false;
                        }
                    }

                    Household owningHousehold = sim.LotCurrent.Household;
                    if (owningHousehold == null)
                    {
                        List<PropertyData> list = RealEstateManager.AllPropertiesFromAllHouseholds();
                        for (int k = 0; k < list.Count; k++)
                        {
                            if (((list[k] != null) && (sim.LotCurrent.LotId == list[k].LotId)) && ((list[k].Owner != null) && (list[k].Owner.OwningHousehold != null)))
                            {
                                owningHousehold = list[k].Owner.OwningHousehold;
                                break;
                            }
                        }
                    }

                    if (sim.Household == null || (sim.Household != null && owningHousehold != sim.Household))
                    {
                        if (sim.FamilyFunds > mDoorCost)
                        {
                            sim.ModifyFunds(-mDoorCost);
                        }
                        else
                        {
                            sim.UnpaidBills += mDoorCost;
                        }

                        if (owningHousehold != null)
                        {
                            owningHousehold.ModifyFamilyFunds(mDoorCost);
                        }

                        return true;
                    }                    
                }

                return false;
            }
开发者ID:Chain-Reaction,项目名称:NRaas,代码行数:48,代码来源:DoorPortalComponentEx.cs


注:本文中的Sim.ModifyFunds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。