Exemplo n.º 1
0
        /*
         * The greeting a shopkeeper gives the character says a lot about his
         * general attitude.
         *
         * Taken and modified from Sangband 1.0.
         */
        public static void prt_welcome(Owner ot_ptr)
        {
            //char short_name[20];
            string short_name;
            string owner_name = ot_ptr.name;

            int j;

            if (Random.one_in_(2))
                return;

            ///* Extract the first name of the store owner (stop before the first space) */
            //for (j = 0; owner_name[j] && owner_name[j] != ' '; j++)
            //    short_name[j] = owner_name[j];

            ///* Truncate the name */
            //short_name[j] = '\0';

            short_name = owner_name.Split(' ')[0];

            if (Random.one_in_(3)) {
                int i = Random.randint0(comment_hint.Length);
                Utilities.msg(comment_hint[i], (object)Xtra3.random_hint());
            } else if (Misc.p_ptr.lev > 5) {
                string player_name;

                /* We go from level 1 - 50  */
                int i = ((int)Misc.p_ptr.lev - 1) / 5;
                i = Math.Min(i, comment_welcome.Length - 1);

                /* Get a title for the character */
                if ((i % 2) != 0 && Random.randint0(2) != 0) player_name = Misc.p_ptr.Class.title[(Misc.p_ptr.lev - 1) / 5];
                else if (Random.randint0(2) != 0)       player_name = Player_Other.instance.full_name;
                else                        player_name = (Misc.p_ptr.psex == Misc.SEX_MALE ? "sir" : "lady");

                /* Balthazar says "Welcome" */
                Utilities.prt(String.Format(comment_welcome[i], short_name, player_name), 0, 0);
            }
        }
Exemplo n.º 2
0
        /*
         * Shuffle one of the stores.
         */
        public void store_shuffle()
        {
            Owner o = owner;

            while (o == owner)
                o = choose_owner();

            owner = o;
        }
Exemplo n.º 3
0
        static Parser.Error parse_own_s(Parser p)
        {
            owner_parser_state s = p.priv as owner_parser_state;
            uint maxcost = p.getuint("maxcost");
            string name = p.getstr("name");
            Owner o;

            if (s.cur == null)
                return Parser.Error.MISSING_RECORD_HEADER;

            o = new Owner();
            o.oidx = (s.cur.owners != null ? s.cur.owners.oidx + 1 : 0);
            o.next = s.cur.owners;
            o.name = name;
            o.max_cost = (int)maxcost;
            s.cur.owners = o;
            return Parser.Error.NONE;
        }