Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Commit

Permalink
Core:
Browse files Browse the repository at this point in the history
* Dropped CreatureGroups.
* Adjusted areas that was missed by proir commits, i hate when i forget to do things.
* Silenced Warnings that get displayed in build with tools,
- til i can get back to fixing them
* Fixed SQL UpdatePack... now theres the option of just using sql updates,
- or  world for Clean installs.

Note~ script_texts needs the allowed range increased.

Conflicts:

	cmake/compiler/msvc/settings.cmake
  • Loading branch information
Bootz committed Mar 19, 2012
1 parent ccb852b commit 77a20d9
Show file tree
Hide file tree
Showing 25 changed files with 233 additions and 1,680 deletions.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -56,4 +56,4 @@ to update your database from an older revision/version can be found in the
database/updates directory.

Our Bug Tracker is located here.
https://github.com/Bootz/SF1/issues
<Disabled...core is in development, this will open when we're given public support>
10 changes: 5 additions & 5 deletions cmake/compiler/msvc/settings.cmake
Expand Up @@ -47,9 +47,9 @@ message(STATUS "MSVC: Disabled POSIX warnings")

# disable warnings in Visual Studio 8 and above if not wanted
if(NOT WITH_WARNINGS)
if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619")
message(STATUS "MSVC: Disabled generic compiletime warnings")
endif()
if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 9")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4820 /wd4986 /wd4514 /wd4710 /wd4668 /wd4365 /wd4005 /wd4640 /wd4242 /wd4711 /wd4738 /wd4625 /wd4626 /wd4061 /wd4100 /wd4265")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4820 /wd4986 /wd4514 /wd4710 /wd4668 /wd4365 /wd4005 /wd4640 /wd4242 /wd4711 /wd4738 /wd4625 /wd4626 /wd4061 /wd4100 /wd4265")
message(STATUS "MSVC: Disabled generic compiletime warnings")
endif()
endif()
2 changes: 1 addition & 1 deletion sql/updates/world/2012_03_12_00_world_version.sql
@@ -1 +1 @@
UPDATE `version` SET `db_version`='SkyFireONE DB Release <1> 2012_03_11' LIMIT 1;
UPDATE `version` SET `db_version`='SkyFireONE DB Release <002> 2012_03_12' LIMIT 1;
766 changes: 0 additions & 766 deletions sql/updates/world/2012_03_12_01_world_skyfire_string.sql

This file was deleted.

2 changes: 1 addition & 1 deletion src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
Expand Up @@ -39,7 +39,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use)
m_CreatureEventAI_TextMap.clear();

