|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T w
Length: 9343 (0x247f) Types: TextFile Names: »weather.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Abermud/weather.c«
/* * Weather Routines * Current weather defined by state of object 47; states are * 0 Sunny 1 Rain 2 Stormy 3 Snowing */ #include "kernel.h" #ifdef RCSID static char RCS[] = "$Header: weather.c,v 1.1 89/03/13 09:37:59 rsalz Exp $"; #endif /* RCSID */ setwthr(n) int n; { if (plev(mynum) < 10 && !EQ(pname(mynum), "Rick")) { /* Our friend who hates the rain */ bprintf("What ?\n"); return; } adjwthr(n); } suncom() { setwthr(0); } raincom() { setwthr(1); } stormcom() { setwthr(2); } snowcom() { setwthr(3); } blizzardcom() { setwthr(4); } adjwthr(n) int n; { int x; x = state(0); setobjstate(0, n); if (x != n) sendsys(pname(mynum), pname(mynum), -10030, n, ""); } longwthr() { int a; if (randperc() < 70) return; a = randperc(); if (a < 50) adjwthr(1); else if (a > 90) adjwthr(2); else adjwthr(0); return; } wthrrcv(type) int type; { if (!outdoors()) return; switch (modifwthr(type)) { case 0: bprintf("\001cThe sun comes out of the clouds\n\001"); break; case 1: bprintf("\001cIt has started to rain\n\001"); break; case 2: bprintf("\001cDark clouds boil across the sky, as a heavy storm breaks\n\001"); break; case 3: bprintf("\001cIt has started to snow\n\001"); break; case 4: bprintf("\001cYou are half blinded by drifting snow, as a white, icy blizzard sweeps across\nthe land\n\001"); } } showwthr() { if (!outdoors()) return; switch (modifwthr(state(0))) { case 1: if (ploc(mynum) > -199 && ploc(mynum) < -178) { bprintf("It is raining, a gentle mist of rain, which sticks to everything around\n"); bprintf("you making it glisten and shine. High in the skies above you is a rainbow\n"); } else bprintf("\001cIt is raining\n\001"); break; case 2: bprintf("\001cThe skies are dark and stormy\n\001"); break; case 3: bprintf("\001cIt is snowing\001\n"); break; case 4: bprintf("\001cA blizzard is howling around you\001\n"); break; } } outdoors() { switch (ploc(mynum)) { case -100: case -101: case -102: return 1; case -183: case -170: return 0; } if (ploc(mynum) > -191 && ploc(mynum) < -168) return 1; if (ploc(mynum) > -172 && ploc(mynum) < -181) return 1; return (0); } /* Silly Section */ sillycom(txt) char *txt; { char bk[256]; sprintf(bk, txt, pname(mynum), pname(mynum)); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), bk); } laughcom() { if (chkdumb()) return; sillycom("\001P%s\001\001d falls over laughing\n\001"); bprintf("You start to laugh\n"); } purrcom() { if (chkdumb()) return; sillycom("\001P%s\001\001d starts purring\n\001"); bprintf("MMMMEEEEEEEEOOOOOOOWWWWWWW!\n"); } crycom() { if (chkdumb()) return; sillycom("\001s%s\001%s bursts into tears\n\001"); bprintf("You burst into tears\n"); } sulkcom() { sillycom("\001s%s\001%s sulks\n\001"); bprintf("You sulk....\n"); } burpcom() { if (chkdumb()) return; sillycom("\001P%s\001\001d burps loudly\n\001"); bprintf("You burp rudely\n"); } hiccupcom() { if (chkdumb()) return; sillycom("\001P%s\001\001d hiccups\n\001"); bprintf("You hiccup\n"); } fartcom() { hasfarted = 1; if (EQ(pname(mynum), "Veryodd")) { sillycom("\001PVeryodd\001\001d lets off a huge almost deafening monster of flatulence!\n"); } else sillycom("\001P%s\001\001d lets off a real rip roarer\n\001"); bprintf("Fine...\n"); } grincom() { sillycom("\001s%s\001%s grins evilly\n\001"); bprintf("You grin evilly\n"); } smilecom() { if (EQ(pname(mynum), "Rick")) { sillycom("\001s%s\001%s smiles, a huge friendly smile\n\001"); } else sillycom("\001s%s\001%s smiles happily\n\001"); bprintf("You smile happily\n"); } winkcom() { /* At person later maybe ? */ sillycom("\001s%s\001%s winks suggestively\n\001"); bprintf("You wink\n"); } sniggercom() { if (chkdumb()) return; sillycom("\001P%s\001\001d sniggers\n\001"); bprintf("You snigger\n"); } posecom() { if (plev(mynum) < 10) { bprintf("You are just not up to this yet\n"); return; } switch (randperc() % 5) { case 0: sillycom("\001s%s\001%s raises his arms in mighty magical invocations\n\001"); break; case 1: sillycom("\001s%s\001%s throws out one arm and sends a huge bolt of fire high\n\ into the sky\n\001"); broad("\001cA massive ball of fire explodes high up in the sky\n\001"); break; case 2: sillycom("\001s%s\001%s turns casually into a hamster before resuming normal shape\n\001"); break; case 3: sillycom("\001s%s\001%s \ starts sizzling with magical energy\n\001"); break; case 4: sillycom("\001s%s\001%s begins to crackle with magical fire\n\001"); break; } } /* (C) Jim Finnis (Yes he really did write one or two routines/A) */ emotecom() { char buf[100]; strcpy(buf, "\001P%s\001 "); getreinput(buf + 6); strcat(buf, "\n"); if (plev(mynum) < 10) bprintf("Your emotions are strictly limited!\n"); else sillycom(buf); } praycom() { sillycom("\001s%s\001%s falls down and grovels in the dirt\n\001"); bprintf("Ok\n"); } yawncom() { sillycom("\001P%s\001\001d yawns\n\001"); } groancom() { sillycom("\001P%s\001\001d groans loudly\n\001"); bprintf("You groan\n"); } moancom() { sillycom("\001P%s\001\001d starts making moaning noises\n\001"); bprintf("You start to moan\n"); } gigglecom() { sillycom("\001P%s\001\001d giggles inanely\n\001"); bprintf("You giggle\n"); } pukecom() { if (plev(mynum) > 10) { bprintf("You puke all over them\n"); sillycom("\001P%s\001\001d pukes over you\n\001"); } else { bprintf("You puke all over yourself\n"); if (psex(mynum) == 0) sillycom("\001P%s\001\001d pukes all over himself\n\001"); else sillycom("\001P%s\001\001d pukes all over herself\n\001"); } } cancarry(plyr) int plyr; { int a, b; if (plev(plyr) > 9 || plev(plyr) < 0) return 1; for (a = 0, b = 0; a < numobs; a++) if (iscarrby(a, plyr) && !otstbit(a, 0)) b++; return b < plev(plyr) + 5; } setcom() { int a, b, c; if (brkword() == -1) { bprintf("set what\n"); return; } if (plev(mynum) < 10) { bprintf("Sorry, wizards only\n"); return; } if ((a = fobna(wordbuf)) == -1) { if ((a = fpbn(wordbuf)) == -1) bprintf("Set what ?\n"); else if (a < 16) bprintf("Mobiles only\n"); else if (brkword() == -1) bprintf("To what value ?\n"); else { if (*wordbuf < '0' || *wordbuf > '9') bprintf("Stamina should be a number.\n"); else { b = atoi(wordbuf); setpstr(a, b); } return; } } if (brkword() == -1) { bprintf("Set to what value ?\n"); return; } if (EQ(wordbuf, "bit")) { if (brkword() == -1) { bprintf("Which bit ?\n"); return; } b = atoi(wordbuf); if (brkword() == -1) { bprintf("The bit is %s\n", otstbit(a, b) ? "TRUE" : "FALSE"); return; } c = atoi(wordbuf); if (c < 0 || c > 1 || b < 0 || b > 15) { bprintf("Number out of range\n"); return; } if (c == 0) oclrbit(a, b); else osetbit(a, b); return; } if (EQ(wordbuf, "byte")) { if (brkword() == -1) { bprintf("Which byte ?\n"); return; } b = atoi(wordbuf); if (brkword() == -1) { bprintf("Current Value is : %d\n", obyte(a, b)); return; } c = atoi(wordbuf); if (b < 0 || b > 1 || c < 0 || c > 255) { bprintf("Number out of range\n"); return; } osetbyte(a, b, c); return; } if ((b = atoi(wordbuf)) > omaxstate(a)) { bprintf("Sorry max state for that is %d\n", omaxstate(a)); return; } if (b < 0) bprintf("States start at 0\n"); else setobjstate(a, b); } isdark() { int c; if (plev(mynum) > 9) return 0; if (ploc(mynum) == -1100 || ploc(mynum) == -1101) return 0; if (!(ploc(mynum) <= -1113 && ploc(mynum) >= -1123)) /* should -499 be -399 instead ??? */ if (ploc(mynum) < -399 || ploc(mynum) > -300) return(0); for (c = 0; c < numobs; c++) { if (c != 32 && otstbit(c, 13) == 0) continue; if (ishere(c)) return 0; if (ocarrf(c) == 0 || ocarrf(c) == 3 || ploc(oloc(c)) != ploc(mynum)) continue; return 0; } return 1; } modifwthr(n) int n; { if (ploc(mynum) >= -179 && ploc(mynum) <= -199) return n > 1 ? n % 2 : n; if (ploc(mynum) >= -178 && ploc(mynum) <= -100) return n == 1 || n == 2 ? n + 2 : n; return n; } setpflags() { int a, b, c; if (!ptstflg(mynum, 2)) { bprintf("You can't do that\n"); return; } if (brkword() == -1) { bprintf("Whose PFlags ?\n"); return; } if ((a = fpbn(wordbuf)) == -1) { bprintf("Who is that ?\n"); return; } if (brkword() == -1) { bprintf("Flag number ?\n"); return; } b = atoi(wordbuf); if (brkword() == -1) { bprintf("Value is %s\n", ptstflg(a, b) ? "TRUE" : "FALSE"); return; } c = atoi(wordbuf); if (c < 0 || c > 1 || b < 0 || b > 31) { bprintf("Out of range\n"); return; } mudlog("PFLAG: %s by %s", pname(a), pname(mynum)); if (c) psetflg(a, b); else pclrflg(a, b); }