示例#1
0
void
account_exhume_char(struct account *account, struct creature *exhumer, long id)
{
    if (player_idnum_exists(id)) {
        send_to_char(exhumer, "That character has already been exhumed.\r\n");
        return;
    }
    // load char from file
    struct creature *victim;
    
    victim = load_player_from_xml(id);
    if (victim) {
        sql_exec
            ("insert into players (idnum, account, name) values (%ld, %d, '%s')",
            GET_IDNUM(victim), account->id, tmp_sqlescape(GET_NAME(victim)));
        load_players(account);
        send_to_char(exhumer, "%s exhumed.\r\n",
            tmp_capitalize(GET_NAME(victim)));
        slog("%s[%ld] exhumed into account %s[%d]", GET_NAME(victim),
            GET_IDNUM(victim), account->name, account->id);
        free_creature(victim);
    } else {
        send_to_char(exhumer, "Unable to load character %ld.\r\n", id);
    }
}
示例#2
0
/*********************************************************
** free memory of list item                             **
** IN                                                   **
**	struct creatureListItem .. pointer to list item **
** OUT                                                  **
**	-                                               **
*********************************************************/
void free_list_item(struct creatureListItem *item)
{
    if(item != NULL) {
        free_creature(item->creature);
        item->creature = NULL;
    }
    free(item);
    item = NULL;
}
示例#3
0
void
check_object_killer(struct obj_data *obj, struct creature *vict)
{
    struct creature *killer = NULL;
    bool loaded_killer = false;
    int obj_id;

    if (ROOM_FLAGGED(vict->in_room, ROOM_PEACEFUL)) {
        return;
    }
    if (IS_NPC(vict))
        return;

    slog("Checking object killer %s -> %s. ", obj->name, GET_NAME(vict));

    if (IS_BOMB(obj))
        obj_id = BOMB_IDNUM(obj);
    else if (GET_OBJ_SIGIL_IDNUM(obj))
        obj_id = GET_OBJ_SIGIL_IDNUM(obj);
    else {
        errlog("unknown damager in check_object_killer.");
        return;
    }

    if (!obj_id)
        return;

    killer = get_char_in_world_by_idnum(obj_id);

    // load the bastich from file.
    if (!killer) {
        killer = load_player_from_xml(obj_id);
        if (killer) {
            killer->account =
                account_by_idnum(player_account_by_idnum(obj_id));
            loaded_killer = true;
        }
    }
    // the piece o shit has a bogus killer idnum on it!
    if (!killer) {
        errlog("bogus idnum %d on object %s damaging %s.",
            obj_id, obj->name, GET_NAME(vict));
        return;
    }

    count_pkill(killer, vict);

    // save the sonuvabitch to file
    crashsave(killer);

    if (loaded_killer)
        free_creature(killer);
}
示例#4
0
int
hasCharLevel(struct account *account, int level)
{
    int idx = 1;
    struct creature *tmp_ch;

    while (!invalid_char_index(account, idx)) {
        tmp_ch = load_player_from_xml(get_char_by_index(account, idx));

        if (!tmp_ch)
            return 0;

        if (GET_LEVEL(tmp_ch) >= level) {
            free_creature(tmp_ch);
            return idx;
        }

        free_creature(tmp_ch);

        idx++;
    }

    return 0;
}
示例#5
0
int
count_account_gens(struct account *account)
{
    struct creature *tmp_ch;
    int count = 0;

    for (int idx = 1; !invalid_char_index(account, idx); idx++) {
        // test for file existence
        tmp_ch = load_player_from_xml(get_char_by_index(account, idx));
        if (!tmp_ch)
            continue;

        count += GET_REMORT_GEN(tmp_ch);

        free_creature(tmp_ch);
    }

    return count;
}
示例#6
0
文件: output.c 项目: mariux/myrill
/***********************************************
** exit from ncurses window mode and free all **
** allocated memory			      **
***********************************************/
void quit_game(struct gamehandle *myrill)
{
    /*
     ** free all memory
     */
    if (myrill->pc != NULL)
        free_creature(myrill->pc);
    myrill->pc = NULL;
    if (myrill->bestiary != NULL){
        free_list(myrill->bestiary->first);
        free_list_handle(myrill->bestiary);
        myrill->bestiary = NULL;
    }
    delwin(statuswin);
    delwin(mapwin);
    delwin(fightmes);
    delwin(debugwin);
    delwin(stdscr);
    endwin();
    exit(0);
}