Ejemplo n.º 1
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is HouseDeed)
            {
                HouseDeed deed  = (HouseDeed)dropped;
                int       price = ComputePriceFor(deed);

                if (price > 0)
                {
                    if (Banker.Deposit(from, price))
                    {
                        // For the deed I have placed gold in your bankbox :
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 1008000, AffixType.Append, price.ToString(), "");

                        deed.Delete();
                        return(true);
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 500390);                           // Your bank box is full.
                        return(false);
                    }
                }
                else
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 500607);                       // I'm not interested in that.
                    return(false);
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 2
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (!TestCenter.Enabled && dropped is HouseDeed)
            {
                Faction fact = Faction.Find(from);
                if (FactionAllegiance != null && fact != null && FactionAllegiance != fact)
                {
                    Say("I will not do business with the enemy!");
                }
                else
                {
                    HouseDeed deed  = (HouseDeed)dropped;
                    int       price = ComputePriceFor(deed);

                    if (price > 0)
                    {
                        if (Banker.Deposit(from, price))
                        {
                            // For the deed I have placed gold in your bankbox :
                            PublicOverheadMessage(MessageType.Regular, 0x3B2, 1008000, AffixType.Append, price.ToString(), "");

                            deed.Delete();
                            return(true);
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0x3B2, 500390);                               // Your bank box is full.
                            return(false);
                        }
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2, 500607);                           // I'm not interested in that.
                        return(false);
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Ejemplo n.º 3
0
        public void Appraise_OnTarget(Mobile from, object obj)
        {
            if (obj is HouseDeed)
            {
                HouseDeed deed  = (HouseDeed)obj;
                int       price = ComputePriceFor(deed);

                if (price > 0)
                {
                    // I will pay you gold for this deed :
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 1008001, AffixType.Append, price.ToString(), "");

                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 500610);                       // Simply hand me the deed if you wish to sell it.
                }
                else
                {
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, 500607);                       // I'm not interested in that.
                }
            }
            else
            {
                PublicOverheadMessage(MessageType.Regular, 0x3B2, 500609);                   // I can't appraise things I know nothing about...
            }
        }
Ejemplo n.º 4
0
        public int ComputePriceFor(HouseDeed deed)
        {
            int price = 0;

            if (deed is SmallBrickHouseDeed || deed is StonePlasterHouseDeed || deed is FieldStoneHouseDeed || deed is SmallBrickHouseDeed || deed is WoodHouseDeed || deed is WoodPlasterHouseDeed || deed is ThatchedRoofCottageDeed)
            {
                price = 43800;
            }
            else if (deed is BrickHouseDeed)
            {
                price = 144500;
            }
            else if (deed is TwoStoryWoodPlasterHouseDeed || deed is TwoStoryStonePlasterHouseDeed)
            {
                price = 192400;
            }
            else if (deed is TowerDeed)
            {
                price = 433200;
            }
            else if (deed is KeepDeed)
            {
                price = 665200;
            }
            else if (deed is CastleDeed)
            {
                price = 1022800;
            }
            else if (deed is LargePatioDeed)
            {
                price = 152800;
            }
            else if (deed is LargeMarbleDeed)
            {
                price = 192800;
            }
            else if (deed is SmallTowerDeed)
            {
                price = 88500;
            }
            else if (deed is LogCabinDeed)
            {
                price = 97800;
            }
            else if (deed is SandstonePatioDeed)
            {
                price = 90900;
            }
            else if (deed is VillaDeed)
            {
                price = 136500;
            }
            else if (deed is StoneWorkshopDeed)
            {
                price = 60600;
            }
            else if (deed is MarbleWorkshopDeed)
            {
                price = 60300;
            }

            return(AOS.Scale((int)(price * 0.33), 80));              // refunds 80% of the purchase price
        }
Ejemplo n.º 5
0
 public HousePlacementTarget(HouseDeed deed)
     : base(deed.MultiID, deed.Offset)
 {
     m_Deed = deed;
 }
