extern void main(void) { OSStatus err; FCBPBRec fcbPB; FSSpec fss; // 1. Show our "icon march" icon ShowInitIcon(128, true); // 2. Find our FSSpec fss.name[0] = 0; fcbPB.ioNamePtr = fss.name; fcbPB.ioVRefNum = 0; fcbPB.ioRefNum = (short)CurResFile(); fcbPB.ioFCBIndx = 0; err = PBGetFCBInfoSync(&fcbPB); // 3. Tell CFM that we're a CFM library container file fss.vRefNum = fcbPB.ioFCBVRefNum; fss.parID = fcbPB.ioFCBParID; if (err == noErr) err = FragRegisterFileLibs(&fss, false); // 4. Now that CFM knows we're a library container, tell it to go and get our library if (err == noErr) { CFragConnectionID c; Ptr m; Str255 e; THz oldZone = GetZone(); SetZone(SystemZone()); err = GetSharedLibrary("\pDarwin;mDNS", kPowerPCCFragArch, kLoadCFrag, &c, &m, e); SetZone(oldZone); }
boolean menewmenubar (hdloutlinerecord houtline, hdlmenubarstack *hstack) { /* create a new, empty menubar data structure, linked into menubarlist. 4.1b2 dmb: xxx - create stack in the (client) application zone */ register hdlmenubarstack hs; #if 0 THz savezone = GetZone (); SetZone (ApplicationZone ()); *hstack = (hdlmenubarstack) NewHandleClear (sizeof (tymenubarstack)); SetZone (savezone); hs = *hstack; /*move into register*/ if (hs == nil) { memoryerror (); return (false); } #else if (!newclearhandle (sizeof (tymenubarstack), (Handle *) hstack)) return (false); hs = *hstack; /*move into register*/ #endif (**hs).menubaroutline = houtline; (**hs).ixdeletedmenu = -1; /*no halfway deleted menu*/ /* if (pushmenubarlist (hs)) /%add it to the end of our list%/ (**hs).flactive = (**menubarlist).flactive; */ return (true); } /*menewmenubar*/
pascal OSErr mDNS_CFMInit(const CFragInitBlock *theInitBlock) { extern pascal OSErr __initialize(const CFragInitBlock *theInitBlock); __initialize(theInitBlock); // MUST do this first! { mStatus err; THz oldZone = GetZone(); SetZone(SystemZone()); LogMsg("mDNS/DNS-SD with Macsbug breaks -- do not ship this version to customers"); err = mDNS_Init(&mDNSStorage, &PlatformSupportStorage, rrcachestorage, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses, mDNS_StatusCallback, mDNS_Init_NoInitCallbackContext); SetZone(oldZone); return((OSErr)err); } }
Character::Character(std::string fromString) { std::vector<std::string> tokens = utils::Tokenfy(fromString, '|'); if (tokens[0] == "PLAYER_OBJECT") { SetName(tokens[57]); SetLastname(tokens[58]); SetRace(tokens[59]); SetGender(tokens[60]); SetFace(tokens[61]); SetSkin(tokens[62]); SetZone(tokens[63]); SetLevel(std::stoi(tokens[64])); SetHp(std::stoi(tokens[65])); SetMaxHp(std::stoi(tokens[66])); SetBp(std::stoi(tokens[67])); SetMaxBp(std::stoi(tokens[68])); SetMp(std::stoi(tokens[69])); SetMaxMp(std::stoi(tokens[70])); SetEp(std::stoi(tokens[71])); SetMaxEp(std::stoi(tokens[72])); SetStrength(std::stoi(tokens[73])); SetConstitution(std::stoi(tokens[74])); SetIntelligence(std::stoi(tokens[75])); SetDexterity(std::stoi(tokens[76])); SetX(std::stof(tokens[77])); SetY(std::stof(tokens[78])); SetZ(std::stof(tokens[79])); SetPitch(std::stof(tokens[80])); SetYaw(std::stof(tokens[81])); } // if (tokens[0] == "NPC_OBJECT") { // // } }
extern pascal OSStatus GetDetachedIconSuite(IconSuiteRef *theIconSuite, SInt16 theResID, IconSelectorValue selector) // See comment in interface part. { long oldA4; OSStatus err; THz oldZone; oldA4 = SetUpA4(); assert(theIconSuite != NULL); oldZone = SetSystemZone(); // The algorithm here is perfectly simple. First get the icon suite, // then iterate over its contents detaching each handle. I looked // at the Icon Services code and this seems like a perfectly reasonable // strategy. It also disassembled SBGetDetachIconSuite and it works // in the same way. err = GetIconSuite(theIconSuite, theResID, selector); if (err == noErr) { (void) ForEachIconDo(*theIconSuite, kSelectorAllAvailableData, gDetachIconActionUPP, NULL); } SetZone(oldZone); (void) SetA4(oldA4); return err; }
void dng_date_time_info::Decode_IPTC_Time (const char *s) { if (strlen (s) == 11) { char time [12]; memcpy (time, s, sizeof (time)); if (time [6] == '+' || time [6] == '-') { int tzsign = (time [6] == '-') ? -1 : 1; time [6] = 0; unsigned hour = 0; unsigned minute = 0; unsigned second = 0; unsigned tzhour = 0; unsigned tzmin = 0; if (sscanf (time, "%2u%2u%2u", &hour, &minute, &second) == 3 && sscanf (time + 7, "%2u%2u", &tzhour, &tzmin) == 2) { dng_time_zone zone; zone.SetOffsetMinutes (tzsign * (tzhour * 60 + tzmin)); if (zone.IsValid ()) { SetTime ((uint32) hour, (uint32) minute, (uint32) second); SetZone (zone); } } } } }
static THz SetSystemZone(void) // Sets the current zone to the system zone, returning // the previous value. { THz result; result = GetZone(); SetZone(SystemZone()); return result; }
OSErr TotalHack(CFragConnectionID connID) { Handle theStrings; CMBufferSizes bufSizes; short procID; Str255 toolName; OSErr error; FSSpec where; short ref; char* end; Ptr tempString; char* here; short baud; Boolean prefsChanged = false; THz myZone; ser_t* storage; gConnection = nil; // get a Connection Tool name strcpy((char *)toolName, "Apple Modem Tool"); // so try to use the Apple modem tool c2pstr((char *)toolName); end = (char *)(toolName + toolName[0] + 1); memset(end, '\0', 255 - toolName[0]); // init the CMBufferSizes variable so that Tool will init with defaults bufSizes[cmDataIn] = 0; bufSizes[cmDataOut] = 0; bufSizes[cmCntlIn] = 0; bufSizes[cmCntlOut] = 0; bufSizes[cmAttnIn] = 0; bufSizes[cmAttnOut] = 0; bufSizes[cmRsrvIn] = 0; bufSizes[cmRsrvOut] = 0; error = noErr; myZone = GetZone(); SetZone(SystemZone()); // get a process ID for the tool procID = CMGetProcID(toolName); if (procID == -1) { error = -2; } // now get a conn record set up if (error == noErr) { gConnection = CMNew(procID, cmData|cmNoMenus|cmQuiet, bufSizes, 0, 0); if (gConnection != nil) { storage = (ser_t*)NewPtrClear(sizeof(ser_t)); storage->sConnection = gConnection; error = SetData(connID, (unsigned long)storage); } } return error; }
extern pascal MenuRef NewSystemMenu(ConstStr255Param title) // See comment in interface part. { MenuRef result; THz oldZone; assert(title != NULL); oldZone = SetSystemZone(); result = NewMenu(0, title); assert(result == NULL || ValidateSystemMenuRef(result)); SetZone(oldZone); return result; }
extern pascal MenuRef GetNewSystemMenu(SInt16 menuResourceID) // See comment in interface part. { MenuRef result; THz oldZone; oldZone = SetSystemZone(); result = GetMenu(menuResourceID); if (result != NULL) { DetachResource( (Handle) result ); assert(ResError() == noErr); assert(ValidateSystemMenuRef(result)); } SetZone(oldZone); return result; }
Character::Character(std::string name, std::string lastname, std::string race, std::string gender, std::string face, std::string skin, std::string zone, int level, int hp, int maxHp, int bp, int maxBp, int mp, int maxMp, int ep, int maxEp, int strength, int constitution, int intelligence, int dexterity, float x, float y, float z, float pitch, float yaw) { SetName(name); SetLastname(lastname); SetRace(race); SetGender(gender); SetFace(face); SetSkin(skin); SetZone(zone); SetHead("head"); SetChest("chest"); SetArms("arms"); SetHands("hands"); SetLegs("legs"); SetFeet("feet"); SetCloak("cloak"); SetNecklace("necklace"); SetRingOne("ringOne"); SetRingTwo("ringTwo"); SetRightHand("rightHand"); SetLeftHand("leftHand"); SetLevel(level); SetHp(hp); SetMaxHp(maxHp); SetBp(bp); SetMaxBp(maxBp); SetMp(mp); SetMaxMp(maxMp); SetEp(ep); SetMaxEp(maxEp); SetStrength(strength); SetConstitution(constitution); SetIntelligence(intelligence); SetDexterity(dexterity); SetX(x); SetY(y); SetZ(z); SetPitch(pitch); SetYaw(yaw); }
void kGUIMenuObj::Resize(void) { int i; unsigned int x; unsigned int y; unsigned int w; unsigned int h; /* calc new size */ x=0; y=0; for(i=0;i<m_numentries;++i) { w=m_title.GetEntryPtr(i)->GetWidth(); h=m_title.GetEntryPtr(i)->GetLineHeight(); m_titlex.SetEntry(i,x); m_titlew.SetEntry(i,w); w+=TITLEGAPX+TITLEGAPX; /* left gap + right gap */ x+=w; y=MAX(y,h); } SetZone(0,0,x,y+TITLEGAPY+TITLEGAPY); }
bool HistogramAttributes::CopyAttributes(const AttributeGroup *atts) { bool retval = false; if(TypeName() == atts->TypeName()) { // Call assignment operator. const HistogramAttributes *tmp = (const HistogramAttributes *)atts; *this = *tmp; retval = true; } else if(atts->TypeName() == "PickAttributes") { const PickAttributes *tmp = (const PickAttributes*)atts; int dom = tmp->GetDomain(); dom = (dom < 0 ? 0 : dom); // -1 is val for single domain problems SetDomain(dom); SetZone(tmp->GetElementNumber()); retval = true; } return retval; }
// KTX has in-built modifications to several maps - frogbot routing relies on entity order so we have // to customise again here. Called after all markers created, but before traveltime calculations static void CustomiseFrogbotMap (void) { gedict_t* ent = NULL; // KTX may have added a quad, so to keep routes compatible with PR1-version, we add it as a marker after others if (streq(g_globalvars.mapname, "aerowalk") && !FrogbotOptionEnabled(FB_OPTION_EDITOR_MODE)) { gedict_t* quad = ez_find (world, "item_artifact_super_damage"); if (quad) { gedict_t* nearest_marker; quad->fb.fl_marker = false; nearest_marker = LocateMarker (quad->s.v.origin); quad->fb.fl_marker = true; StartItemFB (quad); quad->fb.T |= MARKER_DYNAMICALLY_ADDED; // Quad is in same zone as nearest marker, and linked by the first path that's valid SetZone (nearest_marker->fb.Z_, quad->fb.index + 1); SetGoalForMarker (18, quad); AddPath (nearest_marker, quad); AddPath (quad, nearest_marker); SpawnMarkerIndicator (quad); } } // We stopped it from removing the telespawn earlier on... if (!cvar ("k_end_tele_spawn") && streq ("end", g_globalvars.mapname)) { vec3_t TS_ORIGIN = { -392, 608, 40 }; // tele spawn gedict_t* p = NULL; gedict_t* m = NULL; for (p = world; (p = find (p, FOFCLSN, "info_player_deathmatch")); ) { if (VectorCompare (p->s.v.origin, TS_ORIGIN)) { p->classname = "info_player_deathmatch_removed"; // Remove any spawn marker for (m = world; (m = find (m, FOFCLSN, "spawnpoint")); ) { if (m->k_lastspawn == p) { ent_remove (m); break; } } break; } } } // Expand bounding box of all items if (!isRACE()) { for (ent = world; (ent = nextent(ent)); ) { if (streq(ent->classname, "info_teleport_destination") || streq(ent->classname, "info_player_deathmatch")) { continue; } if (streq(ent->classname, "marker")) { vec3_t mins = { -65, -65, -24 }; vec3_t maxs = { 65, 65, 32 }; vec3_t viewoffset = { 80, 80, 24 }; int i; for (i = 0; i < 3; ++i) { if (ent->fb.fixed_size[i]) { mins[i] = -ent->fb.fixed_size[i] / 2 - (i < 2 ? 15 : 0); maxs[i] = ent->fb.fixed_size[i] / 2 - (i < 2 ? 15 : 0); viewoffset[i] = (maxs[i] - mins[i]) / 2; } } VectorCopy(viewoffset, ent->s.v.view_ofs); setsize(ent, PASSVEC3(mins), PASSVEC3(maxs)); } else if ((int)ent->s.v.flags & FL_ITEM) { PlaceItemFB(ent); } } } // Link all teleporters if (FrogbotOptionEnabled (FB_OPTION_EDITOR_MODE)) { for (ent = world; (ent = ez_find (ent, "trigger_teleport")); ) { // If this teleport takes us to the marker close to the grenade, set arrow_time if (!strnull (ent->target)) { gedict_t* target = find (world, FOFS (targetname), ent->target); AddPath (ent, target); } } } }
static boolean getmenutobuild (bigstring bsmenu, boolean flhierarchic, short *id, hdlmenu *hmenu, boolean *flbuiltin) { /* 5.0a24 dmb: before allocating a new menu, see if we want to build onto a builtin menu */ boolean flinfrontier; #ifdef flcomponent THz savezone; #if TARGET_API_MAC_CARBON == 1 savezone = LMGetApplZone(); #else savezone = GetZone (); #endif #endif #ifdef MACVERSION flinfrontier = iscurrentapplication (langipcself); #else flinfrontier = true; #endif if (flinfrontier && !flhierarchic && shelltgetmainmenu (bsmenu, hmenu, id)) { *flbuiltin = true; #ifdef WIN95VERSION // about needs to be last, but resource compiler doesn't allow empty menus if (*id == helpmenu) deletemenuitem (*hmenu, aboutitem); #endif return (true); } *flbuiltin = false; if (*id <= 0) { /*allocate a new menu id*/ if (!meallocmenuid (id)) return (false); } #ifdef flcomponent #if TARGET_API_MAC_CARBON == 1 //Code change by Timothy Paustian Monday, June 26, 2000 9:29:46 PM //This code makes no sense to me. LMSetApplZone(LMGetApplZone()); #else SetZone (ApplicationZone ()); #endif #endif *hmenu = Newmenu (*id, bsmenu); #ifdef flcomponent #if TARGET_API_MAC_CARBON == 1 LMSetApplZone(savezone); #else SetZone (savezone); #endif #endif return (hmenu != nil); } /*getmenutobuild*/
void HistogramAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("HistogramAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("basedOn")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetBasedOn(BasedOn(ival)); } else if(node->GetNodeType() == STRING_NODE) { BasedOn value; if(BasedOn_FromString(node->AsString(), value)) SetBasedOn(value); } } if((node = searchNode->GetNode("histogramType")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetHistogramType(BinContribution(ival)); } else if(node->GetNodeType() == STRING_NODE) { BinContribution value; if(BinContribution_FromString(node->AsString(), value)) SetHistogramType(value); } } if((node = searchNode->GetNode("weightVariable")) != 0) SetWeightVariable(node->AsString()); if((node = searchNode->GetNode("limitsMode")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetLimitsMode(LimitsMode(ival)); } else if(node->GetNodeType() == STRING_NODE) { LimitsMode value; if(LimitsMode_FromString(node->AsString(), value)) SetLimitsMode(value); } } if((node = searchNode->GetNode("minFlag")) != 0) SetMinFlag(node->AsBool()); if((node = searchNode->GetNode("maxFlag")) != 0) SetMaxFlag(node->AsBool()); if((node = searchNode->GetNode("min")) != 0) SetMin(node->AsDouble()); if((node = searchNode->GetNode("max")) != 0) SetMax(node->AsDouble()); if((node = searchNode->GetNode("numBins")) != 0) SetNumBins(node->AsInt()); if((node = searchNode->GetNode("domain")) != 0) SetDomain(node->AsInt()); if((node = searchNode->GetNode("zone")) != 0) SetZone(node->AsInt()); if((node = searchNode->GetNode("useBinWidths")) != 0) SetUseBinWidths(node->AsBool()); if((node = searchNode->GetNode("outputType")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetOutputType(OutputType(ival)); } else if(node->GetNodeType() == STRING_NODE) { OutputType value; if(OutputType_FromString(node->AsString(), value)) SetOutputType(value); } } if((node = searchNode->GetNode("lineStyle")) != 0) SetLineStyle(node->AsInt()); if((node = searchNode->GetNode("lineWidth")) != 0) SetLineWidth(node->AsInt()); if((node = searchNode->GetNode("color")) != 0) color.SetFromNode(node); if((node = searchNode->GetNode("dataScale")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetDataScale(DataScale(ival)); } else if(node->GetNodeType() == STRING_NODE) { DataScale value; if(DataScale_FromString(node->AsString(), value)) SetDataScale(value); } } if((node = searchNode->GetNode("binScale")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetBinScale(DataScale(ival)); } else if(node->GetNodeType() == STRING_NODE) { DataScale value; if(DataScale_FromString(node->AsString(), value)) SetBinScale(value); } } if((node = searchNode->GetNode("normalizeHistogram")) != 0) SetNormalizeHistogram(node->AsBool()); if((node = searchNode->GetNode("computeAsCDF")) != 0) SetComputeAsCDF(node->AsBool()); }
void _ARMIA_RYSUJ_INFO(aint A) { aint AX=0,AY=0,PL=0,I=0; aint GD=0,DANE=0;//,KONIEC=0; aint WOJ=0,SILA=0,SPEED=0,TRYB=0,CELX=0,CELY=0,ROZ=0; aint TEREN=0,ZARCIE=0; astr RO_S="",D_S="",DNI_S="",WOJ_S="",R2_S=""; AX=ARMIA[A][0][TX]; // AX=ARMIA(A,0,TX) AY=ARMIA[A][0][TY]; // AY=ARMIA(A,0,TY) PL=ARMIA[A][0][TMAG]; // PL=ARMIA(A,0,TMAG) OKNO(80,80,150,100); // OKNO[80,80,150,100] GD=50; // GD=50 if( A<20 ) { // If A<20 RO_S=GS("187"); // RO$="Commands" DANE=-1; // DANE=True } else { // Else RO_S=GS("188"); // RO$="Inquiry" if( ARMIA[A][0][TMAGMA]>28 && ARMIA[A][0][TMAGMA]<100 ) { // If ARMIA(A,0,TMAGMA)>28 and ARMIA(A,0,TMAGMA)<100 DANE=0; D_S=GS("189"); // DANE=False : D$="No informations." } else { // Else if( ARMIA[A][0][TMAGMA]>1 ) { // If ARMIA(A,0,TMAGMA)>1 DNI_S=GS("190"); // DNI$=" days." } else { // Else DNI_S=GS("191"); // DNI$=" day." } // End If DANE=0; // DANE=False : D$="Informations during "+Str$(ARMIA(A,0,TMAGMA))+DNI$ D_S=GS("192")+Str_S(ARMIA[A][0][TMAGMA])+DNI_S; } // End If if( ARMIA[A][0][TMAGMA]==0 || ARMIA[A][0][TMAGMA]==100 ) {// If ARMIA(A,0,TMAGMA)=0 or ARMIA(A,0,TMAGMA)=100 RO_S=GS("193"); // RO$="Trace " GD=52; // GD=52 DANE=-1; // DANE=True } // End If } // End If GADGET(OKX+4,OKY+4,142,74,"",31,2,30,1,-1);// GADGET[OKX+4,OKY+4,142,74,"",31,2,30,1,-1] GADGET(OKX+4,OKY+80,GD,15,RO_S,8,2,6,31,10);// GADGET[OKX+4,OKY+80,GD,15,RO$,8,2,6,31,10] GADGET(OKX+106,OKY+80,40,15,GS("194"),8,2,6,31,1);// GADGET[OKX+106,OKY+80,40,15," Ok ",8,2,6,31,1] if( ARMIA[A][0][TMAGMA]==100 ) { // If ARMIA(A,0,TMAGMA)=100 : Ink 31,6 : Text OKX+48,OKY+89,"@" : End If gad_text(1.0); Text(OKX+48,OKY+89,"@"); } //!!!nieco inaczej // No Mask 23+PL : Paste Bob OKX+8,OKY+8,23+PL Gfx::Color(0,0,0); _Bar(OKX+8,OKY+8,OKX+40,OKY+40); PasteBob(OKX+8,OKY+8,23+PL); SetZone(11,OKX+50,OKY+5,OKX+120,OKY+15);// Set Zone 11,OKX+50,OKY+5 To OKX+120,OKY+15 gad_text(1.0); // Ink 1,30 : Text OKX+50,OKY+15,ARMIA$(A,0) Text(OKX+50,OKY+15,ARMIA_S[A][0]); if( DANE !=0 ) { // If DANE for(I=1;I<=10;++I) { // For I=1 To 10 if( ARMIA[A][I][TE]>0 ) { // If ARMIA(A,I,TE)>0 WOJ+=1; // Add WOJ,1 SILA+=ARMIA[A][I][TSI]; // Add SILA,ARMIA(A,I,TSI) SILA+=ARMIA[A][I][TE]; // Add SILA,ARMIA(A,I,TE) SPEED+=ARMIA[A][I][TSZ]; // Add SPEED,ARMIA(A,I,TSZ) } // End If } // Next I ARMIA[A][0][TE]=WOJ; // ARMIA(A,0,TE)=WOJ SPEED=((SPEED/WOJ)/5); // SPEED=((SPEED/WOJ)/5) ARMIA[A][0][TSZ]=SPEED; // ARMIA(A,0,TSZ)=SPEED ARMIA[A][0][TSI]=SILA; // ARMIA(A,0,TSI)=SILA AX=ARMIA[A][0][TX]; // AX=ARMIA(A,0,TX) AY=ARMIA[A][0][TY]; // AY=ARMIA(A,0,TY) TRYB=ARMIA[A][0][TTRYB]; // TRYB=ARMIA(A,0,TTRYB) CELX=ARMIA[A][0][TCELX]; // CELX=ARMIA(A,0,TCELX) CELY=ARMIA[A][0][TCELY]; // CELY=ARMIA(A,0,TCELY) ROZ=ARMIA[A][0][TTRYB]; // ROZ=ARMIA(A,0,TTRYB) TEREN=ARMIA[A][0][TNOGI]; // TEREN=ARMIA(A,0,TNOGI) WOJ_S=GS("195"); // WOJ$=" worriors" if( WOJ==1 ) WOJ_S=GS("196"); // If WOJ=1 : WOJ$=" worrior" : End If if( ROZ==0 ) { // If ROZ=0 RO_S=GS("197"); // RO$="Unit is tenting" if( TEREN>69 ) { // If TEREN>69 RO_S+=GS("198")+MIASTA_S[TEREN-70]; // RO$=RO$+" in "+MIASTA$(TEREN-70) } // End If } // End If if( ROZ==1 || ROZ==2 ) { // If ROZ=1 or ROZ=2 : RO$="Unit is moving." : End If RO_S=GS("199"); } if( ROZ==3 ) { // If ROZ=3 if( CELY==0 ) { // If CELY=0 R2_S=ARMIA_S[CELX][0]; // R2$=ARMIA$(CELX,0) } else { // Else R2_S=MIASTA_S[CELX]; // R2$=MIASTA$(CELX) } // End If RO_S=GS("200")+R2_S; // RO$="We're attacking "+R2$ } // End If if( ROZ==4 ) { // If ROZ=4 : RO$="We're hunting" : End If RO_S=GS("201"); } ZARCIE=ARMIA[A][0][TAMO]/WOJ; // ZARCIE=ARMIA(A,0,TAMO)/WOJ DNI_S=GS("202")+Str_S(ZARCIE)+GS("203");// DNI$="Food for "+Str$(ZARCIE)+" days" if( ZARCIE==1 ) { // If ZARCIE=1 : DNI$="Food for only 1 day" : End If DNI_S=GS("204"); } if( ZARCIE<=0 ) { // If ZARCIE<=0 : DNI$="We have no food !" : End If DNI_S=GS("205"); } gad_text(1.0); // Ink 1,30 Text(OKX+50,OKY+35,GS("206")+Str_S(SILA)); // Text OKX+50,OKY+35,"Strength :"+Str$(SILA) Text(OKX+50,OKY+25,Str_S(WOJ)+WOJ_S); // Text OKX+50,OKY+25,Str$(WOJ)+WOJ$ Text(OKX+50,OKY+45,DNI_S); // Text OKX+50,OKY+45,DNI$ Text(OKX+50,OKY+55,GS("207")+Str_S(SPEED)); // Text OKX+50,OKY+55,"Speed :"+Str$(SPEED) Text(OKX+12,OKY+65,RO_S); // Text OKX+12,OKY+65,RO$ } else { // Else gad_text(1.0); Text(OKX+12,OKY+60,D_S); // Text OKX+12,OKY+60,D$ } // End If }
bool ZoneServer::Process() { if (!tcpc->Connected()) return false; if(ls_zboot.Check()){ LSBootUpdate(GetZoneID(), true); ls_zboot.Disable(); } ServerPacket *pack = 0; while((pack = tcpc->PopPacket())) { _hex(WORLD__ZONE_TRACE,pack->pBuffer,pack->size); if (!authenticated) { if (WorldConfig::get()->SharedKey.length() > 0) { if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) { uint8 tmppass[16]; MD5::Generate((const uchar*) WorldConfig::get()->SharedKey.c_str(), WorldConfig::get()->SharedKey.length(), tmppass); if (memcmp(pack->pBuffer, tmppass, 16) == 0) authenticated = true; else { struct in_addr in; in.s_addr = GetIP(); zlog(WORLD__ZONE_ERR,"Zone authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); return false; } } else { struct in_addr in; in.s_addr = GetIP(); zlog(WORLD__ZONE_ERR,"Zone authorization failed."); ServerPacket* pack = new ServerPacket(ServerOP_ZAAuthFailed); SendPacket(pack); delete pack; Disconnect(); return false; } } else { _log(WORLD__ZONE,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access."); authenticated = true; } } switch(pack->opcode) { case 0: break; case ServerOP_KeepAlive: { // ignore this break; } case ServerOP_ZAAuth: { break; } case ServerOP_LSZoneBoot:{ if(pack->size==sizeof(ZoneBoot_Struct)){ ZoneBoot_Struct* zbs= (ZoneBoot_Struct*)pack->pBuffer; SetCompile(zbs->compile_time); } break; } case ServerOP_GroupInvite: { if(pack->size != sizeof(GroupInvite_Struct)) break; GroupInvite_Struct* gis = (GroupInvite_Struct*) pack->pBuffer; client_list.SendPacket(gis->invitee_name, pack); break; } case ServerOP_GroupFollow: { if(pack->size != sizeof(ServerGroupFollow_Struct)) break; ServerGroupFollow_Struct *sgfs = (ServerGroupFollow_Struct *) pack->pBuffer; client_list.SendPacket(sgfs->gf.name1, pack); break; } case ServerOP_GroupFollowAck: { if(pack->size != sizeof(ServerGroupFollowAck_Struct)) break; ServerGroupFollowAck_Struct *sgfas = (ServerGroupFollowAck_Struct *) pack->pBuffer; client_list.SendPacket(sgfas->Name, pack); break; } case ServerOP_GroupCancelInvite: { if(pack->size != sizeof(GroupCancel_Struct)) break; GroupCancel_Struct *gcs = (GroupCancel_Struct *) pack->pBuffer; client_list.SendPacket(gcs->name1, pack); break; } case ServerOP_GroupIDReq: { SendGroupIDs(); break; } case ServerOP_GroupLeave: { if(pack->size != sizeof(ServerGroupLeave_Struct)) break; zoneserver_list.SendPacket(pack); //bounce it to all zones break; } case ServerOP_GroupJoin: { if(pack->size != sizeof(ServerGroupJoin_Struct)) break; zoneserver_list.SendPacket(pack); //bounce it to all zones break; } case ServerOP_ForceGroupUpdate: { if(pack->size != sizeof(ServerForceGroupUpdate_Struct)) break; zoneserver_list.SendPacket(pack); //bounce it to all zones break; } case ServerOP_OOZGroupMessage: { zoneserver_list.SendPacket(pack); //bounce it to all zones break; } case ServerOP_DisbandGroup: { if(pack->size != sizeof(ServerDisbandGroup_Struct)) break; zoneserver_list.SendPacket(pack); //bounce it to all zones break; } case ServerOP_RaidAdd:{ if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidRemove: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidDisband: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidLockFlag: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidChangeGroup: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_UpdateGroup: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidGroupDisband: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidGroupAdd: { if(pack->size != sizeof(ServerRaidGroupAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidGroupRemove: { if(pack->size != sizeof(ServerRaidGroupAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidGroupSay: { zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidSay: { zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidGroupLeader: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_RaidLeader: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_DetailsChange: { if(pack->size != sizeof(ServerRaidGeneralAction_Struct)) break; zoneserver_list.SendPacket(pack); break; } case ServerOP_SpawnCondition: { if(pack->size != sizeof(ServerSpawnCondition_Struct)) break; //bounce the packet to the correct zone server, if its up ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer; zoneserver_list.SendPacket(ssc->zoneID, ssc->instanceID, pack); break; } case ServerOP_SpawnEvent: { if(pack->size != sizeof(ServerSpawnEvent_Struct)) break; //bounce the packet to the correct zone server, if its up ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer; zoneserver_list.SendPacket(sse->zoneID, 0, pack); break; } case ServerOP_ChannelMessage: { ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer; if(scm->chan_num == 20) { UCSLink.SendMessage(scm->from, scm->message); break; } if (scm->chan_num == 7 || scm->chan_num == 14) { if (scm->deliverto[0] == '*') { Console* con = 0; con = console_list.FindByAccountName(&scm->deliverto[1]); if (((!con) || (!con->SendChannelMessage(scm))) && (!scm->noreply)) zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); break; } ClientListEntry* cle = client_list.FindCharacter(scm->deliverto); if (cle == 0 || cle->Online() < CLE_Status_Zoning || (cle->TellsOff() && ((cle->Anon() == 1 && scm->fromadmin < cle->Admin()) || scm->fromadmin < 80))) { if (!scm->noreply) zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); } else if (cle->Online() == CLE_Status_Zoning) { if (!scm->noreply) { char errbuf[MYSQL_ERRMSG_SIZE]; char *query = 0; MYSQL_RES *result; //MYSQL_ROW row; Trumpcard - commenting. Currently unused. time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); char *telldate=asctime(timeinfo); if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT name from character_ where name='%s'",scm->deliverto), errbuf, &result)) { safe_delete(query); if (result!=0) { if (database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO tellque (Date,Receiver,Sender,Message) values('%s','%s','%s','%s')",telldate,scm->deliverto,scm->from,scm->message), errbuf, &result)) zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "Your message has been added to the %s's que.", scm->to); else zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); safe_delete(query); } else zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); mysql_free_result(result); } else safe_delete(query); } // zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to); } else if (cle->Server() == 0) { if (!scm->noreply) zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not contactable at this time'", scm->to, scm->to); } else cle->Server()->SendPacket(pack); } else { if (scm->chan_num == 5 || scm->chan_num == 6 || scm->chan_num == 11) { console_list.SendChannelMessage(scm); } zoneserver_list.SendPacket(pack); } break; } case ServerOP_EmoteMessage: { ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer; zoneserver_list.SendEmoteMessageRaw(sem->to, sem->guilddbid, sem->minstatus, sem->type, sem->message); break; } case ServerOP_VoiceMacro: { ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer; if(svm->Type == VoiceMacroTell) { ClientListEntry* cle = client_list.FindCharacter(svm->To); if (!cle || (cle->Online() < CLE_Status_Zoning) || !cle->Server()) { zoneserver_list.SendEmoteMessage(svm->From, 0, 0, 0, "'%s is not online at this time'", svm->To); break; } cle->Server()->SendPacket(pack); } else zoneserver_list.SendPacket(pack); break; } case ServerOP_RezzPlayerAccept: { zoneserver_list.SendPacket(pack); break; } case ServerOP_RezzPlayer: { RezzPlayer_Struct* sRezz = (RezzPlayer_Struct*) pack->pBuffer; if (zoneserver_list.SendPacket(pack)){ zlog(WORLD__ZONE,"Sent Rez packet for %s",sRezz->rez.your_name); } else { zlog(WORLD__ZONE,"Could not send Rez packet for %s",sRezz->rez.your_name); } break; } case ServerOP_RezzPlayerReject: { char *Recipient = (char *)pack->pBuffer; client_list.SendPacket(Recipient, pack); break; } case ServerOP_MultiLineMsg: { ServerMultiLineMsg_Struct* mlm = (ServerMultiLineMsg_Struct*) pack->pBuffer; client_list.SendPacket(mlm->to, pack); break; } case ServerOP_SetZone: { if(pack->size != sizeof(SetZone_Struct)) break; SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer; if (szs->zoneid != 0) { if(database.GetZoneName(szs->zoneid)) SetZone(szs->zoneid, szs->instanceid, szs->staticzone); else SetZone(0); } else SetZone(0); break; } case ServerOP_SetConnectInfo: { if (pack->size != sizeof(ServerConnectInfo)) break; ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer; if (!sci->port) { clientport=zoneserver_list.GetAvailableZonePort(); ServerPacket p(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo)); memset(p.pBuffer,0,sizeof(ServerConnectInfo)); ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer; sci->port = clientport; SendPacket(&p); zlog(WORLD__ZONE,"Auto zone port configuration. Telling zone to use port %d",clientport); } else { clientport=sci->port; zlog(WORLD__ZONE,"Zone specified port %d, must be a previously allocated zone reconnecting.",clientport); } } case ServerOP_SetLaunchName: { if(pack->size != sizeof(LaunchName_Struct)) break; const LaunchName_Struct* ln = (const LaunchName_Struct*)pack->pBuffer; launcher_name = ln->launcher_name; launched_name = ln->zone_name; zlog(WORLD__ZONE, "Zone started with name %s by launcher %s", launched_name.c_str(), launcher_name.c_str()); break; } case ServerOP_ShutdownAll: { if(pack->size==0){ zoneserver_list.SendPacket(pack); zoneserver_list.Process(); CatchSignal(2); } else{ WorldShutDown_Struct* wsd=(WorldShutDown_Struct*)pack->pBuffer; if(wsd->time==0 && wsd->interval==0 && zoneserver_list.shutdowntimer->Enabled()){ zoneserver_list.shutdowntimer->Disable(); zoneserver_list.reminder->Disable(); } else{ zoneserver_list.shutdowntimer->SetTimer(wsd->time); zoneserver_list.reminder->SetTimer(wsd->interval-1000); zoneserver_list.reminder->SetAtTrigger(wsd->interval); zoneserver_list.shutdowntimer->Start(); zoneserver_list.reminder->Start(); } } break; } case ServerOP_ZoneShutdown: { ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; ZoneServer* zs = 0; if (s->ZoneServerID != 0) zs = zoneserver_list.FindByID(s->ZoneServerID); else if (s->zoneid != 0) zs = zoneserver_list.FindByName(database.GetZoneName(s->zoneid)); else zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: neither ID nor name specified"); if (zs == 0) zoneserver_list.SendEmoteMessage(s->adminname, 0, 0, 0, "Error: SOP_ZoneShutdown: zoneserver not found"); else zs->SendPacket(pack); break; } case ServerOP_ZoneBootup: { ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer; zoneserver_list.SOPZoneBootup(s->adminname, s->ZoneServerID, database.GetZoneName(s->zoneid), s->makestatic); break; } case ServerOP_ZoneStatus: { if (pack->size >= 1) zoneserver_list.SendZoneStatus((char *) &pack->pBuffer[1], (uint8) pack->pBuffer[0], this); break; } case ServerOP_AcceptWorldEntrance: { if(pack->size != sizeof(WorldToZone_Struct)) break; WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer; Client* client = 0; client = client_list.FindByAccountID(wtz->account_id); if(client != 0) client->Clearance(wtz->response); } case ServerOP_ZoneToZoneRequest: { // // solar: ZoneChange is received by the zone the player is in, then the // zone sends a ZTZ which ends up here. This code then find the target // (ingress point) and boots it if needed, then sends the ZTZ to it. // The ingress server will decide wether the player can enter, then will // send back the ZTZ to here. This packet is passed back to the egress // server, which will send a ZoneChange response back to the client // which can be an error, or a success, in which case the client will // disconnect, and their zone location will be saved when ~Client is // called, so it will be available when they ask to zone. // if(pack->size != sizeof(ZoneToZone_Struct)) break; ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer; ClientListEntry* client = NULL; if(WorldConfig::get()->UpdateStats) client = client_list.FindCharacter(ztz->name); zlog(WORLD__ZONE,"ZoneToZone request for %s current zone %d req zone %d\n", ztz->name, ztz->current_zone_id, ztz->requested_zone_id); if(GetZoneID() == ztz->current_zone_id && GetInstanceID() == ztz->current_instance_id) // this is a request from the egress zone { zlog(WORLD__ZONE,"Processing ZTZ for egress from zone for client %s\n", ztz->name); if ( ztz->admin < 80 && ztz->ignorerestrictions < 2 && zoneserver_list.IsZoneLocked(ztz->requested_zone_id) ) { ztz->response = 0; SendPacket(pack); break; } ZoneServer *ingress_server = NULL; if(ztz->requested_instance_id > 0) { ingress_server = zoneserver_list.FindByInstanceID(ztz->requested_instance_id); } else { ingress_server = zoneserver_list.FindByZoneID(ztz->requested_zone_id); } if(ingress_server) // found a zone already running { _log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name); ztz->response = 1; } else // need to boot one { int server_id; if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){ _log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name); // bootup successful, ready to rock ztz->response = 1; ingress_server = zoneserver_list.FindByID(server_id); } else { _log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name); // bootup failed, send back error code 0 ztz->response = 0; } } if(ztz->response!=0 && client) client->LSZoneChange(ztz); SendPacket(pack); // send back to egress server if(ingress_server) // if we couldn't boot one, this is 0 { ingress_server->SendPacket(pack); // inform target server } } else // this is response from the ingress server, route it back to the egress server { zlog(WORLD__ZONE,"Processing ZTZ for ingress to zone for client %s\n", ztz->name); ZoneServer *egress_server = NULL; if(ztz->current_instance_id > 0) { egress_server = zoneserver_list.FindByInstanceID(ztz->current_instance_id); } else { egress_server = zoneserver_list.FindByZoneID(ztz->current_zone_id); } if(egress_server) { egress_server->SendPacket(pack); } } break; } case ServerOP_ClientList: { if (pack->size != sizeof(ServerClientList_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientList. Got: %d, Expected: %d",pack->size,sizeof(ServerClientList_Struct)); break; } client_list.ClientUpdate(this, (ServerClientList_Struct*) pack->pBuffer); break; } case ServerOP_ClientListKA: { ServerClientListKeepAlive_Struct* sclka = (ServerClientListKeepAlive_Struct*) pack->pBuffer; if (pack->size < 4 || pack->size != 4 + (4 * sclka->numupdates)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_ClientListKA. Got: %d, Expected: %d",pack->size, (4 + (4 * sclka->numupdates))); break; } client_list.CLEKeepAlive(sclka->numupdates, sclka->wid); break; } case ServerOP_Who: { ServerWhoAll_Struct* whoall = (ServerWhoAll_Struct*) pack->pBuffer; Who_All_Struct* whom = new Who_All_Struct; memset(whom,0,sizeof(Who_All_Struct)); whom->gmlookup = whoall->gmlookup; whom->lvllow = whoall->lvllow; whom->lvlhigh = whoall->lvlhigh; whom->wclass = whoall->wclass; whom->wrace = whoall->wrace; strcpy(whom->whom,whoall->whom); client_list.SendWhoAll(whoall->fromid,whoall->from, whoall->admin, whom, this); delete whom; break; } case ServerOP_RequestOnlineGuildMembers: { ServerRequestOnlineGuildMembers_Struct *srogms = (ServerRequestOnlineGuildMembers_Struct*) pack->pBuffer; zlog(GUILDS__IN_PACKETS, "ServerOP_RequestOnlineGuildMembers Recieved. FromID=%i GuildID=%i", srogms->FromID, srogms->GuildID); client_list.SendOnlineGuildMembers(srogms->FromID, srogms->GuildID); break; } case ServerOP_ClientVersionSummary: { ServerRequestClientVersionSummary_Struct *srcvss = (ServerRequestClientVersionSummary_Struct*) pack->pBuffer; client_list.SendClientVersionSummary(srcvss->Name); break; } case ServerOP_ReloadRules: { zoneserver_list.SendPacket(pack); rules->LoadRules(&database, "default"); break; } case ServerOP_ReloadRulesWorld: { rules->LoadRules(&database, "default"); break; } case ServerOP_CameraShake: { zoneserver_list.SendPacket(pack); break; } case ServerOP_FriendsWho: { ServerFriendsWho_Struct* FriendsWho = (ServerFriendsWho_Struct*) pack->pBuffer; client_list.SendFriendsWho(FriendsWho, this); break; } case ServerOP_LFGMatches: { ServerLFGMatchesRequest_Struct* smrs = (ServerLFGMatchesRequest_Struct*) pack->pBuffer; client_list.SendLFGMatches(smrs); break; } case ServerOP_LFPMatches: { ServerLFPMatchesRequest_Struct* smrs = (ServerLFPMatchesRequest_Struct*) pack->pBuffer; LFPGroupList.SendLFPMatches(smrs); break; } case ServerOP_LFPUpdate: { ServerLFPUpdate_Struct* sus = (ServerLFPUpdate_Struct*) pack->pBuffer; if(sus->Action) LFPGroupList.UpdateGroup(sus); else LFPGroupList.RemoveGroup(sus); break; } case ServerOP_ZonePlayer: { //ServerZonePlayer_Struct* szp = (ServerZonePlayer_Struct*) pack->pBuffer; zoneserver_list.SendPacket(pack); break; } case ServerOP_KickPlayer: { zoneserver_list.SendPacket(pack); break; } case ServerOP_KillPlayer: { zoneserver_list.SendPacket(pack); break; } case ServerOP_GuildRankUpdate: { zoneserver_list.SendPacket(pack); break; } //these opcodes get processed by the guild manager. case ServerOP_RefreshGuild: case ServerOP_DeleteGuild: case ServerOP_GuildCharRefresh: case ServerOP_GuildMemberUpdate: { guild_mgr.ProcessZonePacket(pack); break; } case ServerOP_FlagUpdate: { ClientListEntry* cle = client_list.FindCLEByAccountID(*((uint32*) pack->pBuffer)); if (cle) cle->SetAdmin(*((int16*) &pack->pBuffer[4])); zoneserver_list.SendPacket(pack); break; } case ServerOP_GMGoto: { if (pack->size != sizeof(ServerGMGoto_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_GMGoto. Got: %d, Expected: %d",pack->size,sizeof(ServerGMGoto_Struct)); break; } ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer; ClientListEntry* cle = client_list.FindCharacter(gmg->gotoname); if (cle != 0) { if (cle->Server() == 0) this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: Cannot identify %s's zoneserver.", gmg->gotoname); else if (cle->Anon() == 1 && cle->Admin() > gmg->admin) // no snooping for anon GMs this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: %s not found", gmg->gotoname); else cle->Server()->SendPacket(pack); } else { this->SendEmoteMessage(gmg->myname, 0, 0, 13, "Error: %s not found", gmg->gotoname); } break; } case ServerOP_Lock: { if (pack->size != sizeof(ServerLock_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Lock. Got: %d, Expected: %d",pack->size,sizeof(ServerLock_Struct)); break; } ServerLock_Struct* slock = (ServerLock_Struct*) pack->pBuffer; if (slock->mode >= 1) WorldConfig::LockWorld(); else WorldConfig::UnlockWorld(); if (loginserverlist.Connected()) { loginserverlist.SendStatus(); if (slock->mode >= 1) this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked"); else this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked"); } else { if (slock->mode >= 1) this->SendEmoteMessage(slock->myname, 0, 0, 13, "World locked, but login server not connected."); else this->SendEmoteMessage(slock->myname, 0, 0, 13, "World unlocked, but login server not conencted."); } break; } case ServerOP_Motd: { if (pack->size != sizeof(ServerMotd_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Motd. Got: %d, Expected: %d",pack->size,sizeof(ServerMotd_Struct)); break; } ServerMotd_Struct* smotd = (ServerMotd_Struct*) pack->pBuffer; database.SetVariable("MOTD",smotd->motd); //this->SendEmoteMessage(smotd->myname, 0, 0, 13, "Updated Motd."); zoneserver_list.SendPacket(pack); break; } case ServerOP_Uptime: { if (pack->size != sizeof(ServerUptime_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_Uptime. Got: %d, Expected: %d",pack->size,sizeof(ServerUptime_Struct)); break; } ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer; if (sus->zoneserverid == 0) { ZSList::ShowUpTime(this, sus->adminname); } else { ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid); if (zs) zs->SendPacket(pack); } break; } case ServerOP_Petition: { zoneserver_list.SendPacket(pack); break; } case ServerOP_GetWorldTime: { zlog(WORLD__ZONE,"Broadcasting a world time update"); ServerPacket* pack = new ServerPacket; pack->opcode = ServerOP_SyncWorldTime; pack->size = sizeof(eqTimeOfDay); pack->pBuffer = new uchar[pack->size]; memset(pack->pBuffer, 0, pack->size); eqTimeOfDay* tod = (eqTimeOfDay*) pack->pBuffer; tod->start_eqtime=zoneserver_list.worldclock.getStartEQTime(); tod->start_realtime=zoneserver_list.worldclock.getStartRealTime(); SendPacket(pack); delete pack; break; } case ServerOP_SetWorldTime: { zlog(WORLD__ZONE,"Received SetWorldTime"); eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer; zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime); zlog(WORLD__ZONE,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime); zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str()); zoneserver_list.SendTimeSync(); break; } case ServerOP_IPLookup: { if (pack->size < sizeof(ServerGenericWorldQuery_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_IPLookup. Got: %d, Expected (at least): %d",pack->size,sizeof(ServerGenericWorldQuery_Struct)); break; } ServerGenericWorldQuery_Struct* sgwq = (ServerGenericWorldQuery_Struct*) pack->pBuffer; if (pack->size == sizeof(ServerGenericWorldQuery_Struct)) client_list.SendCLEList(sgwq->admin, sgwq->from, this); else client_list.SendCLEList(sgwq->admin, sgwq->from, this, sgwq->query); break; } case ServerOP_LockZone: { if (pack->size < sizeof(ServerLockZone_Struct)) { zlog(WORLD__ZONE_ERR,"Wrong size on ServerOP_LockZone. Got: %d, Expected: %d",pack->size,sizeof(ServerLockZone_Struct)); break; } ServerLockZone_Struct* s = (ServerLockZone_Struct*) pack->pBuffer; switch (s->op) { case 0: zoneserver_list.ListLockedZones(s->adminname, this); break; case 1: if (zoneserver_list.SetLockedZone(s->zoneID, true)) zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone locked: %s", database.GetZoneName(s->zoneID)); else this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); break; case 2: if (zoneserver_list.SetLockedZone(s->zoneID, false)) zoneserver_list.SendEmoteMessage(0, 0, 80, 15, "Zone unlocked: %s", database.GetZoneName(s->zoneID)); else this->SendEmoteMessageRaw(s->adminname, 0, 0, 0, "Failed to change lock"); break; } break; } case ServerOP_ItemStatus: { zoneserver_list.SendPacket(pack); break; } case ServerOP_OOCMute: { zoneserver_list.SendPacket(pack); break; } case ServerOP_Revoke: { RevokeStruct* rev = (RevokeStruct*)pack->pBuffer; ClientListEntry* cle = client_list.FindCharacter(rev->name); if (cle != 0 && cle->Server() != 0) { cle->Server()->SendPacket(pack); } break; } case ServerOP_SpawnPlayerCorpse: { SpawnPlayerCorpse_Struct* s = (SpawnPlayerCorpse_Struct*)pack->pBuffer; ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if (zs->SendPacket(pack)) { zlog(WORLD__ZONE,"Sent request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } else { zlog(WORLD__ZONE_ERR,"Could not send request to spawn player corpse id %i in zone %u.",s->player_corpse_id, s->zone_id); } } break; } case ServerOP_Consent: { // Message string id's likely to be used here are: // CONSENT_YOURSELF = 399 // CONSENT_INVALID_NAME = 397 // TARGET_NOT_FOUND = 101 ZoneServer* zs; ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; ClientListEntry* cle = client_list.FindCharacter(s->grantname); if(cle) { if(cle->instance() != 0) { zs = zoneserver_list.FindByInstanceID(cle->instance()); if(zs) { if(zs->SendPacket(pack)) { zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->instance()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent operation.", s->instance_id); } } else { delete pack; pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; strcpy(scs->grantname, s->grantname); strcpy(scs->ownername, s->ownername); scs->permission = s->permission; scs->zone_id = s->zone_id; scs->instance_id = s->instance_id; scs->message_string_id = 101; zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } } else { zs = zoneserver_list.FindByZoneID(cle->zone()); if(zs) { if(zs->SendPacket(pack)) { zlog(WORLD__ZONE, "Sent consent packet from player %s to player %s in zone %u.", s->ownername, s->grantname, cle->zone()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent operation.", s->zone_id); } } else { // send target not found back to requester delete pack; pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; strcpy(scs->grantname, s->grantname); strcpy(scs->ownername, s->ownername); scs->permission = s->permission; scs->zone_id = s->zone_id; scs->message_string_id = 101; zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } } } else { // send target not found back to requester delete pack; pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct)); ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer; strcpy(scs->grantname, s->grantname); strcpy(scs->ownername, s->ownername); scs->permission = s->permission; scs->zone_id = s->zone_id; scs->message_string_id = 397; zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; } case ServerOP_Consent_Response: { // Message string id's likely to be used here are: // CONSENT_YOURSELF = 399 // CONSENT_INVALID_NAME = 397 // TARGET_NOT_FOUND = 101 ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; if(s->instance_id != 0) { ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id); if(zs) { if(!zs->SendPacket(pack)) zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in instance %u.", s->ownername, zs->GetInstanceID()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for instance id %u in zoneserver list for ServerOP_Consent_Response operation.", s->instance_id); } } else { ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id); if(zs) { if(!zs->SendPacket(pack)) zlog(WORLD__ZONE_ERR, "Unable to send consent response back to player %s in zone %s.", s->ownername, zs->GetZoneName()); } else { zlog(WORLD__ZONE_ERR, "Unable to locate zone record for zone id %u in zoneserver list for ServerOP_Consent_Response operation.", s->zone_id); } } break; } case ServerOP_InstanceUpdateTime : { ServerInstanceUpdateTime_Struct *iut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer; ZoneServer *zm = zoneserver_list.FindByInstanceID(iut->instance_id); if(zm) { zm->SendPacket(pack); } break; } case ServerOP_QGlobalUpdate: { if(pack->size != sizeof(ServerQGlobalUpdate_Struct)) { break; } zoneserver_list.SendPacket(pack); break; } case ServerOP_QGlobalDelete: { if(pack->size != sizeof(ServerQGlobalDelete_Struct)) { break; } zoneserver_list.SendPacket(pack); break; } case ServerOP_AdventureRequest: { adventure_manager.CalculateAdventureRequestReply((const char*)pack->pBuffer); break; } case ServerOP_AdventureRequestCreate: { adventure_manager.TryAdventureCreate((const char*)pack->pBuffer); break; } case ServerOP_AdventureDataRequest: { AdventureFinishEvent fe; while(adventure_manager.PopFinishedEvent((const char*)pack->pBuffer, fe)) { adventure_manager.SendAdventureFinish(fe); } adventure_manager.GetAdventureData((const char*)pack->pBuffer); break; } case ServerOP_AdventureClickDoor: { ServerPlayerClickedAdventureDoor_Struct *pcad = (ServerPlayerClickedAdventureDoor_Struct*)pack->pBuffer; adventure_manager.PlayerClickedDoor(pcad->player, pcad->zone_id, pcad->id); break; } case ServerOP_AdventureLeave: { adventure_manager.LeaveAdventure((const char*)pack->pBuffer); break; } case ServerOP_AdventureCountUpdate: { ServerAdventureCount_Struct *sc = (ServerAdventureCount_Struct*)pack->pBuffer; adventure_manager.IncrementCount(sc->instance_id); break; } case ServerOP_AdventureAssaCountUpdate: { adventure_manager.IncrementAssassinationCount(*((uint16*)pack->pBuffer)); break; } case ServerOP_AdventureZoneData: { adventure_manager.GetZoneData(*((uint16*)pack->pBuffer)); break; } case ServerOP_AdventureLeaderboard: { ServerLeaderboardRequest_Struct *lr = (ServerLeaderboardRequest_Struct*)pack->pBuffer; adventure_manager.DoLeaderboardRequest(lr->player, lr->type); break; } case ServerOP_LSAccountUpdate: { zlog(WORLD__ZONE, "Received ServerOP_LSAccountUpdate packet from zone"); loginserverlist.SendAccountUpdate(pack); break; } case ServerOP_UCSMailMessage: { UCSLink.SendPacket(pack); break; } case ServerOP_QueryServGeneric: case ServerOP_Speech: case ServerOP_QSPlayerLogTrades: { QSLink.SendPacket(pack); break; } case ServerOP_QSPlayerLogHandins: { QSLink.SendPacket(pack); break; } case ServerOP_QSPlayerLogNPCKills: { QSLink.SendPacket(pack); break; } case ServerOP_QSPlayerLogDeletes: { QSLink.SendPacket(pack); break; } case ServerOP_QSPlayerLogMoves: { QSLink.SendPacket(pack); break; } case ServerOP_QSMerchantLogTransactions: { QSLink.SendPacket(pack); break; } case ServerOP_CZSignalClientByName: case ServerOP_CZMessagePlayer: case ServerOP_CZSignalClient: { zoneserver_list.SendPacket(pack); break; } case ServerOP_DepopAllPlayersCorpses: case ServerOP_DepopPlayerCorpse: case ServerOP_ReloadTitles: case ServerOP_SpawnStatusChange: case ServerOP_ReloadTasks: case ServerOP_ReloadWorld: case ServerOP_UpdateSpawn: { zoneserver_list.SendPacket(pack); break; } default: { zlog(WORLD__ZONE_ERR,"Unknown ServerOPcode from zone 0x%04x, size %d",pack->opcode,pack->size); DumpPacket(pack->pBuffer, pack->size); break; } } delete pack; } return true; }