Skip to content

Commit

Permalink
Merge pull request #29 from SargeroDeV/main
Browse files Browse the repository at this point in the history
Core&DB: Fix this commit b369cb5
  • Loading branch information
Nexon99 authored Mar 27, 2022
2 parents 38f05f7 + 583392e commit e07abd1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 113 deletions.
6 changes: 6 additions & 0 deletions sql/updates/characters/2022_03_26_00_vulpera_fix_spell.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALTER TABLE `characters`
ADD COLUMN `camp_x` float NULL DEFAULT NULL AFTER `numRespecs`,
ADD COLUMN `camp_y` float NULL DEFAULT NULL AFTER `camp_x`,
ADD COLUMN `camp_z` float NULL DEFAULT NULL AFTER `camp_y`,
ADD COLUMN `camp_o` float NULL DEFAULT NULL AFTER `camp_z`,
ADD COLUMN `camp_mapid` smallint(5) NULL DEFAULT NULL AFTER `camp_o`;
5 changes: 5 additions & 0 deletions sql/updates/world/2022_03_26_01_spells_fix.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (312372,312370);
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(312372, 'spell_back_camp'),
(312370, 'spell_make_camp');

18 changes: 8 additions & 10 deletions src/server/database/Database/Implementation/CharacterDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"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, "
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
"health, power1, power2, power3, power4, power5, power6, instance_id, activeTalentGroup, lootSpecId, exploredZones, knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, xpRate, fishingSteps, "
"honor, honorLevel, honorRestState, honorRestBonus, numRespecs, camp_x, camp_y, camp_mapid "
"honor, honorLevel, honorRestState, honorRestBonus, numRespecs, camp_x, camp_y, camp_z, camp_o, camp_mapid "
"FROM characters c LEFT JOIN character_fishingsteps cfs ON c.guid = cfs.guid WHERE c.guid = ?", CONNECTION_ASYNC);

PrepareStatement(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_BOTH);
Expand Down Expand Up @@ -540,15 +540,13 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID, "SELECT guid FROM characters WHERE account = ?", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_CHAR_PINFO, "SELECT totaltime, level, money, account, race, class, map, zone, gender, health, playerFlags FROM characters WHERE guid = ?", CONNECTION_SYNCH);
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);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP, "UPDATE characters SET camp_x = ?, camp_y = ?, camp_z = ?, camp_o = ?, camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_X, "UPDATE characters SET camp_x = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Y, "UPDATE characters SET camp_y = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Z, "UPDATE characters SET camp_z = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_MAPID, "UPDATE characters SET camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_CHARACTER_CAMP, "SELECT camp_x, camp_y, camp_z, camp_o, camp_mapid FROM characters WHERE guid = ?", CONNECTION_SYNCH);



PrepareStatement(CHAR_UPD_CHARACTER_CAMP, "UPDATE characters SET camp_x = ?, camp_y = ?, camp_z = ?, camp_o = ?, camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_X, "UPDATE characters SET camp_x = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Y, "UPDATE characters SET camp_y = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_Z, "UPDATE characters SET camp_z = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_O, "UPDATE characters SET camp_o = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_UPD_CHARACTER_CAMP_MAPID, "UPDATE characters SET camp_mapid = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_CHARACTER_CAMP, "SELECT camp_x, camp_y, camp_z, camp_o, camp_mapid FROM characters WHERE guid = ?", CONNECTION_SYNCH);
//0: lowGUID
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);
//0: lowGUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ enum CharacterDatabaseStatements : uint32
CHAR_UPD_CHARACTER_CAMP_X,
CHAR_UPD_CHARACTER_CAMP_Y,
CHAR_UPD_CHARACTER_CAMP_Z,
CHAR_UPD_CHARACTER_CAMP_O,
CHAR_UPD_CHARACTER_CAMP_MAPID,
CHAR_SEL_CHARACTER_CAMP,

