static void PortalTouch(gentity_t * self, gentity_t * other, trace_t * trace) { gentity_t *destination; // see if we will even let other try to use it if(other->health <= 0) { return; } if(!other->client) { return; } // if( other->client->ps.persistant[PERS_TEAM] != self->spawnflags ) { // return; // } if(other->client->ps.powerups[PW_NEUTRALFLAG]) { // only happens in One Flag CTF Drop_Item(other, BG_FindItemForPowerup(PW_NEUTRALFLAG), 0); other->client->ps.powerups[PW_NEUTRALFLAG] = 0; } else if(other->client->ps.powerups[PW_REDFLAG]) { // only happens in standard CTF Drop_Item(other, BG_FindItemForPowerup(PW_REDFLAG), 0); other->client->ps.powerups[PW_REDFLAG] = 0; } else if(other->client->ps.powerups[PW_BLUEFLAG]) { // only happens in standard CTF Drop_Item(other, BG_FindItemForPowerup(PW_BLUEFLAG), 0); other->client->ps.powerups[PW_BLUEFLAG] = 0; } // find the destination destination = NULL; while((destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL) { if(destination->count == self->count) { break; } } // if there is not one, die! if(!destination) { if(self->pos1[0] || self->pos1[1] || self->pos1[2]) { TeleportPlayer(other, self->pos1, self->s.angles); } G_Damage(other, other, other, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG); return; } TeleportPlayer(other, destination->s.pos.trBase, destination->s.angles); }
/* ================= Cmd_SetViewpos_f ================= */ void Cmd_SetViewpos_f( gentity_t *ent ) { vec3_t origin, angles; char buffer[MAX_TOKEN_CHARS]; int i; if ( !g_cheats.integer ) { trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\"")); return; } if ( trap_Argc() != 5 ) { trap_SendServerCommand( ent-g_entities, va("print \"usage: setviewpos x y z yaw\n\"")); return; } VectorClear( angles ); for ( i = 0 ; i < 3 ; i++ ) { trap_Argv( i + 1, buffer, sizeof( buffer ) ); origin[i] = atof( buffer ); } trap_Argv( 4, buffer, sizeof( buffer ) ); angles[YAW] = atof( buffer ); TeleportPlayer( ent, origin, angles ); }
void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { gentity_t *dest; if( self->s.eFlags & EF_NODRAW ) return; if( !other->client ) return; if( other->client->ps.pm_type == PM_DEAD ) return; // Spectators only? if( ( self->spawnflags & 1 ) && other->client->sess.spectatorState == SPECTATOR_NOT ) return; dest = G_PickTarget( self->target ); if( !dest ) { G_Printf( "Couldn't find teleporter destination\n" ); return; } TeleportPlayer( other, dest->s.origin, dest->s.angles ); }
void Cmd_SetViewpos_f(gentity_t* entity) { if (!(*g_cheats)->current.boolean) { SV_GameSendServerCommand(GENTITY_TO_CLIENTNUM(entity), 0, va("%c \"GAME_CHEATSNOTENABLED\"", 101)); return; } if (Cmd_ArgcSV() < 4 || Cmd_ArgcSV() > 6) { SV_GameSendServerCommand(GENTITY_TO_CLIENTNUM(entity), 0, va("%c \"Usage: setviewpos x y z yaw pitch\"", 101)); return; } float pos[3]; for (int i = 1; i < 4; i++) { pos[i - 1] = (float)atof(Cmd_ArgvSV(i)); } float orientation[3] = { 0.0f, 0.0f, 0.0f }; if (Cmd_ArgcSV() >= 5) { orientation[1] = (float)atof(Cmd_ArgvSV(4)); } if (Cmd_ArgcSV() == 6) { orientation[0] = (float)atof(Cmd_ArgvSV(5)); } TeleportPlayer(entity, pos, orientation); }
void MM_JailClient(gentity_t *ent, qboolean respawn) { jail_t *jail = MM_GetJail(); if (jail == NULL) { MM_SendMessage(ent - g_entities, "print \"No jail spots found on this map. Please add a jail spot before trying to jail a client.\n\""); ent->client->sess.jailed = qfalse; } else { ent->client->sess.jailed = qtrue; if(respawn) TeleportPlayer(ent, jail->origin, jail->angles); else { G_SetOrigin(ent, jail->origin); VectorCopy(jail->origin, ent->client->ps.origin); SetClientViewAngle(ent, jail->angles); } G_Unempower(ent); ent->client->ps.fd.forcePowersKnown = 0; ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_MELEE); ent->client->ps.weapon = WP_MELEE; ent->client->ps.pm_flags &= ~PM_NOCLIP; } }
void trigger_teleporter_touch(gentity_t * self, gentity_t * other, trace_t * trace) { gentity_t *dest; if(!other->client) return; if(other->client->ps.pm_type == PM_DEAD) return; // Spectators only? if((self->spawnflags & 1) && other->client->sess.sessionTeam != TEAM_SPECTATOR) return; dest = G_PickTarget(self->target); if(!dest) { G_Printf("Couldn't find teleporter destination\n"); return; } #ifdef G_LUA // Lua API callbacks if(self->luaTrigger) { G_LuaHook_EntityTrigger(self->luaTrigger, self->s.number, other->s.number); } #endif TeleportPlayer(other, dest->s.origin, dest->s.angles); }
void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace) { gentity_t *dest; if (!other->client) { return; } if (other->client->ps.pm_type == PM_DEAD) { return; } // Spectators only? if ((self->spawnflags & 1) && other->client->sess.sessionTeam != TEAM_SPECTATOR) { return; } dest = G_PickTarget(self->target); if (!dest) { G_Printf ("Couldn't find teleporter destination\n"); return; } TeleportPlayer(other, dest->s.origin, dest->s.angles); }
/* ======================================================================================================================================= Touch_TeleporterTrigger ======================================================================================================================================= */ void Touch_TeleporterTrigger(gentity_t *self, gentity_t *other, trace_t *trace) { playerState_t *ps; gentity_t *dest; ps = G_GetEntityPlayerState(other); if (!ps) { return; } if (ps->pm_type == PM_DEAD) { return; } // spectators only? if ((self->spawnflags & 1) && other->client->sess.sessionTeam != TEAM_SPECTATOR) { return; } dest = G_PickTarget(self->target); if (!dest) { G_Printf("Couldn't find teleporter destination\n"); return; } TeleportPlayer(other, dest->s.origin, dest->s.angles); }
void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace ) { gentity_t *dest; if ( self->svFlags & SVF_INACTIVE ) {//set by target_deactivate return; } dest = G_PickTarget( self->target ); if (!dest) { gi.Printf ("Couldn't find teleporter destination\n"); return; } if ( other->client ) { if ( other->client->ps.pm_type == PM_DEAD ) { if ( !(self->spawnflags&TTSF_DEAD_OK) ) {//dead men can't teleport return; } } if ( other->NPC ) { if ( self->spawnflags & NO_NPCS ) { return; } } if ( other->client->playerTeam != TEAM_FREE && SpotWouldTelefrag2( other, dest->currentOrigin ) )//SpotWouldTelefrag( dest, other->client->playerTeam ) ) {//Don't go through if something blocking on the other side return; } TeleportPlayer( other, dest->s.origin, dest->s.angles ); } //FIXME: check for SVF_NO_TELEPORT else if ( !(self->svFlags & SVF_NO_TELEPORT) && !(self->spawnflags & NO_MISSILES) && VectorLengthSquared( other->s.pos.trDelta ) ) {//It's a mover of some sort and is currently moving vec3_t diffAngles = {0, 0, 0}; qboolean snap = qfalse; if ( self->lastEnemy ) { VectorSubtract( dest->s.angles, self->lastEnemy->s.angles, diffAngles ); } else {//snaps to angle VectorSubtract( dest->s.angles, other->currentAngles, diffAngles ); snap = qtrue; } TeleportMover( other, dest->s.origin, diffAngles, snap ); } }
static int Player_Teleport( lua_State *L ) { luaPlayer_t *player = CheckPlayer( L, 1 ); gentity_t *ent = &g_entities[player->clientNum]; vector3 *pos = CheckVector( L, 2 ); vector3 *angles = CheckVector( L, 3 ); TeleportPlayer( ent, pos, angles ); return 0; }
void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { gentity_t *dest; if (!activator->client) return; dest = G_PickTarget( self->target ); if (!dest) { G_Printf ("Couldn't find teleporter destination\n"); return; } TeleportPlayer( activator, dest->s.origin, dest->s.angles, qfalse, qtrue ); }
void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { gentity_t *dest; if (!activator->client) return; G_ActivateBehavior(self,BSET_USE); dest = G_PickTarget( self->target ); if (!dest) { gi.Printf ("Couldn't find teleporter destination\n"); return; } TeleportPlayer( activator, dest->s.origin, dest->s.angles ); }
void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { gentity_t *dest; /* LQ3A */ UNREFERENCED_PARAMETER(other); if (!activator->client) return; dest = G_PickTarget( self->target ); if (!dest) { G_Printf ("Couldn't find teleporter destination\n"); return; } TeleportPlayer( activator, dest->s.origin, dest->s.angles ); }
// Teleport player to this map and this coord. bool CMap::TeleportPlayer( CPlayer* player, fPoint coord, bool TelePassenger ) { GServer->MapList.Index[player->Position->Map]->RemovePlayer( player, false ); player->Position->Map = id; player->Position->current = coord; player->Position->destiny = coord; player->Session->inGame = false; player->Position->lastMoveTime = clock(); if(player->Stats->HP<1)player->Stats->HP=player->Stats->MaxHP * 10 / 100; if(!allowpat || !TelePassenger) { if(!allowpat) player->Status->Stance=0x03; player->Ride->Drive = false; player->Ride->charid= 0; player->Ride->Ride = false; } AddPlayer( player ); BEGINPACKET( pak, 0x07a8 ); ADDWORD ( pak, player->clientid ); ADDWORD ( pak, player->Position->Map ); ADDFLOAT ( pak, player->Position->current.x*100 ); ADDFLOAT ( pak, player->Position->current.y*100 ); ADDWORD ( pak, (player->Status->Stance==0x04?0x0201:0x0001) ); player->client->SendPacket( &pak ); if( player->Ride->Drive && player->Ride->charid!=0 ) { CPlayer* otherclient = GServer->GetClientByCID( player->Ride->charid ); if( otherclient!=NULL ) { if(TelePassenger) { TeleportPlayer( otherclient, coord ); } else { otherclient->Ride->Drive = false; otherclient->Ride->charid= 0; otherclient->Ride->Ride = false; } } } GServer->pakClearUser( player ); GServer->ClearClientID( player->clientid ); player->RestartPlayerVal( ); return true; }
void target_teleporter_use(gentity_t *self, gentity_t *other, gentity_t *activator) { gentity_t *dest; // Nico, silent GCC (void)other; if (!activator->client) { return; } dest = G_PickTarget(self->target); if (!dest) { G_Printf("Couldn't find teleporter destination\n"); return; } TeleportPlayer(activator, dest->s.origin, dest->s.angles); }
void Rune_Phase_Use(gentity_t *ent) { vec3_t oldmuzzle,muzzle,forward,right,up,end; trace_t trace, trace2; AngleVectors (ent->client->ps.viewangles, forward, right, up); CalcMuzzlePoint ( ent, forward, right, up, muzzle ); if (ent->runetime<level.time) { VectorMA (muzzle, 250, forward, end); trap_Trace (&trace, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); // we didn't hit anything, so exit if ( trace.fraction == 1) return; SnapVectorTowards( trace.endpos, muzzle ); // prepare for firing through the wall VectorCopy (muzzle, oldmuzzle); VectorCopy (trace.endpos, muzzle); VectorMA (muzzle, 96, forward, muzzle); if ( !( trap_PointContents( muzzle, -1 ) & CONTENTS_SOLID )) { // the point isn't inside a wall, so check to see if we are outside the bounds of the level VectorCopy(muzzle,end); end[2]=-10000; trap_Trace (&trace2, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); // if we didn't hit anything after that big a trace, we are outside the level if (trace2.fraction==1) return; TeleportPlayer(ent,muzzle,ent->client->ps.viewangles, qtrue, qtrue); ent->runetime = level.time + RUNE_PHASE_RECHARGE; } } else { //trap_SendServerCommand( ent->s.clientNum, va("print \"Phase is recharging\n\"")); } }
void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace ) { gentity_t *dest; if ( !other->client ) { return; } if ( other->client->ps.pm_type == PM_DEAD ) { return; } dest = G_PickTarget( self->target ); if (!dest) { G_Printf ("Couldn't find teleporter destination\n"); return; } TeleportPlayer( other, dest->s.origin, dest->s.angles ); }
/* =================== Svcmd_Teleport_f teleport <player> <x> <y> <z> [yaw] =================== */ void Svcmd_Teleport_f( void ) { gplayer_t *player; gentity_t *ent; char str[MAX_TOKEN_CHARS]; vec3_t position, angles; if ( !g_cheats.integer ) { G_Printf("Cheats are not enabled on this server.\n"); return; } if ( trap_Argc() < 3 ) { G_Printf("Usage: teleport <player> <x> <y> <z> [yaw]\n"); return; } // find the player trap_Argv( 1, str, sizeof( str ) ); player = PlayerForString( str ); if ( !player ) { return; } // set the position trap_Argv( 2, str, sizeof( str ) ); position[0] = atoi( str ); trap_Argv( 3, str, sizeof( str ) ); position[1] = atoi( str ); trap_Argv( 4, str, sizeof( str ) ); position[2] = atoi( str ); ent = &g_entities[player - level.players]; VectorCopy( ent->s.angles, angles ); if ( trap_Argc() > 5 ) { trap_Argv( 5, str, sizeof( str ) ); angles[YAW] = atoi( str ); } TeleportPlayer( ent, position, angles ); }
/* ================ Touch_DoorTriggerSpectator ================ */ static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_t *trace ) { int i, axis; vec3_t origin, dir, angles; axis = ent->count; VectorClear(dir); if (fabs(other->s.origin[axis] - ent->r.absmax[axis]) < fabs(other->s.origin[axis] - ent->r.absmin[axis])) { origin[axis] = ent->r.absmin[axis] - 10; dir[axis] = -1; } else { origin[axis] = ent->r.absmax[axis] + 10; dir[axis] = 1; } for (i = 0; i < 3; i++) { if (i == axis) continue; origin[i] = (ent->r.absmin[i] + ent->r.absmax[i]) * 0.5; } vectoangles(dir, angles); TeleportPlayer(other, origin, angles ); }
/* ================ Touch_DoorTriggerSpectator ================ */ static void Touch_DoorTriggerSpectator( gentity_t *ent, gentity_t *other, trace_t *trace ) { int axis; float doorMin, doorMax; vec3_t origin; axis = ent->count; // the constants below relate to constants in Think_SpawnNewDoorTrigger() doorMin = ent->r.absmin[axis] + 100; doorMax = ent->r.absmax[axis] - 100; VectorCopy(other->player->ps.origin, origin); if (origin[axis] < doorMin || origin[axis] > doorMax) return; if (fabs(origin[axis] - doorMax) < fabs(origin[axis] - doorMin)) { origin[axis] = doorMin - 10; } else { origin[axis] = doorMax + 10; } TeleportPlayer(other, origin, tv(10000000.0, 0, 0)); }
/* ================= Cmd_SetViewpos_f ================= */ void Cmd_SetViewpos_f( gentity_t *ent ) { vec3_t origin, angles; int i; if ( !g_cheats->integer ) { gi.SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\"")); return; } if ( gi.argc() != 5 ) { gi.SendServerCommand( ent-g_entities, va("print \"usage: setviewpos x y z yaw\n\"")); return; } VectorClear( angles ); for ( i = 0 ; i < 3 ; i++ ) { origin[i] = atof( gi.argv( i+1 ) ); } angles[YAW] = atof( gi.argv( 4 ) ); TeleportPlayer( ent, origin, angles ); }
bool PlayerHandler::OnCommand(Player *player, std::string cmd, std::vector<std::string> args, GameUtility *gameUtility) { if (cmd == "hack") { GivePlayerMoney(player->getId(), 500000); return true; } else if (cmd == "pos") { float *x = new float(), *y = new float(), *z = new float(), *angle = new float(); GetPlayerPos(player->getId(), x, y, z); std::stringstream pos; pos << "Pos: X" << *x << " Y" << *y << " Z" << *z << "\nInterior: " << player->GetInterior() << " VirtualWorld: " << player->GetVirtualWorld(); SendClientMessage(player->getId(), 0xFFFFFFFF, pos.str().c_str()); delete x, y, z; return true; } else if (cmd == "spawn") { TeleportPlayer(player->getId(), WorldPositionObject(1958.3783f, 1343.1572f, 15.3746f, gameUtility->interiorHandler->getInterior(-1))); return true; } return false; }
void LFGMgr::UpdateBoot(Player* player, bool accept) { Group* group = player ? player->GetGroup() : NULL; if (!group) return; LFGPlayerBoot* pBoot = GetBoot(group->GetObjectGuid()); if (!pBoot) return; if (pBoot->votes[player->GetObjectGuid()] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice return; Player* victim = sObjectMgr.GetPlayer(pBoot->victim); if (!victim) return; pBoot->votes[player->GetObjectGuid()] = LFGAnswer(accept); uint8 votesNum = 0; uint8 agreeNum = 0; for (LFGAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes) { if (itVotes->second != LFG_ANSWER_PENDING) { ++votesNum; if (itVotes->second == LFG_ANSWER_AGREE) ++agreeNum; } } if (agreeNum >= pBoot->votedNeeded || // Vote passed votesNum >= pBoot->votes.size() || // All voted but not passed (pBoot->votes.size() - votesNum + agreeNum) < pBoot->votedNeeded) // Vote didnt passed { // Send update info to all players pBoot->inProgress = false; for (LFGAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes) { Player* pPlayer = sObjectMgr.GetPlayer(itVotes->first); if (pPlayer && (pPlayer != victim)) { pPlayer->GetLFGState()->SetState(LFG_STATE_DUNGEON); pPlayer->GetSession()->SendLfgBootPlayer(pBoot); } } group->GetLFGState()->SetState(LFG_STATE_DUNGEON); if (agreeNum == pBoot->votedNeeded) // Vote passed - Kick player { Player::RemoveFromGroup(group, victim->GetObjectGuid()); TeleportPlayer(victim, true, false); victim->GetLFGState()->Clear(); OfferContinue(group); group->GetLFGState()->DecreaseKicksLeft(); } DeleteBoot(group->GetObjectGuid()); } }
void hyperspace_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { gentity_t *ent; if (!other || !other->inuse || !other->client || other->s.number < MAX_CLIENTS || !other->m_pVehicle) { //only let vehicles touch return; } if ( other->client->ps.hyperSpaceTime && level.time - other->client->ps.hyperSpaceTime < HYPERSPACE_TIME ) {//already hyperspacing, just keep us moving if ( (other->client->ps.eFlags2&EF2_HYPERSPACE) ) {//they've started the hyperspace but haven't been teleported yet float timeFrac = ((float)(level.time-other->client->ps.hyperSpaceTime))/HYPERSPACE_TIME; if ( timeFrac >= HYPERSPACE_TELEPORT_FRAC ) {//half-way, now teleport them! vec3_t diff, fwd, right, up, newOrg; float fDiff, rDiff, uDiff; //take off the flag so we only do this once other->client->ps.eFlags2 &= ~EF2_HYPERSPACE; //Get the offset from the local position ent = G_Find (NULL, FOFS(targetname), self->target); if (!ent || !ent->inuse) { //this is bad trap->Error(ERR_DROP, "trigger_hyperspace has invalid target '%s'\n", self->target); return; } VectorSubtract( other->client->ps.origin, ent->s.origin, diff ); AngleVectors( ent->s.angles, fwd, right, up ); fDiff = DotProduct( fwd, diff ); rDiff = DotProduct( right, diff ); uDiff = DotProduct( up, diff ); //Now get the base position of the destination ent = G_Find (NULL, FOFS(targetname), self->target2); if (!ent || !ent->inuse) { //this is bad trap->Error(ERR_DROP, "trigger_hyperspace has invalid target2 '%s'\n", self->target2); return; } VectorCopy( ent->s.origin, newOrg ); //finally, add the offset into the new origin AngleVectors( ent->s.angles, fwd, right, up ); VectorMA( newOrg, fDiff, fwd, newOrg ); VectorMA( newOrg, rDiff, right, newOrg ); VectorMA( newOrg, uDiff, up, newOrg ); //trap->Print("hyperspace from %s to %s\n", vtos(other->client->ps.origin), vtos(newOrg) ); //now put them in the offset position, facing the angles that position wants them to be facing TeleportPlayer( other, newOrg, ent->s.angles ); if ( other->m_pVehicle && other->m_pVehicle->m_pPilot ) {//teleport the pilot, too TeleportPlayer( (gentity_t*)other->m_pVehicle->m_pPilot, newOrg, ent->s.angles ); //FIXME: and the passengers? } //make them face the new angle //other->client->ps.hyperSpaceIndex = ent->s.number; VectorCopy( ent->s.angles, other->client->ps.hyperSpaceAngles ); //sound G_Sound( other, CHAN_LOCAL, G_SoundIndex( "sound/vehicles/common/hyperend.wav" ) ); } } return; } else { ent = G_Find (NULL, FOFS(targetname), self->target); if (!ent || !ent->inuse) { //this is bad trap->Error(ERR_DROP, "trigger_hyperspace has invalid target '%s'\n", self->target); return; } if (!other->client->ps.m_iVehicleNum || other->m_pVehicle->m_iRemovedSurfaces) { //if a vehicle touches a boundary without a pilot in it or with parts missing, just blow the thing up G_Damage(other, other, other, NULL, other->client->ps.origin, 99999, DAMAGE_NO_PROTECTION, MOD_SUICIDE); return; } //other->client->ps.hyperSpaceIndex = ent->s.number; VectorCopy( ent->s.angles, other->client->ps.hyperSpaceAngles ); other->client->ps.hyperSpaceTime = level.time; } }
// Teleport player to this map and this coord. bool CMap::TeleportPlayer( CPlayer* player, fPoint coordold, bool TelePassenger ) { fPoint coord; coord=coordold; if(id==9&&player->UWPosition->source.x>0&&player->UWPosition->source.y>0) { coord.x = player->UWPosition->source.x; coord.y = player->UWPosition->source.y; } GServer->MapList.Index[player->Position->Map]->RemovePlayer( player, false ); player->Position->Map = id; player->Position->current = coord; //TELEPORT ONLY player->Position->destiny = coord; //TELEPORT ONLY player->Session->inGame = false; player->Position->lastMoveTime = clock(); if(!allowpat || !TelePassenger) { if(!allowpat) player->Status->Stance=0x03; player->Ride->Drive = false; player->Ride->charid= 0; player->Ride->Ride = false; } AddPlayer( player ); BEGINPACKET( pak, 0x07a8 ); ADDWORD ( pak, player->clientid ); ADDDWORD ( pak, player->Position->Map ); ADDFLOAT ( pak, player->Position->current.x*100 ); ADDFLOAT ( pak, player->Position->current.y*100 ); ADDBYTE ( pak, (player->Status->Stance==0x04?0x0201:0x0001) ); for(int i=0; i<14; i++) ADDBYTE ( pak, 0 ); //move speed. ADDWORD( pak,player->Stats->Base_Speed ); for(int i=0; i<38; i++) ADDBYTE ( pak, 0 ); player->client->SendPacket( &pak ); if( player->Ride->Drive && player->Ride->charid!=0 ) { CPlayer* otherclient = GServer->GetClientByCID( player->Ride->charid ); if( otherclient!=NULL ) { if(TelePassenger) { TeleportPlayer( otherclient, coord ); } else { otherclient->Ride->Drive = false; otherclient->Ride->charid= 0; otherclient->Ride->Ride = false; } } } GServer->pakClearUser( player ); GServer->ClearClientID( player->clientid ); player->RestartPlayerVal( ); return true; }
void hurt_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { int dflags; // UNLOX - space protection vec3_t origin, angles; // END UNLOX if ( !other->takedamage ) { return; } if ( self->timestamp > level.time ) { return; } // UNLOX - space protection (From corkscrew mod) if ( g_spaceProtection.integer && self->damage > 100) { // item = NULL; // Lose the flag // if ( other->client->ps.powerups[ PW_REDFLAG ] ) { // item = BG_FindItemForPowerup( PW_REDFLAG ); // i = PW_REDFLAG; // } else if ( other->client->ps.powerups[ PW_BLUEFLAG ] ) { // item = BG_FindItemForPowerup( PW_BLUEFLAG ); // i = PW_BLUEFLAG; // } // if ( item ) { // drop = Drop_Item( other, item, 0 ); // // decide how many seconds it has left // drop->count = ( other->client->ps.powerups[ i ] - level.time ) / 1000; // if ( drop->count < 1 ) { // drop->count = 1; // } // other->client->ps.powerups[ i ] = 0; // } SelectNearestSpawnPoint( other->client->ps.origin, origin, angles ); TeleportPlayer( other, origin, angles ); return; } // END UNLOX if ( self->spawnflags & 16 ) { self->timestamp = level.time + 1000; } else { self->timestamp = level.time + FRAMETIME; } // play sound if ( !(self->spawnflags & 4) ) { G_Sound( other, CHAN_AUTO, self->noise_index ); } if (self->spawnflags & 8) dflags = DAMAGE_NO_PROTECTION; else dflags = 0; G_Damage (other, self, self, NULL, NULL, self->damage, dflags, MOD_TRIGGER_HURT); }
void LfgGroup::TeleportToDungeon() { if (IsInDungeon()) { for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { Player *plr = sObjectMgr.GetPlayer(citr->guid); if (!plr || !plr->GetSession()) continue; plr->m_lookingForGroup.queuedDungeons.clear(); if (plr->GetMapId() == m_dungeonInfo->map) { sLfgMgr.SendLfgUpdatePlayer(plr, LFG_UPDATETYPE_REMOVED_FROM_QUEUE); sLfgMgr.SendLfgUpdateParty(plr, LFG_UPDATETYPE_REMOVED_FROM_QUEUE); continue; } DungeonInfo* dungeonInfo = sLfgMgr.GetDungeonInfo(m_dungeonInfo->ID); plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, GetMembersCount()-1); TeleportPlayer(plr, dungeonInfo, m_dungeonInfo->ID); } return; } //If random, then select here if (m_dungeonInfo->type == LFG_TYPE_RANDOM && !SelectRandomDungeon()) return; DungeonInfo* dungeonInfo = sLfgMgr.GetDungeonInfo(m_dungeonInfo->ID); //Set Leader m_leaderGuid = 0; for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { Player *plr = sObjectMgr.GetPlayer(citr->guid); if (!plr || !plr->GetSession()) continue; if (IsPremade() && plr->GetGroup()) { plr->GetGroup()->UnbindInstance(dungeonInfo->start_map, m_dungeonInfo->isHeroic() ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL); m_leaderGuid = plr->GetGroup()->GetLeaderGUID(); m_leaderName = plr->GetGroup()->GetLeaderName(); break; } else if (plr->m_lookingForGroup.roles & LEADER) { m_leaderGuid = plr->GetGUID(); m_leaderName = plr->GetName(); break; } } if (m_leaderGuid == 0) { m_leaderGuid = m_memberSlots.begin()->guid; m_leaderName = m_memberSlots.begin()->name; } m_lootMethod = GROUP_LOOT; m_lootThreshold = ITEM_QUALITY_UNCOMMON; m_looterGuid = m_leaderGuid; m_dungeonDifficulty = m_dungeonInfo->isHeroic() ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL; m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; //sort group members... UnbindInstance(dungeonInfo->start_map, m_dungeonInfo->isHeroic() ? DUNGEON_DIFFICULTY_HEROIC : DUNGEON_DIFFICULTY_NORMAL); CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id); ResetInstances(INSTANCE_RESET_ALL, true, NULL); ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL); for(member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { Player *plr = sObjectMgr.GetPlayer(citr->guid); if (!plr || !plr->GetSession()) continue; plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, GetMembersCount()-1); TeleportPlayer(plr, dungeonInfo, GetDungeonInfo(true)->ID); } m_lfgFlags |= LFG_GRP_IN_DUNGEON; //Save to DB CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u' OR leaderGuid='%u'", m_Id, GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty,healGuid,LfgId,LfgRandomEntry,LfgInstanceStatus,LfgFlags) " "VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u','%u','%u','%u','%u','%u')", m_Id, GUID_LOPART(m_leaderGuid), GUID_LOPART(m_tank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), uint32(m_raidDifficulty), GUID_LOPART(m_heal), m_dungeonInfo->ID, GetDungeonInfo(true)->ID, m_instanceStatus, uint8(m_lfgFlags)); }
/* ================ ClientEvents Events will be passed on to the clients for presentation, but any server game effects are handled here ================ */ void ClientEvents(gentity_t * ent, int oldEventSequence) { int i, j; int event; gclient_t *client; int damage; // vec3_t dir; vec3_t origin, angles; gitem_t *item; gentity_t *drop; client = ent->client; if (oldEventSequence < client->ps.eventSequence - MAX_PS_EVENTS) { oldEventSequence = client->ps.eventSequence - MAX_PS_EVENTS; } for (i = oldEventSequence; i < client->ps.eventSequence; i++) { event = client->ps.events[i & (MAX_PS_EVENTS - 1)]; switch (event) { case EV_FALL_MEDIUM: case EV_FALL_FAR: if (ent->s.eType != ET_PLAYER) { break; // not in the player model } if (g_dmflags.integer & DF_NO_FALLING) { break; } // JBravo: fix falling pain during lca if (g_gametype.integer >= GT_TEAM && level.lights_camera_action) { break; } damage = ent->client->ps.stats[STAT_FALLDAMAGE]; // VectorSet(dir, 0, 0, 1); ent->pain_debounce_time = level.time + 200; // no normal pain sound //Elder: added so we can trigger AQ2 pain blends ent->client->ps.damageEvent++; ent->client->ps.damageCount += damage; if (ent->client->lasthurt_mod != 0) { //Blaze: Print out some debug info if (&g_entities[ent->client->lasthurt_client] == NULL) G_Printf("Ln 0748\n"); G_Damage(ent, &g_entities[ent->client->lasthurt_client], &g_entities[ent->client->lasthurt_client], NULL, NULL, damage, 0, MOD_FALLING); } else { G_Damage(ent, NULL, NULL, NULL, NULL, damage, 0, MOD_FALLING); } break; case EV_FALL_FAR_NOSOUND: if (ent->s.eType != ET_PLAYER) { break; // not in the player model } if (g_dmflags.integer & DF_NO_FALLING) { break; } // JBravo: fix falling pain during lca again if (g_gametype.integer >= GT_TEAM && level.lights_camera_action) { break; } damage = ent->client->ps.stats[STAT_FALLDAMAGE]; // VectorSet(dir, 0, 0, 1); ent->pain_debounce_time = level.time + 200; // no normal pain sound //Elder: added so we can trigger AQ2 pain blends ent->client->ps.damageEvent++; ent->client->ps.damageCount += damage; if (ent->client->lasthurt_mod != 0) { //Blaze: Print out some debug info if (&g_entities[ent->client->lasthurt_client] == NULL) G_Printf("Ln 0779\n"); G_Damage(ent, &g_entities[ent->client->lasthurt_client], &g_entities[ent->client->lasthurt_client], NULL, NULL, damage, 0, MOD_FALLING); } else { G_Damage(ent, NULL, NULL, NULL, NULL, damage, 0, MOD_FALLING); } break; case EV_FIRE_WEAPON: FireWeapon(ent); break; case EV_RELOAD_WEAPON1: ReloadWeapon(ent, 1); break; case EV_RELOAD_WEAPON2: ReloadWeapon(ent, 2); break; case EV_CHANGE_WEAPON: //Elder: not a good place to put stuff break; case EV_USE_ITEM1: // teleporter // drop flags in CTF item = NULL; j = 0; if (ent->client->ps.powerups[PW_REDFLAG]) { item = BG_FindItemForPowerup(PW_REDFLAG); j = PW_REDFLAG; } else if (ent->client->ps.powerups[PW_BLUEFLAG]) { item = BG_FindItemForPowerup(PW_BLUEFLAG); j = PW_BLUEFLAG; } else if (ent->client->ps.powerups[PW_NEUTRALFLAG]) { item = BG_FindItemForPowerup(PW_NEUTRALFLAG); j = PW_NEUTRALFLAG; } if (item) { drop = Drop_Item(ent, item, 0); // decide how many seconds it has left drop->count = (ent->client->ps.powerups[j] - level.time) / 1000; if (drop->count < 1) { drop->count = 1; } ent->client->ps.powerups[j] = 0; } SelectSpawnPoint(ent->client->ps.origin, origin, angles); TeleportPlayer(ent, origin, angles); break; case EV_USE_ITEM2: // medkit ent->health = 125; //ent->client->ps.stats[STAT_MAX_HEALTH] + 25; break; default: break; } } }
void trigger_teleporter_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { gentity_t *dest; if ( !other->client ) { return; } if ( other->client->ps.pm_type == PM_DEAD ) { return; } // Spectators only? if ( ( self->spawnflags & 1 ) && ( ( other->client->sess.sessionTeam != TEAM_SPECTATOR ) && !LPSDeadSpec( other->client ) ) ) { return; } // FIXME: Use defines for spawnflags if ( ( self->spawnflags & 0x2 ) && !IsSyc() ) { // No need to check for sprayroom teleporter out return; } if ( ( other->client->sess.sessionTeam != TEAM_SPECTATOR ) && !LPSDeadSpec( other->client ) ) { // sprayroom teleporter in if ( self->spawnflags & 0x2 ) { if ( other->client->ps.ammo[WP_SPRAYPISTOL] <= 0 ) { return; } other->client->logocounter = 0; other->client->sprayroomleavetime = ( ( level.maxsprayroomtime * 1000 ) + level.time ); other->client->sprayroomsoundflags = 0; other->client->ps.stats[STAT_SPRAYROOMSECS] = ( level.maxsprayroomtime + 1 ); if ( other->client->ps.weapon != WP_SPRAYPISTOL ) { other->client->last_nonspray_weapon = other->client->ps.weapon; } if ( other->client->ps.weaponstate == WEAPON_CHARGING ) { other->client->ps.weaponstate = WEAPON_READY; other->client->ps.weaponTime = 0; } trap_SendServerCommand( other->client->ps.clientNum, va( "srwc %i", WP_SPRAYPISTOL ) ); other->client->pers.cmd.weapon = WP_SPRAYPISTOL; other->client->ps.weapon = WP_SPRAYPISTOL; G_BackupPowerups( other->client ); } // sprayroom teleporter out else if ( self->spawnflags & 0x4 ) { other->client->ps.stats[STAT_SPRAYROOMSECS] = 0; trap_SendServerCommand( other->client->ps.clientNum, va( "srwc %i", other->client->last_nonspray_weapon ) ); other->client->pers.cmd.weapon = other->client->last_nonspray_weapon; other->client->ps.weapon = other->client->last_nonspray_weapon; G_RestorePowerups( other->client ); } } dest = G_PickTarget( self->target ); if (!dest) { G_Printf ("Couldn't find teleporter destination\n"); return; } TeleportPlayer( other, dest->s.origin, dest->s.angles ); }
// Teleport player to this map and this coord. bool CMap::TeleportPlayer( CPlayer* player, fPoint coordold, bool TelePassenger ) { fPoint coord; coord=coordold; if(id==9&&player->UWPosition->source.x>0&&player->UWPosition->source.y>0) { coord.x = player->UWPosition->source.x; coord.y = player->UWPosition->source.y; } GServer->MapList.Index[player->Position->Map]->RemovePlayer( player, false ); player->Position->Map = id; player->Position->current = coord; //TELEPORT ONLY player->Position->destiny = coord; //TELEPORT ONLY player->Session->inGame = false; player->Position->lastMoveTime = clock(); if(!allowpat || !TelePassenger) { if(!allowpat) player->Status->Stance=0x03; player->Ride->Drive = false; player->Ride->charid= 0; player->Ride->Ride = false; } AddPlayer( player ); BEGINPACKET( pak, 0x07a8 ); ADDWORD ( pak, player->clientid ); ADDWORD ( pak, player->Position->Map ); ADDFLOAT ( pak, player->Position->current.x*100 ); ADDFLOAT ( pak, player->Position->current.y*100 ); ADDWORD ( pak, (player->Status->Stance == 0x04? 0x0201: 0x0001) ); //PY: structure of WORD above should be //BYTE btRunMode //Byte btRideMode //+ 2 byte of a large byte array // See struct gsv_TELEPORT_REPLY in netPrototypes.h in client source //LMA: it seems they added some stuff... ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); //move speed. ADDWORD(pak,player->Stats->Move_Speed); //this would appear to be in the right place though //0x00 ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDDWORD(pak, 0x00); ADDWORD(pak, 0x00); player->client->SendPacket( &pak ); if( player->Ride->Drive && player->Ride->charid!=0 ) { CPlayer* otherclient = GServer->GetClientByCID( player->Ride->charid ); if( otherclient!=NULL ) { if(TelePassenger) { TeleportPlayer( otherclient, coord ); } else { otherclient->Ride->Drive = false; otherclient->Ride->charid= 0; otherclient->Ride->Ride = false; } } } GServer->pakClearUser( player ); GServer->ClearClientID( player->clientid ); player->RestartPlayerVal( ); player->SetStats( ); return true; }