Changeset 39 for trunk/src/game

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

[svn] * Various small changes here and there.
* Implementing MangChat? IRC system.
* Added new config option, MAX_WHO, can be used to set the limit of characters being sent in a /who request from client.

Original author: XTZGZoReX
Date: 2008-10-12 14:03:38-05:00

Location:
trunk/src/game
Files:
15 added
13 modified

Legend:

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

    r2 r39  
    2727#include "AuctionHouseObject.h" 
    2828#include "Util.h" 
     29#include "IRCClient.h" 
    2930 
    3031//please DO NOT use iterator++, because it is slower than ++iterator!!! 
     
    313314    pl->SaveInventoryAndGoldToDB(); 
    314315    CharacterDatabase.CommitTransaction(); 
     316 
     317    if((sIRC.BOTMASK & 1024) != 0)  
     318        sIRC.AHFunc(it->GetEntry(), it->GetProto()->Name1, pl->GetName(), location); 
    315319 
    316320    SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK); 
  • trunk/src/game/Channel.cpp

    r2 r39  
    2121#include "World.h" 
    2222#include "SocialMgr.h" 
     23#include "IRCClient.h" 
    2324 
    2425Channel::Channel(std::string name, uint32 channel_id) 
     
    113114    SendToOne(&data, p); 
    114115 
     116    sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_JOIN); 
     117 
    115118    JoinNotify(p); 
    116  
    117     // if no owner first logged will become 
    118     if(!IsConstant() && !m_ownerGUID) 
    119     { 
    120         SetOwner(p, (players.size() > 1 ? true : false)); 
    121         players[p].SetModerator(true); 
    122     } 
    123119} 
    124120 
     
    159155 
    160156        LeaveNotify(p); 
     157 
     158        sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_LEAVE); 
    161159 
    162160        if(changeowner) 
  • trunk/src/game/Chat.cpp

    r37 r39  
    457457        { "cometome",       SEC_ADMINISTRATOR,  &ChatHandler::HandleComeToMeCommand,            "", NULL }, 
    458458        { "damage",         SEC_ADMINISTRATOR,  &ChatHandler::HandleDamageCommand,              "", NULL }, 
     459        { "ircpm",          SEC_PLAYER,         &ChatHandler::HandleIRCpmCommand,               "", NULL }, 
    459460        { "combatstop",     SEC_GAMEMASTER,     &ChatHandler::HandleCombatStopCommand,          "", NULL }, 
    460461        { "flusharenapoints",    SEC_ADMINISTRATOR, &ChatHandler::HandleFlushArenaPointsCommand,         "",   NULL }, 
  • trunk/src/game/Chat.h

    r37 r39  
    108108        bool HandleGroupTeleCommand(const char* args); 
    109109        bool HandleDrunkCommand(const char* args); 
     110 
     111        bool HandleIRCpmCommand(const char* args); 
    110112 
    111113        bool HandleEventActiveListCommand(const char* args); 
  • trunk/src/game/ChatHandler.cpp

    r37 r39  
    3535#include "SpellAuras.h" 
    3636#include "Language.h" 
     37#include "IRCClient.h" 
    3738#include "Util.h" 
    3839 
     
    428429                break; 
    429430 
     431            sIRC.Send_WoW_IRC(_player, channel, msg); 
     432 
    430433            if(ChannelMgr* cMgr = channelMgr(_player->GetTeam())) 
    431434            { 
  • trunk/src/game/GameEvent.cpp

    r2 r39  
    2525#include "MapManager.h" 
    2626#include "Policies/SingletonImp.h" 
     27#include "IRCClient.h" 
    2728 
    2829INSTANTIATE_SINGLETON_1(GameEvent); 
     
    422423 
    423424    sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); 
     425 
     426    if((sIRC.BOTMASK & 256) != 0) 
     427    { 
     428        std::string ircchan = "#"; 
     429        ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); 
     430        sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Game Event \00304,08\037/!\\\037\017 %s", "%s", mGameEvent[event_id].description.c_str()), true); 
     431    } 
     432 
    424433    // spawn positive event tagget objects 
    425434    GameEventSpawn(event_id); 
  • trunk/src/game/Language.h

    r37 r39  
    641641    LANG_ARENA_TESTING                  = 745, 
    642642 
     643    LANG_AUTO_ANN                       = 746, 
     644 
    643645    // in game strings 
    644646    LANG_PET_INVALID_NAME               = 800, 
  • trunk/src/game/Level1.cpp

    r37 r39  
    3232#include "CellImpl.h" 
    3333#include "InstanceSaveMgr.h" 
     34#include "IRCClient.h" 
    3435#include "Util.h" 
    3536#ifdef _DEBUG_VMAPS 
     
    124125 
    125126    sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args); 
     127 
     128    if((sIRC.BOTMASK & 256) != 0) 
     129    { 
     130        std::string ircchan = "#"; 
     131        ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); 
     132        sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s", "%s", args), true); 
     133    } 
     134 
    126135    return true; 
    127136} 
     
    139148    data << str; 
    140149    sWorld.SendGlobalMessage(&data); 
     150 
     151    if((sIRC.BOTMASK & 256) != 0) 
     152    { 
     153        std::string ircchan = "#"; 
     154        ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); 
     155        sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Global Notify \00304,08\037/!\\\037\017 %s", "%s", args), true); 
     156    } 
    141157 
    142158    return true; 
     
    23492365} 
    23502366 
     2367bool ChatHandler::HandleIRCpmCommand(const char* args) 
     2368{ 
     2369    std::string Msg = args; 
     2370    if (Msg.find(" ") == std::string::npos) 
     2371        return false; 
     2372    std::string To = Msg.substr(0, Msg.find(" ")); 
     2373    Msg = Msg.substr(Msg.find(" ") + 1); 
     2374    std::size_t pos; 
     2375    while((pos = To.find("||")) != std::string::npos) 
     2376    { 
     2377        std::size_t find1 = To.find("||", pos); 
     2378        To.replace(pos, find1 - pos + 2, "|"); 
     2379    }    
     2380        sIRC.SendIRC("PRIVMSG "+To+" : <WoW>["+m_session->GetPlayerName()+"] : " + Msg); 
     2381    //Msg = "|cffCC4ACCTo [" + To + "]: " + Msg + "|r"; 
     2382    sIRC.Send_WoW_Player(m_session->GetPlayer(), "|cffCC4ACCTo ["+To+"]: "+Msg); 
     2383    return true; 
     2384} 
     2385 
    23512386//teleport at coordinates 
    23522387bool ChatHandler::HandleGoZoneXYCommand(const char* args) 
  • trunk/src/game/Makefile.am

    r23 r39  
    142142$(srcdir)/InstanceSaveMgr.cpp \ 
    143143$(srcdir)/InstanceSaveMgr.h \ 
     144$(srcdir)/IRCClient.cpp \ 
     145$(srcdir)/IRCClient.h \ 
     146$(srcdir)/IRCCmd.cpp \ 
     147$(srcdir)/IRCCmd.h \ 
     148$(srcdir)/IRCCmde.cpp \ 
     149$(srcdir)/IRCConf.cpp \ 
     150$(srcdir)/IRCConf.h \ 
     151$(srcdir)/IRCConf.h \ 
     152$(srcdir)/IRCFunc.h \ 
     153$(srcdir)/IRCIO.cpp \ 
     154$(srcdir)/IRCLog.cpp \ 
     155$(srcdir)/IRCLog.h \ 
     156$(srcdir)/IRCSock.cpp \ 
     157$(srcdir)/MCS_OnlinePlayers.cpp \ 
     158$(srcdir)/MCS_OnlinePlayers.h \ 
    144159$(srcdir)/Item.cpp \ 
    145160$(srcdir)/Item.h \ 
  • trunk/src/game/MiscHandler.cpp

    r37 r39  
    255255        data << uint32( pzoneid );                          // player zone id 
    256256 
    257         // 49 is maximum player count sent to client 
    258         if ((++clientcount) == 49) 
     257        // 49 is maximum player count sent to client - can be overriden 
     258        // through config, but is unstable 
     259        if ((++clientcount) == sWorld.getConfig(CONFIG_MAX_WHO)) 
    259260            break; 
    260261    } 
  • trunk/src/game/Player.cpp

    r37 r39  
    5959#include "Spell.h" 
    6060#include "SocialMgr.h" 
     61#include "IRCClient.h" 
    6162 
    6263#include <cmath> 
     
    17171718            m_items[i]->AddToWorld(); 
    17181719    } 
     1720    if(sIRC.ajoin == 1) 
     1721        sIRC.AutoJoinChannel(this); 
    17191722} 
    17201723 
     
    21462149 
    21472150    UpdateAllStats(); 
     2151 
     2152    if((sIRC.BOTMASK & 64) != 0) 
     2153    { 
     2154        char temp [5]; 
     2155        sprintf(temp, "%u", level); 
     2156        std::string plevel = temp; 
     2157        std::string pname = GetName(); 
     2158        std::string ircchan = "#"; 
     2159        ircchan += sIRC._irc_chan[sIRC.Status].c_str(); 
     2160        sIRC.Send_IRC_Channel(ircchan, "\00311["+pname+"] : Has Reached Level: "+plevel, true); 
     2161    } 
    21482162 
    21492163    if(sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up 
  • trunk/src/game/World.cpp

    r37 r39  
    5757#include "WaypointManager.h" 
    5858#include "Util.h" 
     59#include "IRCClient.h" 
     60#include "Language.h" 
    5961 
    6062INSTANTIATE_SINGLETON_1( World ); 
     
    576578    m_configs[CONFIG_CHARACTERS_CREATING_DISABLED] = sConfig.GetIntDefault("CharactersCreatingDisabled", 0); 
    577579 
     580    m_configs[CONFIG_MAX_WHO] = sConfig.GetIntDefault("MaxWhoListReturns", 49); 
     581 
    578582    m_configs[CONFIG_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("CharactersPerRealm", 10); 
    579583    if(m_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_configs[CONFIG_CHARACTERS_PER_REALM] > 10) 
     
    11771181    WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', %ld, 0)", isoDate, m_startTime ); 
    11781182 
     1183    static uint32 autoanc = 1; 
     1184    autoanc = sIRC.autoanc; 
     1185 
    11791186    m_timers[WUPDATE_OBJECTS].SetInterval(0); 
    11801187    m_timers[WUPDATE_SESSIONS].SetInterval(0); 
     
    11841191                                                            //Update "uptime" table based on configuration entry in minutes. 
    11851192    m_timers[WUPDATE_CORPSES].SetInterval(20*MINUTE*1000);  //erase corpses every 20 minutes 
     1193 
     1194    m_timers[WUPDATE_AUTOANC].SetInterval(autoanc*MINUTE*1000); 
    11861195 
    11871196    //to set mailtimer to return mails every day between 4 and 5 am 
     
    14211430    } 
    14221431 
    1423     /// </ul> 
    1424     ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" 
    1425     MapManager::Instance().DoDelayedMovesAndRemoves(); 
     1432    if (m_timers[WUPDATE_AUTOANC].Passed()) 
     1433    { 
     1434        m_timers[WUPDATE_AUTOANC].Reset(); /// </ul> 
     1435        SendRNDBroadcast(); 
     1436    } 
     1437    MapManager::Instance().DoDelayedMovesAndRemoves(); ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" 
    14261438 
    14271439    // update the instance reset times 
     
    24952507    } 
    24962508    // print the console message here so it looks right 
    2497     p_zprintf("mangos>"); 
     2509    p_zprintf("Trinity Core> "); 
     2510} 
     2511 
     2512void World::SendRNDBroadcast() 
     2513{ 
     2514    std::string msg; 
     2515    QueryResult *result = WorldDatabase.PQuery("SELECT `message` FROM `IRC_AutoAnnounce` ORDER BY RAND() LIMIT 1"); 
     2516    if(!result) 
     2517        return; 
     2518    msg = result->Fetch()[0].GetString(); 
     2519    delete result; 
     2520    std::string str = "|cffff0000[Automatic]:|r"; 
     2521    str += msg; 
     2522    sWorld.SendWorldText(LANG_AUTO_ANN); 
     2523    std::string ircchan = "#"; 
     2524    ircchan += sIRC._irc_chan[sIRC.anchn].c_str(); 
     2525    sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Automatic System Message \00304,08\037/!\\\037\017 %s", "%s", msg.c_str()), true); 
    24982526} 
    24992527 
  • trunk/src/game/World.h

    r37 r39  
    6060    WUPDATE_CORPSES     = 5, 
    6161    WUPDATE_EVENTS      = 6, 
    62     WUPDATE_COUNT       = 7 
     62    WUPDATE_COUNT       = 7, 
     63 
     64    WUPDATE_AUTOANC = 7 
     65 
    6366}; 
    6467 
     
    9295    CONFIG_STRICT_PET_NAMES, 
    9396    CONFIG_CHARACTERS_CREATING_DISABLED, 
     97    CONFIG_MAX_WHO, 
    9498    CONFIG_CHARACTERS_PER_ACCOUNT, 
    9599    CONFIG_CHARACTERS_PER_REALM, 
     
    366370        WorldSession* FindSession(uint32 id) const; 
    367371        void AddSession(WorldSession *s); 
     372 
     373        void SendRNDBroadcast(); 
     374 
    368375        bool RemoveSession(uint32 id); 
    369376        /// Get the number of current active sessions