Jump to content

[dev] Faction / race change (full core side)


Recommended Posts

but need to add quests table and remake rep. table. And ofc to add more id's.

Reputation tables are full. he table has 2 parts. The common and for each pair of races.

(0, 47, 'Ironforge', 0, 530, 'Darkspear Trolls') Used for translation to Human(ID 1) to Orc (ID 2).

If need transfer Human(1) to Troll(8) (1, 47, 'Ironforge', 8, 76, 'Orgrimmar') must be used.

This code implement replace (0, 47, 'Ironforge', 0, 530, 'Darkspear Trolls') to (1, 47, 'Ironforge', 8, 76, 'Orgrimmar') for Human(1) \\ Troll(8)

 CREATE TEMPORARY TABLE current_rep
             SELECT
               Trep.race_A AS race_1, Trep.rep_A AS rep_1, Trep.commentA AS comment1, Trep.race_H AS race_2, Trep.rep_H AS rep_2, Trep.commentH AS comment2
             FROM
               character_reputation AS Rep, transfer_reputation AS Trep

             WHERE
               faction = rep_A AND guid = SrcP
               AND ((race_A = SrcR AND race_H = DestR) OR

               (race_A = 0 AND
               rep_A NOT IN
               (SELECT
                 rep_A
               FROM
                 transfer_reputation
               WHERE
                 (race_A = SrcR AND race_H = DestR) AND rep_A = transfer_reputation.rep_A)
               )

               );

+               // Delete Friend List
+               CharacterDatabase.PExecute("DELETE FROM `character_social` WHERE `guid`= '%u'",GUID_LOPART(guid));

It is necessary to delete the character from other friend lists.

 DELETE    FROM   character_social     WHERE        guid = <char_guid> OR friend = <char_guid>;

Need to implement some checks before faction change. http://eu.blizzard.com/support/article.xml?locale=en_GB&articleId=39811

"If the character is a Guild Master, you will not be able to perform a Faction Change."

Link to comment
Share on other sites

I think there is a problem with languages, because i have test with a faction change form tauren to elf, and then a race change from elf to gnome. After this changes i have

common, Orc, Darnassian, Gnomish, taurahe.

But in chat console, in Idiom (or Language, I have spanish client) only appear Common and gnomish.

Link to comment
Share on other sites

I would like to help. I have made similar functionality on sql. Tables have been made by data http://www.wow-europe.com/en/info/fa...ange/index.xml.

Transfer reputations, achievments, many items, spells, 95% mount (except random, no data), languages ,some Death Knight quest.

My stored procedure and datatables link http://rapidshare.com/files/38638273...v0.19.sql.html

Sorry for my English.

Re-upload SQL please

Link to comment
Share on other sites

I would use this instead for Player.cpp

--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1502,6 +1502,10 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
    *p_data << uint32(char_flags);                          // character flags
    // character customize flags
    *p_data << uint32(atLoginFlags & AT_LOGIN_CUSTOMIZE ? CHAR_CUSTOMIZE_FLAG_CUSTOMIZE : CHAR_CUSTOMIZE_FLAG_NONE);
+    // characters faction change flags
+    *p_data << uint32(atLoginFlags & AT_LOGIN_CHANGE_FACTION ? CHAR_CUSTOMIZE_FLAG_FACTION : CHAR_CUSTOMIZE_FLAG_NONE);
+    // characters race change flags
+    *p_data << uint32(atLoginFlags & AT_LOGIN_CHANGE_RACE ? CHAR_CUSTOMIZE_FLAG_RACE : CHAR_CUSTOMIZE_FLAG_NONE);
    // First login
    *p_data << uint8(atLoginFlags & AT_LOGIN_FIRST ? 1 : 0);

Link to comment
Share on other sites

I want to make an extra check for DeathKnights (If has level > 65 and has the last quest completed), I have written this for include in void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)

Replace

   QueryResult *result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
   if (!result)
   {
       WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
       data << uint8(CHAR_CREATE_ERROR);
       SendPacket( &data );
       return;
   }

with this

QueryResult *result = CharacterDatabase.PQuery("SELECT at_login, class, level FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
   Field *fields = result->Fetch();
   if (!result)
   {
       WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
       data << uint8(CHAR_CREATE_ERROR);
       SendPacket( &data );
       return;
   }
   else
   {
       uint32 clase = fields[1].GetUInt32();
       uint32 nivel = fields[2].GetUInt32();
       if (clase == 6 && nivel < 65)
       {
           WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
           data << uint8(CHAR_CREATE_ERROR);
           SendPacket( &data );
           return;
       }
   }

This is much better, although I don't check for quest

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...
  • 4 months later...
  • 2 weeks later...
Guest
This topic is now closed to further replies.
×
×
  • 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