Ejemplo n.º 6
0
        public static int ComputePriceFor(HouseDeed deed)
        {
            int price = 0;

            if (deed is SmallBrickHouseDeed || deed is StonePlasterHouseDeed || deed is FieldStoneHouseDeed || deed is SmallBrickHouseDeed || deed is WoodHouseDeed || deed is WoodPlasterHouseDeed || deed is ThatchedRoofCottageDeed)
            {
                price = 43800;
            }
            else if (deed is BrickHouseDeed)
            {
                price = 144500;
            }
            else if (deed is TwoStoryWoodPlasterHouseDeed || deed is TwoStoryStonePlasterHouseDeed)
            {
                price = 192400;
            }
            else if (deed is TowerDeed)
            {
                price = 433200;
            }
            else if (deed is KeepDeed)
            {
                price = 665200;
            }
            else if (deed is CastleDeed)
            {
                price = 1022800;
            }
            else if (deed is LargePatioDeed)
            {
                price = 152800;
            }
            else if (deed is LargeMarbleDeed)
            {
                price = 192800;
            }
            else if (deed is SmallTowerDeed)
            {
                price = 88500;
            }
            else if (deed is LogCabinDeed)
            {
                price = 97800;
            }
            else if (deed is SandstonePatioDeed)
            {
                price = 90900;
            }
            else if (deed is VillaDeed)
            {
                price = 136500;
            }
            else if (deed is StoneWorkshopDeed)
            {
                price = 60600;
            }
            else if (deed is MarbleWorkshopDeed)
            {
                price = 60300;
            }
            else if (deed is StaticDeed)             //pla: Allow our static houses to be sold back based on price in blueprint
            {
                price = StaticHouseHelper.GetPrice(((StaticDeed)deed).HouseID);

                //check for the failsafe price and if so set to 0 - dont want someone getting 8 million back!
                if (price == (int)StaticHouseHelper.Error.PriceError)
                {
                    price = 0;
                }

                // track the error
                Misc.Diagnostics.Assert(price != 0, "price == 0");
            }

            return(AOS.Scale(price, 80));            // refunds 80% of the purchase price
        }
