/* doesn't really belong here, but I couldn't figure out where else */ void do_page(int descr, dbref player, const char *arg1, const char *arg2) { char buf[BUFFER_LEN], buf2[BUFFER_LEN]; dbref target; if (!payfor(player, tp_lookup_cost)) { anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies); return; } if (strcmp(arg1, "me")) { if ((target = lookup_player(arg1)) == NOTHING) { anotify_nolisten2(player, CINFO "Who?"); return; } } else target = player; if (Guest(player)) { if (!Mage(target)) { anotify_nolisten2(player, CINFO "Guests can only page wizards, type 'wizzes'."); return; } } if (FLAGS(target) & HAVEN) { anotify_nolisten2(player, CFAIL "That player is haven."); return; } if (Meeper(OWNER(player))) { do_parse_mesg(descr, player, player, arg2, "(page)", buf, MPI_ISPRIVATE); tct(buf, buf2); } else { tct(arg2, buf2); } if (!*buf2) { sprintf(buf, CSUCC "You sense that %s is looking for you in %s.", PNAME(player), NAME(DBFETCH(player)->location)); } else { if (buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, SYSGREEN "%s pages \"" SYSYELLOW "%s %s" SYSGREEN "\"", PNAME(player), PNAME(player), buf2); } else { sprintf(buf, SYSGREEN "%s pages \"" SYSYELLOW "%s" SYSGREEN "\"", PNAME(player), buf2); } } if (anotify_from(player, target, buf)) anotify_nolisten2(player, CSUCC "Your message has been sent."); else { sprintf(buf, CSUCC "%s is not connected.", PNAME(target)); anotify_nolisten2(player, buf); } }
char * displayprop(dbref player, dbref obj, const char *name, char *buf) { char mybuf[BUFFER_LEN], tbuf[BUFFER_LEN]; int pdflag; PropPtr p = get_property(obj, name); if (!p) { sprintf(buf, SYSGLOOM "%s: No such property.", name); return buf; } #ifdef DISKBASE propfetch(obj, p); #endif pdflag = (PropDir(p) != NULL); sprintf(tbuf, "%.*s%c", (BUFFER_LEN / 4), name, (pdflag) ? PROPDIR_DELIMITER : '\0'); tct(tbuf, mybuf); switch (PropType(p)) { case PROP_STRTYP: sprintf(buf, SYSAQUA "str " SYSGREEN "%s" SYSRED ":" SYSCYAN "%.*s", mybuf, (BUFFER_LEN / 2), tct(PropDataUNCStr(p), tbuf)); break; case PROP_REFTYP: sprintf(buf, SYSBROWN "ref " SYSGREEN "%s" SYSRED ":%s", mybuf, ansi_unparse_object(player, PropDataRef(p))); break; case PROP_INTTYP: sprintf(buf, SYSFOREST "int " SYSGREEN "%s" SYSRED ":" SYSYELLOW "%d", mybuf, PropDataVal(p)); break; case PROP_FLTTYP: sprintf(buf, SYSNAVY "flt " SYSGREEN "%s" SYSRED ":" SYSBROWN "%.15g", mybuf, PropDataFVal(p)); break; case PROP_LOKTYP: if (PropFlags(p) & PROP_ISUNLOADED) { sprintf(buf, SYSCRIMSON "lok " SYSGREEN "%s" SYSRED ":" SYSPURPLE "*UNLOCKED*", mybuf); } else { sprintf(buf, SYSCRIMSON "lok " SYSGREEN "%s" SYSRED ":" SYSPURPLE "%.*s", mybuf, (BUFFER_LEN / 2), tct(unparse_boolexp(player, PropDataLok(p), 1), tbuf)); } break; case PROP_DIRTYP: sprintf(buf, SYSWHITE "dir " SYSGREEN "%s" SYSRED ":", mybuf); break; } return buf; }
const char * ansiname(dbref loc, char buf[BUFFER_LEN]) { char tbuf[BUFFER_LEN]; *buf = '\0'; switch (Typeof(loc)) { case TYPE_PLAYER: strcpy(buf, SYSGREEN); break; case TYPE_THING: strcpy(buf, SYSPURPLE); break; case TYPE_EXIT: strcpy(buf, SYSBLUE); break; case TYPE_PROGRAM: strcpy(buf, SYSRED); break; case TYPE_ROOM: strcpy(buf, SYSCYAN); break; default: strcpy(buf, SYSNORMAL); } strcat(buf, tct(NAME(loc), tbuf)); return buf; }
/* doesn't really belong here, but I couldn't figure out where else */ void do_page(dbref player, const char *arg1, const char *arg2) { int ignored; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; dbref target; if (!payfor(player, tp_lookup_cost)) { anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies); return; } if ( strcmp(arg1, "me") ) { if ((target = lookup_player(arg1)) == NOTHING) { anotify(player, CINFO WHO_MESG); return; } } else target = player; if(Guest(player)) { if(!Mage(target)) { anotify(player, CINFO "Guests can only page " NAMEWIZ "s, type 'wizzes'."); return; } } if (FLAGS(target) & HAVEN) { anotify(player, CFAIL "That player is haven."); return; } ignored = ignoring(target, player); if(ignored == 1) { anotify(player, CFAIL "That player is ignoring you."); return; } else if(ignored == 2) { anotify(player, CINFO "That player is ignoring you."); } do_parse_mesg(player, player, arg2, "(page)", buf, MPI_ISPRIVATE); tct(buf,buf2); if (!*buf2) { sprintf(buf, CGREEN "You sense that %s is looking for you in %s.", PNAME(player), NAME(DBFETCH(player)->location)); } else { if(buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, CGREEN "%s pages \"" CYELLOW "%s %.3900s" CGREEN "\"", PNAME(player), PNAME(player), buf2); } else { sprintf(buf, CGREEN "%s pages \"" CYELLOW "%.3900s" CGREEN "\"", PNAME(player), buf2); } } if (anotify_from(player, target, buf)) anotify(player, CSUCC "Your message has been sent."); else { sprintf(buf, CINFO "%s is not connected.", PNAME(target)); anotify(player, buf); } }
TEST(TimeCardTransactionTest, PayrollTest) { AddHourlyEmployee ahe(5, "Test5", "Shanghai", 100.00); ahe.Execute(); Employee *e = ((DatabaseProxy *)getInstance())->GetEmployee(5); EXPECT_TRUE(e->GetName() == "Test5"); EXPECT_TRUE(e->GetAddress() == "Shanghai"); EXPECT_TRUE(e->GetEmpId() == 5); Date date(2010, 10, 10); TimeCardTransaction tct(5, date, 10); tct.Execute(); e = ((DatabaseProxy *)getInstance())->GetEmployee(5); PaymentClassification* pc = e->GetPaymentClassification(); EXPECT_TRUE(pc != 0); HourlyClassification* hc = dynamic_cast<HourlyClassification*>(pc); EXPECT_TRUE(hc != 0); TimeCard timecard(hc->GetTimeCard(date)); EXPECT_TRUE(timecard.GetHours() == 10); }
void do_pose(int descr, dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; if ((loc = getloc(player)) == NOTHING) return; tct(message, buf2); /* notify everybody */ sprintf(buf, "^SAY/POSE^%s %s", PNAME(player), buf2); anotify_except(DBFETCH(loc)->contents, NOTHING, buf, player); }
void do_pose(dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; if ((loc = getloc(player)) == NOTHING) return; do_parse_mesg(player, player, message, "(pose)", buf, MPI_ISPRIVATE); tct(buf,buf2); /* notify everybody */ sprintf(buf, CAQUA "%s%s%.3900s", PNAME(player), isalpha(buf2[0]) ? " " : "", buf2); anotify_except(DBFETCH(loc)->contents, NOTHING, buf, player); }
void do_say(int descr, dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; if ((loc = getloc(player)) == NOTHING) return; tct(message, buf2); /* notify everybody */ sprintf(buf, "^SAY/POSE^You say, ^SAY/QUOTES^\"^SAY/TEXT^%s^SAY/QUOTES^\"", buf2); anotify(player, buf); sprintf(buf, "^SAY/POSE^%s says, ^SAY/QUOTES^\"^SAY/TEXT^%s^SAY/QUOTES^\"", PNAME(player), buf2); anotify_except(DBFETCH(loc)->contents, player, buf, player); }
ToolConfigurationType ToolConfigurationType::createFromXmlNode(xmlNode * node) { std::string id; std::string name; std::string version; slint::XMLtools::getString(node, "toolConfigurationId", id); slint::XMLtools::getString(node, "toolName", name); slint::XMLtools::getString(node, "toolVersion", version); ToolConfigurationType tct(id, name, version); for (xmlNode * child = node->children; child; child = child->next) { tct.add(RuleLinkType::createFromXmlNode(child)); } return tct; }
void do_say(dbref player, const char *message) { dbref loc; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; if ((loc = getloc(player)) == NOTHING) return; do_parse_mesg(player, player, message, "(say)", buf, MPI_ISPRIVATE); tct(buf,buf2); /* Notify player */ sprintf(buf, CAQUA "You say, \"" CYELLOW "%.3900s" CAQUA "\"", buf2); anotify(player, buf); /* notify everybody else */ sprintf(buf, CAQUA "%s says, \"" CYELLOW "%.3900s" CAQUA "\"", PNAME(player), buf2); anotify_except(DBFETCH(loc)->contents, player, buf, player); }
TEST(PaydayTransactionForHourlyEmployeeTest, PayrollTest) { ((DatabaseProxy *)getInstance())->ClearEmployees(); int empid = 102; AddHourlyEmployee ahe(empid, "name02", "Shanghai", 20.00); ahe.Execute(); Employee *e = ((DatabaseProxy *)getInstance())->GetEmployee(empid); EXPECT_TRUE(e->GetName() == "name02"); EXPECT_TRUE(e->GetAddress() == "Shanghai"); EXPECT_TRUE(e->GetEmpId() == empid); Date date(2012, 2, 5); TimeCardTransaction tct(empid, date, 10); tct.Execute(); e = ((DatabaseProxy *)getInstance())->GetEmployee(empid); PaymentClassification* pc = e->GetPaymentClassification(); EXPECT_TRUE(pc != 0); HourlyClassification* hc = dynamic_cast<HourlyClassification*>(pc); EXPECT_TRUE(hc != 0); TimeCard timecard(hc->GetTimeCard(date)); EXPECT_TRUE(timecard.GetHours() == 10); Date paydate(2011, 2, 7); PaydayTransaction pt(paydate); pt.Execute(); PayCheck *check = pt.GetPayCheck(empid); EXPECT_TRUE(check != NULL); EXPECT_TRUE(check->GetName() == "name02"); EXPECT_EQ(check->GetGrossPay(), 200.00); EXPECT_EQ(check->GetDeductions(), 0.0); EXPECT_EQ(check->GetNetPay(), 200.00); }
void tune_show_strings(dbref player, char *name) { int total = 0; const char *lastname = NULL; char buf[BUFFER_LEN + 50], tbuf[BUFFER_LEN]; struct tune_str_entry *tstr = tune_str_list; while (tstr->name) { strcpy(buf, tstr->name); if (MLevel(OWNER(player)) >= tstr->readmlev) { sprintf(buf, SYSCYAN "(str) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSCYAN "%.4096s", (WLevel(OWNER(player)) >= tstr->writemlev) ? ' ' : '-', tstr->name, tct(*tstr->str, tbuf)); lastname = tstr->name; anotify_nolisten2(player, buf); total++; } tstr++; } anotify_fmt(player, CINFO "%d string-parm%s listed.", total, (total == 1) ? "" : "s"); }
int notify_html_listeners(int descr, dbref who, dbref xprog, dbref obj, dbref room, const char *msg, int isprivate) { char buf[BUFFER_LEN], *nohbuf, *noabuf, buf2[BUFFER_LEN]; dbref ref; if (obj == NOTHING) return 0; nohbuf = html_escape(msg); noabuf = tct(buf2, nohbuf); if (tp_listeners && (tp_listeners_obj || Typeof(obj) == TYPE_ROOM)) { listenqueue(descr, who, room, obj, obj, xprog, "_listen", nohbuf, tp_listen_mlev, 1, 0); listenqueue(descr, who, room, obj, obj, xprog, "_olisten", nohbuf, tp_listen_mlev, 0, 0); listenqueue(descr, who, room, obj, obj, xprog, "~listen", nohbuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "~olisten", nohbuf, tp_listen_mlev, 0, 1); listenqueue(descr, who, room, obj, obj, xprog, "@listen", nohbuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "@olisten", nohbuf, tp_listen_mlev, 0, 1); listenqueue(descr, who, room, obj, obj, xprog, "_alisten", noabuf, tp_listen_mlev, 1, 0); listenqueue(descr, who, room, obj, obj, xprog, "_aolisten", noabuf, tp_listen_mlev, 0, 0); listenqueue(descr, who, room, obj, obj, xprog, "~alisten", noabuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "~aolisten", noabuf, tp_listen_mlev, 0, 1); listenqueue(descr, who, room, obj, obj, xprog, "@alisten", noabuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "@aolisten", noabuf, tp_listen_mlev, 0, 1); /* Loop up the environment only if tp_listeners_env is set and obj * is a room. Runs once otherwise. -brevantes */ if (tp_listeners_env && (Typeof(obj) == TYPE_ROOM) ) { obj = DBFETCH(obj)->location; for (;obj != NOTHING;obj = DBFETCH(obj)->location) { listenqueue(descr, who, room, obj, obj, xprog, "_listen", nohbuf, tp_listen_mlev, 1, 0); listenqueue(descr, who, room, obj, obj, xprog, "_olisten", nohbuf, tp_listen_mlev, 0, 0); listenqueue(descr, who, room, obj, obj, xprog, "~listen", nohbuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "~olisten", nohbuf, tp_listen_mlev, 0, 1); listenqueue(descr, who, room, obj, obj, xprog, "@listen", nohbuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "@olisten", nohbuf, tp_listen_mlev, 0, 1); listenqueue(descr, who, room, obj, obj, xprog, "_alisten", noabuf, tp_listen_mlev, 1, 0); listenqueue(descr, who, room, obj, obj, xprog, "_aolisten", noabuf, tp_listen_mlev, 0, 0); listenqueue(descr, who, room, obj, obj, xprog, "~alisten", noabuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "~aolisten", noabuf, tp_listen_mlev, 0, 1); listenqueue(descr, who, room, obj, obj, xprog, "@alisten", noabuf, tp_listen_mlev, 1, 1); listenqueue(descr, who, room, obj, obj, xprog, "@aolisten", noabuf, tp_listen_mlev, 0, 1); } return 0; } } if (tp_zombies && (Typeof(obj) == TYPE_THING) && !isprivate && !(FLAGS(obj) & QUELL)) { if (FLAGS(obj) & VEHICLE) { if (getloc(who) == getloc(obj)) { char pbuf[BUFFER_LEN]; const char *prefix; prefix = GETOECHO(obj); if (prefix && *prefix) { prefix = do_parse_mesg(-1, who, obj, prefix, "(@Oecho)", pbuf, MPI_ISPRIVATE); } if (!prefix || !*prefix) prefix = "Outside>"; sprintf(buf, "%s %.*s", prefix, (int) (BUFFER_LEN - 2 - strlen(prefix)), msg); ref = DBFETCH(obj)->contents; while (ref != NOTHING) { #ifdef IGNORE_SUPPORT if (!ignorance(who, ref)) #endif /* IGNORE_SUPPORT */ notify_html_nolisten(ref, buf, isprivate); ref = DBFETCH(ref)->next; } } } } if (Typeof(obj) == TYPE_PLAYER || Typeof(obj) == TYPE_THING) { #ifdef IGNORE_SUPPORT if (ignorance(who, obj)) return 0; #endif if ( !isprivate && Typeof(obj) == TYPE_THING && FLAGS(obj) & ZOMBIE && LOCATION(obj) == LOCATION(OWNER(obj)) ) return 0; return notify_html_nolisten(obj, msg, isprivate); } else { return 0; } }
void do_whisper(int descr, dbref player, const char *arg1, const char *arg2) { dbref who; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; struct match_data md; if (Guest(player)) { anotify_fmt(player, CFAIL "%s", tp_noguest_mesg); return; } init_match(descr, player, arg1, TYPE_PLAYER, &md); match_neighbor(&md); match_me(&md); if (Mage(player) && Typeof(player) == TYPE_PLAYER) { match_absolute(&md); match_player(&md); } switch (who = match_result(&md)) { case NOTHING: anotify_nolisten2(player, CINFO "Who?"); break; case AMBIGUOUS: anotify_nolisten2(player, CINFO "I don't know who you mean!"); break; default: if (Meeper(OWNER(player))) { do_parse_mesg(descr, player, player, arg2, "(whisper)", buf, MPI_ISPRIVATE); tct(buf, buf2); } else { tct(arg2, buf2); } if (buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, SYSBLUE "%s whispers, \"" SYSPURPLE "%s %s" SYSBLUE "\"", PNAME(player), PNAME(player), buf2 + 1); if (!anotify_from(player, who, buf)) { sprintf(buf, SYSBLUE "%s is not connected.", PNAME(who)); anotify_nolisten2(player, buf); break; } sprintf(buf, SYSBLUE "You whisper, \"" SYSPURPLE "%s %s" SYSBLUE "\" to %s.", PNAME(player), buf2 + 1, PNAME(who)); anotify(player, buf); break; } else { sprintf(buf, SYSBLUE "%s whispers, \"" SYSPURPLE "%s" SYSBLUE "\"", PNAME(player), buf2); if (!anotify_from(player, who, buf)) { sprintf(buf, SYSBLUE "%s is not connected.", PNAME(who)); anotify_nolisten2(player, buf); break; } sprintf(buf, SYSBLUE "You whisper, \"" SYSPURPLE "%s" SYSBLUE "\" to %s.", buf2, PNAME(who)); anotify(player, buf); break; } } }
void tune_display_parms(dbref player, char *name) { int total = 0; const char *lastname = NULL; char buf[BUFFER_LEN + 50], tbuf[BUFFER_LEN]; struct tune_str_entry *tstr = tune_str_list; struct tune_time_entry *ttim = tune_time_list; struct tune_val_entry *tval = tune_val_list; struct tune_ref_entry *tref = tune_ref_list; struct tune_bool_entry *tbool = tune_bool_list; while (tstr->name) { strcpy(buf, tstr->name); if ((MLevel(OWNER(player)) >= tstr->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSCYAN "(str) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSCYAN "%.4096s", (WLevel(OWNER(player)) >= tstr->writemlev) ? ' ' : '-', tstr->name, tct(*tstr->str, tbuf)); lastname = tstr->name; anotify_nolisten2(player, buf); total++; } tstr++; } while (ttim->name) { strcpy(buf, ttim->name); if ((MLevel(OWNER(player)) >= ttim->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSPURPLE "(time) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSPURPLE "%s", (WLevel(OWNER(player)) >= ttim->writemlev) ? ' ' : '-', ttim->name, timestr_full(*ttim->tim)); lastname = ttim->name; anotify_nolisten2(player, buf); total++; } ttim++; } while (tval->name) { strcpy(buf, tval->name); if ((MLevel(OWNER(player)) >= tval->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSGREEN "(int) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSYELLOW "%d", (WLevel(OWNER(player)) >= tval->writemlev) ? ' ' : '-', tval->name, *tval->val); lastname = tval->name; anotify_nolisten2(player, buf); total++; } tval++; } while (tref->name) { strcpy(buf, tref->name); if ((MLevel(OWNER(player)) >= tref->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSYELLOW "(ref) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = %s", (WLevel(OWNER(player)) >= tref->writemlev) ? ' ' : '-', tref->name, ansi_unparse_object(player, *tref->ref)); lastname = tref->name; anotify_nolisten2(player, buf); total++; } tref++; } while (tbool->name) { strcpy(buf, tbool->name); if ((MLevel(OWNER(player)) >= tbool->readmlev) && (!*name || equalstr(name, buf))) { sprintf(buf, SYSWHITE "(bool) " SYSRED "%c" SYSGREEN "%-24s" SYSRED " = " SYSBLUE "%s", (WLevel(OWNER(player)) >= tbool->writemlev) ? ' ' : '-', tbool->name, ((*tbool->boolv) ? "yes" : "no")); lastname = tbool->name; anotify_nolisten2(player, buf); total++; } tbool++; } if ((total == 1) && lastname && *lastname) { do_sysparm(player, lastname); } else { anotify_fmt(player, CINFO "%d sysparm%s listed.", total, (total == 1) ? "" : "s"); anotify(player, SYSYELLOW "@tune str, time, int, ref, or bool to list by data types."); } }
void do_whisper(dbref player, const char *arg1, const char *arg2) { int ignored; dbref who; char buf[BUFFER_LEN], buf2[BUFFER_LEN]; struct match_data md; if(Guest(player)) { anotify(player, CFAIL NOGUEST_MESG); return; } init_match(player, arg1, TYPE_PLAYER, &md); match_neighbor(&md); match_me(&md); if (Mage(player) && Typeof(player) == TYPE_PLAYER) { match_absolute(&md); match_player(&md); } switch (who = match_result(&md)) { case NOTHING: case AMBIGUOUS: anotify(player, CINFO WHO_MESG); break; default: ignored = ignoring(who, player); if(ignored == 1) { anotify(player, CFAIL "That player is ignoring you."); return; } else if(ignored == 2) { anotify(player, CINFO "That player is ignoring you."); } do_parse_mesg(player, player, arg2, "(whisper)", buf, MPI_ISPRIVATE); tct(buf,buf2); if (buf2[0] == ':' || buf2[0] == ';') { sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%s %.3900s" CBLUE "\"", PNAME(player), PNAME(player), buf2+1); if (!anotify_from(player, who, buf)) { sprintf(buf, CBLUE "%s is not connected.", PNAME(who)); anotify(player, buf); break; } sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%s %.3900s" CBLUE "\" to %s.", PNAME(player), buf2+1, PNAME(who)); anotify(player, buf); break; } else { sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%.3900s" CBLUE "\"", PNAME(player), buf2); if (!anotify_from(player, who, buf)) { sprintf(buf, CBLUE "%s is not connected.", PNAME(who)); anotify(player, buf); break; } sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%.3900s" CBLUE "\" to %s.", buf2, PNAME(who)); anotify(player, buf); break; } } }