//look instruction void character::apply_look_instruction(vector<string>& instruction){ //look room operator if (instruction.buffer[1] == "room" && instruction.get_size() == 2){ printf("%s\n%s", location->name.get_string(), location->description.get_string()); printf("\nContaints:"); list<entity*>::node*temp = location->data.first_element; int k = 0; while (temp){ if (temp->data->type != EXIT) printf("\n%s", temp->data->name.get_string()); temp = temp->next; k++; } if (k == 0)printf("This room is empty."); } //look me operator else if (instruction.buffer[1] == "me")printf("%s\n%s\nSTATS:\nlive[%i]\nattack[%i]\nmoney = %i", name.get_string(), description.get_string(), live_points, attack,money); //look inventory operator else if (instruction.buffer[1] == "inventory"){ if (data.first_element == nullptr)printf("The inventory is empty."); else{ int y = 0; list<entity*>::node* temp = data.first_element; for (unsigned int k = 0; k < data.get_size(); k++){ if (temp->data->type == ITEM && ((item*)temp->data)->state == UNEQUIPED){ printf("Cell %i: %s\n", k, temp->data->name.get_string()); temp = temp->next; y++; } } if (y == 0)printf("The inventory is empty."); } } //look room objects else if (instruction.buffer[1] == "room" && instruction.buffer[2] == "objects"){ unsigned int prints = 0; list<entity*>::node* temp = location->data.first_element; while (temp){ if (((entity*)temp->data)->type == ITEM && ((item*)temp->data)->state == UNKNOWN){ printf("\n- %s", ((item*)temp->data)->name.get_string()); prints++; } else if (((entity*)temp->data)->type == CHEST){ printf("\n- Chest"); prints++; } temp = temp->next; } if (prints == 0)printf("There's no objects or chest in this room."); } //look exit else if (exit_focused != nullptr){ exit_focused->look_it(); } //look object else if (object_focused_ad != nullptr){ if (object_focused_ad->place == location || object_focused_ad->state == UNEQUIPED || object_focused_ad->state == EQUIPED){ object_focused_ad->look_it(); } else printf("This object is out of sight"); } //look equipation operator(when equiped) else if (instruction.buffer[1] == "equipation"){ if (equipation == nullptr){ printf("You don't have equiped any item"); } else { printf("You have equiped %s:\n", equipation->name.get_string()); if (equipation->attack_buff > 0)printf("+%i attack!\n", equipation->attack_buff); if (equipation->live_buff > 0)printf("+%i live!\n", equipation->live_buff); } } //look npc else if (npc_focused != nullptr && instruction.buffer[1] == npc_focused->name.get_string()){ if (npc_focused->location != location)printf("%s is not here", npc_focused->name.get_string()); else if (npc_focused->alive == false)printf("%s is simply dead. There's anything interesting to know about him now.",npc_focused->name.get_string()); else{ printf("%s:\n%s", npc_focused->name.get_string(), npc_focused->description.get_string()); //Add storage show } } //look chest else if (chest_focused_ad != nullptr && instruction.buffer[1] == "chest"){ chest_focused_ad->look_it(); } else if (chest_focused_ad == nullptr)printf("There's no chest here"); else printf("Invalid Comand"); }