Ejemplo n.º 7
0
        public static void ImportWorld()
        {
            ArrayList retry = new ArrayList(), houses = new ArrayList();
            int       count = 0;

            foreach (Account a in Accounts.List.Values)
            {
                for (int i = 0; i < 6; i++)
                {
                    if (a[i] != null)
                    {
                        a[i].Player = false;
                    }

                    a[i] = null;
                }
            }

            using (StreamReader r = new StreamReader("world.txt", System.Text.Encoding.ASCII))
            {
                string  line;
                IEntity curObj  = null;
                Mobile  prevMob = null;
                Type    curType = null;

                while ((line = r.ReadLine()) != null)
                {
                    if (string.IsNullOrEmpty(line))
                    {
                        continue;
                    }

                    string[] parts = line.Split(new char[] { '=' }, 3, StringSplitOptions.None);

                    if (parts.Length != 3)
                    {
                        Console.WriteLine("Warning! Wrong number of fields: {0} -- {1}", parts.Length, line);
                        continue;
                    }

                    /*if (parts[0] == "Profile")
                     * {
                     *  long prevPos = r.BaseStream.Position;
                     *  while ((line = r.ReadLine()) != null)
                     *  {
                     *      string[] split = line.Split(new char[] { '=' }, 3, StringSplitOptions.None);
                     *
                     *      if (split.Length != 3)
                     *      {
                     *          parts[2] += "\n" + line;
                     *          prevPos = r.BaseStream.Position;
                     *      }
                     *      else
                     *      {
                     *          r.BaseStream.Seek(prevPos, SeekOrigin.Begin);
                     *          break;
                     *      }
                     *  }
                     * }*/

                    try
                    {
                        if (parts[0] == "Object")
                        {
                            PostProcess(curObj);
                            parts[1] = TranslateType(parts[1]);
                            curObj   = null;
                            curType  = ScriptCompiler.FindTypeByFullName(parts[1], true);

                            if (curType == null)
                            {
                                InsertError("{0}: Type missing", parts[1]);
                                continue;
                            }

                            Serial oldSer = Utility.ToInt32(parts[2]);

                            /*if (IsType(curType, typeof(Item)))
                             *  Serial.NewItem = Utility.ToInt32(parts[2]) - 1;
                             * else if (IsType(curType, typeof(Mobile) ))
                             *  Serial.NewMobile = Utility.ToInt32(parts[2]) - 1;
                             */
                            try { curObj = Activator.CreateInstance(curType, new object[0]) as IEntity; } catch { }

                            if (curObj == null)
                            {
                                try
                                {
                                    if (curType == typeof(BankBox) && prevMob != null)
                                    {
                                        curObj = new BankBox(prevMob);
                                    }
                                    //curObj = Activator.CreateInstance( curType, new object[1]{prevMob} ) as IEntity;
                                }
                                catch { }

                                if (curObj == null)
                                {
                                    InsertError("{0}: Unable to construct", parts[1]);
                                    continue;
                                }
                            }

                            if (curObj is Mobile)
                            {
                                _Mobiles[oldSer] = curObj;
                                prevMob          = (Mobile)curObj;
                            }
                            else if (curObj is Item)
                            {
                                _Items[oldSer] = curObj;
                            }

                            count++;
                            if ((count % 10000) == 0)
                            {
                                Console.WriteLine("Completed {0} objects so far", count - 1);
                            }
                        }
                        else if (parts[0] == "House")
                        {
                            string type, loc, map, owner;

                            type  = r.ReadLine();
                            loc   = r.ReadLine();
                            map   = r.ReadLine();
                            owner = r.ReadLine();
                            houses.Add(new string[] { type, loc, map, owner });
                        }
                        else if (parts[0] == "Skills")
                        {
                            Mobile m = FindMobile(Utility.ToInt32(parts[2]));

                            while ((line = r.ReadLine()) != null)
                            {
                                if (line == "EndSkills" || line == "")
                                {
                                    break;
                                }

                                parts = line.Split(new char[] { '=' }, 3, StringSplitOptions.None);

                                if (parts.Length != 3)
                                {
                                    continue;
                                }

                                SkillName name = (SkillName)Enum.Parse(typeof(SkillName), parts[0]);

                                m.Skills[name].BaseFixedPoint = Utility.ToInt32(parts[2]);
                            }
                        }
                        else if (parts[0] == "RuneBookEntry")
                        {
                            if (curObj is Runebook)
                            {
                                Point3D pt = Point3D.Parse(parts[1]);

                                bool okay = true;
                                if (Spells.SpellHelper.IsAnyT2A(Map.Felucca, pt))
                                {
                                    okay = false;
                                }
                                else if (Spells.SpellHelper.IsFeluccaDungeon(Map.Felucca, pt))
                                {
                                    Regions.DungeonRegion reg = Region.Find(pt, Map.Felucca) as Regions.DungeonRegion;

                                    if (reg != null)
                                    {
                                        if (reg.Name == "Fire" || reg.Name == "Ice" || reg.Name == "Orc Cave" || reg.Name == "Terathan Keep")
                                        {
                                            okay = false;
                                        }
                                    }
                                }

                                if (okay)
                                {
                                    ((Runebook)curObj).Entries.Add(new RunebookEntry(pt, Map.Felucca, parts[2], null));
                                }
                            }
                        }
                        else if (curObj != null)
                        {
                            DoProperty(curObj, curType, parts, retry);
                        }
                    }
                    catch (Exception e)
                    {
                        InsertError("Exception '{0}' for line '{1}'", e.Message, line);
                    }
                }

                PostProcess(curObj);
            }

            foreach (object[] list in retry)
            {
                DoProperty(list[0], list[1] as Type, list[2] as string[], null);
            }

            foreach (string[] list in houses)
            {
                list[0] = TranslateType(list[0]);
                Type    deedType = ScriptCompiler.FindTypeByFullName(list[0], true);
                Point3D loc      = Point3D.Parse(list[1]);
                Map     map      = Map.Parse(list[2]);
                Mobile  owner    = FindMobile(Utility.ToInt32(list[3]));

                if (deedType == null || !deedType.IsSubclassOf(typeof(HouseDeed)))
                {
                    InsertError("{0}: Type missing\n", list[0]);
                    continue;
                }

                if (owner == null || map == null || map == Map.Internal || loc == Point3D.Zero)
                {
                    InsertError("House properties messed up (owner probably missing)\n");
                    continue;
                }

                HouseDeed deed = null;
                try { deed = Activator.CreateInstance(deedType, new object[0]) as HouseDeed; }
                catch { }

                if (deed == null)
                {
                    InsertError("Failed to create deed {0}\n", list[0]);
                    continue;
                }

                BaseHouse house = deed.GetHouse(owner);
                house.MoveToWorld(loc, map);
                deed.Delete();
            }

            Console.WriteLine("Import complete, imported {0} objects.", count);
            Console.WriteLine("\nErrors:");
            foreach (string err in _Errors.Keys)
            {
                Console.WriteLine("{0}  (Count={1})", err, _Errors[err]);
            }

            Console.WriteLine("Done.  Saving...");
            World.Save();

            Console.WriteLine("Press enter to quit.  REMOVE THIS SCRIPT BEFORE RUNNING THE SERVER AGAIN");
            Console.ReadLine();
            System.Diagnostics.Process.GetCurrentProcess().Kill();
        }
