本文整理汇总了C++中ShowNotice函数的典型用法代码示例。如果您正苦于以下问题:C++ ShowNotice函数的具体用法?C++ ShowNotice怎么用?C++ ShowNotice使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShowNotice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cnslif_parse
// Console Command Parser [Wizputer]
int cnslif_parse(const char* buf)
{
char type[64];
char command[64];
int n=0;
if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 ){
if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
}
if( n != 2 ){ //end string
ShowNotice("Type: '%s'\n",type);
command[0] = '\0';
}
else
ShowNotice("Type of command: '%s' || Command: '%s'\n",type,command);
if( n == 2 && strcmpi("server", type) == 0 ){
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
runflag = 0;
}
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n");
}
else if( strcmpi("ers_report", type) == 0 ){
ers_report();
}
else if( strcmpi("help", type) == 0 ){
ShowInfo("Available commands:\n");
ShowInfo("\t server:shutdown => Stops the server.\n");
ShowInfo("\t server:alive => Checks if the server is running.\n");
ShowInfo("\t ers_report => Displays database usage.\n");
}
return 0;
}
示例2: logchrif_parse_reqchgsex
/**
* Receiving a sex change request (sex is reversed).
* @param fd: fd to parse from (char-serv)
* @param id: id of char-serv
* @param ip: char-serv ip (used for info)
* @return 0 not enough info transmitted, 1 success
*/
int logchrif_parse_reqchgsex(int fd, int id, char* ip){
if( RFIFOREST(fd) < 6 )
return 0;
else{
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
uint32 account_id = RFIFOL(fd,2);
RFIFOSKIP(fd,6);
if( !accounts->load_num(accounts, &acc, account_id) )
ShowNotice("Char-server '%s': Error of sex change (account: %d not found, ip: %s).\n", ch_server[id].name, account_id, ip);
else if( acc.sex == 'S' )
ShowNotice("Char-server '%s': Error of sex change - account to change is a Server account (account: %d, ip: %s).\n", ch_server[id].name, account_id, ip);
else{
unsigned char buf[7];
char sex = ( acc.sex == 'M' ) ? 'F' : 'M'; //Change gender
ShowNotice("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n", ch_server[id].name, account_id, sex, ip);
acc.sex = sex;
// Save
accounts->save(accounts, &acc);
// announce to other servers
WBUFW(buf,0) = 0x2723;
WBUFL(buf,2) = account_id;
WBUFB(buf,6) = sex_str2num(sex);
logchrif_sendallwos(-1, buf, 7);
}
}
return 1;
}
示例3: chrif_checkdefaultlogin
// security check, prints warning if using default password
void chrif_checkdefaultlogin(void) {
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowWarning("Usar o s1/p1 como padrao para usuario/senha não é RECOMENDADO.\n");
ShowNotice("Por favor altere a tabela 'login' para criar um usuario/senha adequado do inter-server (Genero 'S')\n");
ShowNotice("e entao altere seu usuario/senha em conf/map_athena.conf (ou conf/import/map_conf.txt)\n");
}
}
示例4: chrif_checkdefaultlogin
// security check, prints warning if using default password
void chrif_checkdefaultlogin(void) {
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n");
ShowNotice("and then edit your user/password in conf/map-server.conf (or conf/import/map_conf.txt)\n");
}
}
示例5: cnslif_parse
/**
* Console Command Parser
* Transmited from command cli.cpp
* note common name for all serv do not rename (extern in cli)
* @author [Wizputer]
* @param buf: buffer to parse, (from console)
* @return 1=success
*/
int cnslif_parse(const char* buf){
char type[64];
char command[64];
int n=0;
if( ( n = sscanf(buf, "%127[^:]:%255[^\n\r]", type, command) ) < 2 ){
if((n = sscanf(buf, "%63[^\n]", type))<1) return -1; //nothing to do no arg
}
if( n != 2 ){ //end string
ShowNotice("Type: '%s'\n",type);
command[0] = '\0';
}
else
ShowNotice("Type of command: '%s' || Command: '%s'\n",type,command);
if( n == 2 ){
if(strcmpi("server", type) == 0 ){
if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 ){
runflag = 0;
}
else if( strcmpi("alive", command) == 0 || strcmpi("status", command) == 0 )
ShowInfo(CL_CYAN "Console: " CL_BOLD "I'm Alive." CL_RESET"\n");
else if( strcmpi("reloadconf", command) == 0 ) {
ShowInfo("Reloading config file \"%s\"\n", login_config.loginconf_name);
login_config_read(login_config.loginconf_name, false);
}
}
if( strcmpi("create",type) == 0 )
{
char username[NAME_LENGTH], password[NAME_LENGTH], md5password[32+1], sex; //23+1 plaintext 32+1 md5
bool md5 = 0;
if( sscanf(command, "%23s %23s %c", username, password, &sex) < 3 || strnlen(username, sizeof(username)) < 4 || strnlen(password, sizeof(password)) < 1 ){
ShowWarning("Console: Invalid parameters for '%s'. Usage: %s <username> <password> <sex:F/M>\n", type, type);
return 0;
}
if( login_config.use_md5_passwds ){
MD5_String(password,md5password);
md5 = 1;
}
if( login_mmo_auth_new(username,(md5?md5password:password), TOUPPER(sex), "0.0.0.0") != -1 ){
ShowError("Console: Account creation failed.\n");
return 0;
}
ShowStatus("Console: Account '%s' created successfully.\n", username);
}
}
else if( strcmpi("ers_report", type) == 0 ){
ers_report();
}
else if( strcmpi("help", type) == 0 ){
ShowInfo("Available commands:\n");
ShowInfo("\t server:shutdown => Stops the server.\n");
ShowInfo("\t server:alive => Checks if the server is running.\n");
ShowInfo("\t server:reloadconf => Reload config file: \"%s\"\n", login_config.loginconf_name);
ShowInfo("\t ers_report => Displays database usage.\n");
ShowInfo("\t create:<username> <password> <sex:M|F> => Creates a new account.\n");
}
return 1;
}
示例6: chrif_checkdefaultlogin
// security check, prints warning if using default password
void chrif_checkdefaultlogin(void)
{
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowWarning("AVISO DE SEGURANЧA - O uso do login/senha padrѕes s1/p1 nуo щ recomendado.\n");
ShowNotice("Edite a tabela 'login' para criar uma certa configuraчуo inter-server login/senha.\n");
ShowNotice("e depois edite o login/senha do map-athena.conf (ou conf/import/map_conf.txt)\n");
}
}
示例7: chrif_checkdefaultlogin
// security check, prints warning if using default password
void chrif_checkdefaultlogin(void)
{
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowError("Utilizar o usuario/senha padrao s1/p1 NAO E RECOMENDADO.\n");
ShowNotice("Por favor edite sua tabela 'login' para criar usuario/senha corretos para o inter-server (sexo 'S')\n");
ShowNotice("e entao modifique usuario/senha utilizados no conf/map_athena.conf (ou conf/import/map_conf.txt)\n");
}
}
示例8: login_mmo_auth_new
/**
* Create a new account and save it in db/sql.
* @param userid: string for user login
* @param pass: string for user pass
* @param sex: should be M|F|S (todo make an enum ?)
* @param last_ip:
* @return :
* -1: success
* 0: unregistered id (wrong sex fail to create in db);
* 1: incorrect pass or userid (userid|pass too short or already exist);
* 3: registration limit exceeded;
*/
int login_mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) {
static int num_regs = 0; // registration counter
static unsigned int new_reg_tick = 0;
unsigned int tick = gettick();
struct mmo_account acc;
//Account Registration Flood Protection by [Kevin]
if( new_reg_tick == 0 )
new_reg_tick = gettick();
if( DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= login_config.allowed_regs ) {
ShowNotice("Account registration denied (registration limit exceeded)\n");
return 3;
}
if( login_config.new_acc_length_limit && ( strlen(userid) < 4 || strlen(pass) < 4 ) )
return 1;
// check for invalid inputs
if( sex != 'M' && sex != 'F' )
return 0; // 0 = Unregistered ID
// check if the account doesn't exist already
if( accounts->load_str(accounts, &acc, userid) ) {
ShowNotice("Attempt of creation of an already existant account (account: %s_%c, pass: %s, received pass: %s)\n", userid, sex, acc.pass, pass);
return 1; // 1 = Incorrect Password
}
memset(&acc, '\0', sizeof(acc));
acc.account_id = -1; // assigned by account db
safestrncpy(acc.userid, userid, sizeof(acc.userid));
safestrncpy(acc.pass, pass, sizeof(acc.pass));
acc.sex = sex;
safestrncpy(acc.email, "[email protected]", sizeof(acc.email));
acc.expiration_time = ( login_config.start_limited_time != -1 ) ? time(NULL) + login_config.start_limited_time : 0;
safestrncpy(acc.lastlogin, "0000-00-00 00:00:00", sizeof(acc.lastlogin));
safestrncpy(acc.last_ip, last_ip, sizeof(acc.last_ip));
safestrncpy(acc.birthdate, "0000-00-00", sizeof(acc.birthdate));
safestrncpy(acc.pincode, "", sizeof(acc.pincode));
acc.pincode_change = 0;
acc.char_slots = MIN_CHARS;
acc.bank_vault = 0;
#ifdef VIP_ENABLE
acc.vip_time = 0;
acc.old_group = 0;
#endif
if( !accounts->create(accounts, &acc) )
return 0;
ShowNotice("Account creation (account %s, id: %d, pass: %s, sex: %c)\n", acc.userid, acc.account_id, acc.pass, acc.sex);
if( DIFF_TICK(tick, new_reg_tick) > 0 ) {// Update the registration check.
num_regs = 0;
new_reg_tick = tick + login_config.time_allowed*1000;
}
++num_regs;
return -1;
}
示例9: chrif_checkdefaultlogin
// security check, prints warning if using default password
void chrif_checkdefaultlogin(void)
{
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowError("Usar o s1/p1 como padrao para usuario/senha nao e recomendado.\n");
#ifdef TXT_ONLY
ShowNotice("Por favor altere seu arquivo save/account.txt para criar um usuario/senha adequado do inter-server (Genero 'S')\n");
#else
ShowNotice("Por favor altere a tabela 'login' para criar um usuario/senha adequado do inter-server (Genero 'S')\n");
#endif
ShowNotice("e entao altere seu usuario/senha em conf/map_athena.conf (ou conf/import/map_conf.txt)\n");
}
}
示例10: chrif_checkdefaultlogin
// security check, prints warning if using default password
void chrif_checkdefaultlogin(void)
{
if (strcmp(userid, "s1")==0 && strcmp(passwd, "p1")==0) {
ShowError("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
#ifdef TXT_ONLY
ShowNotice("Please edit your save/account.txt file to create a proper inter-server user/password (gender 'S')\n");
#else
ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n");
#endif
ShowNotice("and then edit your user/password in conf/map_athena.conf (or conf/import/map_conf.txt)\n");
}
}
示例11: sig_dump
void sig_dump(int sn)
{
FILE *fp;
char file[256];
int no = 0;
crash_flag = 1;
// search for a usable filename
do {
sprintf (file, "log/%s%04d.stackdump", server_name, ++no);
} while((fp = fopen(file,"r")) && (fclose(fp), no < 9999));
// dump the trace into the file
if ((fp = FOPEN_(file, "w", stderr)) != NULL) {
const char *revision;
#ifndef CYGWIN
void* array[20];
char **stack;
size_t size;
#endif
ShowNotice ("Dumping stack to '"CL_WHITE"%s"CL_RESET"'...\n", file);
if ((revision = getrevision()) != NULL)
fprintf(fp, "Version: svn%s \n", revision);
else
fprintf(fp, "Version: %2d.%02d.%02d mod%02d \n", ATHENA_MAJOR_VERSION, ATHENA_MINOR_VERSION, ATHENA_REVISION, ATHENA_MOD_VERSION);
fprintf(fp, "Exception: %s \n", strsignal(sn));
fflush (fp);
#ifdef CYGWIN
cygwin_stackdump ();
#else
fprintf(fp, "Stack trace:\n");
size = backtrace (array, 20);
stack = backtrace_symbols (array, size);
for (no = 0; no < size; no++) {
fprintf(fp, "%s\n", stack[no]);
}
fprintf(fp,"End of stack trace\n");
free(stack);
#endif
ShowNotice("%s Saved.\n", file);
fflush(stdout);
fclose(fp);
}
sig_final(); // Log our uptime
// Pass the signal to the system's default handler
compat_signal(sn, SIG_DFL);
raise(sn);
}
示例12: chmapif_parse_regmapuser
/**
* Map-serv sent us all his users info, (aid and cid) so we can update online_char_db
* @param fd: wich fd to parse from
* @param id: wich map_serv id
* @return : 0 not enough data received, 1 success
*/
int chmapif_parse_regmapuser(int fd, int id){
if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2))
return 0;
{
//TODO: When data mismatches memory, update guild/party online/offline states.
DBMap* online_char_db = char_get_onlinedb();
int i;
map_server[id].users = RFIFOW(fd,4);
online_char_db->foreach(online_char_db,char_db_setoffline,id); //Set all chars from this server as 'unknown'
for(i = 0; i < map_server[id].users; i++) {
int aid = RFIFOL(fd,6+i*8);
int cid = RFIFOL(fd,6+i*8+4);
struct online_char_data* character = idb_ensure(online_char_db, aid, char_create_online_data);
if( character->server > -1 && character->server != id )
{
ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n",
character->account_id, character->char_id, character->server, id, aid, cid);
mapif_disconnectplayer(map_server[character->server].fd, character->account_id, character->char_id, 2);
}
character->server = id;
character->char_id = cid;
}
//If any chars remain in -2, they will be cleaned in the cleanup timer.
RFIFOSKIP(fd,RFIFOW(fd,2));
}
return 1;
}
示例13: logchrif_parse_reqbanacc
/**
* Receiving a ban request from map-server via char-server.
* @param fd: fd to parse from (char-serv)
* @param id: id of char-serv
* @param ip: char-serv ip (used for info)
* @return 0 not enough info transmitted, 1 success
* TODO check logchrif_parse_requpdaccstate for possible merge
*/
int logchrif_parse_reqbanacc(int fd, int id, char* ip){
if (RFIFOREST(fd) < 10)
return 0;
else{
struct mmo_account acc;
AccountDB* accounts = login_get_accounts_db();
uint32 account_id = RFIFOL(fd,2);
int timediff = RFIFOL(fd,6);
RFIFOSKIP(fd,10);
if( !accounts->load_num(accounts, &acc, account_id) )
ShowNotice("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n", ch_server[id].name, account_id, ip);
else{
time_t timestamp;
if (acc.unban_time == 0 || acc.unban_time < time(NULL))
timestamp = time(NULL); // new ban
else
timestamp = acc.unban_time; // add to existing ban
timestamp += timediff;
if (timestamp == -1)
ShowNotice("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n", ch_server[id].name, account_id, ip);
else if( timestamp <= time(NULL) || timestamp == 0 )
ShowNotice("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n", ch_server[id].name, account_id, ip);
else{
uint8 buf[11];
char tmpstr[24];
timestamp2string(tmpstr, sizeof(tmpstr), timestamp, login_config.date_format);
ShowNotice("Char-server '%s': Ban request (account: %d, new final date of banishment: %d (%s), ip: %s).\n", ch_server[id].name, account_id, timestamp, tmpstr, ip);
acc.unban_time = timestamp;
// Save
accounts->save(accounts, &acc);
WBUFW(buf,0) = 0x2731;
WBUFL(buf,2) = account_id;
WBUFB(buf,6) = 1; // 0: change of status, 1: ban
WBUFL(buf,7) = (uint32)timestamp; // status or final date of a banishment
logchrif_sendallwos(-1, buf, 11);
}
}
}
return 1;
}
示例14: mapif_guild_noinfo
// ギルド情報見つからず
int mapif_guild_noinfo(int fd, int guild_id) {
WFIFOHEAD(fd, 8);
WFIFOW(fd,0) = 0x3831;
WFIFOW(fd,2) = 8;
WFIFOL(fd,4) = guild_id;
WFIFOSET(fd,8);
ShowNotice("int_guild: info not found %d\n", guild_id);
return 0;
}
示例15: chrif_changedsex
/*==========================================
* 性別変化終了 (modified by Yor)
*------------------------------------------*/
int chrif_changedsex(int fd)
{
int acc, sex, i;
struct map_session_data *sd;
acc = RFIFOL(fd,2);
sex = RFIFOL(fd,6);
if (battle_config.etc_log)
ShowNotice("chrif_changedsex %d.\n", acc);
sd = map_id2sd(acc);
if (sd) { //Normally there should not be a char logged on right now!
if (sd->status.sex == sex)
return 0; //Do nothing? Likely safe.
sd->status.sex = !sd->status.sex;
// reset skill of some job
if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER) {
// remove specifical skills of Bard classes
for(i = 315; i <= 322; i++) {
if (sd->status.skill[i].id > 0 && !sd->status.skill[i].flag) {
if (sd->status.skill_point > USHRT_MAX - sd->status.skill[i].lv)
sd->status.skill_point = USHRT_MAX;
else
sd->status.skill_point += sd->status.skill[i].lv;
sd->status.skill[i].id = 0;
sd->status.skill[i].lv = 0;
}
}
// remove specifical skills of Dancer classes
for(i = 323; i <= 330; i++) {
if (sd->status.skill[i].id > 0 && !sd->status.skill[i].flag) {
if (sd->status.skill_point > USHRT_MAX - sd->status.skill[i].lv)
sd->status.skill_point = USHRT_MAX;
else
sd->status.skill_point += sd->status.skill[i].lv;
sd->status.skill[i].id = 0;
sd->status.skill[i].lv = 0;
}
}
clif_updatestatus(sd, SP_SKILLPOINT);
// change job if necessary
if (sd->status.sex) //Changed from Dancer
sd->status.class_ -= 1;
else //Changed from Bard
sd->status.class_ += 1;
//sd->class_ needs not be updated as both Dancer/Bard are the same.
}
// save character
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
clif_displaymessage(sd->fd, "Your sex has been changed (need disconnection by the server)...");
clif_setwaitclose(sd->fd); // forced to disconnect for the change
}
return 0;
}