Skip to content

Commit e07abd1

Browse files
authored
Merge pull request #29 from SargeroDeV/main
Core&DB: Fix this commit b369cb5
2 parents 38f05f7 + 583392e commit e07abd1

File tree

5 files changed

+60
-113
lines changed

5 files changed

+60
-113
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ALTER TABLE `characters`
2+
ADD COLUMN `camp_x` float NULL DEFAULT NULL AFTER `numRespecs`,
3+
ADD COLUMN `camp_y` float NULL DEFAULT NULL AFTER `camp_x`,
4+
ADD COLUMN `camp_z` float NULL DEFAULT NULL AFTER `camp_y`,
5+
ADD COLUMN `camp_o` float NULL DEFAULT NULL AFTER `camp_z`,
6+
ADD COLUMN `camp_mapid` smallint(5) NULL DEFAULT NULL AFTER `camp_o`;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
DELETE FROM `spell_script_names` WHERE `spell_id` IN (312372,312370);
2+
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
3+
(312372, 'spell_back_camp'),
4+
(312370, 'spell_make_camp');
5+

src/server/database/Database/Implementation/CharacterDatabase.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
8181
"resettalents_time, primarySpecialization, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, "
8282
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
8383
"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, xpRate, fishingSteps, "
84-
"honor, honorLevel, honorRestState, honorRestBonus, numRespecs, camp_x, camp_y, camp_mapid "
84+
"honor, honorLevel, honorRestState, honorRestBonus, numRespecs, camp_x, camp_y, camp_z, camp_o, camp_mapid "
8585
"FROM characters c LEFT JOIN character_fishingsteps cfs ON c.guid = cfs.guid WHERE c.guid = ?", CONNECTION_ASYNC);
8686

8787
PrepareStatement(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_BOTH);
@@ -540,15 +540,13 @@ void CharacterDatabaseConnection::DoPrepareStatements()
540540
PrepareStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID, "SELECT guid FROM characters WHERE account = ?", CONNECTION_SYNCH);
541541
PrepareStatement(CHAR_SEL_CHAR_PINFO, "SELECT totaltime, level, money, account, race, class, map, zone, gender, health, playerFlags FROM characters WHERE guid = ?", CONNECTION_SYNCH);
542542
PrepareStatement(CHAR_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned WHERE guid = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH);
543-
PrepareStatement(CHAR_UPD_CHARACTER_CAMP, "UPDATE characters SET camp_x = ?, camp_y = ?, camp_z = ?, camp_o = ?, camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
544-
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_X, "UPDATE characters SET camp_x = ? WHERE guid = ?", CONNECTION_ASYNC);
545-
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Y, "UPDATE characters SET camp_y = ? WHERE guid = ?", CONNECTION_ASYNC);
546-
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Z, "UPDATE characters SET camp_z = ? WHERE guid = ?", CONNECTION_ASYNC);
547-
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_MAPID, "UPDATE characters SET camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
548-
PrepareStatement(CHAR_SEL_CHARACTER_CAMP, "SELECT camp_x, camp_y, camp_z, camp_o, camp_mapid FROM characters WHERE guid = ?", CONNECTION_SYNCH);
549-
550-
551-
543+
PrepareStatement(CHAR_UPD_CHARACTER_CAMP, "UPDATE characters SET camp_x = ?, camp_y = ?, camp_z = ?, camp_o = ?, camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
544+
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_X, "UPDATE characters SET camp_x = ? WHERE guid = ?", CONNECTION_ASYNC);
545+
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Y, "UPDATE characters SET camp_y = ? WHERE guid = ?", CONNECTION_ASYNC);
546+
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Z, "UPDATE characters SET camp_z = ? WHERE guid = ?", CONNECTION_ASYNC);
547+
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_O, "UPDATE characters SET camp_o = ? WHERE guid = ?", CONNECTION_ASYNC);
548+
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_MAPID, "UPDATE characters SET camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
549+
PrepareStatement(CHAR_SEL_CHARACTER_CAMP, "SELECT camp_x, camp_y, camp_z, camp_o, camp_mapid FROM characters WHERE guid = ?", CONNECTION_SYNCH);
552550
//0: lowGUID
553551
PrepareStatement(CHAR_SEL_PINFO_MAILS, "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?", CONNECTION_SYNCH);
554552
//0: lowGUID

src/server/database/Database/Implementation/CharacterDatabase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ enum CharacterDatabaseStatements : uint32
427427
CHAR_UPD_CHARACTER_CAMP_X,
428428
CHAR_UPD_CHARACTER_CAMP_Y,
429429
CHAR_UPD_CHARACTER_CAMP_Z,
430+
CHAR_UPD_CHARACTER_CAMP_O,
430431
CHAR_UPD_CHARACTER_CAMP_MAPID,
431432
CHAR_SEL_CHARACTER_CAMP,
432433

src/server/scripts/Spells/spell_generic.cpp

