From de2338c9a4152ba279fea3d33d9916f298e33512 Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Tue, 2 Jun 2009 15:09:38 +0400 Subject: [PATCH 1/2] [7947] Use "NUMERIC" type instead of "BIGINT" in mysql_to_pgsql convertor. --- contrib/mysql_to_pgsql/src/defines.h | 15 +++++++++++++-- src/shared/revision_nr.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/contrib/mysql_to_pgsql/src/defines.h b/contrib/mysql_to_pgsql/src/defines.h index 662a7aab2..ed151bf5f 100644 --- a/contrib/mysql_to_pgsql/src/defines.h +++ b/contrib/mysql_to_pgsql/src/defines.h @@ -89,9 +89,20 @@ string ConvertNativeType(enum_field_types mysqlType, uint32 length) case FIELD_TYPE_INT24: return "integer"; case FIELD_TYPE_LONGLONG: - return "int8"; case FIELD_TYPE_LONG: - return "bigint"; + { + string temp; + char str[10]; + temp = "numeric"; + if (length) + { + temp.append("("); + sprintf(str,"%d",length); + temp.append(str); + temp.append(")"); + } + return temp; + } case FIELD_TYPE_DECIMAL: case FIELD_TYPE_FLOAT: case FIELD_TYPE_DOUBLE: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f9d2a281b..573f1bf0d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7946" + #define REVISION_NR "7947" #endif // __REVISION_NR_H__ From be6e3923d158212f0b147704e59f6591920a9458 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Wed, 3 Jun 2009 15:32:26 +0400 Subject: [PATCH 2/2] [7948] Use SetFaction instead explcit field set, other cleanups. Signed-off-by: VladimirMangos --- src/game/Creature.cpp | 8 ++++---- src/game/Level1.cpp | 2 +- src/game/Pet.cpp | 6 +++--- src/game/SpellAuras.cpp | 12 ++++++------ src/game/SpellEffects.cpp | 14 +++++++------- src/game/Unit.cpp | 2 +- src/shared/revision_nr.h | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 24e4f8da8..0ac9995c9 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -266,9 +266,9 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) SelectLevel(GetCreatureInfo()); if (team == HORDE) - SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_H); + setFaction(GetCreatureInfo()->faction_H); else - SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_A); + setFaction(GetCreatureInfo()->faction_A); SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag); @@ -1501,8 +1501,8 @@ void Creature::setDeathState(DeathState s) if(s == JUST_DIED) { - SetUInt64Value (UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) - SetUInt32Value(UNIT_NPC_FLAGS, 0); + SetUInt64Value(UNIT_FIELD_TARGET,0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) + SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if(!isPet() && GetCreatureInfo()->SkinLootId) if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) ) diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index dff44d6d0..f44561998 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1602,7 +1602,7 @@ bool ChatHandler::HandleModifyMountCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_MOUNT_GIVED, GetNameLink().c_str()); - chr->SetUInt32Value( UNIT_FIELD_FLAGS , 0x001000 ); + chr->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); chr->Mount(mId); WorldPacket data( SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4) ); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 7a2dd0551..78bd87966 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -165,7 +165,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool } setPetType(PetType(fields[18].GetUInt8())); - SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, owner->getFaction()); + setFaction(owner->getFaction()); SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id); CreatureInfo const *cinfo = GetCreatureInfo(); @@ -183,7 +183,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool SetDisplayId(fields[3].GetUInt32()); SetNativeDisplayId(fields[3].GetUInt32()); uint32 petlevel = fields[4].GetUInt32(); - SetUInt32Value(UNIT_NPC_FLAGS, 0); + SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); SetName(fields[8].GetString()); switch (getPetType()) @@ -769,7 +769,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(creature->getLevel())/4); - SetUInt32Value(UNIT_NPC_FLAGS, 0); + SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); if(CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cinfo->family)) SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index e6033a369..eca3292bd 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3068,7 +3068,7 @@ void Aura::HandleModPossess(bool apply, bool Real) if( apply ) { m_target->SetCharmerGUID(GetCasterGUID()); - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction()); + m_target->setFaction(caster->getFaction()); caster->SetCharm(m_target); @@ -3110,7 +3110,7 @@ void Aura::HandleModPossess(bool apply, bool Real) else if(m_target->GetTypeId() == TYPEID_UNIT) { CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A); + m_target->setFaction(cinfo->faction_A); } caster->SetCharm(NULL); @@ -3200,7 +3200,7 @@ void Aura::HandleModCharm(bool apply, bool Real) if( apply ) { m_target->SetCharmerGUID(GetCasterGUID()); - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction()); + m_target->setFaction(caster->getFaction()); m_target->CastStop(m_target == caster ? GetId() : 0); caster->SetCharm(m_target); @@ -3249,12 +3249,12 @@ void Aura::HandleModCharm(bool apply, bool Real) if(((Creature*)m_target)->isPet()) { if(Unit* owner = m_target->GetOwner()) - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, owner->getFaction()); + m_target->setFaction(owner->getFaction()); else if(cinfo) - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A); + m_target->setFaction(cinfo->faction_A); } else if(cinfo) // normal creature - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A); + m_target->setFaction(cinfo->faction_A); // restore UNIT_FIELD_BYTES_0 if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c72564862..dd501c0cd 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3265,9 +3265,9 @@ void Spell::EffectSummon(uint32 i) spawnCreature->SetDuration(duration); spawnCreature->SetOwnerGUID(m_caster->GetGUID()); - spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); + spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); spawnCreature->setPowerType(POWER_MANA); - spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction()); + spawnCreature->setFaction(m_caster->getFaction()); spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); @@ -3699,8 +3699,8 @@ void Spell::EffectSummonGuardian(uint32 i) spawnCreature->SetOwnerGUID(m_caster->GetGUID()); spawnCreature->setPowerType(POWER_MANA); - spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); - spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction()); + spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + spawnCreature->setFaction(m_caster->getFaction()); spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); @@ -4181,8 +4181,8 @@ void Spell::EffectSummonPet(uint32 i) NewSummon->SetOwnerGUID(m_caster->GetGUID()); NewSummon->SetCreatorGUID(m_caster->GetGUID()); - NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0); - NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); + NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + NewSummon->setFaction(faction); NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); @@ -5980,7 +5980,7 @@ void Spell::EffectSummonCritter(uint32 i) critter->SetOwnerGUID(m_caster->GetGUID()); critter->SetCreatorGUID(m_caster->GetGUID()); - critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); + critter->setFaction(m_caster->getFaction()); critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); critter->AIM_Initialize(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index de733feac..3bdb02d9b 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11453,7 +11453,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) pet->SetOwnerGUID(GetGUID()); pet->SetCreatorGUID(GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); + pet->setFaction(getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); if(GetTypeId()==TYPEID_PLAYER) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 573f1bf0d..aad32fbb2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7947" + #define REVISION_NR "7948" #endif // __REVISION_NR_H__