Ejemplo n.º 8
0
        private static void OnCalculateAndWrite(Mobile cmdmob, int maxtoprint, bool bSupressNames, bool bSupressStaff, bool bIndicateBanned)
        {
            if (bInProcess == true)
            {
                System.Console.WriteLine("Got GoldTracker call when already processing.");
                return;
            }

            bInProcess = true;

            DateTime startDateTime = DateTime.Now;

            if (!Directory.Exists(OUTPUT_DIRECTORY))
            {
                Directory.CreateDirectory(OUTPUT_DIRECTORY);
            }

            try
            {
                string initmsg = string.Format("Tracking Gold...outputing top {0}", maxtoprint);
                System.Console.WriteLine(initmsg);
                SM(cmdmob, initmsg);

#if false
                using (StreamWriter op = new StreamWriter(OUTPUT_DIRECTORY + "/" + OUTPUT_FILE))
                {
                    op.WriteLine("<HTML><BODY>");
                    op.WriteLine("<TABLE BORDER=1 WIDTH=90%><TR>");
                    op.WriteLine("<TD>Account</TD><TD>Character</TD><TD>Total Worth</TD><TD>Backpack Gold</TD><TD>Bank Gold</TD><TD>House Gold</TD><TD>Number of Houses</TD><TD>Vendor Gold</TD>");
                    op.WriteLine("</TR>");

                    foreach (Account acct in Accounts.Table.Values)
                    {
                        string acctname = acct.Username;
                        //System.Console.WriteLine(acctname);

                        //iterate through characters:
                        for (int i = 0; i < 5; ++i)
                        {
                            if (acct[i] != null)
                            {
                                PlayerMobile player = (PlayerMobile)acct[i];

                                op.WriteLine("<TR><TD><B>" + acctname + "</B></TD>");
                                op.WriteLine("<TD>" + player.Name + "</TD>");

                                Container backpack     = player.Backpack;
                                BankBox   bank         = player.BankBox;
                                int       backpackgold = 0;
                                int       bankgold     = 0;

                                //BACKPACK
                                backpackgold = GetGoldInContainer(backpack);

                                //BANK
                                bankgold = GetGoldInContainer(bank);

                                //house?
                                int       housetotal = 0;
                                ArrayList list       = Multis.BaseHouse.GetHouses(player);
                                for (int j = 0; j < list.Count; ++j)
                                {
                                    if (list[j] is BaseHouse)
                                    {
                                        BaseHouse house = (BaseHouse)list[j];
                                        housetotal += GetGoldInHouse(house);
                                    }
                                }

                                //vendors
                                int       vendortotal = 0;
                                ArrayList vendors     = GetVendors(player);
                                for (int j = 0; j < vendors.Count; j++)
                                {
                                    if (vendors[j] is PlayerVendor)
                                    {
                                        PlayerVendor pv = vendors[j] as PlayerVendor;
                                        vendortotal += pv.HoldGold;
                                    }
                                }

                                op.WriteLine("<TD>" + (backpackgold + bankgold + housetotal + vendortotal) + "</TD>");

                                op.WriteLine("<TD>" + backpackgold + "</TD>");
                                op.WriteLine("<TD>" + bankgold + "</TD>");
                                op.WriteLine("<TD>" + housetotal + "</TD>");
                                op.WriteLine("<TD>" + list.Count + "</TD>");
                                op.WriteLine("<TD>" + vendortotal + " (" + vendors.Count + " vendors)" + "</TD>");

                                op.WriteLine("</TR>");
                            }
                        }
                    }

                    op.WriteLine("</BODY></HTML>");
                    op.Flush();
                    op.Close();
                }
#else
                Hashtable table = new Hashtable(Accounts.Table.Values.Count);

                System.Console.WriteLine("GT: building hashtable");
                SM(cmdmob, "GT: building hashtable");
                foreach (Account acct in Accounts.Table.Values)
                {
                    if (acct == null)
                    {
                        continue;
                    }

                    if ((bSupressStaff && acct.GetAccessLevel() > AccessLevel.Player) == false)
                    {
                        table.Add(acct, new GoldTotaller());
                    }
                }

                System.Console.WriteLine("GT: looping through accounts");
                SM(cmdmob, "GT: looping through accounts");
                foreach (Account acct in Accounts.Table.Values)
                {
                    if (acct == null)
                    {
                        continue;
                    }

                    if ((bSupressStaff && acct.GetAccessLevel() > AccessLevel.Player) == false)
                    {
                        //iterate through characters:
                        for (int i = 0; i < 5; ++i)
                        {
                            if (acct[i] != null)
                            {
                                PlayerMobile player       = (PlayerMobile)acct[i];
                                Container    backpack     = player.Backpack;
                                BankBox      bank         = player.BankBox;
                                int          backpackgold = 0;
                                int          bankgold     = 0;

                                int housedeedcount = 0;
                                int housedeedworth = 0;

                                int housesworth = 0;

                                //BACKPACK
                                backpackgold   = GetGoldInContainer(backpack);
                                housedeedworth = GetHouseDeedsInContainer(backpack, ref housedeedcount);

                                //BANK
                                bankgold        = GetGoldInContainer(bank);
                                housedeedworth += GetHouseDeedsInContainer(bank, ref housedeedcount);

                                //house?
                                int       housetotal = 0;
                                ArrayList list       = Multis.BaseHouse.GetHouses(player);
                                for (int j = 0; j < list.Count; ++j)
                                {
                                    if (list[j] is BaseHouse)
                                    {
                                        BaseHouse house = (BaseHouse)list[j];
                                        housesworth += (int)house.UpgradeCosts;
                                        HouseDeed hd = house.GetDeed();
                                        if (hd != null && hd is SiegeTentBag == false && hd is TentBag == false)
                                        {
                                            housesworth += RealEstateBroker.ComputePriceFor(hd);
                                            hd.Delete();
                                        }

                                        housetotal     += GetGoldInHouse(house);
                                        housedeedworth += GetHouseDeedWorthInHouse(house, ref housedeedcount);
                                    }
                                }

                                ((GoldTotaller)table[acct]).BackpackGold   += backpackgold;
                                ((GoldTotaller)table[acct]).BankGold       += bankgold;
                                ((GoldTotaller)table[acct]).HouseGold      += housetotal;
                                ((GoldTotaller)table[acct]).HouseCount     += list.Count;
                                ((GoldTotaller)table[acct]).CharacterCount += 1;
                                ((GoldTotaller)table[acct]).HouseDeedCount += housedeedcount;
                                ((GoldTotaller)table[acct]).HouseDeedWorth += housedeedworth;
                                ((GoldTotaller)table[acct]).HousesWorth    += housesworth;
                            }
                        }
                    }
                }

                System.Console.WriteLine("GT: Searching mobiles for PlayerVendors");
                SM(cmdmob, "GT: Searching mobiles for PlayerVendors");
                foreach (Mobile wm in World.Mobiles.Values)
                {
                    if (wm == null)
                    {
                        continue;
                    }

                    if (wm is PlayerVendor)
                    {
                        PlayerVendor pv = wm as PlayerVendor;
                        if (pv != null && pv.Owner != null)
                        {
                            Account thisacct = pv.Owner.Account as Account;
                            if (thisacct != null)
                            {
                                if ((bSupressStaff && thisacct.GetAccessLevel() > AccessLevel.Player) == false)
                                {
                                    ((GoldTotaller)table[thisacct]).VendorCount += 1;
                                    ((GoldTotaller)table[thisacct]).VendorGold  += pv.HoldGold;
                                }
                            }
                        }
                    }
                }

                System.Console.WriteLine("GT: sorting");
                SM(cmdmob, "GT: sorting");
                ArrayList keys = new ArrayList(table.Keys);
                keys.Sort(new GTComparer(table));

                System.Console.WriteLine("GT: Outputting html");
                SM(cmdmob, "GT: Outputting html");

                using (StreamWriter op = new StreamWriter(OUTPUT_DIRECTORY + "/" + OUTPUT_FILE))
                {
                    op.WriteLine("<HTML><BODY>");
                    op.WriteLine("<TABLE BORDER=1 WIDTH=90%><TR>");
                    if (bSupressNames)
                    {
                        op.WriteLine("<TD>=(char count)</TD>");
                    }
                    else
                    {
                        op.WriteLine("<TD>Account (char count)</TD>");
                    }
                    op.WriteLine("<TD>Total Worth</TD>");
                    op.WriteLine("<TD>Backpack Gold</TD>");
                    op.WriteLine("<TD>Bank Gold</TD>");
                    op.WriteLine("<TD>House Gold (house count)</TD>");
                    op.WriteLine("<TD>Vendor Gold (vendor count)</TD>");
                    op.WriteLine("<TD>Returnable Deed Worth (deed count)<br>(Included house and storage upgrade deeds</TD>");
                    op.WriteLine("<TD>House(s) Worth</TD>");
                    op.WriteLine("</TR>");

                    for (int i = 0; i < keys.Count && i < maxtoprint; i++)
                    {
                        GoldTotaller gt = table[keys[i]] as GoldTotaller;
                        if (gt != null)
                        {
                            string bannedstr = "";
                            if (bIndicateBanned)
                            {
                                if (((Account)keys[i]).Banned)
                                {
                                    bannedstr = " **banned** ";
                                }
                            }
                            //System.Console.WriteLine( "Acct: {0}, total: {1}", ((Account)keys[i]).Username, gt.TotalGold );
                            if (bSupressNames)
                            {
                                op.WriteLine("<TR><TD>(" + gt.CharacterCount + ")" + bannedstr + "</TD>");                                 //Account
                            }
                            else
                            {
                                op.WriteLine("<TR><TD><B>" + ((Account)keys[i]).Username + "</B>(" + gt.CharacterCount + ")" + bannedstr + "</TD>"); //Account
                            }
                            op.WriteLine("<TD>" + gt.TotalGold + "</TD>");                                                                           //Total Worth
                            op.WriteLine("<TD>" + gt.BackpackGold + "</TD>");                                                                        //Backpack
                            op.WriteLine("<TD>" + gt.BankGold + "</TD>");                                                                            //bank
                            op.WriteLine("<TD>" + gt.HouseGold + " (" + gt.HouseCount + ")</TD>");                                                   //houses
                            op.WriteLine("<TD>" + gt.VendorGold + " (" + gt.VendorCount + ")</TD>");                                                 //vendors
                            op.WriteLine("<TD>" + gt.HouseDeedWorth + " (" + gt.HouseDeedCount + ")</TD>");                                          //housedeeds
                            op.WriteLine("<TD>" + gt.HousesWorth + "</TD>");                                                                         //housedeeds

                            op.WriteLine("</TR>");
                        }
                    }

                    op.WriteLine("</TABLE></BODY></HTML>");
                    op.Flush();
                    op.Close();
                }
#endif
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                System.Console.WriteLine("Error in GoldTracker: " + e.Message);
                System.Console.WriteLine(e.StackTrace);
            }
            finally
            {
                DateTime endDateTime = DateTime.Now;
                TimeSpan time        = endDateTime - startDateTime;
                string   endmsg      = "finished in " + ((double)time.TotalMilliseconds / (double)1000) + " seconds.";
                System.Console.WriteLine(endmsg);
                SM(cmdmob, endmsg);
                bInProcess = false;
            }
        }