// Load EventAI Text
sObjectMgr.LoadTrinityStrings(WorldDatabase, "creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
sObjectMgr.LoadSkyFireStrings(WorldDatabase, "creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);

// Gather Additional data from EventAI Texts
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
Expand Down
1 change: 0 additions & 1 deletion src/server/game/Chat/Chat.cpp
Expand Up @@ -492,7 +492,6 @@ ChatCommand * ChatHandler::getCommandTable()
{ "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL },
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL },
{ "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL },
{ "addgroup", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddGroupCommand, "", NULL },
{ "setlink", SEC_MODERATOR, false, &ChatHandler::HandleNpcSetLinkCommand, "", NULL },

//{ TODO: fix or remove this commands
Expand Down
1 change: 0 additions & 1 deletion src/server/game/Chat/Chat.h
Expand Up @@ -223,7 +223,6 @@ class ChatHandler
bool HandleNpcYellCommand(const char* args);
bool HandleNpcSetDeathStateCommand(const char* args);
bool HandleNpcAddFormationCommand(const char* args);
bool HandleNpcAddGroupCommand(const char* args);
bool HandleNpcSetLinkCommand(const char* args);

//----------------------------------------------------------
Expand Down
208 changes: 18 additions & 190 deletions src/server/game/Chat/Commands/Level2.cpp
Expand Up @@ -38,7 +38,7 @@
#include "PoolHandler.h"
#include "AccountMgr.h"
#include "WaypointManager.h"
#include "CreatureFormations.h"
#include "CreatureGroups.h"
#include "Util.h"
#include <cctype>
#include <iostream>
Expand Down Expand Up @@ -3997,30 +3997,7 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
if (!*args)
return false;

char* ldrGUID = strtok((char*)args, " ");

if (!ldrGUID)
return false;

uint32 leaderGUID = (uint32) atoi(ldrGUID);

char* cmt = strtok(NULL, "");
char* commentText = "";

if (cmt)
commentText = extractQuotedArg(cmt);

char* frmAI = strtok(NULL, " ");
uint8 formationAI = 0;

if (frmAI)
formationAI = (uint8) atoi(frmAI);

uint32 formationId = 0;
uint32 memberGUID = 0;
float follow_dist = 0;
float follow_angle = 0;

uint32 leaderGUID = (uint32) atoi((char*)args);
Creature *pCreature = getSelectedCreature();

if (!pCreature || !pCreature->GetDBTableGUIDLow())
Expand All @@ -4030,184 +4007,35 @@ bool ChatHandler::HandleNpcAddFormationCommand(const char* args)
return false;
}

Player *chr = m_session->GetPlayer();

memberGUID = pCreature->GetDBTableGUIDLow();
follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(), int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(), int(2)));
follow_angle = (pCreature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI;

if (follow_angle < 0)
follow_angle = follow_angle + 360;

if (!memberGUID)
return false;

uint32 lowguid = pCreature->GetDBTableGUIDLow();
if (pCreature->GetFormation())
{
PSendSysMessage("Selected creature is already member of formation %u", pCreature->GetFormation()->GetId());
PSendSysMessage("Selected creature is already member of group %u", pCreature->GetFormation()->GetId());
return false;
}

//Check if formation with given leaderGUID exist
QueryResult_AutoPtr result_FormationId = WorldDatabase.PQuery("SELECT formationId, leaderGUID, formationAI FROM creature_formations WHERE leaderGUID = %u ", leaderGUID);

if (result_FormationId)
{
//Load FormationId
Field *fields = result_FormationId->Fetch();
formationId = fields[0].GetUInt32();
//Overwrite given Data
leaderGUID = fields[1].GetUInt32();
formationAI = fields[2].GetUInt8();

WorldDatabase.PExecute("INSERT INTO creature_formation_data (formationId, memberGUID, dist, angle) VALUES (%u, %u, %f, %f)", formationId, memberGUID, follow_dist, follow_angle);

PSendSysMessage("Creature %u added to formation %u with leader %u and formationAI %u", memberGUID, formationId, leaderGUID, formationAI);
}
else
{
//Create newFormation and load formationId
if (memberGUID != leaderGUID)
{
PSendSysMessage("You should set the Leader for this Formation first.");
return false;
}

//Must be executed direct, not asyncron
WorldDatabase.DirectPExecute("INSERT INTO creature_formations (leaderGUID, formationAI, comment) VALUES (%u, %u, %s)", leaderGUID, formationAI, commentText);

QueryResult_AutoPtr result_newFormationId = WorldDatabase.Query("SELECT MAX(formationId) FROM creature_formations");

formationId = result_newFormationId->Fetch()->GetInt32();

FormationInfo *formation_info;

formation_info = new FormationInfo;
formation_info->leaderGUID = leaderGUID;
formation_info->formationAI = formationAI;

CreatureFormationMap[formationId] = formation_info;

WorldDatabase.PExecute("INSERT INTO creature_formation_data (formationId, memberGUID, dist, angle) VALUES (%u, %u, 0, 0)", formationId, memberGUID);

PSendSysMessage("Creature %u added to new formation %u with leader %u and formationAI %u", memberGUID, formationId, leaderGUID, formationAI);
}

FormationData *formation_data;

formation_data = new FormationData;
formation_data->formationId = formationId;
formation_data->follow_dist = follow_dist;
formation_data->follow_angle = follow_angle;

if (memberGUID == leaderGUID) {
formation_data->follow_dist = 0;
formation_data->follow_angle = 0;
}

CreatureFormationDataMap[memberGUID] = formation_data;
pCreature->SearchFormation();

return true;
}

