chore. Compatibility with the latest version (#46)

* chore. Compatibility with the latest version

* add pull request
This commit is contained in:
Walter Pagani
2024-04-07 18:27:20 -03:00
committed by GitHub
parent 2c2f81adda
commit 1ded5dc7b5
20 changed files with 276 additions and 244 deletions

View File

@@ -1,49 +0,0 @@
### TITLE
## Type(Scope/Subscope): Commit ultra short explanation
## |---- Write below the examples with a maximum of 50 characters ----|
## Example 1: fix(DB/SAI): Missing spell to NPC Hogger
## Example 2: fix(CORE/Raid): Phase 2 of Ragnaros
## Example 3: feat(CORE/Commands): New GM command to do something
### DESCRIPTION
## Explain why this change is being made, what does it fix etc...
## |---- Write below the examples with a maximum of 72 characters per lines ----|
## Example: Hogger (id: 492) was not charging player when being engaged.
## Provide links to any issue, commit, pull request or other resource
## Example 1: Closes issue #23
## Example 2: Ported from other project's commit (link)
## Example 3: References taken from wowpedia / wowhead / wowwiki / https://wowgaming.altervista.org/aowow/
## =======================================================
## EXTRA INFOS
## =======================================================
## "Type" can be:
## feat (new feature)
## fix (bug fix)
## refactor (refactoring production code)
## style (formatting, missing semi colons, etc; no code change)
## docs (changes to documentation)
## test (adding or refactoring tests; no production code change)
## chore (updating bash scripts, git files etc; no production code change)
## --------------------
## Remember to
## Capitalize the subject line
## Use the imperative mood in the subject line
## Do not end the subject line with a period
## Separate subject from body with a blank line
## Use the body to explain what and why rather than how
## Can use multiple lines with "-" for bullet points in body
## --------------------
## More info here https://www.conventionalcommits.org/en/v1.0.0-beta.2/
## =======================================================
## "Scope" can be:
## CORE (core related, c++)
## DB (database related, sql)
## =======================================================
## "Subscope" is optional and depends on the nature of the commit.
## =======================================================

10
.gitattributes vendored
View File

@@ -32,16 +32,16 @@
## For documentation
# Documents
*.doc diff=astextplain
*.DOC diff=astextplain
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
## DOCUMENTATION
*.markdown text

72
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: Bug report
description: Create a bug report to help us improve.
title: "Bug: "
body:
- type: textarea
id: current
attributes:
label: Current Behaviour
description: |
Description of the problem or issue here.
Include entries of affected creatures / items / quests / spells etc.
If this is a crash, post the crashlog (upload to https://gist.github.com/) and include the link here.
Never upload files! Use GIST for text and YouTube for videos!
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behaviour
description: |
Tell us what should happen instead.
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce the problem
description: |
What does someone else need to do to encounter the same bug?
placeholder: |
1. Step 1
2. Step 2
3. Step 3
validations:
required: true
- type: textarea
id: extra
attributes:
label: Extra Notes
description: |
Do you have any extra notes that can help solve the issue that does not fit any other field?
placeholder: |
None
validations:
required: false
- type: textarea
id: commit
attributes:
label: AC rev. hash/commit
description: |
Copy the result of the `.server debug` command (if you need to run it from the client get a prat addon)
validations:
required: true
- type: input
id: os
attributes:
label: Operating system
description: |
The Operating System the Server is running on.
i.e. Windows 11 x64, Debian 10 x64, macOS 12, Ubuntu 20.04
validations:
required: true
- type: textarea
id: custom
attributes:
label: Custom changes or Modules
description: |
List which custom changes or modules you have applied, i.e. Eluna module, etc.
placeholder: |
None
validations:
required: false

View File

@@ -0,0 +1,33 @@
name: Feature request
description: Suggest an idea for this project
title: "Feature: "
body:
- type: markdown
attributes:
value: |
Thank you for taking your time to fill out a feature request. Remember to fill out all fields including the title above.
An issue that is not properly filled out will be closed.
- type: textarea
id: description
attributes:
label: Describe your feature request or suggestion in detail
description: |
A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe a possible solution to your feature or suggestion in detail
description: |
A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional context
description: |
Add any other context or screenshots about the feature request here.
validations:
required: false

View File

@@ -1,7 +1,10 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
- Latest build status with azerothcore: [![Build Status](https://travis-ci.org/azerothcore/mod-guildhouse.svg?branch=master)](https://travis-ci.org/azerothcore/mod-guildhouse)
# Guild House Module
- Latest build status with azerothcore:
[![Build Status](https://travis-ci.org/azerothcore/mod-guildhouse.svg)](https://travis-ci.org/azerothcore/mod-guildhouse)
# Guild House Module
## Important notes
@@ -10,19 +13,20 @@ You have to use at least AzerothCore commit [77f1363](https://github.com/azeroth
## Description
This is a phased guild house system for AzerothCore, it allows players from the same guild to visit their guild house.
All guilds will get their own phasing system and then the guild master can purchase NPC creatures and other stuff to complete the Guild House.
### Purchasables
* Class Trainers (all available in Wrath)
* Primary Profession Trainers (all available in Wrath)
* Secondary Profession Trainers (all available in Wrath)
* Vendors: Reagents Vendor, Food & Drink, Trade Goods, Ammo & Repair Vendor, and Poisons Vendor
* Portals to Neutral, Horde and Alliance cities
* Spirit Healer
* Guild Bank and Personal Bank access
* Auctioneer/Neutral Auctioneer
* Stable Master
- Class Trainers (all available in Wrath)
- Primary Profession Trainers (all available in Wrath)
- Secondary Profession Trainers (all available in Wrath)
- Vendors: Reagents Vendor, Food & Drink, Trade Goods, Ammo & Repair Vendor, and Poisons Vendor
- Portals to Neutral, Horde and Alliance cities
- Spirit Healer
- Guild Bank and Personal Bank access
- Auctioneer/Neutral Auctioneer
- Stable Master
## How to use ingame
@@ -36,8 +40,7 @@ All guilds will get their own phasing system and then the guild master can purch
```
1) Place the module under the `modules` directory of your AzerothCore source.
2) Import the SQL files manually to the right Database (auth, world or characters)
3) Re-run cmake and launch a clean build of AzerothCore.
2) Re-run cmake and launch a clean build of AzerothCore.
```
## Edit module configuration (optional)
@@ -46,10 +49,10 @@ If you need to change the module configuration, go to your server configuration
## Credits
* [Talamortis](https://github.com/talamortis) (Original author of the module)
* [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support
* [rbedfordpro](https://github.com/rbedfordpro) & [WiZZy](https://github.com/wizzymore)
* [Nelnamara - Porkserver](https://github.com/Porkserver) & [SoulSeekkor](https://github.com/SoulSeekkor) 2022 rework, crash fixes and new additions
* [Bogir](https://github.com/Bogir) For being amazing and forever helpful
- [Talamortis](https://github.com/talamortis) (Original author of the module)
- [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support
- [rbedfordpro](https://github.com/rbedfordpro) & [WiZZy](https://github.com/wizzymore)
- [Nelnamara - Porkserver](https://github.com/Porkserver) & [SoulSeekkor](https://github.com/SoulSeekkor) 2022 rework, crash fixes and new additions
- [Bogir](https://github.com/Bogir) For being amazing and forever helpful
AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/64FH6Y8)

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
#
# CUSTOM
#
DB_CHARACTERS_CUSTOM_PATHS+=(
$MOD_GUILDHOUSE_ROOT"/sql/characters/"
)
DB_WORLD_CUSTOM_PATHS+=(
$MOD_GUILDHOUSE_ROOT"/sql/world/"
)

View File

View File

@@ -1,9 +0,0 @@
#!/usr/bin/env bash
MOD_GUILDHOUSE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
source $MOD_GUILDHOUSE_ROOT"/conf/conf.sh.dist"
if [ -f $MOD_GUILDHOUSE_ROOT"/conf/conf.sh" ]; then
source $MOD_GUILDHOUSE_ROOT"/conf/conf.sh"
fi

25
pull_request_template.md Normal file
View File

@@ -0,0 +1,25 @@
<!-- First of all, THANK YOU for your contribution. -->
## Changes Proposed:
-
-
## Issues Addressed:
<!-- If your fix has a relating issue, link it below -->
- Closes
## SOURCE:
<!-- If you can, include a source that can strengthen your claim -->
## Tests Performed:
<!-- Does it build without errors? Did you test in-game? What did you test? On which OS did you test? Describe any other tests performed -->
-
-
## How to Test the Changes:
<!-- Describe in a detailed step-by-step order how to test the changes -->
1.
2.
3.

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env bash
## Set a local git commit template
git config --local commit.template ".git_commit_template.txt" ;

View File

@@ -1,24 +0,0 @@
# BEST PRACTICES
## Create a new table
**Example:**
```
CREATE TABLE IF NOT EXISTS `table`(
`id` int(11) unsigned NOT NULL,
`active` BOOLEAN DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```
**Boolean datatype in mysql:**
Use "TinyInt(1)"" or "Boolean" (this is the same thing)
"bit(1)" can also work, but it may require a syntax like b'(0) and b'(1) when inserting (not sure).
If there are multiple booleans in the same table, bit(1) is better, otherwise it's the same result.
## Resources
https://www.w3schools.com/sql/sql_datatypes.asp

View File

@@ -1,7 +1,8 @@
void AddGuildHouseScripts();
void AddGuildHouseButlerScripts();
void Addmod_guildhouseScripts() {
void Addmod_guildhouseScripts()
{
AddGuildHouseScripts();
AddGuildHouseButlerScripts();
}

View File

@@ -33,17 +33,17 @@ class GuildHelper : public GuildScript
public:
GuildHelper() : GuildScript("GuildHelper") {}
void OnCreate(Guild *, Player *leader, const std::string &)
void OnCreate(Guild* /*guild*/, Player* leader, const std::string& /*name*/)
{
ChatHandler(leader->GetSession()).PSendSysMessage("You now own a guild. You can purchase a Guild House!");
}
uint32 GetGuildPhase(Guild *guild)
uint32 GetGuildPhase(Guild* guild)
{
return guild->GetId() + 10;
}
void OnDisband(Guild *guild)
void OnDisband(Guild* guild)
{
if (RemoveGuildHouse(guild))
@@ -56,29 +56,28 @@ public:
}
}
bool RemoveGuildHouse(Guild *guild)
bool RemoveGuildHouse(Guild* guild)
{
uint32 guildPhase = GetGuildPhase(guild);
QueryResult CreatureResult;
QueryResult GameobjResult;
// Lets find all of the gameobjects to be removed
GameobjResult = WorldDatabase.Query("SELECT `guid` FROM `gameobject` WHERE `map` = 1 AND `phaseMask` = '{}'", guildPhase);
GameobjResult = WorldDatabase.Query("SELECT `guid` FROM `gameobject` WHERE `map`=1 AND `phaseMask`={}", guildPhase);
// Lets find all of the creatures to be removed
CreatureResult = WorldDatabase.Query("SELECT `guid` FROM `creature` WHERE `map` = 1 AND `phaseMask` = '{}'", guildPhase);
CreatureResult = WorldDatabase.Query("SELECT `guid` FROM `creature` WHERE `map`=1 AND `phaseMask`={}", guildPhase);
Map *map = sMapMgr->FindMap(1, 0);
Map* map = sMapMgr->FindMap(1, 0);
// Remove creatures from the deleted guild house map
if (CreatureResult)
{
do
{
Field *fields = CreatureResult->Fetch();
Field* fields = CreatureResult->Fetch();
uint32 lowguid = fields[0].Get<int32>();
if (CreatureData const *cr_data = sObjectMgr->GetCreatureData(lowguid))
if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
{
if (Creature *creature = map->GetCreature(ObjectGuid::Create<HighGuid::Unit>(cr_data->id1, lowguid)))
if (Creature* creature = map->GetCreature(ObjectGuid::Create<HighGuid::Unit>(cr_data->id1, lowguid)))
{
creature->CombatStop();
creature->DeleteFromDB();
@@ -95,9 +94,9 @@ public:
{
Field *fields = GameobjResult->Fetch();
uint32 lowguid = fields[0].Get<int32>();
if (GameObjectData const *go_data = sObjectMgr->GetGameObjectData(lowguid))
if (GameObjectData const* go_data = sObjectMgr->GetGameObjectData(lowguid))
{
if (GameObject *gobject = map->GetGameObject(ObjectGuid::Create<HighGuid::GameObject>(go_data->id, lowguid)))
if (GameObject* gobject = map->GetGameObject(ObjectGuid::Create<HighGuid::GameObject>(go_data->id, lowguid)))
{
gobject->SetRespawnTime(0);
gobject->Delete();
@@ -111,7 +110,7 @@ public:
}
// Delete actual guild_house data from characters database
CharacterDatabase.Query("DELETE FROM `guild_house` WHERE `guild` = '{}'", guild->GetId());
CharacterDatabase.Query("DELETE FROM `guild_house` WHERE `guild`={}", guild->GetId());
return true;
}
@@ -121,27 +120,24 @@ class GuildHouseSeller : public CreatureScript
{
public:
GuildHouseSeller() : CreatureScript("GuildHouseSeller")
{
}
GuildHouseSeller() : CreatureScript("GuildHouseSeller") {}
struct GuildHouseSellerAI : public ScriptedAI
{
GuildHouseSellerAI(Creature *creature) : ScriptedAI(creature) {}
GuildHouseSellerAI(Creature* creature) : ScriptedAI(creature) {}
void UpdateAI(uint32 /* diff */) override
void UpdateAI(uint32 /*diff*/) override
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
};
CreatureAI *
GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature* creature) const override
{
return new GuildHouseSellerAI(creature);
}
bool OnGossipHello(Player *player, Creature *creature) override
bool OnGossipHello(Player* player, Creature* creature) override
{
if (!player->GetGuild())
{
@@ -158,8 +154,8 @@ public:
AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1);
// Only show "Sell" option if they have a guild house & have permission to sell it
Guild *guild = sGuildMgr->GetGuildById(player->GetGuildId());
Guild::Member const *memberMe = guild->GetMember(player->GetGUID());
Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId());
Guild::Member const* memberMe = guild->GetMember(player->GetGUID());
if (memberMe->IsRankNotLower(sConfigMgr->GetOption<int32>("GuildHouseSellRank", 0)))
{
AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild House?", 0, false);
@@ -179,7 +175,7 @@ public:
return true;
}
bool OnGossipSelect(Player *player, Creature *m_creature, uint32, uint32 action) override
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
uint32 map;
float posX;
@@ -200,11 +196,11 @@ public:
CloseGossipMenuFor(player);
break;
case 4: // --- MORE TO COME ---
BuyGuildHouse(player->GetGuild(), player, m_creature);
BuyGuildHouse(player->GetGuild(), player, creature);
break;
case 3: // sell back guild house
{
QueryResult has_gh = CharacterDatabase.Query("SELECT id, `guild` FROM `guild_house` WHERE guild = {}", player->GetGuildId());
QueryResult has_gh = CharacterDatabase.Query("SELECT id, `guild` FROM `guild_house` WHERE guild={}", player->GetGuildId());
if (!has_gh)
{
ChatHandler(player->GetSession()).PSendSysMessage("Your guild does not own a Guild House!");
@@ -229,10 +225,10 @@ public:
break;
}
case 2: // buy guild house
BuyGuildHouse(player->GetGuild(), player, m_creature);
BuyGuildHouse(player->GetGuild(), player, creature);
break;
case 1: // teleport to guild house
TeleportGuildHouse(player->GetGuild(), player, m_creature);
TeleportGuildHouse(player->GetGuild(), player, creature);
break;
}
@@ -255,12 +251,12 @@ public:
return true;
}
uint32 GetGuildPhase(Player *player)
uint32 GetGuildPhase(Player* player)
{
return player->GetGuildId() + 10;
}
bool RemoveGuildHouse(Player *player)
bool RemoveGuildHouse(Player* player)
{
uint32 guildPhase = GetGuildPhase(player);
@@ -277,11 +273,11 @@ public:
{
do
{
Field *fields = CreatureResult->Fetch();
Field* fields = CreatureResult->Fetch();
uint32 lowguid = fields[0].Get<uint32>();
if (CreatureData const *cr_data = sObjectMgr->GetCreatureData(lowguid))
if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
{
if (Creature *creature = map->GetCreature(ObjectGuid::Create<HighGuid::Unit>(cr_data->id1, lowguid)))
if (Creature* creature = map->GetCreature(ObjectGuid::Create<HighGuid::Unit>(cr_data->id1, lowguid)))
{
creature->CombatStop();
creature->DeleteFromDB();
@@ -296,11 +292,11 @@ public:
{
do
{
Field *fields = GameobjResult->Fetch();
Field* fields = GameobjResult->Fetch();
uint32 lowguid = fields[0].Get<uint32>();
if (GameObjectData const *go_data = sObjectMgr->GetGameObjectData(lowguid))
if (GameObjectData const* go_data = sObjectMgr->GetGameObjectData(lowguid))
{
if (GameObject *gobject = map->GetGameObject(ObjectGuid::Create<HighGuid::GameObject>(go_data->id, lowguid)))
if (GameObject* gobject = map->GetGameObject(ObjectGuid::Create<HighGuid::GameObject>(go_data->id, lowguid)))
{
gobject->SetRespawnTime(0);
gobject->Delete();
@@ -314,12 +310,12 @@ public:
}
// Delete actual guild_house data from characters database
CharacterDatabase.Query("DELETE FROM `guild_house` WHERE `guild` = '{}'", player->GetGuildId());
CharacterDatabase.Query("DELETE FROM `guild_house` WHERE `guild`={}", player->GetGuildId());
return true;
}
void SpawnStarterPortal(Player *player)
void SpawnStarterPortal(Player* player)
{
uint32 entry = 0;
@@ -328,7 +324,7 @@ public:
float posZ;
float ori;
Map *map = sMapMgr->FindMap(1, 0);
Map* map = sMapMgr->FindMap(1, 0);
if (player->GetTeamId() == TEAM_ALLIANCE)
{
@@ -347,7 +343,7 @@ public:
return;
}
QueryResult result = WorldDatabase.Query("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = {}", entry);
QueryResult result = WorldDatabase.Query("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry`={}", entry);
if (!result)
{
@@ -357,7 +353,7 @@ public:
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
posX = fields[0].Get<float>();
posY = fields[1].Get<float>();
posZ = fields[2].Get<float>();
@@ -372,7 +368,7 @@ public:
return;
}
const GameObjectTemplate *objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
if (!objectInfo)
{
@@ -386,7 +382,7 @@ public:
return;
}
GameObject *object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject();
GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject();
ObjectGuid::LowType guidLow = player->GetMap()->GenerateLowGuid<HighGuid::GameObject>();
if (!object->Create(guidLow, objectInfo->entry, map, GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY))
@@ -416,7 +412,7 @@ public:
CloseGossipMenuFor(player);
}
void SpawnButlerNPC(Player *player)
void SpawnButlerNPC(Player* player)
{
uint32 entry = 500031;
float posX = 16202.185547f;
@@ -424,7 +420,7 @@ public:
float posZ = 21.160221f;
float ori = 6.195375f;
Map *map = sMapMgr->FindMap(1, 0);
Map* map = sMapMgr->FindMap(1, 0);
Creature *creature = new Creature();
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, player->GetPhaseMaskForSpawn(), entry, 0, posX, posY, posZ, ori))
@@ -448,9 +444,9 @@ public:
return;
}
bool BuyGuildHouse(Guild *guild, Player *player, Creature *creature)
bool BuyGuildHouse(Guild* guild, Player* player, Creature* creature)
{
QueryResult result = CharacterDatabase.Query("SELECT `id`, `guild` FROM guild_house WHERE `guild` = {}", guild->GetId());
QueryResult result = CharacterDatabase.Query("SELECT `id`, `guild` FROM `guild_house` WHERE `guild`={}", guild->GetId());
if (result)
{
@@ -467,10 +463,10 @@ public:
return true;
}
void TeleportGuildHouse(Guild *guild, Player *player, Creature *creature)
void TeleportGuildHouse(Guild* guild, Player* player, Creature* creature)
{
GuildData *guildData = player->CustomData.GetDefault<GuildData>("phase");
QueryResult result = CharacterDatabase.Query("SELECT `phase`, `map`,`positionX`, `positionY`, `positionZ`, `orientation` FROM guild_house WHERE `guild` = {}", guild->GetId());
GuildData* guildData = player->CustomData.GetDefault<GuildData>("phase");
QueryResult result = CharacterDatabase.Query("SELECT `phase`, `map`,`positionX`, `positionY`, `positionZ`, `orientation` FROM `guild_house` WHERE `guild`={}", guild->GetId());
if (!result)
{
@@ -492,7 +488,7 @@ public:
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
guildData->phase = fields[0].Get<uint32>();
uint32 map = fields[1].Get<uint32>();
guildData->posX = fields[2].Get<float>();
@@ -511,12 +507,12 @@ class GuildHousePlayerScript : public PlayerScript
public:
GuildHousePlayerScript() : PlayerScript("GuildHousePlayerScript") {}
void OnLogin(Player *player)
void OnLogin(Player* player)
{
CheckPlayer(player);
}
void OnUpdateZone(Player *player, uint32 newZone, uint32 /*newArea*/)
void OnUpdateZone(Player* player, uint32 newZone, uint32 /*newArea*/)
{
if (newZone == 876)
CheckPlayer(player);
@@ -524,26 +520,26 @@ public:
player->SetPhaseMask(GetNormalPhase(player), true);
}
bool OnBeforeTeleport(Player *player, uint32 mapid, float x, float y, float z, float orientation, uint32 options, Unit *target)
{
(void)mapid;
(void)x;
(void)y;
(void)z;
(void)orientation;
(void)options;
(void)target;
bool OnBeforeTeleport(Player* player, uint32 mapid, float x, float y, float z, float orientation, uint32 options, Unit* target)
{
(void)mapid;
(void)x;
(void)y;
(void)z;
(void)orientation;
(void)options;
(void)target;
if (player->GetZoneId() == 876 && player->GetAreaId() == 876) // GM Island
{
// Remove the rested state when teleporting from the guild house
player->RemoveRestState();
}
return true;
}
{
// Remove the rested state when teleporting from the guild house
player->RemoveRestState();
}
uint32 GetNormalPhase(Player *player) const
return true;
}
uint32 GetNormalPhase(Player* player) const
{
if (player->IsGameMaster())
return PHASEMASK_ANYWHERE;
@@ -555,9 +551,9 @@ public:
return phase;
}
void CheckPlayer(Player *player)
void CheckPlayer(Player* player)
{
GuildData *guildData = player->CustomData.GetDefault<GuildData>("phase");
GuildData* guildData = player->CustomData.GetDefault<GuildData>("phase");
QueryResult result = CharacterDatabase.Query("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ`, `orientation` FROM guild_house WHERE `guild` = {}", player->GetGuildId());
if (result)
@@ -580,9 +576,9 @@ public:
if (player->GetZoneId() == 876 && player->GetAreaId() == 876) // GM Island
{
// Set the guild house as a rested area
player->SetRestState(0);
// Set the guild house as a rested area
player->SetRestState(0);
// If player is not in a guild he doesnt have a guild house teleport away
// TODO: What if they are in a guild, but somehow are in the wrong phaseMask and seeing someone else's area?
@@ -592,13 +588,14 @@ public:
teleportToDefault(player);
return;
}
player->SetPhaseMask(guildData->phase, true);
}
else
player->SetPhaseMask(GetNormalPhase(player), true);
}
void teleportToDefault(Player *player)
void teleportToDefault(Player* player)
{
if (player->GetTeamId() == TEAM_ALLIANCE)
player->TeleportTo(0, -8833.379883f, 628.627991f, 94.006599f, 1.0f);
@@ -617,28 +614,30 @@ public:
ChatCommandTable GetCommands() const override
{
static ChatCommandTable GuildHouseCommandTable =
{
{"teleport", HandleGuildHouseTeleCommand, SEC_PLAYER, Console::Yes},
{"butler", HandleSpawnButlerCommand, SEC_PLAYER, Console::Yes},
};
{
{"teleport", HandleGuildHouseTeleCommand, SEC_PLAYER, Console::Yes},
{"butler", HandleSpawnButlerCommand, SEC_PLAYER, Console::Yes},
};
static ChatCommandTable GuildHouseCommandBaseTable =
{
{"guildhouse", GuildHouseCommandTable},
{"gh", GuildHouseCommandTable}};
{
{"guildhouse", GuildHouseCommandTable},
{"gh", GuildHouseCommandTable}
};
return GuildHouseCommandBaseTable;
}
static uint32 GetGuildPhase(Player *player)
static uint32 GetGuildPhase(Player* player)
{
return player->GetGuildId() + 10;
}
static bool HandleSpawnButlerCommand(ChatHandler *handler)
static bool HandleSpawnButlerCommand(ChatHandler* handler)
{
Player *player = handler->GetSession()->GetPlayer();
Map *map = player->GetMap();
Player* player = handler->GetSession()->GetPlayer();
Map* map = player->GetMap();
if (!player->GetGuild() || (player->GetGuild()->GetLeaderGUID() != player->GetGUID()))
{
handler->SendSysMessage("You must be the Guild Master of a guild to use this command!");
@@ -665,7 +664,7 @@ public:
float posZ = 21.160221f;
float ori = 6.195375f;
Creature *creature = new Creature();
Creature* creature = new Creature();
if (!creature->Create(map->GenerateLowGuid<HighGuid::Unit>(), map, GetGuildPhase(player), 500031, 0, posX, posY, posZ, ori))
{
handler->SendSysMessage("You already have the Guild House Butler!");
@@ -691,9 +690,9 @@ public:
return true;
}
static bool HandleGuildHouseTeleCommand(ChatHandler *handler)
static bool HandleGuildHouseTeleCommand(ChatHandler* handler)
{
Player *player = handler->GetSession()->GetPlayer();
Player* player = handler->GetSession()->GetPlayer();
if (!player)
return false;
@@ -705,8 +704,8 @@ public:
return false;
}
GuildData *guildData = player->CustomData.GetDefault<GuildData>("phase");
QueryResult result = CharacterDatabase.Query("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ`, `orientation` FROM guild_house WHERE `guild` = {}", player->GetGuildId());
GuildData* guildData = player->CustomData.GetDefault<GuildData>("phase");
QueryResult result = CharacterDatabase.Query("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ`, `orientation` FROM `guild_house` WHERE `guild`={}", player->GetGuildId());
if (!result)
{
@@ -717,8 +716,7 @@ public:
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
// uint32 id = fields[0].Get<uint32>(); // fix for travis
// uint32 guild = fields[1].Get<uint32>(); // fix for travis
guildData->phase = fields[2].Get<uint32>();
@@ -741,7 +739,7 @@ class GuildHouseGlobal : public GlobalScript
public:
GuildHouseGlobal() : GlobalScript("GuildHouseGlobal") {}
void OnBeforeWorldObjectSetPhaseMask(WorldObject const *worldObject, uint32 & /*oldPhaseMask*/, uint32 & /*newPhaseMask*/, bool &useCombinedPhases, bool & /*update*/) override
void OnBeforeWorldObjectSetPhaseMask(WorldObject const* worldObject, uint32 & /*oldPhaseMask*/, uint32 & /*newPhaseMask*/, bool &useCombinedPhases, bool & /*update*/) override
{
if (worldObject->GetZoneId() == 876)
useCombinedPhases = false;

View File

@@ -24,27 +24,26 @@ public:
struct GuildHouseSpawnerAI : public ScriptedAI
{
GuildHouseSpawnerAI(Creature *creature) : ScriptedAI(creature) {}
GuildHouseSpawnerAI(Creature* creature) : ScriptedAI(creature) {}
void UpdateAI(uint32 /* diff */) override
void UpdateAI(uint32 /*diff*/) override
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
};
CreatureAI *
GetAI(Creature *creature) const override
CreatureAI* GetAI(Creature *creature) const override
{
return new GuildHouseSpawnerAI(creature);
}
bool OnGossipHello(Player *player, Creature *creature) override
bool OnGossipHello(Player* player, Creature* creature) override
{
if (player->GetGuild())
{
Guild *guild = sGuildMgr->GetGuildById(player->GetGuildId());
Guild::Member const *memberMe = guild->GetMember(player->GetGUID());
Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId());
Guild::Member const* memberMe = guild->GetMember(player->GetGUID());
if (!memberMe->IsRankNotLower(GuildHouseBuyRank))
{
ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make Guild House purchases.");
@@ -74,7 +73,7 @@ public:
return true;
}
bool OnGossipSelect(Player *player, Creature *m_creature, uint32, uint32 action) override
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
switch (action)
@@ -92,7 +91,7 @@ public:
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Warlock", GOSSIP_SENDER_MAIN, 26331, "Spawn Warlock Trainer?", GuildHouseTrainer, false);
AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Warrior", GOSSIP_SENDER_MAIN, 26332, "Spawn Warrior Trainer?", GuildHouseTrainer, false);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID());
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
break;
case 3: // Vendors
ClearGossipMenuFor(player);
@@ -103,7 +102,7 @@ public:
AddGossipItemFor(player, GOSSIP_ICON_TALK, "Ammo & Repair Vendor", GOSSIP_SENDER_MAIN, 29493, "Spawn Ammo & Repair Vendor?", GuildHouseVendor, false);
AddGossipItemFor(player, GOSSIP_ICON_TALK, "Poisons Vendor", GOSSIP_SENDER_MAIN, 2622, "Spawn Poisons Vendor?", GuildHouseVendor, false);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID());
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
break;
case 4: // Objects & Portals
ClearGossipMenuFor(player);
@@ -132,7 +131,7 @@ public:
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 500009, "Add Dalaran Portal?", GuildHousePortal, false);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID());
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
break;
case 6: // Auctioneer
{
@@ -172,7 +171,7 @@ public:
}
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID());
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
break;
case 8: // Secondary Profession Trainers
ClearGossipMenuFor(player);
@@ -180,10 +179,10 @@ public:
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 2834, "Spawn Fishing Trainer?", GuildHouseProf, false);
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 19185, "Spawn Cooking Trainer?", GuildHouseProf, false);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID());
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
break;
case 9: // Go back!
OnGossipHello(player, m_creature);
OnGossipHello(player, creature);
break;
case 10: // PVP toggle
break;
@@ -271,12 +270,12 @@ public:
return true;
}
uint32 GetGuildPhase(Player *player)
uint32 GetGuildPhase(Player* player)
{
return player->GetGuildId() + 10;
}
void SpawnNPC(uint32 entry, Player *player)
void SpawnNPC(uint32 entry, Player* player)
{
if (player->FindNearestCreature(entry, VISIBILITY_RANGE, true))
{
@@ -290,14 +289,14 @@ public:
float posZ;
float ori;
QueryResult result = WorldDatabase.Query("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = {}", entry);
QueryResult result = WorldDatabase.Query("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry`={}", entry);
if (!result)
return;
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
posX = fields[0].Get<float>();
posY = fields[1].Get<float>();
posZ = fields[2].Get<float>();
@@ -305,7 +304,7 @@ public:
} while (result->NextRow());
Creature *creature = new Creature();
Creature* creature = new Creature();
if (!creature->Create(player->GetMap()->GenerateLowGuid<HighGuid::Unit>(), player->GetMap(), GetGuildPhase(player), entry, 0, posX, posY, posZ, ori))
{
@@ -329,7 +328,7 @@ public:
CloseGossipMenuFor(player);
}
void SpawnObject(uint32 entry, Player *player)
void SpawnObject(uint32 entry, Player* player)
{
if (player->FindNearestGameObject(entry, VISIBLE_RANGE))
{
@@ -343,14 +342,14 @@ public:
float posZ;
float ori;
QueryResult result = WorldDatabase.Query("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = {}", entry);
QueryResult result = WorldDatabase.Query("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry`={}", entry);
if (!result)
return;
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
posX = fields[0].Get<float>();
posY = fields[1].Get<float>();
posZ = fields[2].Get<float>();
@@ -362,7 +361,7 @@ public:
if (!objectId)
return;
const GameObjectTemplate *objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
if (!objectInfo)
return;
@@ -370,7 +369,7 @@ public:
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
return;
GameObject *object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject();
GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject();
ObjectGuid::LowType guidLow = player->GetMap()->GenerateLowGuid<HighGuid::GameObject>();
if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY))