Permanent Scale and Morph System

This is a small client modification to let players keep their morphs and scale after logging out

Wanted to release this here because I wouldn’t have it without the help from this forum. Thanks all /emoticons/default_biggrin.png

The base for the code used was found here…

http://modcraft.superparanoid.de/viewtopic.php?f=61&t=1077

The base for the NPC was here…

http://www.trinitycore.org/f/topic/6496-npc-server-helper-for-trinitycore/

Thanks

hondacrx

For taking the time to answer questions and help me understand what I did wrong. /emoticons/default_biggrin.png

Working as of commit 001f62deb4bc1bbd5224106c957a3f941d380f4f

Permanent-Morph-and-Scale-System.patch

IMHO better code it as custom script.

[CODE]diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index dd29bcf…22b98d5 100644
— a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -257,6 +257,10 @@ void AddSC_boss_renataki();
void AddSC_boss_wushoolay();
void AddSC_instance_zulgurub();

+// Custom mods: START
+void AddSC_Mod_CharacterModel(); // by Codels
+// Custom mods: END
+
//void AddSC_alterac_mountains();
void AddSC_arathi_highlands();
void AddSC_blasted_lands();
@@ -1358,6 +1362,8 @@ void AddCustomScripts()
// 2
// 3
// 4

  • // Scale and Model
  • AddSC_Mod_CharacterModel();
    // 5
    // 6
    // 7
    diff --git a/src/server/scripts/Custom/CMakeLists.txt b/src/server/scripts/Custom/CMakeLists.txt
    index 5ca05cd…0fb07a2 100644
    — a/src/server/scripts/Custom/CMakeLists.txt
    +++ b/src/server/scripts/Custom/CMakeLists.txt
    @@ -17,6 +17,7 @@ set(scripts_STAT_SRCS

3

4

5

  • Custom/mod_CharacterModel.cpp

6

7

8

diff --git a/src/server/scripts/Custom/mod_CharacterModel.cpp b/src/server/scripts/Custom/mod_CharacterModel.cpp
new file mode 100644
index 0000000…e9b8c51
— /dev/null
+++ b/src/server/scripts/Custom/mod_CharacterModel.cpp
@@ -0,0 +1,45 @@
+#include “ScriptPCH.h”
+#include “Config.h”
+
+#define SQL_INFO “SELECT model_id, size FROM character_model WHERE guid = ‘%u’”
+
+bool CharacterModelEnable = false;
+
+class mod_CharacterModel_WorldScript : public WorldScript
+{

  • public:
  • mod_CharacterModel_WorldScript() : WorldScript(“mod_CharacterModel_WorldScript”) { }
  • // Called after the world configuration is (re)loaded.
  • void OnConfigLoad(bool /reload/)
  • {
  • CharacterModelEnable = sConfigMgr->GetBoolDefault(“CharacterModel.Enable”, false);
  • }
    +};

+class mod_CharacterModel_PlayerScript : public PlayerScript
+{

  • public:
  • mod_CharacterModel_PlayerScript() : PlayerScript(“mod_CharacterModel_PlayerScript”) { }
  • // Called when a player logs in.
  • void OnLogin(Player* player)
  • {
  • if (!CharacterModelEnable)
  • return;
  • QueryResult result = CharacterDatabase.PQuery(SQL_INFO, player->GetGUIDLow());
  • if (!result)
  • return;
  • player->SetNativeDisplayId((*result)[0].GetUInt32());
  • player->SetObjectScale((*result)[1].GetFloat());
  • player->SetDisplayId(player->GetNativeDisplayId());
  • }
    +};

+void AddSC_Mod_CharacterModel()
+{

  • new mod_CharacterModel_WorldScript();
  • new mod_CharacterModel_PlayerScript();
    +}[/CODE]

[/SPOILER]
o.O

Very nice Aokromes /emoticons/default_biggrin.png

Not my thing /emoticons/default_tongue.png