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

[svn] * Updated to 6743 and 685

Moved language id used by Arena to a higher place to solve conflicts
Added the empty script folders

Original author: Neo2003
Date: 2008-10-09 08:42:22-05:00

Files:
1 modified

Legend:

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

    r9 r28  
    148148    if(!*args) 
    149149    { 
    150         SendSysMessage(LANG_USE_BOL); 
    151         SetSentErrorMessage(true); 
    152         return false; 
     150        if(m_session->GetPlayer()->isGameMaster()) 
     151            m_session->SendNotification(LANG_GM_ON); 
     152        else 
     153            m_session->SendNotification(LANG_GM_OFF); 
     154        return true; 
    153155    } 
    154156 
     
    158160    { 
    159161        m_session->GetPlayer()->SetGameMaster(true); 
    160         m_session->SendNotification("GM mode is ON"); 
     162        m_session->SendNotification(LANG_GM_ON); 
    161163        #ifdef _DEBUG_VMAPS 
    162164        VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); 
     
    169171    { 
    170172        m_session->GetPlayer()->SetGameMaster(false); 
    171         m_session->SendNotification("GM mode is OFF"); 
     173        m_session->SendNotification(LANG_GM_OFF); 
    172174        #ifdef _DEBUG_VMAPS 
    173175        VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); 
     
    182184} 
    183185 
     186// Enables or disables hiding of the staff badge 
     187bool ChatHandler::HandleGMChatCommand(const char* args) 
     188{ 
     189    if(!*args) 
     190    { 
     191        if(m_session->GetPlayer()->isGMChat()) 
     192            m_session->SendNotification(LANG_GM_CHAT_ON); 
     193        else 
     194            m_session->SendNotification(LANG_GM_CHAT_OFF); 
     195        return true; 
     196    } 
     197 
     198    std::string argstr = (char*)args; 
     199 
     200    if (argstr == "on") 
     201    { 
     202        m_session->GetPlayer()->SetGMChat(true); 
     203        m_session->SendNotification(LANG_GM_CHAT_ON); 
     204        return true; 
     205    } 
     206 
     207    if (argstr == "off") 
     208    { 
     209        m_session->GetPlayer()->SetGMChat(false); 
     210        m_session->SendNotification(LANG_GM_CHAT_OFF); 
     211        return true; 
     212    } 
     213 
     214    SendSysMessage(LANG_USE_BOL); 
     215    SetSentErrorMessage(true); 
     216    return false; 
     217} 
     218 
     219 
    184220//Enable\Dissable Invisible mode 
    185221bool ChatHandler::HandleVisibleCommand(const char* args) 
     
    196232    { 
    197233        m_session->GetPlayer()->SetGMVisible(true); 
    198         m_session->SendNotification(GetMangosString(LANG_INVISIBLE_VISIBLE)); 
     234        m_session->SendNotification(LANG_INVISIBLE_VISIBLE); 
    199235        return true; 
    200236    } 
     
    202238    if (argstr == "off") 
    203239    { 
    204         m_session->SendNotification(GetMangosString(LANG_INVISIBLE_INVISIBLE)); 
     240        m_session->SendNotification(LANG_INVISIBLE_INVISIBLE); 
    205241        m_session->GetPlayer()->SetGMVisible(false); 
    206242        return true; 
     
    18241860        return false; 
    18251861 
     1862    // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] 
     1863 
    18261864    char* pName = strtok((char*)args, " "); 
    1827     char* msgSubject = strtok(NULL, " "); 
    1828     char* msgText = strtok(NULL, ""); 
     1865    if(!pName) 
     1866        return false; 
     1867 
     1868    char* tail1 = strtok(NULL, ""); 
     1869    if(!tail1) 
     1870        return false; 
     1871 
     1872    char* msgSubject; 
     1873    if(*tail1=='"') 
     1874        msgSubject = strtok(tail1+1, "\""); 
     1875    else 
     1876    { 
     1877        char* space = strtok(tail1, "\""); 
     1878        if(!space) 
     1879            return false; 
     1880        msgSubject = strtok(NULL, "\""); 
     1881    } 
     1882 
     1883    if (!msgSubject) 
     1884        return false; 
     1885 
     1886    char* tail2 = strtok(NULL, ""); 
     1887    if(!tail2) 
     1888        return false; 
     1889 
     1890    char* msgText; 
     1891    if(*tail2=='"') 
     1892        msgText = strtok(tail2+1, "\""); 
     1893    else 
     1894    { 
     1895        char* space = strtok(tail2, "\""); 
     1896        if(!space) 
     1897            return false; 
     1898        msgText = strtok(NULL, "\""); 
     1899    } 
    18291900 
    18301901    if (!msgText) 
     
    18321903 
    18331904    // pName, msgSubject, msgText isn't NUL after prev. check 
    1834  
    18351905    std::string name    = pName; 
    18361906    std::string subject = msgSubject; 
    18371907    std::string text    = msgText; 
    18381908 
     1909    // extract items 
     1910    typedef std::pair<uint32,uint32> ItemPair; 
     1911    typedef std::list< ItemPair > ItemPairs; 
     1912    ItemPairs items; 
     1913 
     1914    // get all tail string 
     1915    char* tail = strtok(NULL, ""); 
     1916 
     1917    // get from tail next item str 
     1918    while(char* itemStr = strtok(tail, " ")) 
     1919    { 
     1920        // and get new tail  
     1921        tail = strtok(NULL, ""); 
     1922 
     1923        // parse item str 
     1924        char* itemIdStr = strtok(itemStr, ":"); 
     1925        char* itemCountStr = strtok(NULL, " "); 
     1926         
     1927        uint32 item_id = atoi(itemIdStr); 
     1928        if(!item_id) 
     1929            return false; 
     1930 
     1931        ItemPrototype const* item_proto = objmgr.GetItemPrototype(item_id); 
     1932        if(!item_proto) 
     1933        { 
     1934            PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); 
     1935            SetSentErrorMessage(true); 
     1936            return false; 
     1937        } 
     1938 
     1939        uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1; 
     1940        if(item_count < 1 || item_proto->MaxCount && item_count > item_proto->MaxCount) 
     1941        { 
     1942            PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id); 
     1943            SetSentErrorMessage(true); 
     1944            return false; 
     1945        } 
     1946 
     1947        while(item_count > item_proto->Stackable) 
     1948        { 
     1949            items.push_back(ItemPair(item_id,item_proto->Stackable)); 
     1950            item_count -= item_proto->Stackable; 
     1951        } 
     1952 
     1953        items.push_back(ItemPair(item_id,item_count)); 
     1954 
     1955        if(items.size() > MAX_MAIL_ITEMS) 
     1956        { 
     1957            PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); 
     1958            SetSentErrorMessage(true); 
     1959            return false; 
     1960        } 
     1961    } 
     1962 
    18391963    if(!normalizePlayerName(name)) 
    18401964    { 
     
    18451969 
    18461970    uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name); 
    1847  
    18481971    if(!receiver_guid) 
    1849         return false; 
     1972    { 
     1973        SendSysMessage(LANG_PLAYER_NOT_FOUND); 
     1974        SetSentErrorMessage(true); 
     1975        return false; 
     1976    } 
    18501977 
    18511978    uint32 mailId = objmgr.GenerateMailID(); 
     
    18611988    Player *receiver = objmgr.GetPlayer(receiver_guid); 
    18621989 
    1863     WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_NONE); 
     1990    // fill mail 
     1991    MailItemsInfo mi;                                       // item list preparing 
     1992 
     1993    for(ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) 
     1994    { 
     1995        if(Item* item = Item::CreateItem(itr->first,itr->second,m_session->GetPlayer())) 
     1996        { 
     1997            item->SaveToDB();                               // save for prevent lost at next mail load, if send fail then item will deleted 
     1998            mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item); 
     1999        } 
     2000    } 
     2001 
     2002    WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, &mi, 0, 0, MAIL_CHECK_MASK_NONE); 
    18642003 
    18652004    PSendSysMessage(LANG_MAIL_SENT, name.c_str());