mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Rename activities to task_activities for consistency since we're changing up task data
This commit is contained in:
parent
c08993b60b
commit
623b7b3eee
@ -127,7 +127,7 @@ void MainFrame::NewActivity(wxCommandEvent& event)
|
||||
|
||||
if(mMysql){
|
||||
char * mActQuery = 0;
|
||||
MakeAnyLenString(&mActQuery, "INSERT INTO `activities` (`taskid`,`activityid`,`step`,`activitytype`,`text1`,`text2`,`text3`,`goalid`,`goalmethod`,`goalcount`,`delivertonpc`,`zoneid`,`optional`) VALUES (%u,%u,%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u)",
|
||||
MakeAnyLenString(&mActQuery, "INSERT INTO `task_activities` (`taskid`,`activityid`,`step`,`activitytype`,`text1`,`text2`,`text3`,`goalid`,`goalmethod`,`goalcount`,`delivertonpc`,`zoneid`,`optional`) VALUES (%u,%u,%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u)",
|
||||
newAct.id, newAct.activityId, newAct.step, newAct.activityType, newAct.text1, newAct.text2, newAct.text3, newAct.goalid, newAct.goalmethod, newAct.goalcount, newAct.deliverToNpc, newAct.zoneid, newAct.optional );
|
||||
|
||||
mErrorLog->Log(eqEmuLogSQL, "%s", mActQuery);
|
||||
@ -167,7 +167,7 @@ void MainFrame::DeleteActivity(wxCommandEvent& event)
|
||||
{
|
||||
if(mMysql){
|
||||
char * mActQuery = 0;
|
||||
MakeAnyLenString(&mActQuery, "DELETE FROM activities WHERE taskid=%u AND activityid=%u",selAct->id, selAct->activityid);
|
||||
MakeAnyLenString(&mActQuery, "DELETE FROM `task_activities` WHERE taskid=%u AND activityid=%u",selAct->id, selAct->activityid);
|
||||
mErrorLog->Log(eqEmuLogSQL, "%s", mActQuery);
|
||||
if (mysql_query(mMysql, mActQuery)) {
|
||||
mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql));
|
||||
@ -554,7 +554,7 @@ void MainFrame::SaveActivity(wxCommandEvent& event)
|
||||
if(canUpdate)
|
||||
{
|
||||
char * mQuery = 0;
|
||||
MakeAnyLenString(&mQuery, "UPDATE activities SET step=%u, activitytype=%u, text1='%s', text2='%s', text3='%s', goalid=%u, goalmethod=%u,goalcount=%u, delivertonpc=%u, zoneid=%u, optional=%u WHERE taskid=%u AND activityid =%u",
|
||||
MakeAnyLenString(&mQuery, "UPDATE `task_activities` SET step=%u, activitytype=%u, text1='%s', text2='%s', text3='%s', goalid=%u, goalmethod=%u,goalcount=%u, delivertonpc=%u, zoneid=%u, optional=%u WHERE taskid=%u AND activityid =%u",
|
||||
ourAct.step, ourAct.activityType, MakeStringSQLSafe(ourAct.text1).mb_str(), MakeStringSQLSafe(ourAct.text2).mb_str(), MakeStringSQLSafe(ourAct.text3).mb_str(), ourAct.goalid, ourAct.goalmethod, ourAct.goalcount, ourAct.deliverToNpc, ourAct.zoneid, ourAct.optional, ourAct.id, ourAct.activityId );
|
||||
mErrorLog->Log(eqEmuLogSQL, "%s", mQuery);
|
||||
if (mysql_query(mMysql, mQuery)) {
|
||||
@ -565,14 +565,14 @@ void MainFrame::SaveActivity(wxCommandEvent& event)
|
||||
else
|
||||
{
|
||||
char * mQuery = 0;
|
||||
MakeAnyLenString(&mQuery, "DELETE FROM activities WHERE taskid=%u AND activityid=%u", ourAct.id, delid);
|
||||
MakeAnyLenString(&mQuery, "DELETE FROM `task_activities` WHERE taskid=%u AND activityid=%u", ourAct.id, delid);
|
||||
mErrorLog->Log(eqEmuLogSQL, "%s", mQuery);
|
||||
if (mysql_query(mMysql, mQuery)) {
|
||||
mErrorLog->Log(eqEmuLogBoth, "MySQL Error: %s", mysql_error(mMysql));
|
||||
return;
|
||||
}
|
||||
|
||||
MakeAnyLenString(&mQuery, "INSERT INTO `activities` (`taskid`,`activityid`,`step`,`activitytype`,`text1`,`text2`,`text3`,`goalid`,`goalmethod`,`goalcount`,`delivertonpc`,`zoneid`,`optional`) VALUES (%u,%u,%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u)",
|
||||
MakeAnyLenString(&mQuery, "INSERT INTO `task_activities` (`taskid`,`activityid`,`step`,`activitytype`,`text1`,`text2`,`text3`,`goalid`,`goalmethod`,`goalcount`,`delivertonpc`,`zoneid`,`optional`) VALUES (%u,%u,%u,%u,'%s','%s','%s',%u,%u,%u,%u,%u,%u)",
|
||||
ourAct.id, ourAct.activityId, ourAct.step, ourAct.activityType, MakeStringSQLSafe(ourAct.text1).mb_str(), MakeStringSQLSafe(ourAct.text2).mb_str(), MakeStringSQLSafe(ourAct.text3).mb_str(), ourAct.goalid, ourAct.goalmethod, ourAct.goalcount, ourAct.deliverToNpc, ourAct.zoneid, ourAct.optional);
|
||||
mErrorLog->Log(eqEmuLogSQL, "%s", mQuery);
|
||||
if (mysql_query(mMysql, mQuery)) {
|
||||
|
||||
@ -241,44 +241,43 @@ bool MainFrame::LoadGoals()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainFrame::LoadActivities()
|
||||
{
|
||||
if(mMysql){
|
||||
bool MainFrame::LoadActivities() {
|
||||
if (mMysql) {
|
||||
mErrorLog->Log(eqEmuLogBoth, "Loading Activities...");
|
||||
unsigned int activitiesLoaded = 0;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (mysql_query(mMysql, "SELECT taskid, activityid, step, activitytype, text1, text2, text3, goalid, goalmethod, goalcount, delivertonpc, zoneid, optional FROM activities")) {
|
||||
if (mysql_query(mMysql,
|
||||
"SELECT taskid, activityid, step, activitytype, text1, text2, text3, goalid, goalmethod, goalcount, delivertonpc, zoneid, optional FROM `task_activities`")) {
|
||||
mErrorLog->Log(eqEmuLogBoth, "MySQL Connection Error: %s", mysql_error(mMysql));
|
||||
return false;
|
||||
}
|
||||
|
||||
res = mysql_use_result(mMysql);
|
||||
while ((row = mysql_fetch_row(res)) != NULL){
|
||||
res = mysql_use_result(mMysql);
|
||||
while ((row = mysql_fetch_row(res)) != NULL) {
|
||||
eqtask_activities newAL;
|
||||
|
||||
newAL.id = atoi(row[0]);
|
||||
newAL.activityId = atoi(row[1]);
|
||||
newAL.step = atoi(row[2]);
|
||||
newAL.id = atoi(row[0]);
|
||||
newAL.activityId = atoi(row[1]);
|
||||
newAL.step = atoi(row[2]);
|
||||
newAL.activityType = atoi(row[3]);
|
||||
strcpy(newAL.text1, row[4]);
|
||||
strcpy(newAL.text2, row[5]);
|
||||
strcpy(newAL.text3, row[6]);
|
||||
newAL.goalid = atoi(row[7]);
|
||||
newAL.goalmethod = atoi(row[8]);
|
||||
newAL.goalcount = atoi(row[9]);
|
||||
newAL.goalid = atoi(row[7]);
|
||||
newAL.goalmethod = atoi(row[8]);
|
||||
newAL.goalcount = atoi(row[9]);
|
||||
newAL.deliverToNpc = atoi(row[10]);
|
||||
newAL.zoneid = atoi(row[11]);
|
||||
newAL.optional = atoi(row[12]) ? true : false;
|
||||
newAL.zoneid = atoi(row[11]);
|
||||
newAL.optional = atoi(row[12]) ? true : false;
|
||||
|
||||
taskActivitiesList.push_back(newAL);
|
||||
activitiesLoaded++;
|
||||
}
|
||||
mErrorLog->Log(eqEmuLogBoth, "%u Successfully Loaded Activities", activitiesLoaded);
|
||||
mysql_free_result(res);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
mErrorLog->Log(eqEmuLogBoth, "Mysql connection did not exist for activity load.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -19,3 +19,4 @@ ALTER TABLE `activities` DROP COLUMN `text3`;
|
||||
ALTER TABLE `activities` DROP COLUMN `zoneid`;
|
||||
ALTER TABLE `tasks` DROP COLUMN `startzone`;
|
||||
ALTER TABLE `tasks` ADD `faction_reward` INT(10) NOT NULL DEFAULT '0';
|
||||
RENAME TABLE `activities` TO `task_activities`;
|
||||
@ -175,14 +175,14 @@ bool TaskManager::LoadTasks(int singleTask)
|
||||
query =
|
||||
StringFormat("SELECT `taskid`, `step`, `activityid`, `activitytype`, `target_name`, `item_list`, "
|
||||
"`skill_list`, `spell_list`, `description_override`, `goalid`, `goalmethod`, "
|
||||
"`goalcount`, `delivertonpc`, `zones`, `optional` FROM `activities` WHERE `taskid` < "
|
||||
"`goalcount`, `delivertonpc`, `zones`, `optional` FROM `task_activities` WHERE `taskid` < "
|
||||
"%i AND `activityid` < %i ORDER BY taskid, activityid ASC",
|
||||
MAXTASKS, MAXACTIVITIESPERTASK);
|
||||
else
|
||||
query =
|
||||
StringFormat("SELECT `taskid`, `step`, `activityid`, `activitytype`, `target_name`, `item_list`, "
|
||||
"`skill_list`, `spell_list`, `description_override`, `goalid`, `goalmethod`, "
|
||||
"`goalcount`, `delivertonpc`, `zones`, `optional` FROM `activities` WHERE `taskid` = "
|
||||
"`goalcount`, `delivertonpc`, `zones`, `optional` FROM `task_activities` WHERE `taskid` = "
|
||||
"%i AND `activityid` < %i ORDER BY taskid, activityid ASC",
|
||||
singleTask, MAXACTIVITIESPERTASK);
|
||||
results = database.QueryDatabase(query);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user