bool ChatHandler::HandleNpcAddGroupCommand(const char* args)
{
if (!*args)
return false;

char* ldrGUID = strtok((char*)args, " ");

if (!ldrGUID)
return false;

uint32 leaderGUID = (uint32) atoi(ldrGUID);

char* cmt = strtok(NULL, "");
char* commentText = "";

if (cmt)
commentText = extractQuotedArg(cmt);

char* grpType = strtok(NULL, " ");
uint8 groupType = 0;

if (grpType)
groupType = (uint8) atoi(grpType);

uint32 groupId = 0;
uint32 memberGUID = 0;

Creature *pCreature = getSelectedCreature();

if (!pCreature || !pCreature->GetDBTableGUIDLow())
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}

memberGUID = pCreature->GetDBTableGUIDLow();

if (!memberGUID)
if (!lowguid)
return false;

if (pCreature->GetGroup())
{
PSendSysMessage("Selected creature is already member of group %u", pCreature->GetGroup()->GetId());
return false;
}

//Check if group with given leaderGUID exist
QueryResult_AutoPtr result_GroupId = WorldDatabase.PQuery("SELECT groupId, leaderGUID, groupType FROM creature_groups WHERE leaderGUID = %u ", leaderGUID);

if (result_GroupId)
{
//Load GroupId
Field *fields = result_GroupId->Fetch();
groupId = fields[0].GetUInt32();
//Overwrite given Data
leaderGUID = fields[1].GetUInt32();
groupType = fields[2].GetUInt8();

WorldDatabase.PExecute("INSERT INTO creature_group_data (groupId, memberGUID) VALUES (%u, %u)", groupId, memberGUID);

PSendSysMessage("Creature %u added to group %u with leader %u and GroupType %u", memberGUID, groupId, leaderGUID, groupType);
}
else
{
//Create newGroup and load groupId
if (memberGUID != leaderGUID)
{
PSendSysMessage("You should set the Leader for this Group first.");
return false;
}

//Must be executed direct, not asyncron
WorldDatabase.DirectPExecute("INSERT INTO creature_groups (leaderGUID, groupType, comment) VALUES (%u, %u, %s)", leaderGUID, groupType, commentText);

QueryResult_AutoPtr result_newGroupId = WorldDatabase.Query("SELECT MAX(groupId) FROM creature_groups");

groupId = result_newGroupId->Fetch()->GetInt32();

GroupInfo *group_member;
Player *chr = m_session->GetPlayer();
FormationInfo *group_member;

group_member = new GroupInfo;
group_member->leaderGUID = leaderGUID;
group_member->groupType = groupType;
group_member = new FormationInfo;
group_member->follow_angle = (pCreature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI;
group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(),int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(),int(2)));
group_member->leaderGUID = leaderGUID;
group_member->groupAI = 0;

CreatureGroupMap[groupId] = group_member;
CreatureGroupMap[lowguid] = group_member;
pCreature->SearchFormation();

WorldDatabase.PExecute("INSERT INTO creature_group_data (groupId, memberGUID) VALUES (%u, %u)", groupId, memberGUID);
WorldDatabase.PExecuteLog("INSERT INTO creature_formations (leaderGUID, memberGUID, dist, angle, groupAI) VALUES ('%u','%u','%f', '%f', '%u')",
leaderGUID, lowguid, group_member->follow_dist, group_member->follow_angle, group_member->groupAI);

PSendSysMessage("Creature %u added to new group %u with leader %u and GroupType %u", memberGUID, groupId, leaderGUID, groupType);
}

