void cEvent::Dump(FILE *f, const char *Prefix, bool InfoOnly) const { if (InfoOnly || startTime + duration + Setup.EPGLinger * 60 >= time(NULL)) { fprintf(f, "%sE %u %ld %d %X %X\n", Prefix, eventID, startTime, duration, tableID, version); if (!isempty(title)) fprintf(f, "%sT %s\n", Prefix, title); if (!isempty(shortText)) fprintf(f, "%sS %s\n", Prefix, shortText); if (!isempty(description)) { strreplace(description, '\n', '|'); fprintf(f, "%sD %s\n", Prefix, description); strreplace(description, '|', '\n'); } if (contents[0]) { fprintf(f, "%sG", Prefix); for (int i = 0; Contents(i); i++) fprintf(f, " %02X", Contents(i)); fprintf(f, "\n"); } if (parentalRating) fprintf(f, "%sR %d\n", Prefix, parentalRating); if (components) { for (int i = 0; i < components->NumComponents(); i++) { tComponent *p = components->Component(i); fprintf(f, "%sX %s\n", Prefix, *p->ToString()); } } if (vps) fprintf(f, "%sV %ld\n", Prefix, vps); if (!InfoOnly) fprintf(f, "%se\n", Prefix); } }
// Splits the calling object into its components. global func Split2Components() { // Safety: can only be called from object context. if (!this || GetType(this) != C4V_C4Object) return FatalError(Format("Split2Components must be called from object context and not from %v", this)); // Transfer all contents to container. var ctr = Contained(); while (Contents()) if (!ctr || !Contents()->Enter(ctr)) Contents()->Exit(); // Split components. for (var i = 0, compid; compid = GetComponent(nil, i); ++i) for (var j = 0; j < GetComponent(compid); ++j) { var comp = CreateObjectAbove(compid, nil, nil, GetOwner()); if (OnFire()) comp->Incinerate(); if (!ctr || !comp->Enter(ctr)) { comp->SetR(Random(360)); comp->SetXDir(Random(3) - 1); comp->SetYDir(Random(3) - 1); comp->SetRDir(Random(3) - 1); } } return RemoveObject(); }
void notify_except2_rlevel2 ( dbref loc, dbref player, dbref exc1, dbref exc2, const UTF8 *msg ) { if ( loc != exc1 && loc != exc2 && IsReal(loc, player)) { notify_check(loc, player, msg, (MSG_ME_ALL | MSG_F_UP | MSG_S_INSIDE | MSG_NBR_EXITS_A)); } dbref first; DOLIST(first, Contents(loc)) { if ( first != exc1 && first != exc2 && IsReal(first, player) && IsReal(first, exc2)) { notify_check(first, player, msg, (MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE)); } } }
func Script81() { if (!Contents(0,GetActionTarget(0,catapult_clnk))) return(goto(81)); SetPlrShowControl(0,"0_2345678_0123456789___3___7__"); TutorialMessage("$TxtFlingthematerialupto$"); wait(20); }
func Script61() { if (!Contents(0,GetActionTarget(0,valley_clnk))) return(goto(61)); SetPlrShowControl(0,"0_2345678_0123456789___3___7__"); TutorialMessage("$TxtHitthrowagaintofiret$"); wait(15); }
void notify_except_rlevel ( dbref loc, dbref player, dbref exception, const UTF8 *msg, int xflags ) { if ( loc != exception && IsReal(loc, player)) { notify_check(loc, player, msg, (MSG_ME_ALL | MSG_F_UP | MSG_S_INSIDE | MSG_NBR_EXITS_A| xflags)); } dbref first; DOLIST(first, Contents(loc)) { if ( first != exception && IsReal(first, player)) { notify_check(first, player, msg, (MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE | xflags)); } } }
double RatingPainter::RatingForPos(const QPoint& pos, const QRect& rect) { const QRect contents = Contents(rect); const double raw = double(pos.x() - contents.left()) / contents.width(); // Round to the nearest 0.1 return double(int(raw * kStarCount * 2 + 0.5)) / (kStarCount * 2); }
func Script60() { if(GetID(Contents(0,GetHiRank(0)))!=FLAG) { goto(60); return; } Sound("Applause"); RemoveArrow(); }
func Script205() { if (GetID(Contents(0,GetHiRank(0)))!=GOLD) { goto(205); return; } Sound("Applause"); RemoveArrow(); SetPlrShowControl(0,"___345678_ 345678 __________"); }
bool FUniqueNetIdRepl::ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText) { SetUniqueNetId(nullptr); bool bShouldWarn = true; if (Buffer) { static FString InvalidString(TEXT("INVALID")); if (Buffer[0] == TEXT('\0') || Buffer == InvalidString) { // An empty string or the word invalid are just considered expected invalid FUniqueNetIdRepls. No need to warn about those. bShouldWarn = false; } else { checkf(UOnlineEngineInterface::Get() && UOnlineEngineInterface::Get()->IsLoaded(), TEXT("Attempted to ImportText to FUniqueNetIdRepl while OSS is not loaded. Parent:%s"), *GetPathNameSafe(Parent)); FString Contents(Buffer); UniqueIdFromString(Contents); } } if (bShouldWarn && !IsValid()) { #if !NO_LOGGING ErrorText->CategorizedLogf(LogNet.GetCategoryName(), ELogVerbosity::Warning, TEXT("Failed to import text to FUniqueNetIdRepl Parent:%s"), *GetPathNameSafe(Parent)); #endif } return true; }
BOOL DoImport(HWND hwnd, LPCWSTR pszFile) { HANDLE hFile = CreateFileW(pszFile, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (hFile == INVALID_HANDLE_VALUE) return FALSE; BOOL bSuccess = FALSE; DWORD dwSize = GetFileSize(hFile, NULL); if (dwSize != 0xFFFFFFFF) { std::vector<BYTE> Contents(dwSize + 2); DWORD cbRead; if (ReadFile(hFile, &Contents[0], dwSize, &cbRead, NULL) && cbRead == dwSize) { /* check BOM */ if (memcmp(&Contents[0], "\xFF\xFE", 2) == 0) { bSuccess = DoParseFile(&Contents[2], dwSize - 2); } else { bSuccess = DoParseFile(&Contents[0], dwSize); } } } CloseHandle(hFile); return bSuccess; }
static dbref make_player(const char *name, const char *password, const char *host, const char *ip) { dbref player; char temp[SBUF_LEN]; char *flaglist, *flagname; char flagbuff[BUFFER_LEN]; player = new_object(); /* initialize everything */ set_name(player, name); Location(player) = PLAYER_START; Home(player) = PLAYER_START; Owner(player) = player; Parent(player) = NOTHING; Type(player) = TYPE_PLAYER; Flags(player) = new_flag_bitmask("FLAG"); strcpy(flagbuff, options.player_flags); flaglist = trim_space_sep(flagbuff, ' '); if (*flaglist != '\0') { while (flaglist) { flagname = split_token(&flaglist, ' '); twiddle_flag_internal("FLAG", player, flagname, 0); } } if (Suspect_Site(host, player) || Suspect_Site(ip, player)) set_flag_internal(player, "SUSPECT"); set_initial_warnings(player); /* Modtime tracks login failures */ ModTime(player) = (time_t) 0; (void) atr_add(player, pword_attr, password_hash(password, NULL), GOD, 0); giveto(player, START_BONUS); /* starting bonus */ (void) atr_add(player, "LAST", show_time(mudtime, 0), GOD, 0); (void) atr_add(player, "LASTSITE", host, GOD, 0); (void) atr_add(player, "LASTIP", ip, GOD, 0); (void) atr_add(player, "LASTFAILED", " ", GOD, 0); snprintf(temp, sizeof temp, "%d", START_QUOTA); (void) atr_add(player, "RQUOTA", temp, GOD, 0); (void) atr_add(player, "MAILCURF", "0", GOD, AF_LOCKED | AF_NOPROG | AF_WIZARD); add_folder_name(player, 0, "inbox"); /* link him to PLAYER_START */ PUSH(player, Contents(PLAYER_START)); add_player(player); add_lock(GOD, player, Basic_Lock, parse_boolexp(player, "=me", Basic_Lock), LF_DEFAULT); add_lock(GOD, player, Enter_Lock, parse_boolexp(player, "=me", Basic_Lock), LF_DEFAULT); add_lock(GOD, player, Use_Lock, parse_boolexp(player, "=me", Basic_Lock), LF_DEFAULT); current_state.players++; local_data_create(player); return player; }
// Handles getting the contents of an object, which is often // specific to each game driver. void CHSInterface::GetContents(int loc, CSTLDbrefList & rlistDbrefs, int type) { int thing; #ifdef PENNMUSH // No change in code between versions for (thing = db[loc].contents; GoodObject(thing); thing = Next(thing)) { if (type != NOTYPE) { if (Typeof(thing) == type) { rlistDbrefs.push_back(thing); } } else { rlistDbrefs.push_back(thing); } } #endif #if defined(TM3) || defined(MUX) for (thing = Contents(loc); Good_obj(thing); thing = Next(thing)) { if (type != NOTYPE) { if (Typeof(thing) == type) rlistDbrefs.push_back(thing); } else rlistDbrefs.push_back(thing); } #endif }
func Script65() { if (!Contents(0,catapult_clnk)) return(goto(65)); SetPlrShowControl(0,"0_2345678_0123456789_______7__"); TutorialMessage("$TxtNowgrabtheothercatap$"); SetArrowToObj(hill_cata); wait(15); }
public func ControlThrow() { if (GetPlrDownDouble(GetOwner())) return(0); // Träger bereit zum Werfen? if (Contents(0) && GetAction() == "Jump") if (SetAction("JumpThrow")) { return(1); } return(_inherited()); }
func Script37() { if (!Contents(0,valley_clnk)) return(goto(37)); SetPlrShowControl(0,"0_2345678_0123456789_______7__"); TutorialMessage("$TxtNowstopinfrontofthec$"); SetArrowToObj(valley_cata); wait(15); }
func Script85() { if (!Contents(0,constructor_clnk)) return(goto(85)); SetPlrShowControl(0,"0_2345678_0123456789_______6__"); TutorialMessage("$TxtWithadoublestopatthe$"); SetArrowToObj(the_elevator); wait(10); }
public func ControlThrow (pClonk) // Bedienung: Werfen (benutzen) { if(!(pClonk->~FireRifle())) return(0); SetPhase(6, pClonk); // Fadenkreuz zum besseren Zielen erzeugen var pCross = CreateObject(WCHR, 0, 0, GetOwner(pClonk)); pCross->SetAction("Crosshair", pClonk); Local(0,GetCrosshair(pClonk)) = 84; WINC->ActualizePhase(pClonk); // dem Clonk übermitteln, wie viel Ammo da ist LocalN("iRifleAmmo", pClonk) = ContentsCount(); while(Contents()) Enter(pCross, Contents()); // eigene ID speichern LocalN("idWeapon",pClonk)=GetID(); // Schnell noch schauen, ob der Clonk auch Munition hat! if(!LocalN("iRifleAmmo", pClonk)) DefinitionCall(GetID(), "CheckAmmo", pClonk); // ...und selbst löschen RemoveObject(); return(1); }
HS_DBREF CHSInterface::GetContents(HS_DBREF dbItem) { #ifdef PENNMUSH // No change in code between versions return db[dbItem].contents; #endif #if defined(TM3) || defined(MUX) return Contents(dbItem); #endif }
void match_possession(void) { if (md.confidence >= CON_DBREF) { return; } if (Good_loc(md.player)) { match_list(Contents(md.player), CON_LOCAL); } }
void move_object(dbref thing, dbref dest) { dbref src; /* * Remove from the source location */ src = Location(thing); if(src != NOTHING) s_Contents(src, remove_first(Contents(src), thing)); /* * Special check for HOME */ if(dest == HOME) dest = Home(thing); /* * Add to destination location */ if(dest != NOTHING) s_Contents(dest, insert_first(Contents(dest), thing)); else s_Next(thing, NOTHING); s_Location(thing, dest); /* * Look around and do the penny check */ look_in(thing, dest, (LK_SHOWEXIT | LK_OBEYTERSE)); if(isPlayer(thing) && (mudconf.payfind > 0) && (Pennies(thing) < mudconf.paylimit) && (!Controls(thing, dest)) && ((random() % mudconf.payfind) == 0)) { giveto(thing, 1); notify_printf(thing, "You found a %s!", mudconf.one_coin); } }
/* Clone an object. The new object is owned by the cloning player */ static dbref clone_object(dbref player, dbref thing, const char *newname, int preserve) { dbref clone; clone = new_object(); Owner(clone) = Owner(player); Name(clone) = NULL; if (newname && *newname) set_name(clone, newname); else set_name(clone, Name(thing)); s_Pennies(clone, Pennies(thing)); AttrCount(clone) = 0; List(clone) = NULL; Locks(clone) = NULL; clone_locks(player, thing, clone); Zone(clone) = Zone(thing); Parent(clone) = Parent(thing); Flags(clone) = clone_flag_bitmask("FLAG", Flags(thing)); if (!preserve) { clear_flag_internal(clone, "WIZARD"); clear_flag_internal(clone, "ROYALTY"); Warnings(clone) = 0; /* zap warnings */ Powers(clone) = new_flag_bitmask("POWER"); /* zap powers */ } else { Powers(clone) = clone_flag_bitmask("POWER", Powers(thing)); Warnings(clone) = Warnings(thing); if (Wizard(clone) || Royalty(clone) || Warnings(clone) || !null_flagmask("POWER", Powers(clone))) notify(player, T ("Warning: @CLONE/PRESERVE on an object with WIZ, ROY, @powers, or @warnings.")); } /* We give the clone the same modification time that its * other clone has, but update the creation time */ ModTime(clone) = ModTime(thing); CreTime(clone) = mudtime; Type(clone) = Type(thing); Contents(clone) = Location(clone) = Next(clone) = NOTHING; if (IsRoom(thing)) Exits(clone) = NOTHING; else Home(clone) = Home(thing); atr_cpy(clone, thing); queue_event(player, "OBJECT`CREATE", "%s,%s", unparse_objid(clone), unparse_objid(thing)); return clone; }
static void process_sticky_dropto(dbref loc, dbref player) { dbref dropto, thing, next; /* * Do nothing if checking anything but a sticky room */ if(!Good_obj(loc) || !Has_dropto(loc) || !Sticky(loc)) return; /* * Make sure dropto loc is valid */ dropto = Dropto(loc); if((dropto == NOTHING) || (dropto == loc)) return; /* * Make sure no players hanging out */ DOLIST(thing, Contents(loc)) { if(Dropper(thing)) return; } /* * Send everything through the dropto */ s_Contents(loc, reverse_list(Contents(loc))); SAFE_DOLIST(thing, next, Contents(loc)) { send_dropto(thing, player); }
void match_neighbor(void) { dbref loc; if (md.confidence >= CON_DBREF) { return; } if (Good_obj(md.player) && Has_location(md.player)) { loc = Location(md.player); if (Good_obj(loc)) { match_list(Contents(loc), CON_LOCAL); } } }
public func Activate(oCaller, oClonk) { if(!oClonk) oClonk = oCaller; // Effekt prüfen var iChkEff; if (iChkEff = CheckEffect("WarmPSpell", oExtiObj, 180)) return(iChkEff!=-1 && RemoveObject()); // Nächstes gerforenes Objekt finden var oExtiObj, iExtiCount, pObj; // Den Clonk selbst? if(Frozen(oClonk)) iExtiCount += DoUnfreeze(oClonk, oCaller); else if(oClonk->~MagicWarm(1800)) iExtiCount += DoUnfreeze(oClonk, oCaller); else if(pObj = Contents(0,oClonk)) if(GetID(pObj)==METL) if(GetDefHeight(ANML)) { RemoveObject(pObj); CreateContents(ANML, oClonk); return(RemoveObject()); } // Nächstliegende Objekte SetPosition(GetX(oCaller), GetY(oCaller)); // Suchradius ist abhängig von Höhe des Aufrufenden - ein Zauberturm hat einen größeren Radius var iSearchRadius = GetObjHeight(oCaller) * 3; while(oExtiObj = FindObject(0, 0, 0, -1, -1, 0, 0, 0, 0, oExtiObj)) if(ObjectDistance(oCaller, oExtiObj) > iSearchRadius) break; else if(Frozen(oExtiObj)) iExtiCount += DoUnfreeze(oExtiObj, oCaller); else if (oExtiObj->~MagicUnfreeze(oCaller)) iExtiCount += DoUnfreeze(oExtiObj, oCaller); // Irgendwas erwärmt? if (!iExtiCount) { Message("$NoUnfreeze$", oClonk); RemoveObject(); return 0; } // Einmaliger Effekt pro Zauber Sound("Inflame"); return(true); }
global func FxPotionSupplyTimer(pTarget) { if(!Random(50) || GetCon(pTarget) !=100) return(); var i,p; for(i=0; i<ObjectCount(0,0,0,0,0,0,0,0,pTarget); ++i) { if(Contents(i, pTarget)->~IsPotion()) p++; } if(p>3) return(0); var rnd=Random(8); if(!rnd--) if(!FindContents(PFIR, pTarget)) CreateContents(PFIR, pTarget); if(!rnd--) if(!FindContents(PFIS, pTarget)) CreateContents(PFIS, pTarget); if(!rnd--) if(!FindContents(PHEA, pTarget)) CreateContents(PHEA, pTarget); if(!rnd--) if(!FindContents(PIMM, pTarget)) CreateContents(PIMM, pTarget); if(!rnd--) if(!FindContents(PMAN, pTarget)) CreateContents(PMAN, pTarget); if(!rnd--) if(!FindContents(PMON, pTarget)) CreateContents(PMON, pTarget); if(!rnd--) if(!FindContents(PSTO, pTarget)) CreateContents(PSTO, pTarget); if(!rnd--) if(!FindContents(PWIP, pTarget)) CreateContents(PWIP, pTarget); return(1); }
public func Activate(pCaller, pClonk) { if(!pClonk) pClonk = pCaller; // Effekt prüfen var iChkEff; if (iChkEff = CheckEffect("CookPSpell", pCaller, 180)) return(iChkEff!=-1 && RemoveObject()); // Inhalt untersuchen var obj = Contents(0, pClonk), obj2; var res; if(!obj) res = 0; else if(obj->~Cook()) res = 1; // Kochbar? else if(obj->~Bake()) res = 1; // Backbar? else if(GetAlive(obj)) { Kill(obj); res=1; } // Tötbar? if(!res) return(0, Message("$NoCook$", pCaller), RemoveObject()); // Einmaliger Effekt pro Zauber Sound("Cook"); CastParticles("Fire", 20, 30, 0, 0, 50, 70, RGBa(255, 100, 0, 50), RGBa(200, 100, 0, 75),pClonk); CastParticles("Fire2", 100, 50, 0, 0, 50, 70, RGBa(255, 100, 0, 50), RGBa(200, 100, 0, 75),pClonk); return(true); }
/* Main entry point */ int HandledCommand(dbref player, dbref loc, char *command) { dbref curr, temp; if(Slave(player)) return 0; if(strlen(command) > (LBUF_SIZE - MBUF_SIZE)) return 0; if(OkayHcode(player) && HandledCommand_sub(player, player, command)) return 1; if(OkayHcode(loc) && HandledCommand_sub(player, loc, command)) return 1; SAFE_DOLIST(curr, temp, Contents(player)) { if(OkayHcode(curr)) if(HandledCommand_sub(player, curr, command)) return 1; #if 0 /* Recursion is evil ; let's not do that, this time */ if(Has_contents(curr)) if(HandledCommand_contents(player, curr, command)) return 1; #endif } return 0; }
HS_DBREF CHSInterface::GetFirstContent(HS_DBREF dbObject) { return Contents(dbObject); }
bool ReceivedBundleElement::IsBundle() const { return (Size() > 0 && Contents()[0] == '#'); }