Ejemplo n.º 9
0
        public static int ComputePriceFor(HouseDeed deed)
        {
            int price = 0;

            /*if (deed is SmallBrickHouseDeed || deed is StonePlasterHouseDeed || deed is FieldStoneHouseDeed || deed is SmallBrickHouseDeed || deed is WoodHouseDeed || deed is WoodPlasterHouseDeed || deed is ThatchedRoofCottageDeed)
             * else if (deed is BrickHouseDeed)
             *      price = 144500;
             * else if (deed is TwoStoryWoodPlasterHouseDeed || deed is TwoStoryStonePlasterHouseDeed)
             *      price = 192400;
             * else if (deed is TowerDeed)
             *      price = 433200;
             * else if (deed is KeepDeed)
             *      price = 665200;
             * else if (deed is CastleDeed)
             *      price = 1022800;
             * else if (deed is LargePatioDeed)
             *      price = 152800;
             * else if (deed is LargeMarbleDeed)
             *      price = 192800;
             * else if (deed is SmallTowerDeed)
             *      price = 88500;
             * else if (deed is LogCabinDeed)
             *      price = 97800;
             * else if (deed is SandstonePatioDeed)
             *      price = 90900;
             * else if (deed is VillaDeed)
             *      price = 136500;
             * else if (deed is StoneWorkshopDeed)
             *      price = 60600;
             * else if (deed is MarbleWorkshopDeed)
             *      price = 60300;
             * else if (deed is StaticDeed) //pla: Allow our static houses to be sold back based on price in blueprint
             * {
             *      price = StaticHouseHelper.GetPrice(((StaticDeed)deed).HouseID);
             *
             *      //check for the failsafe price and if so set to 0 - dont want someone getting 8 million back!
             *      if (price == (int)StaticHouseHelper.Error.PriceError)
             *              price = 0;
             *
             *      // track the error
             *      Misc.Diagnostics.Assert(price != 0, "price == 0");
             * } */

            if (deed is HouseDeed)
            {
                price = deed.Price;
            }

            //check for the failsafe price and if so set to 0 - dont want someone getting 8 million back!
            if (price == (int)StaticHouseHelper.Error.PriceError)
            {
                price = 0;
            }

            // track the error
            Misc.Diagnostics.Assert(price != 0, "price == 0");

            // don't allow repurchase (or sale) of customs on siege. Before we can buy them back, we need to markup the sale price and that's not been done
            // on the player vendors in the special	housing area. (so they will make 300% profit!)
            if (Core.UOSP && !Misc.Diagnostics.Assert(deed is StaticDeed == false, "deed is StaticDeed for sale on siege!"))
            {
                price = 0;
            }

            // Publish 11
            // o) NPC real estate brokers will now buy house deeds back at 20% below the base price of the deed, or the original
            //	price paid when the deed was purchased from a vendor (whichever is lower).
            // o) House deed prices when reselling to real estate agents raised to the correct level on Siege Perilous
            if (!Core.UOAI && !Core.UOAR && !Core.UOMO && Core.Publish < 11)
            {
                return(GenericBuyInfo.ComputeSiegeMarkup(price)); // 100%
            }
            return(AOS.Scale(price, 80));                         // refunds 80% of the purchase price
        }