void Client::SetTitleSuffix(const char *Suffix) { strn0cpy(m_pp.suffix, Suffix, sizeof(m_pp.suffix)); EQApplicationPacket *outapp = new EQApplicationPacket(OP_SetTitleReply, sizeof(SetTitleReply_Struct)); SetTitleReply_Struct *strs = (SetTitleReply_Struct *)outapp->pBuffer; strs->is_suffix = 1; strn0cpy(strs->title, Suffix, sizeof(strs->title)); strs->entity_id = GetID(); entity_list.QueueClients(this, outapp, false); safe_delete(outapp); }
bool cPluginPictures::SetupParse(const char *Name, const char *Value) { // Parse your own setup parameters and store their values. if (!strcasecmp(Name, "PictureDirectory")) strn0cpy(PictureDirectory, Value, sizeof(PictureDirectory)); else if (!strcasecmp(Name, "SlideShowDelay")) SlideShowDelay = atoi(Value); else return false; return true; }
Horse::Horse(Client *_owner, uint16 spell_id, const glm::vec4& position) : NPC(GetHorseType(spell_id), nullptr, position, FlyMode3) { //give the horse its proper name. strn0cpy(name, _owner->GetCleanName(), 55); strcat(name,"`s_Mount00"); owner = _owner; }
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) { BootingUp = false; const char* zn = MakeLowerString(database.GetZoneName(iZoneID)); char* longname; if (iZoneID) zlog(WORLD__ZONE,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID, iStaticZone ? " (Static)" : ""); zoneID = iZoneID; instanceID = iInstanceID; if(iZoneID!=0) oldZoneID = iZoneID; if (zoneID == 0) { client_list.CLERemoveZSRef(this); pNumPlayers = 0; LSSleepUpdate(GetPrevZoneID()); } staticzone = iStaticZone; if (zn) { strn0cpy(zone_name, zn, sizeof(zone_name)); if( database.GetZoneLongName( (char*)zone_name, &longname, NULL, NULL, NULL, NULL, NULL, NULL ) ) { strn0cpy(long_name, longname, sizeof(long_name)); safe_delete_array( longname ); } else strcpy(long_name, ""); } else { strcpy(zone_name, ""); strcpy(long_name, ""); } client_list.ZoneBootup(this); ls_zboot.Start(); return true; }
Raid::Raid(Client* nLeader) : GroupIDConsumer() { memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); leader = nLeader; memset(leadername, 0, 64); strn0cpy(leadername, nLeader->GetName(), 64); locked = false; LootType = 4; }
void LauncherLink::StopZone(const char *short_name) { ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneRequest, sizeof(LauncherZoneRequest)); LauncherZoneRequest* s = (LauncherZoneRequest *) pack->pBuffer; strn0cpy(s->short_name, short_name, 32); s->command = ZR_Stop; SendPacket(pack); delete pack; }
bool BaseGuildManager::GetGuildURL(uint32 GuildID, char *URLBuffer) const { std::map<uint32, GuildInfo *>::const_iterator res; res = m_guilds.find(GuildID); if(res == m_guilds.end()) return(false); strn0cpy(URLBuffer, res->second->url.c_str(), 512); return(true); }
void Raid::SendGroupUpdate(Client *to) { if(!to) return; EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupUpdate2_Struct)); GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer; gu->action = groupActUpdate; int index = 0; uint32 grp = GetGroup(to->GetName()); if(grp > 11) { safe_delete(outapp); return; } for(int x = 0; x < MAX_RAID_MEMBERS; x++) { if(members[x].GroupNumber == grp && strlen(members[x].membername) > 0) { if(members[x].IsGroupLeader){ strn0cpy(gu->leadersname, members[x].membername, 64); if(strcmp(to->GetName(), members[x].membername) != 0){ strn0cpy(gu->membername[index], members[x].membername, 64); index++; } } else{ if(strcmp(to->GetName(), members[x].membername) != 0){ strn0cpy(gu->membername[index], members[x].membername, 64); index++; } } } } if(strlen(gu->leadersname) < 1){ strn0cpy(gu->leadersname, to->GetName(), 64); } strn0cpy(gu->yourname, to->GetName(), 64); memcpy(&gu->leader_aas, &group_aa[grp], sizeof(GroupLeadershipAA_Struct)); to->FastQueuePacket(&outapp); }
void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool running) { ServerPacket* pack = new ServerPacket(ServerOP_LauncherZoneStatus, sizeof(LauncherZoneStatus)); LauncherZoneStatus* it =(LauncherZoneStatus*) pack->pBuffer; strn0cpy(it->short_name, short_name, 32); it->start_count = start_count; it->running = running?1:0; SendPacket(pack); safe_delete(pack); }
Encounter::Encounter(const char* enc_name) :Mob ( nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, glm::vec4(0,0,0,0), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, EQEmu::TintProfile(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) { encounter_name[0] = 0; strn0cpy(encounter_name, enc_name, 64); remove_me = false; }
void Raid::SetRaidLeader(const char *wasLead, const char *name) { char errbuf[MYSQL_ERRMSG_SIZE]; char* query = 0; MYSQL_RES *result; if (!database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET israidleader=0 WHERE name='%s'", wasLead),errbuf,&result)){ printf("Set Raid Leader error: %s\n", errbuf); } else mysql_free_result(result); safe_delete_array(query); query = 0; if (!database.RunQuery(query,MakeAnyLenString(&query, "UPDATE raid_members SET israidleader=1 WHERE name='%s'", name),errbuf,&result)){ printf("Set Raid Leader error: %s\n", errbuf); } else mysql_free_result(result); safe_delete_array(query); strn0cpy(leadername, name, 64); Client *c = entity_list.GetClientByName(name); if(c) SetLeader(c); LearnMembers(); VerifyRaid(); SendMakeLeaderPacket(name); ServerPacket *pack = new ServerPacket(ServerOP_RaidLeader, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct *rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; rga->rid = GetID(); strn0cpy(rga->playername, name, 64); rga->zoneid = zone->GetZoneID(); rga->instance_id = zone->GetInstanceID(); worldserver.SendPacket(pack); safe_delete(pack); }
void cComponents::SetComponent(int Index, uchar Stream, uchar Type, const char *Language, const char *Description) { Realloc(Index); tComponent *p = &components[Index]; p->stream = Stream; p->type = Type; strn0cpy(p->language, Language, sizeof(p->language)); char *q = strchr(p->language, ','); if (q) *q = 0; // strips rest of "normalized" language codes p->description = strcpyrealloc(p->description, !isempty(Description) ? Description : NULL); }
/* * Packet Functions Start */ void Raid::SendRaidCreate(Client *to){ if(!to) return; EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidJoin,sizeof(RaidCreate_Struct)); RaidCreate_Struct *rc = (RaidCreate_Struct*)outapp->pBuffer; rc->action = raidCreate; strn0cpy(rc->leader_name, leadername, 64); rc->leader_id = (GetLeader()?GetLeader()->GetID():0); to->QueuePacket(outapp); safe_delete(outapp); }
void Raid::SendRaidRemove(const char *who, Client *to) { if(!to) return; for(int x = 0; x < MAX_RAID_MEMBERS; x++) { if(strcmp(members[x].membername, who) == 0) { EQApplicationPacket* outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidGeneral_Struct)); RaidGeneral_Struct *rg = (RaidGeneral_Struct*)outapp->pBuffer; rg->action = raidRemove2; strn0cpy(rg->leader_name, who, 64); strn0cpy(rg->player_name, who, 64); rg->parameter = 0; to->QueuePacket(outapp); safe_delete(outapp); return; } } }
void cMenuBrowseFiles::Set(void) { Clear(); if (!*m_CurrentDir) m_CurrentDir = m_ConfigLastDir; int RootDirLen = strlen(xc.media_root_dir); if (strncmp(m_CurrentDir, xc.media_root_dir, RootDirLen)) { LOGMSG("Not allowing browsing to %s (root is %s)", *m_CurrentDir, xc.media_root_dir); m_CurrentDir = xc.media_root_dir; } if (m_CurrentDir[0] != '/') { #if defined(APIVERSNUM) && (APIVERSNUM < 20102) m_CurrentDir = VideoDirectory; #else m_CurrentDir = cVideoDirectory::Name(); #endif } // find deepest accessible directory from path while (!ScanDir(m_CurrentDir) && strlen(m_CurrentDir) > 1) { m_CurrentDir = ParentDir(m_CurrentDir); } // add link to parent folder int CurrentDirLen = strlen(m_CurrentDir); if (CurrentDirLen > 1 && CurrentDirLen > RootDirLen) Add(new cFileListItem("..",true)); Sort(); SetCurrent(Get(Count()>1 && CurrentDirLen>1 ? 1 : 0)); // select last selected item cString lastParent = ParentDir(m_ConfigLastDir); if (!strncmp(m_CurrentDir, lastParent, CurrentDirLen)) { cString item = LastDir(m_ConfigLastDir); if (*item) { for (cFileListItem *it = (cFileListItem*)First(); it; it = (cFileListItem*)Next(it)) if (!strcmp(it->Name(), item)) SetCurrent(it); } } strn0cpy(m_ConfigLastDir, m_CurrentDir, sizeof(xc.browse_files_dir)); StoreConfig(); SetHelpButtons(); Display(); }
void Object::SetModelName(const char* modelname) { strn0cpy(m_data.object_name, modelname, sizeof(m_data.object_name)); // 32 is the max for chars in object_name, this should be safe EQApplicationPacket* app = new EQApplicationPacket(); EQApplicationPacket* app2 = new EQApplicationPacket(); this->CreateDeSpawnPacket(app); this->CreateSpawnPacket(app2); entity_list.QueueClients(0, app); entity_list.QueueClients(0, app2); safe_delete(app); safe_delete(app2); }
void ZoneGuildManager::SendGuildMemberUpdateToWorld(const char *MemberName, uint32 GuildID, uint16 ZoneID, uint32 LastSeen) { ServerPacket* pack = new ServerPacket(ServerOP_GuildMemberUpdate, sizeof(ServerGuildMemberUpdate_Struct)); ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer; sgmus->GuildID = GuildID; strn0cpy(sgmus->MemberName, MemberName, sizeof(sgmus->MemberName)); sgmus->ZoneID = ZoneID; sgmus->LastSeen = LastSeen; worldserver.SendPacket(pack); safe_delete(pack); }
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer* iZS, ServerClientList_Struct* scl, int8 iOnline) : id(in_id) { ClearVars(true); pIP = 0; pLSID = scl->LSAccountID; strn0cpy(plsname, scl->name, sizeof(plsname)); strn0cpy(plskey, scl->lskey, sizeof(plskey)); pworldadmin = 0; paccountid = scl->AccountID; strn0cpy(paccountname, scl->AccountName, sizeof(paccountname)); padmin = scl->Admin; pinstance = 0; if (iOnline >= CLE_Status_Zoning) Update(iZS, scl, iOnline); else SetOnline(iOnline); }
void Raid::SendRaidMOTDToWorld() { if (motd.empty()) return; size_t size = motd.size() + 1; ServerPacket *pack = new ServerPacket(ServerOP_RaidMOTD, sizeof(ServerRaidMOTD_Struct) + size); ServerRaidMOTD_Struct *smotd = (ServerRaidMOTD_Struct *)pack->pBuffer; smotd->rid = GetID(); strn0cpy(smotd->motd, motd.c_str(), size); worldserver.SendPacket(pack); safe_delete(pack); }
void servermsinit(const char *master, const char *sdesc, bool listen) { const char *mid = strstr(master, "/"); if (!mid) mid = master; strcpy_s(masterpath, mid); strn0cpy(masterbase, master, mid-master+1); strcpy_s(serverdesc, sdesc); if (listen) { ENetAddress address = { ENET_HOST_ANY, CUBE_SERVINFO_PORT }; pongsock = enet_socket_create(ENET_SOCKET_TYPE_DATAGRAM, &address); if (pongsock == ENET_SOCKET_NULL) sys::fatal("could not create server info socket\n"); } }
bool cPluginDvdswitch::ProcessArgs(int argc, char *argv[]) { static struct option long_options[] = { { "debug", required_argument, NULL, 'D' }, { "readscript", required_argument, NULL, 'r' }, { "writescript", required_argument, NULL, 'w' }, { "imagedir", required_argument, NULL, 'i' }, { NULL } }; int c = 0; optind = 1; //default for getopt while((c = getopt_long(argc, argv, "D:r:w:i:", long_options, NULL)) != -1) { switch(c) { case 'D': DebugLog.SetLogFile(optarg); break; case 'r': strn0cpy(DVDSwitchSetup.DVDReadScript, optarg, MaxFileName); break; case 'w': strn0cpy(DVDSwitchSetup.DVDWriteScript, optarg, MaxFileName); break; case 'i': strn0cpy(DVDSwitchSetup.ImageDir, optarg, MaxFileName); DVDSwitchSetup.ImageDirPerParam = true; break; default: esyslog("DVDSwitch: unknown Parameter: %c", c); break; } } return true; }
void out(const char *s, ...) { SDL_LockMutex(mutex); vasprintfsd(sf, s, s); s = sf.c_str(); int n = 0; while (strlen(s)>WORDWRAP) { // cut strings to fit on screen fixedstring t; strn0cpy(t.c_str(), s, WORDWRAP+1); line(t.c_str(), n++!=0); s += WORDWRAP; } line(s, n!=0); SDL_UnlockMutex(mutex); }
char* cSearchTimerThread::SummaryExtended(cSearchExt* searchExt, cTimer* Timer, const cEvent* pEvent) { bool UseVPS = searchExt->useVPS && pEvent->Vps() && Setup.UseVps; time_t eStart; if (!UseVPS) eStart = pEvent->StartTime(); else eStart = pEvent->Vps(); time_t eStop; if (!UseVPS) eStop = pEvent->EndTime(); else eStop = pEvent->Vps() + pEvent->Duration(); // make sure that eStart and eStop represent a full minute eStart = (eStart / 60) * 60; eStop = (eStop / 60) * 60; time_t start = eStart - (UseVPS?0:(searchExt->MarginStart * 60)); time_t stop = eStop + (UseVPS?0:(searchExt->MarginStop * 60)); char* addSummaryFooter = NULL; msprintf(&addSummaryFooter, "<channel>%d - %s</channel><searchtimer>%s</searchtimer><start>%ld</start><stop>%ld</stop><s-id>%d</s-id><eventid>%ld</eventid>", Timer->Channel()->Number(), CHANNELNAME(Timer->Channel()), searchExt->search, start, stop, searchExt->ID, (long) pEvent->EventID()); const char* aux = Timer->Aux(); // remove epgsearch entries char* tmpaux = NULL; if (!isempty(aux)) { tmpaux = strdup(aux); const char* begin = strstr(aux, "<epgsearch>"); const char* end = strstr(aux, "</epgsearch>"); if (begin && end) { if (begin == aux) strcpy(tmpaux, ""); else strn0cpy(tmpaux, aux, begin-aux+1); strcat(tmpaux, end + strlen("</epgsearch>")); } } char* tmpSummary = NULL; msprintf(&tmpSummary, "<epgsearch>%s</epgsearch>%s", addSummaryFooter, tmpaux?tmpaux:""); free(addSummaryFooter); if (tmpaux) free(tmpaux); return tmpSummary; }
void Mob::AddTrap(Aura *aura, AuraRecord &record) { // this is called only when it's safe assert(aura != nullptr); strn0cpy(trap_mgr.auras[trap_mgr.count].name, aura->GetCleanName(), 64); trap_mgr.auras[trap_mgr.count].spawn_id = aura->GetID(); trap_mgr.auras[trap_mgr.count].aura = aura; if (record.icon == -1) trap_mgr.auras[trap_mgr.count].icon = spells[record.spell_id].new_icon; else trap_mgr.auras[trap_mgr.count].icon = record.icon; // doesn't send to client trap_mgr.count++; }
SpawnGroup::SpawnGroup( uint32 in_id, char* name, int in_group_spawn_limit, float dist, float maxx, float minx, float maxy, float miny, int delay_in, int despawn_in, uint32 despawn_timer_in, int min_delay_in ) { id = in_id; strn0cpy( name_, name, 120); group_spawn_limit = in_group_spawn_limit; roambox[0]=maxx; roambox[1]=minx; roambox[2]=maxy; roambox[3]=miny; roamdist=dist; min_delay=min_delay_in; delay=delay_in; despawn=despawn_in; despawn_timer=despawn_timer_in; }
Doors::Doors(const Door* door) : close_timer(5000) { db_id = door->db_id; door_id = door->door_id; strn0cpy(zone_name,door->zone_name,32); strn0cpy(door_name,door->door_name,32); pos_x = door->pos_x; pos_y = door->pos_y; pos_z = door->pos_z; heading = door->heading; incline = door->incline; opentype = door->opentype; guild_id = door->guild_id; lockpick = door->lockpick; keyitem = door->keyitem; nokeyring = door->nokeyring; trigger_door = door->trigger_door; trigger_type = door->trigger_type; triggered=false; door_param = door->door_param; size = door->size; invert_state = door->invert_state; SetOpenState(false); close_timer.Disable(); strn0cpy(dest_zone,door->dest_zone,32); dest_instance_id = door->dest_instance_id; dest_x = door->dest_x; dest_y = door->dest_y; dest_z = door->dest_z; dest_heading = door->dest_heading; is_ldon_door = door->is_ldon_door; client_version_mask = door->client_version_mask; }
Doors::Doors(const char *dmodel, float dx, float dy, float dz, float dheading, uint8 dopentype, uint16 dsize) : close_timer(5000) { db_id = database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); door_id = database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()); strn0cpy(zone_name,zone->GetShortName(),32); strn0cpy(door_name,dmodel,32); pos_x = dx; pos_y = dy; pos_z = dz; heading = dheading; incline = 0; opentype = dopentype; guild_id = 0; lockpick = 0; keyitem = 0; nokeyring = 0; trigger_door = 0; trigger_type = 0; triggered=false; door_param = 0; size = dsize; invert_state = 0; SetOpenState(false); close_timer.Disable(); strn0cpy(dest_zone,"NONE",32); dest_instance_id = 0; dest_x = 0; dest_y = 0; dest_z = 0; dest_heading = 0; is_ldon_door = 0; client_version_mask = 4294967295u; }
bool cSetup::ParseLanguages(const char *Value, int *Values) { int n = 0; while (Value && *Value && n < I18nLanguages()->Size()) { char buffer[4]; strn0cpy(buffer, Value, sizeof(buffer)); int i = I18nLanguageIndex(buffer); if (i >= 0) Values[n++] = i; if ((Value = strchr(Value, ' ')) != NULL) Value++; } Values[n] = -1; return true; }
void cSkinCursesDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { if (Setup.ShowReplayMode) { const char *Mode; if (Speed == -1) Mode = Play ? " > " : " || "; else if (Play) Mode = Forward ? " X>> " : " <<X "; else Mode = Forward ? " X|> " : " <|X "; char buf[16]; strn0cpy(buf, Mode, sizeof(buf)); char *p = strchr(buf, 'X'); if (p) *p = Speed > 0 ? '1' + Speed - 1 : ' '; SetJump(buf); } }
static void XMLCALL StartHandler(void *data, const char *el, const char **attr) { XmlNode node; strn0cpy(node.nodename, el, sizeof(node.nodename)); node.depth = depth; nodestack.push(node); if (!strncmp(el, "item", 4)) { cItem *tmpitem = new cItem; item = tmpitem; item->Clear(); } depth++; }