Esempio n. 1
0
bool GLHardCut::process( const QList<Effect*> &el, double pts, Frame *first, Frame *second, Profile *p )
{
	Q_UNUSED( first );
	Q_UNUSED( second );
	Q_UNUSED( p );
	return el[0]->set_float( "show_second", getNormalizedTime( pts ) > getParamValue( position ).toDouble() ? 1 : 0 );
}
int	QuaternionInterpolator::getValue( float time, float* value, int size, int hint ) const
{
	assert( keys() > 0 );
	assert( size == channels() );

	// single key?
	int last = keys() - 1;
	if ( 0 == last )
	{
		getKeyValue( last, value, size );
		return last;
	}

	// find key frame and normalize time
	time = getNormalizedTime( time );
	int key = findKey( time, hint );

	// end of animation?
	if ( time >= getKeyTime(last) )
	{
		getKeyValue( last, value, size );
		return last;
	}
	assert( time < getKeyTime(last) );
	assert( key < last );

	// interpolate
	switch ( m_interp )
	{
	case INTERPOLATE_STEPPED:{
		getKeyValue( key, value, size );
		break;}

	case INTERPOLATE_LINEAR:{
		// get keys, ensure acute angle
		const float* p = getKeyValue(key);
		float q[4];
		getKeyValue( key+1, q, 4 );
		if ( Quat::dot(p,q) < 0.f )
			Quat::negate( q, q );

		// interpolate
		float keyInterval = getKeyTime(key+1) - getKeyTime(key);
		assert( keyInterval > Float::MIN_VALUE );
		float u = (time - getKeyTime(key)) / keyInterval;
		assert( u >= 0.f && u <= 1.f );
		Quat::slerp( value, u, p, q );
		Quat::normalize( value, value );
		break;}
	}

	return key;
}
Esempio n. 3
0
cFightInfo::cFightInfo(P_CHAR attacker, P_CHAR victim, bool legitimate) {
	attacker_ = attacker;
	victim_ = victim;
	legitimate_ = legitimate;
	victimDamage_ = 0;
	attackerDamage_ = 0;
	lastaction_ = getNormalizedTime();

	// Register the fight info object with the combat system.
	attacker->fights().append(this);
	victim->fights().append(this);
	Combat::instance()->fights().append(this);
}
Esempio n. 4
0
//s: char#
void cCombat::SpawnGuard(P_CHAR pc_offender, P_CHAR pc_caller, int x, int y, signed char z)
{
	int t;
//	if (i < 0 || i >= cmem || s < 0 || s >= cmem)
//		return;
	
//	P_CHAR pc_offender = MAKE_CHARREF_LR(s);
//	P_CHAR pc_caller   = MAKE_CHARREF_LR(i);
	if ( pc_offender == NULL || pc_caller == NULL)
		return;
	
	if (!(pc_caller->inGuardedArea() || pc_offender->inGuardedArea()))
		return;
	
	if (pc_offender->dead || pc_caller->dead)
		return; // AntiChrist
	
	if (SrvParams->guardsActive() && !pc_offender->isInvul())
	{
        t = region[pc_caller->region].guardnum[(rand()%10)];
		P_CHAR pc_guard = Npcs->AddNPCxyz(calcSocketFromChar(pc_offender), t, 0, x, y, z);
		if ( pc_guard == NULL ) return;
		
		pc_guard->npcaitype = 4; // CITY GUARD, LB, bugfix, was 0x40 -> not existing
		pc_guard->setAttackFirst();
		pc_guard->attacker = pc_offender->serial;
		pc_guard->targ = pc_offender->serial;
		pc_guard->npcWander = 2;  // set wander mode Tauriel
		npcToggleCombat(pc_guard);
		pc_guard->setNextMoveTime();
		pc_guard->summontimer =(getNormalizedTime() +(MY_CLOCKS_PER_SEC*25));    
		
		soundeffect2(pc_guard, 0x01FE);  // Tauriel 1-9-99 changed to stop crashing used to call soundeffect (expeted socket)
		staticeffect(pc_guard, 0x37, 0x2A, 0x09, 0x06);
		
		updatechar(pc_guard);
		switch (RandomNum(0,1))
		{
		case 0:		npctalkall(pc_guard, "Thou shalt regret thine actions, swine!", 1);	break;
		case 1:		npctalkall(pc_guard, "Death to all Evil!", 1);							break;
		}
	}
}
Esempio n. 5
0
bool UnStableSpeech(cChar* pMaster, const QString& comm, cChar* pPlayer, UOXSOCKET s)
{
	if (pMaster->npc_type!=1)	// is it a stablemaster ?
		return 0;

//    if (!(strstr( comm, "CLAIM") || strstr( comm, "RETRIEVE")))	// lets check if the keyword CLAIM is in the commandstring, if not return !
	if (!comm.contains("CLAIM") && !comm.contains("RETRIEVE"))
	
		return 0;

	/////////////////////////////////////////////////////////////////////
	//// so far we have a stablemaster! lets see if the stablemaster has a pet
	//// stabled the petowner owns
	//// if not return
    ///////////////////////////////////////////////////////////////////
	unsigned int ci;	
	P_CHAR  p_pet = NULL;
	bool found = false;
	vector<SERIAL> pets = stablesp.getData(pMaster->serial);
    for (ci = 0; ci < pets.size(); ci++)
	{
		p_pet = FindCharBySerial(pets[ci]);
		if (p_pet != NULL)
		{
			 if (pPlayer->Owns(p_pet) && p_pet->stablemaster_serial!=0) // already stabled and owned by claimer ?
			 {
			 	QString search3 = p_pet->name.c_str();
				if (comm.contains(search3, false))
				{
					found=true;
					break;
				}
			}
		}
	}
	if (!found) 
	{ 
		npctalk(s,pMaster, "sorry, I can't return that pet",0);
		return 1;
	} 

	/////////////////////////////////////////////////////////////
	/// now we have the claimed pet and stablemaster -> time to UNSTABLE :-)
    ////////////////////////////////////////////////////////////

	/// calc fee
	float f_fee = ( (p_pet->time_unused) / 600.0f) * SrvParams->stablingFee() ; // (fee per 10 minutes) * number of 10 minute blocks
	int fee = ( (int) f_fee) + 5; // 5 basefee

	sprintf((char*)temp,"That's %i gold pieces",fee);
	npctalk(s,pMaster,(char*)temp,0);

	/////////// check if customer can pay ! ///////////////    
	int gold = pPlayer->CountGold();
	if (gold<fee) // not enough gold in bp, dont try to subtract gold !
	{
		sprintf((char*)temp,"you can't afford that %i",fee);
		npctalk(s,pMaster,(char*)temp,0);
		return 1;
	}
	else
	{
		delequan( pPlayer, 0x0EED, fee, NULL );
	}
	
    //// if paid -> return pet
	
	// remove from hash table
	stablesp.remove(pMaster->serial, p_pet->serial);
	
	p_pet->stablemaster_serial=0; // actual unstabling
	
	p_pet->timeused_last=getNormalizedTime();
	p_pet->time_unused=0;
	
	mapRegions->Remove(p_pet);	
	mapRegions->Add( p_pet );
	
	for (int ch=0; ch<now; ch++)
	{	
		if (perm[ch]) impowncreate(ch, p_pet, 0); 
	}
	
	npctalk(s,pMaster,"Thx! Here's your pet",0);
	return 1;
}
Esempio n. 6
0
bool StableSpeech(cChar* pMaster, const QString& comm, cChar* pPlayer, UOXSOCKET s)
{
	if (pMaster->npc_type!=1)	// is it a stablemaster ?
		return 0;

    //if (!strstr( comm, "STABLE"))	// lets check if the keyword stable is in the commandstring, if not return !
	if (!comm.contains("STABLE"))
		return 0;
      
	/////////////////////////////////////////////////////////////////////
	//// so far we have a stablemaster! lets see if the caller has a pet
	//// if so check if the pets name is in the commandstring
	//// if not return
    ///////////////////////////////////////////////////////////////////
	
	bool found = false;
	P_CHAR p_pet = NULL;
	cRegion::RegionIterator4Chars ri(pPlayer->pos);
	for (ri.Begin(); !ri.atEnd(); ri++)
	{
		p_pet = ri.GetData();
		if (pPlayer->dist(p_pet) <= 8)
		{
			// khpae : small bug fix
			//if (pPlayer->Owns(p_pet) && p_pet->stablemaster_serial==0) //owner of the pet ? and not already stabled ?
			if (pPlayer->Owns(p_pet) && (p_pet->stablemaster_serial==INVALID_SERIAL))
			{
				//char pntmp[150];
				//strcpy(pntmp, p_pet->name.c_str());
				//strupr(pntmp);
				QString pntmp = p_pet->name.c_str();
				if (comm.contains(pntmp, false))
				{
					found=true;
					break;
				}
			}
		}
	}

	if (!found) 
	{ 
		npctalk(s,pMaster,"which pet?",0);
		return 1;
	} 

	/////////////////////////////////////////////////////////////
	/// now we have a pet and stablemaster -> time to STABLE :-)
    ////////////////////////////////////////////////////////////
	
    // set stablesp && pets stablemaster serial
	
	// remove it from screen!

	int xx=p_pet->pos.x;
	int yy=p_pet->pos.y;
	short id=p_pet->id(); 
	p_pet->setId(0); 
	p_pet->pos.x=0;
	p_pet->pos.y=0;

	for (int ch=0; ch<now; ch++)
	{	
		if (perm[ch]) impowncreate(ch, p_pet, 0); 
	}

	p_pet->setId(id); 
	p_pet->war=false;
	p_pet->attacker = INVALID_SERIAL;
	pPlayer->war=false;
	pPlayer->targ=INVALID_SERIAL;
	p_pet->pos.x=xx;
	p_pet->pos.y=yy;

	mapRegions->Remove(p_pet);

	p_pet->stablemaster_serial=pMaster->serial;

	// set timer for fee calculation

    p_pet->time_unused=0;
	p_pet->timeused_last = getNormalizedTime();

	stablesp.insert(pMaster->serial, p_pet->serial);

	sprintf(temp,"Your pet is now stabled, say retrieve or claim %s to claim your pet",p_pet->name.c_str());
	npctalk(s,pMaster,temp,0);

	return 1;
}
Esempio n. 7
0
void cChar::Init(bool ser)
{
	VisRange = VISRANGE ;
	unsigned int i;

	if (ser)
	{
		this->setSerial(cCharsManager::getInstance()->getUnusedSerial());
	}
	else
	{
		this->serial = INVALID_SERIAL;
	}
	this->multis=-1;//Multi serial
	this->free = false;
	this->name = "Mr. noname";
	this->orgname = "Mr. noname";

	this->antispamtimer=0;//LB - anti spam

	this->unicode = false; // This is set to 1 if the player uses unicode speech, 0 if not
	this->account=-1;
	this->pos.x=100;
	this->pos.y=100;
	this->pos.z=this->dispz=0;
	
//	this->oldpos.x=0; // fix for jail bug
//	this->oldpos.y=0; // fix for jail bug
//	this->oldpos.z=0; // LB, experimental, change back to unsignbed if this give sproblems
	this->race=0; // -Fraz- Race AddOn
	this->dir=0; //&0F=Direction
	this->xid = 0x0190;
	this->setId(0x0190);
	this->skin = this->xskin = 0x0000; // Skin color
	this->setPriv(0);	// 1:GM clearance, 2:Broadcast, 4:Invulnerable, 8: single click serial numbers
	// 10: Don't show skill titles, 20: GM Pagable, 40: Can snoop others packs, 80: Counselor clearance
	this->priv2=0;	// 1:Allmove, 2: Frozen, 4: View houses as icons, 8: permanently hidden
	// 10: no need mana, 20: dispellable, 40: permanent magic reflect, 80: no need reagents
	for (i=0;i<7;i++)
		this->priv3[i]=0;  // needed for Lord bianrys meta-gm stuff
	this->fonttype=3; // Speech font to use
	this->saycolor=0x1700; // Color for say messages
	this->emotecolor = 0x0023; // Color for emote messages
	this->st=50; // Strength
	this->st2=0; // Reserved for calculation
	this->dx=50; // Dexterity
	this->dx2=0; // Reserved for calculation
	this->tmpDex=0; // Reserved for calculation
	this->in=50; // Intelligence
	this->in2=0; // Reserved for calculation
	this->hp=50; // Hitpoints
	this->stm=50; // Stamina
	this->mn=50; // Mana
	this->mn2=0; // Reserved for calculation
	this->hidamage=0; //NPC Damage
	this->lodamage=0; //NPC Damage
	this->jailtimer=0; //blackwinds jail system 
    this->jailsecs=0;
	
	this->creationday = getPlatformDay() ;
	for (i=0;i<TRUESKILLS;i++)
	{
		this->baseskill[i]=0;
		this->skill[i]=0;
	}
	this->npc=false;
	this->shop=false; //1=npc shopkeeper
	this->cell=0; // Reserved for jailing players 
	            // bugfix, LB 0= player not in jail !, not -1
	
	this->jailtimer=0; //blackwinds jail system
	this->jailsecs=0;

	this->ownserial=INVALID_SERIAL; // If Char is an NPC, this sets its owner
	this->tamed = false; // True if NPC is tamed
	this->robe = -1; // Serial number of generated death robe (If char is a ghost)
	this->karma=0;
	this->fame=0;
	this->pathnum = PATHNUM;
	this->kills=0; // PvP Kills
	this->deaths=0;
	this->dead = false; // Is character dead
	this->packitem=INVALID_SERIAL; // Only used during character creation
	this->fixedlight=255; // Fixed lighting level (For chars in dungeons, where they dont see the night)
	// changed to -1, LB, bugfix
	this->speech=0; // For NPCs: Number of the assigned speech block
	this->weight=0; //Total weight
	this->att=0; // Intrinsic attack (For monsters that cant carry weapons)
	this->def=0; // Intrinsic defense
	this->war=false; // War Mode
	this->targ=INVALID_SERIAL; // Current combat target
	this->timeout=0; // Combat timeout (For hitting)
	this->timeout2=0;
	this->regen=0;
	this->regen2=0;
	this->regen3=0;//Regeneration times for mana, stamin, and str
	this->inputmode = enNone;
	this->inputitem = INVALID_SERIAL;
	this->attacker = INVALID_SERIAL; // Character's serial who attacked this character
	this->npcmovetime=0; // Next time npc will walk
	this->npcWander=0; // NPC Wander Mode
	this->oldnpcWander=0; // Used for fleeing npcs
	this->ftarg = INVALID_SERIAL; // NPC Follow Target
	this->fx1=-1; //NPC Wander Point 1 x or Deed's Serial
	this->fx2=-1; //NPC Wander Point 2 x
	this->fy1=-1; //NPC Wander Point 1 y
	this->fy2=-1; //NPC Wander Point 2 y
	this->fz1=0; //NPC Wander Point 1 z
	this->spawnserial=-1; // Spawned by
	this->hidden=0; // 0 = not hidden, 1 = hidden, 2 = invisible spell
	this->invistimeout=0;
	this->resetAttackFirst(); // 0 = defending, 1 = attacked first
	this->onhorse=false; // On a horse?
	this->hunger=6;  // Level of hungerness, 6 = full, 0 = "empty"
	this->hungertime=0; // Timer used for hunger, one point is dropped every 20 min
	this->smeltitem= INVALID_SERIAL;
	this->tailitem = INVALID_SERIAL;
	this->npcaitype=0; // NPC ai
	this->callnum= 0; //-1; //GM Paging		// khpae changed to 0
	this->playercallnum= 0; //-1; //GM Paging	// khpae changed to 0
	this->region=255;
	this->skilldelay=0;
	this->objectdelay=0;
	this->combathitmessage=0;
	this->making=-1; // skill number of skill using to make item, 0 if not making anything.
	this->blocked=0;
	this->dir2=0;
	this->spiritspeaktimer=0; // Timer used for duration of spirit speak
	this->spattack=0;
	this->spadelay=0;
	this->spatimer=0;
	this->taming=0; //Skill level required for taming
	this->summontimer=0; //Timer for summoned creatures.
	this->trackingtimer=0; // Timer used for the duration of tracking
	this->trackingtarget = INVALID_SERIAL; // Tracking target ID
	for (i=0;i<MAXTRACKINGTARGETS;i++)
		this->trackingtargets[i]=0;
	this->fishingtimer=0; // Timer used to delay the catching of fish

	this->advobj=0; //Has used advance gate?
	
	this->poison=0; // used for poison skill 
	this->poisoned=0; // type of poison
	this->poisontime=0; // poison damage timer
	this->poisontxt=0; // poision text timer
	this->poisonwearofftime=0; // LB, makes poision wear off ...
	
	this->fleeat=SrvParams->npc_base_fleeat();
	this->reattackat=SrvParams->npc_base_reattackat();
	this->trigger=0; //Trigger number that character activates
	this->trigword = "";
	this->disabled=0; //Character is disabled for n cicles, cant trigger.
	this->disabledmsg = ""; //Character disabled message. -- by Magius(CHE) §
	this->envokeid = 0x00; //ID of item user envoked
	this->envokeitem = INVALID_SERIAL;
	this->split = 0;
	this->splitchnc = 0;
	this->targtrig=0; //Stores the number of the trigger the character for targeting
	this->ra=0;  // Reactive Armor spell
	this->trainer=0; // Serial of the NPC training the char, -1 if none.
	this->trainingplayerin=0; // Index in skillname of the skill the NPC is training the player in
	this->cantrain=true;
	// Begin of Guild Related Character information (DasRaetsel)
	this->guildtoggle=false;		// Toggle for Guildtitle								(DasRaetsel)
	this->guildtitle="";	// Title Guildmaster granted player						(DasRaetsel)
	this->guildfealty=-1;		// Serial of player you are loyal to (default=yourself)	(DasRaetsel)
	this->guildstone=INVALID_SERIAL;		// GuildStone Serial of guild player is in (INVALID_SERIAL=no guild)			(DasRaetsel)
	this->GuildTraitor=false; 
	//this->flag=0x04; //1=red 2=grey 4=Blue 8=green 10=Orange
	this->flag=0x02; //1=red 2=grey 4=Blue 8=green 10=Orange // grey as default - AntiChrist
	this->tempflagtime=0;
	// End of Guild Related Character information
	this->murderrate=0; //# of ticks till murder decays.
	this->crimflag=-1; // time when no longer criminal -1 = not criminal
	this->casting=0; // 0/1 is the cast casting a spell?
	this->spelltime=0; //Time when they are done casting....
	this->spell=0; //current spell they are casting....
	this->spellaction=0; //Action of the current spell....
	this->nextact=0; //time to next spell action....
	this->poisonserial=-1; //AntiChrist -- poisoning skill
	
	this->squelched=0; // zippy  - squelching
	this->mutetime=0; //Time till they are UN-Squelched.
	this->med = false; // false = not meditating, true = meditating //Morrolan - Meditation 
	this->stealth=-1; //AntiChrist - stealth ( steps already done, -1=not using )
	this->running=0; //AntiChrist - Stamina Loose while running
	this->logout=0;//Time till logout for this char -1 means in the world or already logged out //Instalog
	this->swingtarg=-1; //Tagret they are going to hit after they swing
	this->holdg=0; // Gold a player vendor is holding for Owner
	this->fly_steps=0; //LB -> used for flyging creatures
	this->menupriv=0; // Lb -> menu priv
	this->guarded=false; // True if CHAR is guarded by some NPC
	this->smoketimer=0;
	this->smokedisplaytimer=0;
	this->carve=-1; // AntiChrist - for new carving system
	this->antiguardstimer=0; // AntiChrist - for "GUARDS" call-spawn
	this->polymorph=false;//polymorph - AntiChrist
	this->incognito=false;//incognito - AntiChrist
    this->postType = LOCALPOST;
    this->questDestRegion = 0;
    this->questOrigRegion= 0;
    this->questBountyReward= 0;
    this->questBountyPostSerial = INVALID_SERIAL;
    this->murdererSer = 0;
    this->spawnregion = 0;
    this->npc_type = 0;
    this->stablemaster_serial = INVALID_SERIAL;
	this->timeused_last = getNormalizedTime();
	this->time_unused = 0;

	for (i=0;i<TRUESKILLS;i++)
	{
		this->baseskill[i]=0;
		this->skill[i]=0;
	}
	for (i = 0; i < ALLSKILLS; i++) 
		this->lockSkill[i]=0;
}