Jump to content

MacWarriors

Members
  • Posts

    17
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by MacWarriors

  1. What bug does the patch fix? What features does the patch add?

    Prevent using wrong display in .modify morph command

    For which repository revision was the patch created?

    11781

    Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

    No

    Who has been writing this patch? Please include either forum user names or email addresses.

    Me

    Description

    At this time, .modify morph command allow using wrong displayID, with this patch, it won't.

    Patch

    http://pastebin.com/nGH1iuZz

    diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp
    index 0fbfab1..a6bfaef 100644
    --- a/src/game/Level2.cpp
    +++ b/src/game/Level2.cpp
    @@ -2453,6 +2453,14 @@ bool ChatHandler::HandleModifyMorphCommand(char* args)
    
        uint16 display_id = (uint16)atoi(args);
    
    +    CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(display_id);
    +    if(!displayEntry)
    +    {
    +        SendSysMessage(LANG_BAD_VALUE);
    +        SetSentErrorMessage(true);
    +        return false;
    +    }
    +
        Unit *target = getSelectedUnit();
        if (!target)
            target = m_session->GetPlayer();
    

    Best regards,

    MacWarrior.

  2. What bug does the patch fix? What features does the patch add?

    Mirror Image Spell ( 60352 ) doesn't reset player's race and class anymore when used with .aura command.

    For which repository revision was the patch created?

    11781

    Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

    No

    Who has been writing this patch? Please include either forum user names or email addresses.

    Me

    Description

    When using Mirror Image on an other player, this one will disapear from characters list because of a wrong race and class in DB.

    This is because this spell musn't be casted on a player, so I just added a verification.

    Patch

    http://pastebin.com/Z9pTaFwU

    diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
    index 92c5762..00b759a 100644
    --- a/src/game/SpellAuras.cpp
    +++ b/src/game/SpellAuras.cpp
    @@ -8235,6 +8235,9 @@ void Aura::HandleAuraMirrorImage(bool apply, bool Real)
        // Target of aura should always be creature (ref Spell::CheckCast)
        Creature* pCreature = (Creature*)GetTarget();
    
    +	if (pCreature->GetTypeId()==TYPEID_PLAYER)
    +		return;
    +
        if (apply)
        {
            // Caster can be player or creature, the unit who pCreature will become an clone of.

    Best regards,

    MacWarrior.

  3. Hi,

    What bug does the patch fix? What features does the patch add?

    Optimisation of GameObjectTarget command by adding some conditions in SQL query.

    Using a 500meters radius instead of just a all map search.

    For which repository revision was the patch created?

    Mangos - [11737]

    Who has been writing this patch? Please include either forum user names or email addresses.

    Me

    Patch

    V1 : Original patch

    V2 : Fix typo

    V3 : Fix crash ( How stupid I am -_- )

    http://paste2.org/p/1522405

    Cordially,

    MacWarrior.

  4. This is the final version I made and use :

    diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
    index 9702808..82c40d0 100644
    --- a/src/game/Chat.cpp
    +++ b/src/game/Chat.cpp
    @@ -713,6 +713,7 @@ ChatCommand * ChatHandler::getCommandTable()
            { "aura",           SEC_ADMINISTRATOR,  false, &ChatHandler::HandleAuraCommand,                "", NULL },
            { "unaura",         SEC_ADMINISTRATOR,  false, &ChatHandler::HandleUnAuraCommand,              "", NULL },
            { "announce",       SEC_MODERATOR,      true,  &ChatHandler::HandleAnnounceCommand,            "", NULL },
    +		{ "gmannounce",  	SEC_MODERATOR,  	true,  &ChatHandler::HandleGmAnnounceCommand,          "", NULL },
            { "notify",         SEC_MODERATOR,      true,  &ChatHandler::HandleNotifyCommand,              "", NULL },
            { "goname",         SEC_MODERATOR,      false, &ChatHandler::HandleGonameCommand,              "", NULL },
            { "namego",         SEC_MODERATOR,      false, &ChatHandler::HandleNamegoCommand,              "", NULL },
    diff --git a/src/game/Chat.h b/src/game/Chat.h
    index c9d4af7..9999b01 100644
    --- a/src/game/Chat.h
    +++ b/src/game/Chat.h
    @@ -523,6 +523,7 @@ class ChatHandler
            bool HandleGroupgoCommand(char* args);
            bool HandleRecallCommand(char* args);
            bool HandleAnnounceCommand(char* args);
    +		bool HandleGmAnnounceCommand(char* args);
            bool HandleNotifyCommand(char* args);
            bool HandleGPSCommand(char* args);
            bool HandleTaxiCheatCommand(char* args);
    diff --git a/src/game/Language.h b/src/game/Language.h
    index b4f6f47..c86b489 100644
    --- a/src/game/Language.h
    +++ b/src/game/Language.h
    @@ -943,6 +943,8 @@ enum MangosStrings
        //                                    10000-10999
    
        // Use for custom patches             11000-11999
    +	// GmAnnounce
    +	LANG_GMSYSTEMMESSAGE				  = 11000,
    
        // NOT RESERVED IDS                   12000-1999999999
        // `db_script_string` table index     2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
    diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
    index c1c7517..bdf2cca 100644
    --- a/src/game/Level1.cpp
    +++ b/src/game/Level1.cpp
    @@ -130,6 +130,16 @@ bool ChatHandler::HandleAnnounceCommand(char* args)
        return true;
    }
    
    +// Gm announce
    +bool ChatHandler::HandleGmAnnounceCommand(char* args)
    +{
    +    if(!*args)
    +        return false;
    +
    +    sWorld.SendGMText(LANG_GMSYSTEMMESSAGE,args);
    +    return true;
    +}
    +
    //notification player at the screen
    bool ChatHandler::HandleNotifyCommand(char* args)
    {
    diff --git a/src/game/World.cpp b/src/game/World.cpp
    index 7445c2d..fafca2b 100644
    --- a/src/game/World.cpp
    +++ b/src/game/World.cpp
    @@ -1626,6 +1626,24 @@ void World::SendWorldText(int32 string_id, ...)
        va_end(ap);
    }
    
    +void World::SendGMText(int32 string_id, ...)
    +{
    +    va_list ap;
    +    va_start(ap, string_id);
    +
    +    MaNGOS::WorldWorldTextBuilder wt_builder(string_id, &ap);
    +    MaNGOS::LocalizedPacketListDo<MaNGOS::WorldWorldTextBuilder> wt_do(wt_builder);
    +    for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
    +    {
    +        if(!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld() && itr->second->GetSecurity() =< SEC_MODERATOR)
    +            continue;
    +
    +        wt_do(itr->second->GetPlayer());
    +    }
    +
    +    va_end(ap);
    +}
    +
    /// DEPRICATED, only for debug purpose. Send a System Message to all players (except self if mentioned)
    void World::SendGlobalText(const char* text, WorldSession *self)
    {
    diff --git a/src/game/World.h b/src/game/World.h
    index d382489..342f14d 100644
    --- a/src/game/World.h
    +++ b/src/game/World.h
    @@ -500,6 +500,7 @@ class World
            void LoadConfigSettings(bool reload = false);
    
            void SendWorldText(int32 string_id, ...);
    +		void SendGMText(int32 string_id, ...);
            void SendGlobalText(const char* text, WorldSession *self);
            void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);
            void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);

    And the SQL :

    DELETE FROM `command` WHERE name = 'gmannounce';
    INSERT INTO `command` (name, security, help) VALUES
    ('gmannounce', 12, 'Display a message to every connected GM. Affiche un message à tous les Mj connectés.');
    
    DELETE FROM mangos_string WHERE entry = 11000;
    INSERT INTO mangos_string (entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8) VALUES
    (11000,'|cffff0000[GM Announce]: %s|r',NULL,'|cffff0000[Annonce Mj]: %s|r',NULL,NULL,NULL,NULL,NULL,NULL);

    Have Fun !

    Cordially,

    MacWarrior.

  5. This works fine :

    To World.cpp :

    void World::SendGMText(int32 string_id, ...)
    {
       va_list ap;
       va_start(ap, string_id);
    
       MaNGOS::WorldWorldTextBuilder wt_builder(string_id, &ap);
       MaNGOS::LocalizedPacketListDo<MaNGOS::WorldWorldTextBuilder> wt_do(wt_builder);
       for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
       {
           if(!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld() )
               continue;
    
           if (itr->second->GetSecurity() < SEC_MODERATOR)
               continue;
    
           wt_do(itr->second->GetPlayer());
       }
    
       va_end(ap);
    }

    To World.h :

    void SendGMText(int32 string_id, ...);

    Cordially,

    MacWarrior.

  6. This is from trinity :

    World.cpp:

    void World::SendGMText(int32 string_id, ...)
    {
       va_list ap;
       va_start(ap, string_id);
    
       Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
       Trinity::LocalizedPacketListDo<Trinity::WorldWorldTextBuilder> wt_do(wt_builder);
       for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
       {
           if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
               continue;
    
           if (itr->second->GetSecurity() < SEC_MODERATOR)
               continue;
    
           wt_do(itr->second->GetPlayer());
       }
    
       va_end(ap);
    }

  7. Old line 4 :

    --- /dev/null

    New line 4 :

    --- a/sql/v01_vehicle_table.sql

    In fact, depending on how you apply the patch, you need some code modifications.

    If you use tortoisemerge, per exemple, the last patch will works perfectly.

    New line should work with both tortoisemerge and git apply command...

    Old line don't work for sure with tortoisemerge.

    Cordially,

    MacWarrior.

  8. Hi everybody,

    I just finished to code this.

    Tested In Game, works very fine.

    I didn't modify the .gm command a lot, just the minimum to don't have bugs or things like this.

    Here is the code I used :

    Add this in Level1.cpp

    bool ChatHandler::HandleDevCommand(const char* args)
    {
       if(!*args)
       {
           if(m_session->GetPlayer()->isDev())
           {
               m_session->SendNotification(LANG_DEV_ON);
           } else {
               m_session->SendNotification(LANG_DEV_OFF);
           }
           return true;
       }
    
       std::string argstr = (char*)args;
    
       if (argstr == "on")
       {
           if(m_session->GetPlayer()->isGameMaster())
           {
               m_session->GetPlayer()->SetGameMaster(false);
               m_session->SendNotification(LANG_GM_OFF);
           }
           m_session->GetPlayer()->SetDev(true);
           m_session->SendNotification(LANG_DEV_ON);
           #ifdef _DEBUG_VMAPS
           VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
           vMapManager->processCommand("stoplog");
           #endif
           return true;
       }
    
       if (argstr == "off")
       {
           m_session->GetPlayer()->SetDev(false);
           m_session->SendNotification(LANG_DEV_OFF);
           #ifdef _DEBUG_VMAPS
           VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
           vMapManager->processCommand("startlog");
           #endif
           return true;
       }
    
       SendSysMessage(LANG_USE_BOL);
       SetSentErrorMessage(true);
       return false;
    }

    Then add this in Chat.cpp

    { "dev",            SEC_ADMINISTRATOR,    false, &ChatHandler::HandleDevCommand,                   "", NULL },

    And this to Chat.h

    bool HandleDevCommand(const char* args);

    Then modify the .gm command like this, in Level1.cpp :

    bool ChatHandler::HandleGMCommand(const char* args)
    {
       if(!*args)
       {
           if(m_session->GetPlayer()->isGameMaster())
           {
               m_session->SendNotification(LANG_GM_ON);
           } else {
               m_session->SendNotification(LANG_GM_OFF);
           }
           return true;
       }
    
       std::string argstr = (char*)args;
    
       if (argstr == "on")
       {
           if(m_session->GetPlayer()->isDev())
           {
               m_session->GetPlayer()->SetDev(false);
               m_session->SendNotification(LANG_DEV_OFF);
           }
           m_session->GetPlayer()->SetGameMaster(true);
           m_session->SendNotification(LANG_GM_ON);
           #ifdef _DEBUG_VMAPS
           VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
           vMapManager->processCommand("stoplog");
           #endif
           return true;
       }
    
       if (argstr == "off")
       {
           m_session->GetPlayer()->SetGameMaster(false);
           m_session->SendNotification(LANG_GM_OFF);
           #ifdef _DEBUG_VMAPS
           VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
           vMapManager->processCommand("startlog");
           #endif
           return true;
       }
    
       SendSysMessage(LANG_USE_BOL);
       SetSentErrorMessage(true);
       return false;
    }

    Then, add this in Player.cpp :

    void Player::SetDev(bool on)
    {
       if(on)
       {
           m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
           setFaction(35);
           SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
    
           CallForAllControlledUnits(SetGameMasterOnHelper(),true,true,true,false);
    
           SetFFAPvP(false);
           ResetContestedPvP();
    
           getHostileRefManager().setOnlineOfflineState(false);
           CombatStopWithPets();
    
           SetPhaseMask(PHASEMASK_ANYWHERE,false);             // see and visible in all phases
       }
       else
       {
           // restore phase
           AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
           SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : PHASEMASK_NORMAL,false);
    
           m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
           setFactionForRace(getRace());
           RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
    
           CallForAllControlledUnits(SetGameMasterOffHelper(getFaction()),true,true,true,false);
    
           // restore FFA PvP Server state
           if(sWorld.IsFFAPvPRealm())
               SetFFAPvP(true);
    
           // restore FFA PvP area state, remove not allowed for GM mounts
           UpdateArea(m_areaUpdateId);
    
           getHostileRefManager().setOnlineOfflineState(true);
       }
    
       m_camera.UpdateVisibilityForOwner();
       UpdateObjectVisibility();
    }

    Then add this to Player.h :

    bool isDev() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; }
    void SetDev(bool on);

    This have to go in Language.h :

    LANG_DEV_ON                          = 20112,
    LANG_DEV_OFF                          = 20113,

    I used this ids for my core, you can and you should edit this.

    And finally, the SQL file :

    DELETE FROM `command` WHERE name IN ('dev');
    INSERT INTO `command` (name, security, help) VALUES
    ('dev',3,'Syntaxe: .dev[on/off] Active ou Désactive le mode DEV en jeu.\\r\\n\\r Syntax: .dev [on/off]\\r\\n\\r\\nEnable or Disable in game DEV MODE.'),
    DELETE FROM mangos_string WHERE `entry` IN (20044, 20045);
    insert into `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) values
    (20112,'DEV mode is ON',NULL,'Mode Dev activé',NULL,NULL,NULL,NULL,NULL,NULL),
    (20113,'DEV mode is OFF',NULL,'Mode Dev désactivé',NULL,NULL,NULL,NULL,NULL,NULL);

    Here you can also edit the command description.

    Note that, it's in english and in french ;)

    Want to see what happen in game ?

    Watch this !

    dev_macwarrior.png

    Cordially,

    MacWarrior.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use