CreatureGroupDataMap[memberGUID] = groupId;
pCreature->SearchGroup();
PSendSysMessage("Creature %u added to formation with leader %u", lowguid, leaderGUID);

return true;
}
}

bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Chat/Commands/Level3.cpp
Expand Up @@ -389,7 +389,7 @@ bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*)
bool ChatHandler::HandleReloadSkyFireStringCommand(const char*)
{
sLog->outString("Re-Loading skyfire_string Table!");
sObjectMgr.LoadTrinityStrings();
sObjectMgr.LoadSkyFireStrings();
SendGlobalGMSysMessage("DB table skyfire_string reloaded.");
return true;
}
Expand Down
38 changes: 12 additions & 26 deletions src/server/game/Entities/Creature/Creature.cpp
Expand Up @@ -47,7 +47,6 @@
#include "CellImpl.h"
#include "OutdoorPvPMgr.h"
#include "GameEventMgr.h"
#include "CreatureFormations.h"
#include "CreatureGroups.h"
// apply implementation of the singletons
#include "Policies/SingletonImp.h"
Expand Down Expand Up @@ -183,16 +182,17 @@ Creature::~Creature()

void Creature::AddToWorld()
{
// Register the creature for guid lookup
///- Register the creature for guid lookup
if (!IsInWorld())
{
if (m_zoneScript)
m_zoneScript->OnCreatureCreate(this, true);
m_zoneScript->OnCreatureCreate(this);
sObjectAccessor.AddObject(this);
Unit::AddToWorld();
SearchFormation();
SearchGroup();
AIM_Initialize();
//if (IsVehicle())
//GetVehicleKit()->Install();
}
}

Expand All @@ -201,9 +201,9 @@ void Creature::RemoveFromWorld()
if (IsInWorld())
{
if (m_zoneScript)
m_zoneScript->OnCreatureCreate(this, false);
m_zoneScript->OnCreatureRemove(this);
if (m_formation)
formation_mgr.RemoveCreatureFromFormation(m_formation, this);
FormationMgr::RemoveCreatureFromGroup(m_formation, this);
Unit::RemoveFromWorld();
sObjectAccessor.RemoveObject(this);
}
Expand All @@ -226,23 +226,9 @@ void Creature::SearchFormation()
if (!lowguid)
return;

CreatureFormationDataType::iterator frmdata = CreatureFormationDataMap.find(lowguid);
if (frmdata != CreatureFormationDataMap.end())
formation_mgr.AddCreatureToFormation(frmdata->second->formationId, this);
}

void Creature::SearchGroup()
{
if (isPet())
return;

uint32 lowguid = GetDBTableGUIDLow();
if (!lowguid)
return;

CreatureGroupDataType::iterator grpdata = CreatureGroupDataMap.find(lowguid);
if (grpdata != CreatureGroupDataMap.end())
group_mgr.AddCreatureToGroup(grpdata->second, this);
CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid);
if (frmdata != CreatureGroupMap.end())
FormationMgr::AddCreatureToGroup(frmdata->second->leaderGUID, this);
}

void Creature::RemoveCorpse(bool setSpawnTime)
Expand Down Expand Up @@ -522,11 +508,11 @@ void Creature::Update(uint32 diff)
if (m_isDeadByDefault)
break;

if (GetGroup() && GetGroup()->IsAllowedToRespawn(this))
/*if (GetGroup() && GetGroup()->IsAllowedToRespawn(this))
{
Respawn();
break;
}
}*/

if (m_corpseRemoveTime <= time(NULL))
{
Expand Down Expand Up @@ -1384,7 +1370,7 @@ void Creature::setDeathState(DeathState s)

//Dismiss group if is leader
if (m_formation && m_formation->getLeader() == this)
m_formation->Reset(true);
m_formation->FormationReset(true);

if (m_zoneScript)
m_zoneScript->OnCreatureDeath(this);
Expand Down

0 comments on commit 77a20d9

Please sign in to comment.