levelup+autoguild script
This commit is contained in:
		
							parent
							
								
									8fa12002ad
								
							
						
					
					
						commit
						6fc771b042
					
				@ -16,6 +16,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This is where scripts' loading functions should be declared:
 | 
					// This is where scripts' loading functions should be declared:
 | 
				
			||||||
 | 
					void AddSC_mod_mxw_autoguild();
 | 
				
			||||||
void AddSC_mod_mxw_dynamicxp();
 | 
					void AddSC_mod_mxw_dynamicxp();
 | 
				
			||||||
void AddSC_mod_mxw_sololfg();
 | 
					void AddSC_mod_mxw_sololfg();
 | 
				
			||||||
void AddSC_solocraft();
 | 
					void AddSC_solocraft();
 | 
				
			||||||
@ -27,6 +28,7 @@ void AddSC_solocraft();
 | 
				
			|||||||
// void Add${NameOfDirectory}Scripts()
 | 
					// void Add${NameOfDirectory}Scripts()
 | 
				
			||||||
void AddCustomScripts()
 | 
					void AddCustomScripts()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    AddSC_mod_mxw_autoguild();
 | 
				
			||||||
    AddSC_mod_mxw_dynamicxp();
 | 
					    AddSC_mod_mxw_dynamicxp();
 | 
				
			||||||
    AddSC_mod_mxw_sololfg();
 | 
					    AddSC_mod_mxw_sololfg();
 | 
				
			||||||
    AddSC_solocraft();    	
 | 
					    AddSC_solocraft();    	
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										29
									
								
								src/server/scripts/Custom/mod_mxw_autoguild.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								src/server/scripts/Custom/mod_mxw_autoguild.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					#include "ScriptMgr.h"
 | 
				
			||||||
 | 
					#include "Player.h"
 | 
				
			||||||
 | 
					#include "GuildMgr.h"
 | 
				
			||||||
 | 
					#include "Config.h"
 | 
				
			||||||
 | 
					#include "Guild.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class mod_mxw_autoguild : public PlayerScript
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
 | 
					        mod_mxw_autoguild() : PlayerScript("mod_mxw_autoguild") { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void OnLogin(Player* player, bool firstLogin)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if (firstLogin)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            uint32 GUILD_ID_ALLIANCE = sConfigMgr->GetIntDefault("AutoGuild.Alliance", 0);
 | 
				
			||||||
 | 
					            uint32 GUILD_ID_HORDE = sConfigMgr->GetIntDefault("AutoGuild.Horde", 0);
 | 
				
			||||||
 | 
					            Guild* guild = sGuildMgr->GetGuildById(player->GetTeam() == ALLIANCE ? GUILD_ID_ALLIANCE : GUILD_ID_HORDE);
 | 
				
			||||||
 | 
					            SQLTransaction trans(nullptr);
 | 
				
			||||||
 | 
					            if (guild)
 | 
				
			||||||
 | 
					                guild->AddMember(player->GetGUID());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AddSC_mod_mxw_autoguild()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    new mod_mxw_autoguild();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										72
									
								
								src/server/scripts/Custom/mod_mxw_levelup.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								src/server/scripts/Custom/mod_mxw_levelup.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,72 @@
 | 
				
			|||||||
 | 
					//// MxWoW Official Module
 | 
				
			||||||
 | 
					//// Level Up
 | 
				
			||||||
 | 
					//// Dev:       mikx
 | 
				
			||||||
 | 
					//// Git:       https://mxgit.ovh/MxWoW/mod_mxwow_levelup
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "Configuration/Config.h"
 | 
				
			||||||
 | 
					#include "ScriptMgr.h"
 | 
				
			||||||
 | 
					#include "Player.h"
 | 
				
			||||||
 | 
					#include "Chat.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class mod_mxw_levelup : public PlayerScript
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mod_mxw_levelup() : PlayerScript("mod_mxw_levelup") { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void OnLogin(Player* player) override
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00MxW Level Up |rscript.");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void OnLevelChanged(Player * player, uint8 oldLevel)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Map* map = player->GetMap();
 | 
				
			||||||
 | 
					        std::string mapName = map->GetMapName();
 | 
				
			||||||
 | 
					        std::ostringstream ss;
 | 
				
			||||||
 | 
					        if (sConfigMgr->GetBoolDefault("LevelUp.Enabled", true))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            ss << "|cffabeeff[MxW] [" << GetPlayerColor(player) << player->GetName() << "|cffabeeff][|cff09ff00"<< mapName <<"|cffabeeff] est maintenant niveau |cff09ff00"<< oldLevel + 1 <<"|cffabeeff.";
 | 
				
			||||||
 | 
					            sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::string GetPlayerColor(const Player* p)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        switch (p->getClass())
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        case CLASS_ROGUE:
 | 
				
			||||||
 | 
					            return "|cffFFF468";
 | 
				
			||||||
 | 
					        case CLASS_DEATH_KNIGHT:
 | 
				
			||||||
 | 
					            return "|cffC41E3A";
 | 
				
			||||||
 | 
					        case CLASS_WARRIOR:
 | 
				
			||||||
 | 
					            return "|cffC69B6D";
 | 
				
			||||||
 | 
					        case CLASS_PRIEST:
 | 
				
			||||||
 | 
					            return "|cffFFFFFF";
 | 
				
			||||||
 | 
					        case CLASS_MAGE:
 | 
				
			||||||
 | 
					            return "|cff3FC7EB";
 | 
				
			||||||
 | 
					        case CLASS_PALADIN:
 | 
				
			||||||
 | 
					            return "|cffF48CBA";
 | 
				
			||||||
 | 
					        case CLASS_HUNTER:
 | 
				
			||||||
 | 
					            return "|cffAAD372";
 | 
				
			||||||
 | 
					        case CLASS_DRUID:
 | 
				
			||||||
 | 
					            return "|cffFF7C0A";
 | 
				
			||||||
 | 
					        case CLASS_SHAMAN:
 | 
				
			||||||
 | 
					            return "|cff0070DD";
 | 
				
			||||||
 | 
					        case CLASS_WARLOCK:
 | 
				
			||||||
 | 
					            return "|cff8788EE";
 | 
				
			||||||
 | 
					        case CLASS_DEMON_HUNTER:
 | 
				
			||||||
 | 
					            return "|cffA330C9";
 | 
				
			||||||
 | 
					        case CLASS_MONK:
 | 
				
			||||||
 | 
					            return "|cff00FF98";
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            return "n/d";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AddSC_mod_mxw_levelup()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    new mod_mxw_levelup();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -88,14 +88,14 @@ namespace {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        solocraft_player_instance_handler() : PlayerScript("solocraft_player_instance_handler")
 | 
					        solocraft_player_instance_handler() : PlayerScript("solocraft_player_instance_handler")
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "[Solocraft] solocraft_player_instance_handler Loaded");
 | 
					            TC_LOG_INFO(LOG_FILTER_PLAYER, "[Solocraft] solocraft_player_instance_handler Loaded");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void OnMapChanged(Player *player) override
 | 
					        void OnMapChanged(Player* player) override
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (sConfigMgr->GetBoolDefault("Solocraft.Enable", true))
 | 
					            if (sConfigMgr->GetBoolDefault("Solocraft.Enable", true))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Map *map = player->GetMap();
 | 
					                Map* map = player->GetMap();
 | 
				
			||||||
                float difficulty = CalculateDifficulty(map, player);
 | 
					                float difficulty = CalculateDifficulty(map, player);
 | 
				
			||||||
                int numInGroup = GetNumInGroup(player);
 | 
					                int numInGroup = GetNumInGroup(player);
 | 
				
			||||||
                ApplyBuffs(player, map, difficulty, numInGroup);
 | 
					                ApplyBuffs(player, map, difficulty, numInGroup);
 | 
				
			||||||
@ -115,7 +115,7 @@ namespace {
 | 
				
			|||||||
        const float D40 = sConfigMgr->GetFloatDefault("Solocraft.Raid30", 40.0);
 | 
					        const float D40 = sConfigMgr->GetFloatDefault("Solocraft.Raid30", 40.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Set the instance difficulty
 | 
					        // Set the instance difficulty
 | 
				
			||||||
        float CalculateDifficulty(Map *map, Player *player) {
 | 
					        float CalculateDifficulty(Map* map, Player* player) {
 | 
				
			||||||
            float difficulty = 1.0;
 | 
					            float difficulty = 1.0;
 | 
				
			||||||
            if (map) {
 | 
					            if (map) {
 | 
				
			||||||
                if (map->IsRaid())
 | 
					                if (map->IsRaid())
 | 
				
			||||||
@ -131,7 +131,7 @@ namespace {
 | 
				
			|||||||
                    case 40:
 | 
					                    case 40:
 | 
				
			||||||
                        difficulty = D40; break;
 | 
					                        difficulty = D40; break;
 | 
				
			||||||
                    default:
 | 
					                    default:
 | 
				
			||||||
                        TC_LOG_WARN(LOG_FILTER_WORLDSERVER, "[SoloCraft] Unrecognized max players %d, defaulting to 10 man difficulty",
 | 
					                        TC_LOG_WARN(LOG_FILTER_PLAYER, "[SoloCraft] Unrecognized max players %d, defaulting to 10 man difficulty",
 | 
				
			||||||
                            map->GetMapDifficulty()->MaxPlayers);
 | 
					                            map->GetMapDifficulty()->MaxPlayers);
 | 
				
			||||||
                        difficulty = D10;
 | 
					                        difficulty = D10;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -150,9 +150,9 @@ namespace {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Get the groups size
 | 
					        // Get the groups size
 | 
				
			||||||
        int GetNumInGroup(Player *player) {
 | 
					        int GetNumInGroup(Player* player) {
 | 
				
			||||||
            int numInGroup = 1;
 | 
					            int numInGroup = 1;
 | 
				
			||||||
            Group *group = player->GetGroup();
 | 
					            Group* group = player->GetGroup();
 | 
				
			||||||
            if (group) {
 | 
					            if (group) {
 | 
				
			||||||
                Group::MemberSlotList const& groupMembers = group->GetMemberSlots();
 | 
					                Group::MemberSlotList const& groupMembers = group->GetMemberSlots();
 | 
				
			||||||
                numInGroup = groupMembers.size();
 | 
					                numInGroup = groupMembers.size();
 | 
				
			||||||
@ -161,7 +161,7 @@ namespace {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Apply the player buffs
 | 
					        // Apply the player buffs
 | 
				
			||||||
        void ApplyBuffs(Player *player, Map *map, float difficulty, int numInGroup)
 | 
					        void ApplyBuffs(Player* player, Map* map, float difficulty, int numInGroup)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ClearBuffs(player, map);
 | 
					            ClearBuffs(player, map);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -193,7 +193,7 @@ namespace {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void ClearBuffs(Player *player, Map *map)
 | 
					        void ClearBuffs(Player* player, Map* map)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::map<ObjectGuid, float>::iterator unitDifficultyIterator = _unitDifficulty.find(player->GetGUID());
 | 
					            std::map<ObjectGuid, float>::iterator unitDifficultyIterator = _unitDifficulty.find(player->GetGUID());
 | 
				
			||||||
            if (unitDifficultyIterator != _unitDifficulty.end())
 | 
					            if (unitDifficultyIterator != _unitDifficulty.end())
 | 
				
			||||||
 | 
				
			|||||||
@ -2993,6 +2993,15 @@ QuestPOI.DisableErrors = 1
 | 
				
			|||||||
###################################################################################################
 | 
					###################################################################################################
 | 
				
			||||||
# CUSTOM SETTINGS #################################################################################
 | 
					# CUSTOM SETTINGS #################################################################################
 | 
				
			||||||
###################################################################################################
 | 
					###################################################################################################
 | 
				
			||||||
 | 
					# Auto Guild #
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AutoGuild.Alliance = 1
 | 
				
			||||||
 | 
					AutoGuild.Horde = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					###################################################################################################
 | 
				
			||||||
 | 
					###################################################################################################
 | 
				
			||||||
# Dynamic XP Rate #
 | 
					# Dynamic XP Rate #
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user