[Ante-cvs] SF.net SVN: ante: [475] trunk/ant
Brought to you by:
roguestar191
|
From: <rog...@us...> - 2007-01-24 06:10:51
|
Revision: 475
http://svn.sourceforge.net/ante/?rev=475&view=rev
Author: roguestar191
Date: 2007-01-23 22:10:52 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Added new printing callback and documentation for it, todo is getting small
Modified Paths:
--------------
trunk/ant/cgiscript.cpp
trunk/ant/cgiscript.h
trunk/ant/httpd/aski.html
trunk/ant/todo
Modified: trunk/ant/cgiscript.cpp
===================================================================
--- trunk/ant/cgiscript.cpp 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/cgiscript.cpp 2007-01-24 06:10:52 UTC (rev 475)
@@ -33,6 +33,7 @@
SFunctor<loaderhelper>* move;
SFunctor<loaderhelper>* give;
SFunctor<loaderhelper>* gotoo;
+ SFunctor<loaderhelper>* printtoallbut;
};
loaderhelper::loaderhelper() {
@@ -45,6 +46,7 @@
FH::copyover = new SFunctor<loaderhelper>(this, &loaderhelper::copyover);
FH::gonline = new SFunctor<loaderhelper>(this, &loaderhelper::getOnlinePlayers);
FH::printto = new SFunctor<loaderhelper>(this, &loaderhelper::printTo);
+ FH::printtoallbut = new SFunctor<loaderhelper>(this, &loaderhelper::printToAllBut);
FH::printroom = new SFunctor<loaderhelper>(this, &loaderhelper::printToRoom);
FH::getaccess = new SFunctor<loaderhelper>(this, &loaderhelper::getAccess);
FH::getvar= new SFunctor<loaderhelper>(this, &loaderhelper::getVariable);
@@ -77,6 +79,7 @@
com.add("%display", FH::display);
com.add("%regskill", FH::addS);
com.add("%print", FH::print);
+ com.add("%printtoallbut", FH::printtoallbut);
com.add("%skargs", FH::args);
com.add("%grant", FH::grant);
com.add("%username", FH::uname);
@@ -116,6 +119,30 @@
com.remove(FH::putvar);
com.remove(FH::addS);
com.remove(FH::display);
+
+
+ com.remove(FH::gotoo);
+ com.remove(FH::move);
+ com.remove(FH::give);
+ com.remove(FH::printtoallbut);
+ com.remove(FH::junk);
+ com.remove(FH::get);
+ com.remove(FH::drop);
+ com.remove(FH::wear);
+ com.remove(FH::remove);
+
+ delete FH::gotoo;
+ delete FH::move;
+ delete FH::give;
+ delete FH::printtoallbut;
+ delete FH::junk;
+ delete FH::get;
+ delete FH::drop;
+ delete FH::wear;
+ delete FH::remove;
+
+
+
delete FH::display;
delete FH::addS;
delete FH::print;
@@ -469,6 +496,57 @@
return "PNF";
}
// }}}
+// Arguments: "playername;playername;playername" what2print
+// it's printed to the callers room to everyone but the players listed
+bool isInVec(std::vector<std::string>&check, std::string &forthis) {
+ std::vector<std::string>::iterator iter = check.begin(), end = check.end();
+ while(iter!=end) {
+ if((*(iter)).compare(forthis) == 0) return true;
+ iter++;
+ }
+ return false;
+}
+extern void replaceAll(std::string &in, std::string from, std::string to);
+std::string loaderhelper::printToAllBut(std::vector<std::string>&d, void*callera) {
+ if(d.size() < 3) return "";
+ std::string players = d[1];
+ size_t x = 2, xend = d.size();
+
+ std::string what = d[x];
+ x++;
+ while(x != xend) { what += " "; what += d[x]; x++; }
+ object*o=(object*)callera;
+ if(players.size() >=7 ) {
+ if(players.substr(0, 7).compare("global=") == 0) {
+ //gossip replace
+ players.replace(0, 7, "");
+ //players now contains channame
+ if(players.size() == 0) return "";
+ mudg->echoallf(&what, o, players);
+ return "";
+ }
+ }
+ players += "\"";
+ players.insert(0, "\"");
+ replaceAll(players, ";", "\" \"");
+ std::vector<std::string> svec = strToVec(players);
+
+ std::vector<object*>::iterator iter = o->room_in->players.begin(), end = o->room_in->players.end();
+ while(iter!=end) {
+ if(isInVec(svec, (*(iter))->Name)) { iter++; continue; }
+ if( ( (void*)(*(iter))) == callera ) {
+ std::string output = what;
+ replaceAll(output, "<S-NAME>", "You");
+ mudg->print1(o, &output, o->socket);
+ } else {
+ std::string output = what;
+ replaceAll(output, "<S-NAME>", o->Name);
+ mudg->print1((*(iter)), &output, (*(iter))->socket);
+ }
+ iter++;
+ }
+ return "";
+}
// Grant a single command {{{
std::string loaderhelper::grant(std::vector<std::string>&d, void*callera) {
Modified: trunk/ant/cgiscript.h
===================================================================
--- trunk/ant/cgiscript.h 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/cgiscript.h 2007-01-24 06:10:52 UTC (rev 475)
@@ -21,24 +21,34 @@
std::string addSkill(std::vector<std::string>&d, void*callera);
std::string getVariable(std::vector<std::string>&d, void*callera);
std::string putVariable(std::vector<std::string> &d, void *callera);
- std::string print(std::vector<std::string>&d, void*callera);
+
std::string getArguments(void*callera);
std::string getAccess(void*callera);
+
std::string username(void *callera);
+
std::string copyover(void *callera);
std::string uptime(void *callera);
+
+ std::string print(std::vector<std::string>&d, void*callera);
std::string printTo(std::vector<std::string>&d, void*c);
std::string printToRoom(std::vector<std::string>&d, void*callera);
+ std::string printToAllBut(std::vector<std::string>&d, void*callera);
std::string grant(std::vector<std::string>&d, void*callera);
+
std::string getOnlinePlayers();
+
std::string setDefaultInput(std::vector<std::string> &d, void *callera);
+
inline void lower(std::string&what){
std::transform(what.begin(), what.end(), what.begin(),static_cast < int(*)(int) > (tolower));
}
+
std::string create(std::vector<std::string> &stuff, void *caller);
std::string modify(std::vector<std::string> &stuff, void *caller);
std::string setModify(std::vector<std::string>&stuff, void*caller);
std::string arbscript(std::vector<std::string>&stuff, void*caller);
+
std::string Display(std::vector<std::string>&args, void*callera);
std::string destroy(std::vector<std::string>&stuff, void *caller);
@@ -54,6 +64,7 @@
std::string give(std::vector<std::string>&stuff, void*caller);
std::string gotoo(std::vector<std::string>&stuff, void*caller);
+
// std::string equipment(std::vector<std::string>&stuff, void *caller);
};
#endif
Modified: trunk/ant/httpd/aski.html
===================================================================
--- trunk/ant/httpd/aski.html 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/httpd/aski.html 2007-01-24 06:10:52 UTC (rev 475)
@@ -63,8 +63,10 @@
<tr><th>%uptime<td>nothing<td>Returns the years/months/weeks/days/minutes/seconds ANT has been running for as numbers in a space seperated list<td>..</th></tr>
<tr><th>%copyover<td>nothing<Td>nothing<td>Only those with the <IMM> flag in their pfile can use this, used for quickly launching a new binary without disconnecting users.</th></tr>
<tr><th>%getonline<td>nothing<td>nothing<td>Returns a space seperated list of the names of connected users</th></tr>
+
<tr><th>%printto<td>username and arguments<td>nothing<td>Used for directly printing to a specific user</th></tr>
<tr><th>%printroom<td>username channelname arguments<td>nothing<td>Used for printing to the "room" username is in</th></tr>
+<tr><th>%printtoallbut<td>SEE BELOW</th></tr>
<tr><th>%getaccess<td>none<td>The word used to access the script<td>getting the word that accessed the script...</th></tr>
<tr><th>%input<td>anything<td>none<td>executes arguments as if it were input coming from the user who executed the script (Used for input bar, but may have other purposes)</th></tr>
<tr><th>%getvariable<td>variablename<td>lots of stuff<td>Used for retriving variables stored by ant so "script" programs can pass information back and fourth about a player</th></tr>
@@ -297,6 +299,21 @@
RACES - Returns a list of all races<br>
RACES2 - Returns a list of all start races<br>
<hr>
+%printtoallbut
+<hr>
+This callback finish's the print to callbacks. It's designed to operate in two modes, the first mode operates just as it says, it prints to everyone but the players defined in the room it's being called from. The second mode it can send a message to everyone on the entire server (To replace the internal global communications with modules).<br>
+An example:<br>(Using the totalaccess module with the access word "script", so the input is sent to the module totalaccess, a % is put on it there, then it's sent through the fcgi scripter)<br>
+script printtoallbut Rogue;Testing shh, don't tell Rogue or Testing this...<br>
+script printtoallbut "Some X word player name;some other x word player name" don't tell player x or y this<br>
+<br>Global mode example:<br>
+script printtoallbut global=gossip <S-NAME><CHAN> hello world<br><br>
+type that in and you will see from your side:<br>
+You gossip hello world<br><br>
+other players connect will see<br>
+Yourusername gossips hello world<br>
+(Besides the <S-NAME> being different the <CHAN> (in this case gossip) gets an s autoappended to it. The S-NAME and CHAN flags are not required, although a channel name is after global=.<br>
+
+
</body></html>
Modified: trunk/ant/todo
===================================================================
--- trunk/ant/todo 2007-01-24 03:03:12 UTC (rev 474)
+++ trunk/ant/todo 2007-01-24 06:10:52 UTC (rev 475)
@@ -1,16 +1,16 @@
NEEDS FINISHED FIRST
Step 1
+
Make a fcgi script to do wear/remove/display EQUIPMENT to replace the in game command equivilents just removed - Server support is already in place
-Add print2room2 and P2R3 fcgi callbacks - Same as print to room except it doesn't echo to the user who called it, so you can easily send to the user calling the script something different than what every else sees. Print2room3 takes in two users and prints to everyone else in the room but those two users.
+Add basic give module to exploit give callback - put in skills/commands/invcontrol.cpp
-Add basic give module to exploit give callback
+Add snoop ability and callback to enable/disable
-Add snoop ability, callback, and module
+Add username/IP-(un)ban script callback (Module not needed, those who should have access to this should have access to totalaccess script)
+ On username ban it grabs the last ip of the user, and bans it, and bans any ip that tries to log into that username(successfully) until the username is unbanned.
-Add IP-(un)ban script callback (Module not needed, those who should have access to this should have access to totalaccess script)
-
Step 2
memtests, test mud, release 1.0
---------------------------------------------------------------------------------------------
@@ -72,8 +72,6 @@
Create AI
-Add train command, anything (players, items, rooms, hell, even exits) with a skill can train it to anyone else, if they meet the requirments for learning it that is. Can only be trained 10% from other things, everything else must be learned by practice
-
Add cast command to launch spells that can affect any stat and even add new scripts to the caster or one being casted on (Such as a plague tickscript which slowly lowers hp - which is tranfered by touch)
Add an interface for quickly making/modifying/destroy "socials" live
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|