Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Envy602 committed Apr 9, 2012
2 parents d63d96a + abed18d commit c587072
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 169 deletions.
11 changes: 5 additions & 6 deletions src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -297,14 +297,13 @@ void ScriptedAI::DoTeleportTo(const float position[4])


void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o) void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
{ {
if (!unit || unit->GetTypeId() != TYPEID_PLAYER) if (!unit)
{
if (unit)
sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
return; return;
}


CAST_PLR(unit)->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
} }


void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
Expand Down
1 change: 0 additions & 1 deletion src/server/game/CMakeLists.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ set(game_STAT_SRCS
include_directories( include_directories(
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/mersennetwister
${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/SFMT
${CMAKE_SOURCE_DIR}/dep/zlib ${CMAKE_SOURCE_DIR}/dep/zlib
${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision
Expand Down
39 changes: 19 additions & 20 deletions src/server/game/Chat/Commands/Level3.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4593,40 +4593,38 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
{ {
std::string name; std::string name;
Player* player; Player* player;
char *TargetName = strtok((char*)args, " "); //get entered name char* targetName = strtok((char*)args, " "); // Get entered name
if (!TargetName) //if no name entered use target
{
player = getSelectedPlayer();
if (player) //prevent crash with creature as target
name = player->GetName();
}


else // if name entered if (targetName)
{ {
name = TargetName; name = targetName;
normalizePlayerName(name); normalizePlayerName(name);
player = sObjectAccessor->FindPlayerByName(name.c_str()); player = sObjectAccessor->FindPlayerByName(name.c_str());
} }
else // If no name was entered - use target
{
player = getSelectedPlayer();
if (player)
name = player->GetName();
}


//effect
if (player) if (player)
{ {
PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());


//Reset player faction + allow combat + allow duels // Reset player faction + allow combat + allow duels
player->setFactionForRace(player->getRace()); player->setFactionForRace(player->getRace());
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);


//allow movement and spells // Remove Freeze spell (allowing movement and spells)
player->RemoveAurasDueToSpell(9454); player->RemoveAurasDueToSpell(9454);


//save player // Save player
player->SaveToDB(); player->SaveToDB();
} }

else
if (!player)
{ {
if (TargetName) if (targetName)
{ {
// Check for offline players // Check for offline players
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
Expand All @@ -4638,12 +4636,13 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
SendSysMessage(LANG_COMMAND_FREEZE_WRONG); SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
return true; return true;
} }
//if player found: delete his freeze aura
Field* fields=result->Fetch(); // If player found: delete his freeze aura
uint64 pguid = fields[0].GetUInt64(); Field* fields = result->Fetch();
uint32 lowGuid = fields[0].GetUInt32();


stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
stmt->setUInt32(0, pguid); stmt->setUInt32(0, lowGuid);
CharacterDatabase.Execute(stmt); CharacterDatabase.Execute(stmt);


PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@ void ConfusedMovementGenerator<T>::Initialize(T &unit)


if ((is_water && !is_water_ok) || (!is_water && !is_land_ok)) if ((is_water && !is_water_ok) || (!is_water && !is_land_ok))
{ {
//! Ignore bad generated path. Use the current or previous position. //! Cannot use coordinates outside our InhabitType. Use the current or previous position.
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x; wanderX = idx > 0 ? i_waypoints[idx-1][0] : x;
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y; wanderY = idx > 0 ? i_waypoints[idx-1][1] : y;
} }

unit.UpdateAllowedPositionZ(wanderX, wanderY, z);

//! Positions are now fine - apply them to this waypoint
i_waypoints[idx][0] = wanderX;
i_waypoints[idx][1] = wanderY;
i_waypoints[idx][2] = z;
} }
else else
{ {
//! Ignore bad generated path. Use the current or previous position. //! Trying to access path outside line of sight. Skip this by using the current or previous position.
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x; wanderX = idx > 0 ? i_waypoints[idx-1][0] : x;
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y; wanderY = idx > 0 ? i_waypoints[idx-1][1] : y;
} }

unit.UpdateAllowedPositionZ(wanderX, wanderY, z);

//! Positions are fine - apply them to this waypoint
i_waypoints[idx][0] = wanderX;
i_waypoints[idx][1] = wanderY;
i_waypoints[idx][2] = z;
} }


unit.StopMoving(); unit.StopMoving();
Expand Down
1 change: 0 additions & 1 deletion src/server/scripts/CMakeLists.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ include_directories(
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/SFMT
${CMAKE_SOURCE_DIR}/dep/mersennetwister
${CMAKE_SOURCE_DIR}/dep/zlib ${CMAKE_SOURCE_DIR}/dep/zlib
${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/shared/Configuration ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
Expand Down
164 changes: 81 additions & 83 deletions src/server/scripts/Commands/cs_reload.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class reload_commandscript : public CommandScript
continue; continue;
} }


CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry); CreatureTemplate* cInfo = const_cast<CreatureTemplate*>(sObjectMgr->GetCreatureTemplate(entry));
if (!cInfo) if (!cInfo)
{ {
handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry); handler->PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry);
Expand All @@ -435,90 +435,88 @@ class reload_commandscript : public CommandScript


Field* fields = result->Fetch(); Field* fields = result->Fetch();


const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32(); cInfo->DifficultyEntry[0] = fields[0].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32(); cInfo->DifficultyEntry[1] = fields[1].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[2] = fields[2].GetUInt32(); cInfo->DifficultyEntry[2] = fields[2].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->KillCredit[0] = fields[3].GetUInt32(); cInfo->KillCredit[0] = fields[3].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->KillCredit[1] = fields[4].GetUInt32(); cInfo->KillCredit[1] = fields[4].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->Modelid1 = fields[5].GetUInt32(); cInfo->Modelid1 = fields[5].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->Modelid2 = fields[6].GetUInt32(); cInfo->Modelid2 = fields[6].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->Modelid3 = fields[7].GetUInt32(); cInfo->Modelid3 = fields[7].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->Modelid4 = fields[8].GetUInt32(); cInfo->Modelid4 = fields[8].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->Name = fields[9].GetString(); cInfo->Name = fields[9].GetString();
const_cast<CreatureTemplate*>(cInfo)->SubName = fields[10].GetString(); cInfo->SubName = fields[10].GetString();
const_cast<CreatureTemplate*>(cInfo)->IconName = fields[11].GetString(); cInfo->IconName = fields[11].GetString();
const_cast<CreatureTemplate*>(cInfo)->GossipMenuId = fields[12].GetUInt32(); cInfo->GossipMenuId = fields[12].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->minlevel = fields[13].GetUInt32(); cInfo->minlevel = fields[13].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->maxlevel = fields[14].GetUInt32(); cInfo->maxlevel = fields[14].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->expansion = fields[15].GetUInt32(); cInfo->expansion = fields[15].GetUInt16();
const_cast<CreatureTemplate*>(cInfo)->faction_A = fields[16].GetUInt32(); cInfo->faction_A = fields[16].GetUInt16();
const_cast<CreatureTemplate*>(cInfo)->faction_H = fields[17].GetUInt32(); cInfo->faction_H = fields[17].GetUInt16();
const_cast<CreatureTemplate*>(cInfo)->npcflag = fields[18].GetUInt32(); cInfo->npcflag = fields[18].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->speed_walk = fields[19].GetFloat(); cInfo->speed_walk = fields[19].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->speed_run = fields[20].GetFloat(); cInfo->speed_run = fields[20].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->scale = fields[21].GetFloat(); cInfo->scale = fields[21].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->rank = fields[22].GetUInt32(); cInfo->rank = fields[22].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->mindmg = fields[23].GetFloat(); cInfo->mindmg = fields[23].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->maxdmg = fields[24].GetFloat(); cInfo->maxdmg = fields[24].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->dmgschool = fields[25].GetUInt32(); cInfo->dmgschool = fields[25].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->attackpower = fields[26].GetUInt32(); cInfo->attackpower = fields[26].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->dmg_multiplier = fields[27].GetFloat(); cInfo->dmg_multiplier = fields[27].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->baseattacktime = fields[28].GetUInt32(); cInfo->baseattacktime = fields[28].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = fields[29].GetUInt32(); cInfo->rangeattacktime = fields[29].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->unit_class = fields[30].GetUInt32(); cInfo->unit_class = fields[30].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->unit_flags = fields[31].GetUInt32(); cInfo->unit_flags = fields[31].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->dynamicflags = fields[32].GetUInt32(); cInfo->dynamicflags = fields[32].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->family = fields[33].GetUInt32(); cInfo->family = fields[33].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->trainer_type = fields[34].GetUInt32(); cInfo->trainer_type = fields[34].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->trainer_spell = fields[35].GetUInt32(); cInfo->trainer_spell = fields[35].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->trainer_class = fields[36].GetUInt32(); cInfo->trainer_class = fields[36].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->trainer_race = fields[37].GetUInt32(); cInfo->trainer_race = fields[37].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->minrangedmg = fields[38].GetFloat(); cInfo->minrangedmg = fields[38].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->maxrangedmg = fields[39].GetFloat(); cInfo->maxrangedmg = fields[39].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->rangedattackpower = fields[40].GetUInt32(); cInfo->rangedattackpower = fields[40].GetUInt16();
const_cast<CreatureTemplate*>(cInfo)->type = fields[41].GetUInt32(); cInfo->type = fields[41].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->type_flags = fields[42].GetUInt32(); cInfo->type_flags = fields[42].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->lootid = fields[43].GetUInt32(); cInfo->lootid = fields[43].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->pickpocketLootId = fields[44].GetUInt32(); cInfo->pickpocketLootId = fields[44].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->SkinLootId = fields[45].GetUInt32(); cInfo->SkinLootId = fields[45].GetUInt32();


for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{ cInfo->resistance[i] = fields[46 + i -1].GetUInt16();
const_cast<CreatureTemplate*>(cInfo)->resistance[i] = fields[46 + i -1].GetUInt32();
} cInfo->spells[0] = fields[52].GetUInt32();

cInfo->spells[1] = fields[53].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[0] = fields[52].GetUInt32(); cInfo->spells[2] = fields[54].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[1] = fields[53].GetUInt32(); cInfo->spells[3] = fields[55].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[2] = fields[54].GetUInt32(); cInfo->spells[4] = fields[56].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[3] = fields[55].GetUInt32(); cInfo->spells[5] = fields[57].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[4] = fields[56].GetUInt32(); cInfo->spells[6] = fields[58].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[5] = fields[57].GetUInt32(); cInfo->spells[7] = fields[59].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[6] = fields[58].GetUInt32(); cInfo->PetSpellDataId = fields[60].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->spells[7] = fields[59].GetUInt32(); cInfo->VehicleId = fields[61].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->PetSpellDataId = fields[60].GetUInt32(); cInfo->mingold = fields[62].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->VehicleId = fields[61].GetUInt32(); cInfo->maxgold = fields[63].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->mingold = fields[62].GetUInt32(); cInfo->AIName = fields[64].GetString();
const_cast<CreatureTemplate*>(cInfo)->maxgold = fields[63].GetUInt32(); cInfo->MovementType = fields[65].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->AIName = fields[64].GetString(); cInfo->InhabitType = fields[66].GetUInt8();
const_cast<CreatureTemplate*>(cInfo)->MovementType = fields[65].GetUInt32(); cInfo->HoverHeight = fields[67].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->InhabitType = fields[66].GetUInt32(); cInfo->ModHealth = fields[68].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->HoverHeight = fields[67].GetFloat(); cInfo->ModMana = fields[69].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->ModHealth = fields[68].GetFloat(); cInfo->ModArmor = fields[70].GetFloat();
const_cast<CreatureTemplate*>(cInfo)->ModMana = fields[69].GetFloat(); cInfo->RacialLeader = fields[71].GetBool();
const_cast<CreatureTemplate*>(cInfo)->ModArmor = fields[70].GetFloat(); cInfo->questItems[0] = fields[72].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->RacialLeader = fields[71].GetBool(); cInfo->questItems[1] = fields[73].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->questItems[0] = fields[72].GetUInt32(); cInfo->questItems[2] = fields[74].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->questItems[1] = fields[73].GetUInt32(); cInfo->questItems[3] = fields[75].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->questItems[2] = fields[74].GetUInt32(); cInfo->questItems[4] = fields[76].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->questItems[3] = fields[75].GetUInt32(); cInfo->questItems[5] = fields[77].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->questItems[4] = fields[76].GetUInt32(); cInfo->movementId = fields[78].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->questItems[5] = fields[77].GetUInt32(); cInfo->RegenHealth = fields[79].GetBool();
const_cast<CreatureTemplate*>(cInfo)->movementId = fields[78].GetUInt32(); cInfo->equipmentId = fields[80].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->RegenHealth = fields[79].GetBool(); cInfo->MechanicImmuneMask = fields[81].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->equipmentId = fields[80].GetUInt32(); cInfo->flags_extra = fields[82].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->MechanicImmuneMask = fields[81].GetUInt32(); cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString());
const_cast<CreatureTemplate*>(cInfo)->flags_extra = fields[82].GetUInt32();
const_cast<CreatureTemplate*>(cInfo)->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString());


sObjectMgr->CheckCreatureTemplate(cInfo); sObjectMgr->CheckCreatureTemplate(cInfo);
} }
Expand Down
Loading

0 comments on commit c587072

Please sign in to comment.