00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <libfuture.h>
00022 #include <Parse.h>
00023 #include <Utility.h>
00024
00025 #include "List.h"
00026 #include "InSocket.h"
00027 #include "Player.h"
00028 #include "Area.h"
00029
00030
00031 void List::Execute(InSocket *from,const std::string& param,Parse& pa)
00032 {
00033 Database& db = from -> GetDatabase();
00034 Query q(db);
00035 if (param == "terrain")
00036 {
00037 Player pl(db, from -> GetAccountName());
00038 Area area(db, pl.GetArea());
00039 q.get_result("select * from terrain where area=" + Utility::l2string(area.GetNum()));
00040 while (q.fetch_row())
00041 {
00042 db::Terrain t(&db, &q);
00043 from -> Send(t.tcolor + t.tchar + "&n " + t.name + (t.impassable ? " (Impassable)" : "") + "\n");
00044 }
00045 q.free_result();
00046 }
00047 else
00048 if (param == "wizards")
00049 {
00050 q.get_result("select * from account where wizard<>0");
00051 while (q.fetch_row())
00052 {
00053 db::Account x(&db, &q);
00054 from -> Send(" " + x.display_name + "\n");
00055 }
00056 q.free_result();
00057 }
00058 else
00059 if (param == "areas")
00060 {
00061 q.get_result("select * from area");
00062 while (q.fetch_row())
00063 {
00064 db::Area area(&db, &q);
00065 from -> Sendf("#%ld: %2ldx%2ld %s\n", area.num, area.width, area.height, area.name.c_str());
00066 }
00067 q.free_result();
00068 }
00069 else
00070 {
00071 from -> Send("List what?\n");
00072 }
00073 from -> SetPrompt();
00074 }
00075
00076