Lines changed: 40 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -44,56 +44,14 @@
4444
#include "SpellMgr.h"
4545
#include "SpellScript.h"
4646
#include "Vehicle.h"
47-
#include "AccountMgr.h"
48-
#include "CellImpl.h"
49-
#include "CharacterCache.h"
50-
#include "Chat.h"
51-
#include "CreatureGroups.h"
5247
#include "DatabaseEnv.h"
53-
#include "DB2Stores.h"
54-
#include "DisableMgr.h"
55-
#include "GridNotifiers.h"
56-
#include "Group.h"
57-
#include "GroupMgr.h"
58-
#include "InstanceSaveMgr.h"
59-
#include "IpAddress.h"
60-
#include "IPLocation.h"
61-
#include "Item.h"
62-
#include "Language.h"
63-
#include "LFG.h"
64-
#include "Log.h"
65-
#include "MapManager.h"
66-
#include "MiscPackets.h"
67-
#include "MMapFactory.h"
68-
#include "MovementGenerator.h"
69-
#include "ObjectAccessor.h"
70-
#include "ObjectMgr.h"
71-
#include "Opcodes.h"
72-
#include "Pet.h"
73-
#include "PhasingHandler.h"
74-
#include "Player.h"
75-
#include "Realm.h"
76-
#include "ScriptMgr.h"
77-
#include "SpellAuras.h"
78-
#include "SpellHistory.h"
79-
#include "SpellMgr.h"
80-
#include "TargetedMovementGenerator.h"
81-
#include "Transport.h"
82-
#include "Weather.h"
83-
#include "WeatherMgr.h"
84-
#include "World.h"
85-
#include "WorldSession.h"
86-
#include "RestMgr.h"
87-
8848

8949

9050
//312372
9151
class spell_back_camp : public SpellScript
9252
{
9353
PrepareSpellScript(spell_back_camp);
94-
95-
96-
54+
9755
void HandleTeleport()
9856
{
9957
Unit* caster = GetCaster();
@@ -102,7 +60,6 @@ class spell_back_camp : public SpellScript
10260
stmt->setUInt64(0, player->GetGUID().GetCounter());
10361
PreparedQueryResult result = CharacterDatabase.Query(stmt);
10462

105-
10663
Field* fields = result->Fetch();
10764
float camp_x = fields[0].GetFloat();
10865
float camp_y = fields[1].GetFloat();
@@ -120,7 +77,8 @@ class spell_back_camp : public SpellScript
12077
// Sac: 276247
12178
// campfire: 301125
12279

123-
while (caster->GetPositionX() == camp_x) {
80+
while (caster->GetPositionX() == camp_x)
81+
{
12482
uint32 spawntm = 300;
12583
uint32 objectId = atoul("292769");
12684
GameObject* tempGob = gamer->SummonGameObject(objectId, *gamer, QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
@@ -134,14 +92,8 @@ class spell_back_camp : public SpellScript
13492
tempGob = gamer->SummonGameObject(objectId, Position(camp_x + -2.0f, camp_y + -2.0f, camp_z, camp_o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
13593
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
13694
}
137-
138-
139-
140-
14195
}
14296

143-
144-
14597
void Register() override
14698
{
14799
OnCast += SpellCastFn(spell_back_camp::HandleTeleport);
@@ -154,62 +106,47 @@ class spell_make_camp : public SpellScript
154106
{
155107
PrepareSpellScript(spell_make_camp);
156108

157-
158-
159-
void Oncast()
160-
{
161-
Unit* caster = GetCaster();
162-
float x = caster->GetPositionX();
163-
float y = caster->GetPositionY();
164-
float z = caster->GetPositionZ();
165-
float o = caster->GetOrientation();
166-
int m = caster->GetMapId();
167-
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_CAMP);
168-
stmt->setFloat(0, x);
169-
stmt->setFloat(1, y);
170-
stmt->setFloat(2, z);
171-
stmt->setFloat(3, o);
172-
stmt->setUInt16(4, uint16(m));
173-
stmt->setUInt64(5, caster->GetGUID().GetCounter());
174-
CharacterDatabase.Execute(stmt);
175-
// Tente: 292769
176-
// Sac: 276247
177-
// campfire: 301125
178-
179-
180-
181-
182-
Player* gamer = GetCaster()->ToPlayer();
183-
uint32 spawntm = 300;
184-
uint32 objectId = atoul("292769");
185-
GameObject* tempGob = gamer->SummonGameObject(objectId, *gamer, QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
186-
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
187-
188-
objectId = atoul("276247");
189-
tempGob = gamer->SummonGameObject(objectId, Position(x + 2.0f, y + 2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
190-
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
191-
192-
objectId = atoul("301125");
193-
tempGob = gamer->SummonGameObject(objectId, Position(x + -2.0f, y + -2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
194-
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
195-
196-
197-
198-
199-
200-
}
109+
void Oncast()
110+
{
111+
Unit* caster = GetCaster();
112+
float x = caster->GetPositionX();
113+
float y = caster->GetPositionY();
114+
float z = caster->GetPositionZ();
115+
float o = caster->GetOrientation();
116+
int m = caster->GetMapId();
117+
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_CAMP);
118+
stmt->setFloat(0, x);
119+
stmt->setFloat(1, y);
120+
stmt->setFloat(2, z);
121+
stmt->setFloat(3, o);
122+
stmt->setUInt16(4, uint16(m));
123+
stmt->setUInt64(5, caster->GetGUID().GetCounter());
124+
CharacterDatabase.Execute(stmt);
125+
// Tente: 292769
126+
// Sac: 276247
127+
// campfire: 301125
201128

202-
void Register() override
203-
{
204-
OnCast += SpellCastFn(spell_make_camp::Oncast);
205-
}
129+
Player* gamer = GetCaster()->ToPlayer();
130+
uint32 spawntm = 300;
131+
uint32 objectId = atoul("292769");
132+
GameObject* tempGob = gamer->SummonGameObject(objectId, *gamer, QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
133+
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
134+
135+
objectId = atoul("276247");
136+
tempGob = gamer->SummonGameObject(objectId, Position(x + 2.0f, y + 2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
137+
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
138+
139+
objectId = atoul("301125");
140+
tempGob = gamer->SummonGameObject(objectId, Position(x + -2.0f, y + -2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
141+
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
142+
}
206143

144+
void Register() override
145+
{
146+
OnCast += SpellCastFn(spell_make_camp::Oncast);
147+
}
207148
};
208149

209-
210-
211-
212-
213150
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
214151
{
215152
public:

0 commit comments

Comments
 (0)