Expand Down
143 changes: 40 additions & 103 deletions src/server/scripts/Spells/spell_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,56 +44,14 @@
#include "SpellMgr.h"
#include "SpellScript.h"
#include "Vehicle.h"
#include "AccountMgr.h"
#include "CellImpl.h"
#include "CharacterCache.h"
#include "Chat.h"
#include "CreatureGroups.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
#include "GridNotifiers.h"
#include "Group.h"
#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
#include "IpAddress.h"
#include "IPLocation.h"
#include "Item.h"
#include "Language.h"
#include "LFG.h"
#include "Log.h"
#include "MapManager.h"
#include "MiscPackets.h"
#include "MMapFactory.h"
#include "MovementGenerator.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
#include "PhasingHandler.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "TargetedMovementGenerator.h"
#include "Transport.h"
#include "Weather.h"
#include "WeatherMgr.h"
#include "World.h"
#include "WorldSession.h"
#include "RestMgr.h"



//312372
class spell_back_camp : public SpellScript
{
PrepareSpellScript(spell_back_camp);




void HandleTeleport()
{
Unit* caster = GetCaster();
Expand All @@ -102,7 +60,6 @@ class spell_back_camp : public SpellScript
stmt->setUInt64(0, player->GetGUID().GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);


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

while (caster->GetPositionX() == camp_x) {
while (caster->GetPositionX() == camp_x)
{
uint32 spawntm = 300;
uint32 objectId = atoul("292769");
GameObject* tempGob = gamer->SummonGameObject(objectId, *gamer, QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
Expand All @@ -134,14 +92,8 @@ class spell_back_camp : public SpellScript
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);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
}




}



void Register() override
{
OnCast += SpellCastFn(spell_back_camp::HandleTeleport);
Expand All @@ -154,62 +106,47 @@ class spell_make_camp : public SpellScript
{
PrepareSpellScript(spell_make_camp);



void Oncast()
{
Unit* caster = GetCaster();
float x = caster->GetPositionX();
float y = caster->GetPositionY();
float z = caster->GetPositionZ();
float o = caster->GetOrientation();
int m = caster->GetMapId();
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_CAMP);
stmt->setFloat(0, x);
stmt->setFloat(1, y);
stmt->setFloat(2, z);
stmt->setFloat(3, o);
stmt->setUInt16(4, uint16(m));
stmt->setUInt64(5, caster->GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
// Tente: 292769
// Sac: 276247
// campfire: 301125




Player* gamer = GetCaster()->ToPlayer();
uint32 spawntm = 300;
uint32 objectId = atoul("292769");
GameObject* tempGob = gamer->SummonGameObject(objectId, *gamer, QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());

objectId = atoul("276247");
tempGob = gamer->SummonGameObject(objectId, Position(x + 2.0f, y + 2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());

objectId = atoul("301125");
tempGob = gamer->SummonGameObject(objectId, Position(x + -2.0f, y + -2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());





}
void Oncast()
{
Unit* caster = GetCaster();
float x = caster->GetPositionX();
float y = caster->GetPositionY();
float z = caster->GetPositionZ();
float o = caster->GetOrientation();
int m = caster->GetMapId();
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_CAMP);
stmt->setFloat(0, x);
stmt->setFloat(1, y);
stmt->setFloat(2, z);
stmt->setFloat(3, o);
stmt->setUInt16(4, uint16(m));
stmt->setUInt64(5, caster->GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
// Tente: 292769
// Sac: 276247
// campfire: 301125

void Register() override
{
OnCast += SpellCastFn(spell_make_camp::Oncast);
}
Player* gamer = GetCaster()->ToPlayer();
uint32 spawntm = 300;
uint32 objectId = atoul("292769");
GameObject* tempGob = gamer->SummonGameObject(objectId, *gamer, QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());

objectId = atoul("276247");
tempGob = gamer->SummonGameObject(objectId, Position(x + 2.0f, y + 2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());

objectId = atoul("301125");
tempGob = gamer->SummonGameObject(objectId, Position(x + -2.0f, y + -2.0f, z, o), QuaternionData::fromEulerAnglesZYX(gamer->GetOrientation(), 0.0f, 0.0f), spawntm);
gamer->SetLastTargetedGO(tempGob->GetGUID().GetCounter());
}

void Register() override
{
OnCast += SpellCastFn(spell_make_camp::Oncast);
}
};





class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
{
public:
Expand Down

0 comments on commit e07abd1

Please sign in to comment.