Ejemplo n.º 1
0
/* this is the jump function */
int
jump(int destructive_jump)
{
    int i;
    char *quad_name;

    cmdflags &= ~C_ROOMLOCK;

    quad_name = get_name(3);
    i = get_room_name(quad_name);

    if (i == -2)
	return 0;
    else if (i == -1) {
	cprintf("\1f\1rNo %s called `\1y%s\1r'.\1a\n", config.forum, quad_name);
	return 0;
    }
    usergoto(i, curr_rm, destructive_jump);

    return 1;
}
Ejemplo n.º 2
0
/*
 * Procedure which allows a player to purchase a portal from a mob.  The mob must be
 * set as act portalmerchant.  There is a base cost in the portal_shop_table and those
 * prices will be altered here based on the desination (e.g. it will cost more to create
 * a portal across continents than it will to travel inter-continent.  This procedure
 * will be called from do_list and do_buy to make it function like a normal shop.
 */
void process_portal_merchant(CHAR_DATA * ch, char *argument)
{
    int x = 0;
    char buf[MAX_STRING_LENGTH];
    char buf2[MAX_STRING_LENGTH];
    bool found = FALSE;
    CHAR_DATA *mob;
    OBJ_DATA *portal;
    int cost = 0;
    int roll = 0;

    if ((mob = find_mob_by_act(ch, ACT_IS_PORTAL_MERCHANT)) == NULL)
    {
        send_to_char("You must find a portal merchant in order to purchase a portal.\r\n", ch);
        return;
    }

    // Not with people that can't be seen.. this will depend on the mob.. if the mob has detect hidden
    // or detect invis they will see most people unless they are in another for of non-detect, etc.
    if (!can_see(mob, ch))
    {
        act("{x$N says '{gI don't trade with folks I can't see, please make yourself 'visible'.{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    // No argument was sent, send them the list of destinations.
    if (IS_NULLSTR(argument))
    {
        act("{x$N says '{gI offer the creation of portals to following destinations.{x'\r\n", ch, NULL, mob, TO_CHAR);

        // Loop through the destinations for display
        for (x = 0; portal_shop_table[x].name != NULL; x++)
        {
            int temp_cost = 0;

            if (same_continent(ch->in_room->vnum, portal_shop_table[x].to_vnum))
            {
                // They're in the same continent, normal cost (converted to gold).
                temp_cost = portal_shop_table[x].cost / 100;
            }
            else
            {
                // They are in different continents, double the cost (converted to gold).
                temp_cost = (portal_shop_table[x].cost / 100) * 2;
            }

            // To get the : into the formatted string
            sprintf(buf2, "{_%s{x:", portal_shop_table[x].name);

            sprintf(buf, "  %-17s{x {c%-40s{x %d gold\r\n",
                buf2,
                get_room_name(portal_shop_table[x].to_vnum),
                temp_cost);
            send_to_char(buf, ch);
        }

        send_to_char("\r\nType buy <location> to purchase a portal to that destination.\r\n", ch);
        return;
    }

    // Did the user select a valid input?
    for (x = 0; portal_shop_table[x].name != NULL; x++)
    {
        if (!str_prefix(argument, portal_shop_table[x].name))
        {
            if (same_continent(ch->in_room->vnum, portal_shop_table[x].to_vnum))
            {
                // They're in the same continent, normal cost (the raw cost).
                cost = portal_shop_table[x].cost;
            }
            else
            {
                // They are in different continents, double the cost (the raw cost)
                cost = (portal_shop_table[x].cost) * 2;
            }

            found = TRUE;
            break;
        }
    }

    // What the location found?
    if (!found)
    {
        act("{x$N says '{gThat is not a place that I know of.{x", ch, NULL, mob, TO_CHAR);
        return;
    }

    // Do they have enough money?
    if (cost > (ch->gold * 100 + ch->silver))
    {
        act("{x$N says '{gYou do not have enough gold for my services.{x'", ch, NULL, mob, TO_CHAR);
        return;
    }

    // Can the player haggle, if successful, adjust the price down?
    roll = number_percent();

    if (roll < get_skill(ch, gsn_haggle))
    {
        cost -= cost / 2 * roll / 100;
        sprintf(buf, "You haggle the price down to %d coins.\r\n", cost);
        send_to_char(buf, ch);
        check_improve(ch, gsn_haggle, TRUE, 4);
    }
    else
    {
        check_improve(ch, gsn_haggle, FALSE, 2);
    }

    // Slight purchase lag, same as buy.
    WAIT_STATE(ch, PULSE_VIOLENCE);

    // Deduct the money.
    deduct_cost(ch, cost);

    portal = create_object(get_obj_index(OBJ_VNUM_PORTAL));
    portal->timer = 2;  // 2 ticks.
    portal->value[3] = portal_shop_table[x].to_vnum;

    // Alter the keywords for the portal to include the destination to make the portals easier to use
    // than the enter 3.portal syntax (if there are multiples in the room)
    sprintf(buf, "portal gate %s", portal_shop_table[x].name);
    free_string(portal->name);
    portal->name = str_dup(buf);

    // Alter the portal's description to the room, we'll presume we know where these are going.
    sprintf(buf, "A shimmering black gate rises from the ground, leading to %s.", get_area_name(portal_shop_table[x].to_vnum));
    free_string(portal->description);
    portal->description = str_dup(buf);

    // Put said object in said room.
    obj_to_room(portal, ch->in_room);

    act("$N raises $s hand and begans chanting.", ch, NULL, mob, TO_CHAR);
    act("$p rises up from the ground.", ch, portal, NULL, TO_ALL);

} // end do_portal