Show
Ignore:
Timestamp:
11/19/08 13:22:12 (17 years ago)
Author:
yumileroy
Message:

[svn] * Added ACE for Linux and Windows (Thanks Derex for Linux part and partial Windows part)
* Updated to 6721 and 676
* Fixed TrinityScript? logo
* Version updated to 0.2.6721.676

Original author: Neo2003
Date: 2008-10-04 06:17:19-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Level1.cpp

    r2 r6  
    15551555} 
    15561556 
    1557 //Teleport by game_tele entry 
    15581557bool ChatHandler::HandleModifyHonorCommand (const char* args) 
    15591558{ 
     
    15851584    Player* _player = m_session->GetPlayer(); 
    15861585 
    1587     char* cId = extractKeyFromLink((char*)args,"Htele");    // string or [name] Shift-click form |color|Htele:name|h[name]|h|r 
    1588     if(!cId) 
    1589         return false; 
    1590  
    1591     std::string name = cId; 
    1592     WorldDatabase.escape_string(name); 
    1593  
    1594     QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM game_tele WHERE name = '%s'",name.c_str()); 
    1595     if (!result) 
     1586    // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r 
     1587    GameTele const* tele = extractGameTeleFromLink((char*)args); 
     1588 
     1589    if (!tele) 
    15961590    { 
    15971591        SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); 
    1598         SetSentErrorMessage(true); 
    1599         return false; 
    1600     } 
    1601     Field *fields = result->Fetch(); 
    1602     float x = fields[0].GetFloat(); 
    1603     float y = fields[1].GetFloat(); 
    1604     float z = fields[2].GetFloat(); 
    1605     float ort = fields[3].GetFloat(); 
    1606     int mapid = fields[4].GetUInt16(); 
    1607     delete result; 
    1608  
    1609     if(!MapManager::IsValidMapCoord(mapid,x,y,x,ort)) 
    1610     { 
    1611         PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); 
    16121592        SetSentErrorMessage(true); 
    16131593        return false; 
     
    16241604        _player->SaveRecallPosition(); 
    16251605 
    1626     _player->TeleportTo(mapid, x, y, z, ort); 
     1606    _player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); 
    16271607    return true; 
    16281608} 
     
    17031683 
    17041684    std::string namepart = str; 
    1705     WorldDatabase.escape_string(namepart); 
    1706     QueryResult *result = WorldDatabase.PQuery("SELECT name FROM game_tele WHERE name "_LIKE_" '""%%%s%%""'",namepart.c_str()); 
    1707     if (!result) 
    1708     { 
    1709         SendSysMessage(LANG_COMMAND_TELE_NOREQUEST); 
    1710         SetSentErrorMessage(true); 
    1711         return false; 
    1712     } 
    1713     std::string reply; 
    1714     for (uint64 i=0; i < result->GetRowCount(); i++) 
    1715     { 
    1716         Field *fields = result->Fetch(); 
    1717         reply += "  |cffffffff|Htele:"; 
    1718         reply += fields[0].GetCppString(); 
    1719         reply += "|h["; 
    1720         reply += fields[0].GetCppString(); 
    1721         reply += "]|h|r\n"; 
    1722         result->NextRow(); 
    1723     } 
    1724     delete result; 
    1725  
    1726     if(reply.empty()) 
     1685    std::wstring wnamepart; 
     1686 
     1687    if(!Utf8toWStr(namepart,wnamepart)) 
     1688        return false; 
     1689 
     1690    // converting string that we try to find to lower case 
     1691    wstrToLower( wnamepart ); 
     1692 
     1693    GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); 
     1694 
     1695    std::ostringstream reply; 
     1696    for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) 
     1697    { 
     1698        GameTele const* tele = &itr->second; 
     1699 
     1700        if(tele->wnameLow.find(wnamepart) == std::wstring::npos) 
     1701            continue; 
     1702 
     1703        reply << "  |cffffffff|Htele:"; 
     1704        reply << itr->first; 
     1705        reply << "|h["; 
     1706        reply << tele->name; 
     1707        reply << "]|h|r\n"; 
     1708    } 
     1709 
     1710    if(reply.str().empty()) 
    17271711        SendSysMessage(LANG_COMMAND_TELE_NOLOCATION); 
    17281712    else 
    1729     { 
    1730         reply = GetMangosString(LANG_COMMAND_TELE_LOCATION) + reply; 
    1731         SendSysMessage(reply.c_str()); 
    1732     } 
     1713        PSendSysMessage(LANG_COMMAND_TELE_LOCATION,reply.str().c_str()); 
     1714 
    17331715    return true; 
    17341716} 
     
    18621844        return false; 
    18631845 
     1846    std::string name = pName; 
     1847 
     1848    if(!normalizePlayerName(name)) 
     1849    { 
     1850        SendSysMessage(LANG_PLAYER_NOT_FOUND); 
     1851        SetSentErrorMessage(true); 
     1852        return false; 
     1853    } 
     1854 
    18641855    char* tail = strtok(NULL, ""); 
    18651856    if(!tail) 
    18661857        return false; 
    18671858 
    1868     char* cId = extractKeyFromLink((char*)tail,"Htele");    // string or [name] Shift-click form |color|Htele:name|h[name]|h|r 
    1869     if(!cId) 
    1870         return false; 
    1871  
    1872     std::string location = cId; 
    1873  
    1874     std::string name = pName; 
    1875  
    1876     if(!normalizePlayerName(name)) 
    1877     { 
    1878         SendSysMessage(LANG_PLAYER_NOT_FOUND); 
    1879         SetSentErrorMessage(true); 
    1880         return false; 
    1881     } 
    1882  
    1883     WorldDatabase.escape_string(location); 
    1884     QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM game_tele WHERE name = '%s'",location.c_str()); 
    1885     if (!result) 
     1859    // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r 
     1860    GameTele const* tele = extractGameTeleFromLink(tail); 
     1861    if(!tele) 
    18861862    { 
    18871863        SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); 
    1888         SetSentErrorMessage(true); 
    1889         return false; 
    1890     } 
    1891  
    1892     Field *fields = result->Fetch(); 
    1893     float x = fields[0].GetFloat(); 
    1894     float y = fields[1].GetFloat(); 
    1895     float z = fields[2].GetFloat(); 
    1896     float ort = fields[3].GetFloat(); 
    1897     int mapid = fields[4].GetUInt16(); 
    1898     delete result; 
    1899  
    1900     if(!MapManager::IsValidMapCoord(mapid,x,y,x,ort)) 
    1901     { 
    1902         PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); 
    19031864        SetSentErrorMessage(true); 
    19041865        return false; 
     
    19161877        } 
    19171878 
    1918         PSendSysMessage(LANG_TELEPORTING_TO, chr->GetName(),"", location.c_str()); 
     1879        PSendSysMessage(LANG_TELEPORTING_TO, chr->GetName(),"", tele->name.c_str()); 
    19191880 
    19201881        if (m_session->GetPlayer()->IsVisibleGloballyFor(chr)) 
     
    19311892            chr->SaveRecallPosition(); 
    19321893 
    1933         chr->TeleportTo(mapid,x,y,z,chr->GetOrientation()); 
     1894        chr->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation); 
    19341895    } 
    19351896    else if (uint64 guid = objmgr.GetPlayerGUIDByName(name.c_str())) 
    19361897    { 
    1937         PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetMangosString(LANG_OFFLINE), location.c_str()); 
    1938         Player::SavePositionInDB(mapid,x,y,z,ort,MapManager::Instance().GetZoneId(mapid,x,y),guid); 
     1898        PSendSysMessage(LANG_TELEPORTING_TO, name.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str()); 
     1899        Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y),guid); 
    19391900    } 
    19401901    else 
     
    19581919    } 
    19591920 
    1960     char* cId = extractKeyFromLink((char*)args,"Htele");    // string or [name] Shift-click form |color|Htele:name|h[name]|h|r 
    1961     if(!cId) 
    1962         return false; 
    1963  
    1964     std::string location = cId; 
    1965  
    1966     WorldDatabase.escape_string(location); 
    1967     QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM game_tele WHERE name = '%s'",location.c_str()); 
    1968     if (!result) 
     1921    // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r 
     1922    GameTele const* tele = extractGameTeleFromLink((char*)args); 
     1923    if(!tele) 
    19691924    { 
    19701925        SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); 
     
    19721927        return false; 
    19731928    } 
    1974     Field *fields = result->Fetch(); 
    1975     float x = fields[0].GetFloat(); 
    1976     float y = fields[1].GetFloat(); 
    1977     float z = fields[2].GetFloat(); 
    1978     float ort = fields[3].GetFloat(); 
    1979     int mapid = fields[4].GetUInt16(); 
    1980     delete result; 
    1981  
    1982     if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) 
    1983     { 
    1984         PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); 
    1985         SetSentErrorMessage(true); 
    1986         return false; 
    1987     } 
    19881929 
    19891930    Group *grp = player->GetGroup(); 
    1990  
    19911931    if(!grp) 
    19921932    { 
     
    20091949        } 
    20101950 
    2011         PSendSysMessage(LANG_TELEPORTING_TO, pl->GetName(),"", location.c_str()); 
     1951        PSendSysMessage(LANG_TELEPORTING_TO, pl->GetName(),"", tele->name.c_str()); 
    20121952 
    20131953        if (m_session->GetPlayer() != pl && m_session->GetPlayer()->IsVisibleGloballyFor(pl)) 
     
    20241964            pl->SaveRecallPosition(); 
    20251965 
    2026         pl->TeleportTo(mapid, x, y, z, ort); 
     1966        pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); 
    20271967    } 
    20281968