viewing paste Unknown #654 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
{ MAP_PRONTERA,   110, 39 }, // 35=Prontera
    };
 
    nullpo_retr(-1, sd);
 
    if( map[sd->bl.m].flag.nogo && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE) ) {
        clif_displaymessage(sd->fd,"You can not use @go on this map.");
        return 0;
    }
 
    memset(map_name, '\0', sizeof(map_name));
    memset(atcmd_output, '\0', sizeof(atcmd_output));
 
    // get the number
    town = atoi(message);
 
    if (!message || !*message || sscanf(message, "%11s", map_name) < 1 || town < 0 || town >= ARRAYLENGTH(data))
    {// no value matched so send the list of locations
        const char* text;
 
        // attempt to find the text help string
        text = atcommand_help_string( command );
 
        // Invalid location number, or name.
        clif_displaymessage(fd, msg_txt(38));
 
        if( text )
        {// send the text to the client
            clif_displaymessage( fd, text );
        }
        
        return -1;
    }
 
    // get possible name of the city
    map_name[MAP_NAME_LENGTH-1] = '\0';
    for (i = 0; map_name[i]; i++)
        map_name[i] = TOLOWER(map_name[i]);
    // try to identify the map name
    if (strncmp(map_name, "caspen", 3) == 0) {
        town = 0;
    } else if (strncmp(map_name, "morocc", 3) == 0) {
        town = 1;
    } else if (strncmp(map_name, "geffen", 3) == 0) {
        town = 2;
    } else if (strncmp(map_name, "payon", 3) == 0 ||
               strncmp(map_name, "paion", 3) == 0) {
        town = 3;
    } else if (strncmp(map_name, "alberta", 3) == 0) {
        town = 4;
    } else if (strncmp(map_name, "izlude", 3) == 0 ||
               strncmp(map_name, "islude", 3) == 0) {
        town = 5;
    } else if (strncmp(map_name, "aldebaran", 3) == 0 ||
               strcmp(map_name,  "al") == 0) {
        town = 6;
    } else if (strncmp(map_name, "lutie", 3) == 0 ||
               strcmp(map_name,  "christmas") == 0 ||
               strncmp(map_name, "xmas", 3) == 0 ||
               strncmp(map_name, "x-mas", 3) == 0) {
        town = 7;
    } else if (strncmp(map_name, "comodo", 3) == 0) {
        town = 8;
    } else if (strncmp(map_name, "yuno", 3) == 0) {
        town = 9;
    } else if (strncmp(map_name, "amatsu", 3) == 0) {
        town = 10;
    } else if (strncmp(map_name, "gonryun", 3) == 0) {
        town = 11;
    } else if (strncmp(map_name, "umbala", 3) == 0) {
        town = 12;
    } else if (strncmp(map_name, "niflheim", 3) == 0) {
        town = 13;
    } else if (strncmp(map_name, "louyang", 3) == 0) {
        town = 14;
    } else if (strncmp(map_name, "new_1-1", 3) == 0 ||
               strncmp(map_name, "startpoint", 3) == 0 ||
               strncmp(map_name, "begining", 3) == 0) {
        town = 15;
    } else if (strncmp(map_name, "sec_pri", 3) == 0 ||
               strncmp(map_name, "prison", 3) == 0 ||
               strncmp(map_name, "jails", 3) == 0) {
        town = 16;
    } else if (strncmp(map_name, "jawaii", 3) == 0 ||
               strncmp(map_name, "jawai", 3) == 0) {
        town = 17;
    } else if (strncmp(map_name, "ayothaya", 3) == 0 ||
               strncmp(map_name, "ayotaya", 3) == 0) {
        town = 18;
    } else if (strncmp(map_name, "einbroch", 5) == 0 ||
               strncmp(map_name, "ainbroch", 5) == 0) {
        town = 19;
    } else if (strncmp(map_name, "lighthalzen", 3) == 0) {
        town = 20;
    } else if (strncmp(map_name, "einbech", 3) == 0) {
        town = 21;
    } else if (strncmp(map_name, "hugel", 3) == 0) {
        town = 22;
    } else if (strncmp(map_name, "rachel", 3) == 0) {
        town = 23;
    } else if (strncmp(map_name, "veins", 3) == 0) {
        town = 24;
    } else if (strncmp(map_name, "moscovia", 3) == 0) {
        town = 25;
    } else if (strncmp(map_name, "mid_camp", 3) == 0) {
        town = 26;
    } else if (strncmp(map_name, "manuk", 3) == 0) {
        town = 27;
    } else if (strncmp(map_name, "splendide", 3) == 0) {
        town = 28;
    } else if (strncmp(map_name, "brasilis", 3) == 0) {
        town = 29;
    } else if (strncmp(map_name, "dicastes01", 3) == 0) {
        town = 30;
    } else if (strncmp(map_name, "mora", 3) == 0) {
        town = 31;
    } else if (strncmp(map_name, "dewata", 3) == 0) {
        town = 32;
    } else if (strncmp(map_name, "malangdo", 3) == 0) {
        town = 33;
    } else if (strncmp(map_name, "malaya", 3) == 0) {
        town = 34;
    } else if (strncmp(map_name, "eclage", 3) == 0) {
        town = 35;
    } else if (strncmp(map_name, "prontera", 3) == 0) {
        town = 36;
    }
 
    if (town >= 0 && town < ARRAYLENGTH(data))
    {
        m = map_mapname2mapid(data[town].map);
        if (m >= 0 && map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
            clif_displaymessage(fd, msg_txt(247));
            return -1;
        }
        if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
            clif_displaymessage(fd, msg_txt(248));
            return -1;
        }
        if (pc_setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
            clif_displaymessage(fd, msg_txt(0)); // Warped.
        } else {
            clif_displaymessage(fd, msg_txt(1)); // Map not found.
            return -1;
        }
    } else { // if you arrive here, you have an error in town variable when reading of names
        clif_displaymessage(fd, msg_txt(38)); // Invalid location number or name.
        return -1;
    }
 
    return 0;
}
Viewed 704 times, submitted by Guest.