this is where i stop for the evening

This commit is contained in:
DarthArgus
2016-07-24 21:48:49 -07:00
parent 9d2013918a
commit 8b9665a0f8
46 changed files with 2654 additions and 3069 deletions
@@ -19,12 +19,15 @@
// ======================================================================
TaskLocateStructure::TaskLocateStructure(const NetworkId &itemId, const std::string &whoRequested) :
TaskRequest(),
m_itemId(itemId),
m_whoRequested(whoRequested)
TaskRequest(),
m_itemId(itemId),
m_whoRequested(whoRequested),
m_x(0),
m_z(0),
m_found(false)
{
}
//-----------------------------------------------------------------------
TaskLocateStructure::~TaskLocateStructure()
@@ -38,7 +41,7 @@ bool TaskLocateStructure::process(DB::Session *session)
LocateStructureQuery query;
query.item_id = m_itemId;
if (! (session->exec(&query)))
if (!(session->exec(&query)))
return false;
query.done();
@@ -49,8 +52,8 @@ bool TaskLocateStructure::process(DB::Session *session)
m_z = query.z.getValue();
m_sceneId = query.sceneId.getValueASCII();
}
LOG("CustomerService", ("playerStructure: Locate structure (%s): result %s", m_itemId.getValueString().c_str(), (m_found? "found": "not found")));
LOG("CustomerService", ("playerStructure: Locate structure (%s): result %s", m_itemId.getValueString().c_str(), (m_found ? "found" : "not found")));
return true;
}
@@ -77,7 +80,7 @@ void TaskLocateStructure::onComplete()
void TaskLocateStructure::LocateStructureQuery::getSQL(std::string &sql)
{
sql=std::string("begin ") + DatabaseProcess::getInstance().getSchemaQualifier()+"loader.locate_structure(:item_id, :x, :z, :scene_id, :found); end;";
sql = std::string("begin ") + DatabaseProcess::getInstance().getSchemaQualifier() + "loader.locate_structure(:item_id, :x, :z, :scene_id, :found); end;";
}
// ----------------------------------------------------------------------
@@ -89,7 +92,7 @@ bool TaskLocateStructure::LocateStructureQuery::bindParameters()
if (!bindParameter(z)) return false;
if (!bindParameter(sceneId)) return false;
if (!bindParameter(found)) return false;
return true;
}
@@ -113,4 +116,4 @@ TaskLocateStructure::LocateStructureQuery::LocateStructureQuery()
{
}
// ======================================================================
// ======================================================================
@@ -18,13 +18,14 @@
// ======================================================================
TaskMoveToPlayer::TaskMoveToPlayer(const NetworkId &oid, const NetworkId &player, const std::string &whoRequested) :
TaskRequest(),
m_oid(oid),
m_player(player),
m_whoRequested(whoRequested)
TaskRequest(),
m_oid(oid),
m_player(player),
m_whoRequested(whoRequested),
m_result(0)
{
}
//-----------------------------------------------------------------------
TaskMoveToPlayer::~TaskMoveToPlayer()
@@ -38,13 +39,13 @@ bool TaskMoveToPlayer::process(DB::Session *session)
MoveToPlayerQuery query;
query.oid = m_oid;
query.player = m_player;
if (! (session->exec(&query)))
if (!(session->exec(&query)))
return false;
query.done();
m_result = query.result.getValue();
LOG("DatabaseRestore", ("Move Item (%s) to Player (%s): result %i", m_oid.getValueString().c_str(), m_player.getValueString().c_str(), m_result));
return true;
}
@@ -56,81 +57,81 @@ void TaskMoveToPlayer::onComplete()
std::string message;
switch (m_result)
{
case 1:
message = "Item moved. (It may not reappear until the next server restart.)";
break;
case 1:
message = "Item moved. (It may not reappear until the next server restart.)";
break;
case 2:
message = "Could not find player's inventory";
break;
case 2:
message = "Could not find player's inventory";
break;
case 3:
message = "Object id does not exist";
break;
case 3:
message = "Object id does not exist";
break;
case 4:
message = "The database returned an unknown error code";
break;
case 4:
message = "The database returned an unknown error code";
break;
case 5:
message = "Object id cannot be a player";
break;
case 5:
message = "Object id cannot be a player";
break;
case 6:
message = "Object id cannot be object/tangible/inventory/character_inventory.iff";
break;
case 6:
message = "Object id cannot be object/tangible/inventory/character_inventory.iff";
break;
case 7:
message = "Object id cannot be object/tangible/mission_bag/mission_bag.iff";
break;
case 7:
message = "Object id cannot be object/tangible/mission_bag/mission_bag.iff";
break;
case 8:
message = "Object id cannot be object/tangible/datapad/character_datapad.iff";
break;
case 8:
message = "Object id cannot be object/tangible/datapad/character_datapad.iff";
break;
case 9:
message = "Object id cannot be object/tangible/bank/character_bank.iff";
break;
case 9:
message = "Object id cannot be object/tangible/bank/character_bank.iff";
break;
case 10:
message = "Object id cannot be object/weapon/melee/unarmed/unarmed_default_player.iff";
break;
case 10:
message = "Object id cannot be object/weapon/melee/unarmed/unarmed_default_player.iff";
break;
case 11:
message = "Object id cannot be object/player/player.iff";
break;
case 11:
message = "Object id cannot be object/player/player.iff";
break;
case 12:
message = "Object id cannot be object/cell/cell.iff";
break;
case 12:
message = "Object id cannot be object/cell/cell.iff";
break;
case 13:
message = "Object id cannot be object/tangible/inventory/vendor_inventory.iff";
break;
case 13:
message = "Object id cannot be object/tangible/inventory/vendor_inventory.iff";
break;
case 14:
message = "Object cannot be contained directly by a datapad";
break;
case 15:
message = "Object cannot be a building";
break;
case 16:
message = "Object cannot be an installation";
break;
case 17:
message = "Object cannot be a ship";
break;
default:
message = "admin.move_item_to_player() returned an unknown error code";
break;
case 14:
message = "Object cannot be contained directly by a datapad";
break;
case 15:
message = "Object cannot be a building";
break;
case 16:
message = "Object cannot be an installation";
break;
case 17:
message = "Object cannot be a ship";
break;
default:
message = "admin.move_item_to_player() returned an unknown error code";
break;
}
GenericValueTypeMessage<std::pair<std::string, std::string> > reply("DatabaseConsoleReplyMessage",
std::make_pair(m_whoRequested, message));
std::make_pair(m_whoRequested, message));
DatabaseProcess::getInstance().sendToAnyGameServer(reply);
}
@@ -138,7 +139,7 @@ void TaskMoveToPlayer::onComplete()
void TaskMoveToPlayer::MoveToPlayerQuery::getSQL(std::string &sql)
{
sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.move_item_to_player (:item_id, :player_id); end;";
sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.move_item_to_player (:item_id, :player_id); end;";
}
// ----------------------------------------------------------------------
@@ -148,7 +149,7 @@ bool TaskMoveToPlayer::MoveToPlayerQuery::bindParameters()
if (!bindParameter(result)) return false;
if (!bindParameter(oid)) return false;
if (!bindParameter(player)) return false;
return true;
}
@@ -172,4 +173,4 @@ TaskMoveToPlayer::MoveToPlayerQuery::MoveToPlayerQuery()
{
}
// ======================================================================
// ======================================================================
@@ -18,12 +18,15 @@
// ======================================================================
TaskRestoreCharacter::TaskRestoreCharacter(const NetworkId &characterId, const std::string &whoRequested) :
TaskRequest(),
m_characterId(characterId),
m_whoRequested(whoRequested)
TaskRequest(),
m_characterId(characterId),
m_whoRequested(whoRequested),
m_result(0),
m_account(0),
m_templateId(0)
{
}
//-----------------------------------------------------------------------
TaskRestoreCharacter::~TaskRestoreCharacter()
@@ -36,8 +39,8 @@ bool TaskRestoreCharacter::process(DB::Session *session)
{
RestoreCharacterQuery query;
query.character_id = m_characterId;
if (! (session->exec(&query)))
if (!(session->exec(&query)))
return false;
query.done();
@@ -45,7 +48,7 @@ bool TaskRestoreCharacter::process(DB::Session *session)
query.character_name.getValue(m_characterName);
query.account.getValue(m_account);
query.template_id.getValue(m_templateId);
LOG("DatabaseRestore", ("Restore Character (%s): result %i", m_characterId.getValueString().c_str(), m_result));
return true;
}
@@ -54,7 +57,7 @@ bool TaskRestoreCharacter::process(DB::Session *session)
void TaskRestoreCharacter::onComplete()
{
if (m_result==1)
if (m_result == 1)
{
LoginRestoreCharacterMessage msg(m_whoRequested, m_characterId, m_account, m_characterName, m_templateId, false); //TODO: "/restoreJedi" command
DatabaseProcess::getInstance().sendToCentralServer(msg, true);
@@ -64,21 +67,21 @@ void TaskRestoreCharacter::onComplete()
std::string message;
switch (m_result)
{
case 2:
message = "Object id was incorrect or character was not deleted";
break;
case 2:
message = "Object id was incorrect or character was not deleted";
break;
case 3:
message = "There was an error in the database while attempting to restore the character.";
break;
case 3:
message = "There was an error in the database while attempting to restore the character.";
break;
default:
message = "The database returned an unknown code in response to the request to restore the character.";
break;
default:
message = "The database returned an unknown code in response to the request to restore the character.";
break;
}
GenericValueTypeMessage<std::pair<std::string, std::string> > reply("DatabaseConsoleReplyMessage",
std::make_pair(m_whoRequested, message));
std::make_pair(m_whoRequested, message));
DatabaseProcess::getInstance().sendToAnyGameServer(reply);
}
}
@@ -87,7 +90,7 @@ void TaskRestoreCharacter::onComplete()
void TaskRestoreCharacter::RestoreCharacterQuery::getSQL(std::string &sql)
{
sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.restore_character (:character_id, :character_name, :account, :template_id); end;";
sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.restore_character (:character_id, :character_name, :account, :template_id); end;";
}
// ----------------------------------------------------------------------
@@ -99,7 +102,7 @@ bool TaskRestoreCharacter::RestoreCharacterQuery::bindParameters()
if (!bindParameter(character_name)) return false;
if (!bindParameter(account)) return false;
if (!bindParameter(template_id)) return false;
return true;
}
@@ -123,4 +126,4 @@ TaskRestoreCharacter::RestoreCharacterQuery::RestoreCharacterQuery()
{
}
// ======================================================================
// ======================================================================
@@ -18,12 +18,13 @@
// ======================================================================
TaskRestoreHouse::TaskRestoreHouse(const NetworkId &houseId, const std::string &whoRequested) :
TaskRequest(),
m_houseId(houseId),
m_whoRequested(whoRequested)
TaskRequest(),
m_houseId(houseId),
m_whoRequested(whoRequested),
m_result(0)
{
}
//-----------------------------------------------------------------------
TaskRestoreHouse::~TaskRestoreHouse()
@@ -36,13 +37,13 @@ bool TaskRestoreHouse::process(DB::Session *session)
{
RestoreHouseQuery query;
query.house_id = m_houseId;
if (! (session->exec(&query)))
if (!(session->exec(&query)))
return false;
query.done();
m_result = query.result.getValue();
LOG("DatabaseRestore", ("Restore house (%s): result %i", m_houseId.getValueString().c_str(), m_result));
return true;
}
@@ -54,25 +55,25 @@ void TaskRestoreHouse::onComplete()
std::string message;
switch (m_result)
{
case 1:
message = "House restored. (It may not reappear until the next server restart.)";
break;
case 1:
message = "House restored. (It may not reappear until the next server restart.)";
break;
case 2:
message = "Object id was incorrect or house was not deleted";
break;
case 2:
message = "Object id was incorrect or house was not deleted";
break;
case 3:
message = "There was an error in the database while attempting to restore the house.";
break;
case 3:
message = "There was an error in the database while attempting to restore the house.";
break;
default:
message = "The database returned an unknown code in response to the request to restore the house.";
break;
default:
message = "The database returned an unknown code in response to the request to restore the house.";
break;
}
GenericValueTypeMessage<std::pair<std::string, std::string> > reply("DatabaseConsoleReplyMessage",
std::make_pair(m_whoRequested, message));
std::make_pair(m_whoRequested, message));
DatabaseProcess::getInstance().sendToAnyGameServer(reply);
}
@@ -80,7 +81,7 @@ void TaskRestoreHouse::onComplete()
void TaskRestoreHouse::RestoreHouseQuery::getSQL(std::string &sql)
{
sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.restore_house (:house_id); end;";
sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.restore_house (:house_id); end;";
}
// ----------------------------------------------------------------------
@@ -89,7 +90,7 @@ bool TaskRestoreHouse::RestoreHouseQuery::bindParameters()
{
if (!bindParameter(result)) return false;
if (!bindParameter(house_id)) return false;
return true;
}
@@ -113,4 +114,4 @@ TaskRestoreHouse::RestoreHouseQuery::RestoreHouseQuery()
{
}
// ======================================================================
// ======================================================================
@@ -18,12 +18,13 @@
// ======================================================================
TaskUndeleteItem::TaskUndeleteItem(const NetworkId &itemId, const std::string &whoRequested) :
TaskRequest(),
m_itemId(itemId),
m_whoRequested(whoRequested)
TaskRequest(),
m_itemId(itemId),
m_whoRequested(whoRequested),
m_result(0)
{
}
//-----------------------------------------------------------------------
TaskUndeleteItem::~TaskUndeleteItem()
@@ -37,12 +38,12 @@ bool TaskUndeleteItem::process(DB::Session *session)
UndeleteItemQuery query;
query.item_id = m_itemId;
if (! (session->exec(&query)))
if (!(session->exec(&query)))
return false;
query.done();
m_result = query.result.getValue();
LOG("DatabaseRestore", ("Undelete Item (%s): result %i", m_itemId.getValueString().c_str(), m_result));
return true;
}
@@ -54,29 +55,29 @@ void TaskUndeleteItem::onComplete()
std::string message;
switch (m_result)
{
case 1:
message = "Item restored.";
break;
case 1:
message = "Item restored.";
break;
case 2:
message = "Object id was incorrect or item was not deleted";
break;
case 2:
message = "Object id was incorrect or item was not deleted";
break;
case 3:
message = "There was an error in the database while attempting to undelete the item.";
break;
case 4:
message = "Item restored. Loading this item from database...";
Loader::getInstance().locateStructure(m_itemId, m_whoRequested);
break;
case 3:
message = "There was an error in the database while attempting to undelete the item.";
break;
case 4:
message = "Item restored. Loading this item from database...";
Loader::getInstance().locateStructure(m_itemId, m_whoRequested);
break;
default:
message = "The database returned an unknown code in response to the request to undelete the item.";
break;
default:
message = "The database returned an unknown code in response to the request to undelete the item.";
break;
}
GenericValueTypeMessage<std::pair<std::string, std::string> > reply("DatabaseConsoleReplyMessage",
std::make_pair(m_whoRequested, message));
std::make_pair(m_whoRequested, message));
DatabaseProcess::getInstance().sendToAnyGameServer(reply);
}
@@ -84,7 +85,7 @@ void TaskUndeleteItem::onComplete()
void TaskUndeleteItem::UndeleteItemQuery::getSQL(std::string &sql)
{
sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.undelete_item (:item_id); end;";
sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.undelete_item (:item_id); end;";
}
// ----------------------------------------------------------------------
@@ -93,7 +94,7 @@ bool TaskUndeleteItem::UndeleteItemQuery::bindParameters()
{
if (!bindParameter(result)) return false;
if (!bindParameter(item_id)) return false;
return true;
}
@@ -117,4 +118,4 @@ TaskUndeleteItem::UndeleteItemQuery::UndeleteItemQuery()
{
}
// ======================================================================
// ======================================================================