{\r
try\r
{\r
- //PlayerGL pgl;\r
- //boost::shared_ptr<PlayerGO> spPlayer = pgl.GetById("Kain");\r
- //\r
+ PlayerGL pgl;\r
+ boost::shared_ptr<PlayerGO> spPlayer = pgl.GetById("Kain");\r
+ \r
+ cout << "Name: " << spPlayer->Name() << endl\r
+ << "Level: " << spPlayer->LevelNumber() << endl\r
+ << "Exp: " << spPlayer->Experience() << endl\r
+ << "Strength: " << spPlayer->Strength() << endl\r
+ << "Defense: " << spPlayer->Defense() << endl\r
+ << "Gold: " << spPlayer->Gold() << endl\r
+ << "Bank: " << spPlayer->Bank() << endl\r
+ << "Items: " << endl;\r
+\r
+ boost::shared_ptr<InventoryManager> spInventory = InventoryManager::Instance();\r
+ ItemList inventory = spInventory->GetInventory(spPlayer->Id());\r
+ ItemList::const_iterator iter;\r
+ for (iter = inventory.begin(); iter != inventory.end(); iter++)\r
+ {\r
+ boost::shared_ptr<ItemGO> spItem = (*iter);\r
+ cout << ItemInfo(spItem) << endl;\r
+ }\r
+\r
+ ForestGL forestGL;\r
+ FightGL fightGL;\r
+ string cmd = "";\r
+ while (cmd.compare("quit") != 0)\r
+ {\r
+ spPlayer->Health(spPlayer->MaxHealth());\r
+ spPlayer->Alive(true);\r
+ DisplayPlayer(spPlayer);\r
+ getline(cin, cmd);\r
+\r
+ if (cmd == "search")\r
+ {\r
+ cout << "Searching the forest..." << endl;\r
+ boost::shared_ptr<MonsterGO> spMonster = forestGL.GetRandomMonsterForPlayer(spPlayer);\r
+ \r
+ while (spPlayer->Alive() && spMonster->Alive())\r
+ {\r
+ DisplayMonster(spMonster);\r
+ cout << "Hit Enter to attack: " << endl;\r
+ getline(cin, cmd);\r
+ unsigned int attack = fightGL.PlayerAttackMonster(spPlayer, spMonster);\r
+ cout << "You hit " << spMonster->Name() << " for " << attack << endl;\r
+ if (!spMonster->Alive())\r
+ {\r
+ cout << "You have killed " << spMonster->Name() << endl;\r
+ cout << "He shouts: " << spMonster->DeathCry() << endl;\r
+ }\r
+ else\r
+ {\r
+ unsigned int mAttack = fightGL.MonsterAttackPlayer(spMonster, spPlayer);\r
+ cout << spMonster->Name() << " hits you with their "\r
+ << spMonster->WeaponName() << " for " << mAttack\r
+ << endl;\r
+ if (!spPlayer->Alive())\r
+ {\r
+ cout << spMonster->Name() << " has killed you!" << endl;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ string what = "what";\r
+ //MySQLItemDAO test;\r
+ //boost::shared_ptr<ItemGO> spItem = test.GetById("3");\r
+ //spItem->Name("Testin' again!!");\r
//\r
+ //test.Insert(spItem);\r
//\r
- //cout << "Name: " << spPlayer->Name() << endl\r
- // << "Level: " << spPlayer->LevelNumber() << endl\r
- // << "Exp: " << spPlayer->Experience() << endl\r
- // << "Strength: " << spPlayer->Strength() << endl\r
- // << "Defense: " << spPlayer->Defense() << endl\r
- // << "Gold: " << spPlayer->Gold() << endl\r
- // << "Bank: " << spPlayer->Bank() << endl\r
- // << "Items: " << endl;\r
-\r
-\r
-\r
- //boost::shared_ptr<InventoryManager> spInventory = InventoryManager::Instance();\r
- //ItemList inventory = spInventory->GetInventory(spPlayer);\r
- //ItemList::const_iterator iter;\r
- //for (iter = inventory.begin(); iter != inventory.end(); iter++)\r
- //{\r
- // boost::shared_ptr<ItemGO> spItem = (*iter);\r
- // cout << ItemInfo(spItem) << endl;\r
- //}\r
+ //MySQLPlayerDAO playerTest;\r
\r
- //ForestGL forestGL;\r
- //FightGL fightGL;\r
- //string cmd = "";\r
- ////while (cmd != "quit")\r
- //for (int x = 0; x < 10000; x++)\r
- //{\r
- // spPlayer->Health(spPlayer->MaxHealth());\r
- // spPlayer->Alive(true);\r
- // //DisplayPlayer(spPlayer);\r
- // //getline(cin, cmd);\r
- // cmd="search";\r
- // if (cmd == "search")\r
- // {\r
- // //cout << "Searching the forest..." << endl;\r
- // boost::shared_ptr<MonsterGO> spMonster = forestGL.GetRandomMonsterForPlayer(spPlayer);\r
- // \r
- // while (spPlayer->Alive() && spMonster->Alive())\r
- // {\r
- // //DisplayMonster(spMonster);\r
- // //cout << "Hit Enter to attack: " << endl;\r
- // //getline(cin, cmd);\r
- // unsigned int attack = fightGL.PlayerAttackMonster(spPlayer, spMonster);\r
- // //cout << "You hit " << spMonster->Name() << " for " << attack << endl;\r
- // if (!spMonster->Alive())\r
- // {\r
- // //cout << "You have killed " << spMonster->Name() << endl;\r
- // //cout << "He shouts: " << spMonster->DeathCry() << endl;\r
- // }\r
- // else\r
- // {\r
- // unsigned int mAttack = fightGL.MonsterAttackPlayer(spMonster, spPlayer);\r
- // /*cout << spMonster->Name() << " hits you with their "\r
- // << spMonster->WeaponName() << " for " << mAttack\r
- // << endl;*/\r
- // if (!spPlayer->Alive())\r
- // {\r
- // /*cout << spMonster->Name() << " has killed you!" << endl;*/\r
- // }\r
- // }\r
- // }\r
- // }\r
- //}\r
-\r
-\r
- MySQLItemDAO test;\r
- boost::shared_ptr<ItemGO> spItem = test.GetById("3");\r
- spItem->Name("Testin' again!!");\r
- \r
- test.Insert(spItem);\r
- \r
- MySQLPlayerDAO playerTest;\r
//map <int, int> frequencies;\r
//int x;\r
//for (x = 0; x < 10000; x++)\r