char* Snake::getSnakeHeadPath(bool bite) { if(bite) { if(isInvulnerable()) { return "Resources/Images/snake/snake_head_bite_helmet.png"; } else { return "Resources/Images/snake/snake_head_bite.png"; } } else { if(isInvulnerable()) { return "Resources/Images/snake/snake_head_helmet.png"; } else { return "Resources/Images/snake/snake_head.png"; } } }
quint8 cPlayer::notoriety( P_CHAR pChar ) // Gets the notoriety toward another char { // 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red, 0x07 Yellow quint8 result; if ( isInvulnerable() ) { return 7; } if ( isIncognito() ) { return 1; // Always Innocent } if ( isPolymorphed() && !isHuman() ) { return 3; // Polymorph Defaults to Grey Name } // Guilds override kills if ( guild_ && pChar != this ) { P_PLAYER player = dynamic_cast<P_PLAYER>( pChar ); if ( player && player->guild_ ) { // Same Guild => Green if ( player->guild_ == guild_ || guild_->isAllied(player->guild_) ) { return 0x02; } else if ( guild_->isAtWar(player->guild_) ) { return 0x05; } } } if ( pChar->kills() > Config::instance()->maxkills() ) { result = 0x06; // 6 = Red -> Murderer } else if ( account_ ) { if ( isCriminal() ) result = 0x03; else if ( karma_ < -2000 ) result = 0x06; else if ( karma_ < 0 ) result = 0x03; else result = 0x01; } else { // Everything else result = 0x03; } return result; }
Q_UINT8 cPlayer::notoriety( P_CHAR pChar ) // Gets the notoriety toward another char { // Player is incognito if ( isIncognito() ) { return 0x03; } // 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red, 0x07 Yellow Q_UINT8 result; if ( isInvulnerable() ) { return 7; } // Guilds override kills if ( guild_ && pChar != this ) { P_PLAYER player = dynamic_cast<P_PLAYER>( pChar ); if ( player && player->guild_ ) { // Same Guild => Green if ( player->guild_ == guild_ ) { return 0x02; } // TODO: Enemy Guilds, Allied Guilds } } if ( pChar->kills() > Config::instance()->maxkills() ) { result = 0x06; // 6 = Red -> Murderer } else if ( account_ ) { if ( isCriminal() ) result = 0x03; else if ( karma_ < -2000 ) result = 0x06; else if ( karma_ < 0 ) result = 0x03; else result = 0x01; } else { // Everything else result = 0x03; } return result; }
void cNPC::showName( cUOSocket *socket ) { if( !socket->player() ) return; QString charName = name(); // apply titles if( SrvParams->showNpcTitles() && !title_.isEmpty() ) charName.append( ", " + title_ ); // Append serial for GMs if( socket->player()->showSerials() ) charName.append( QString( " [0x%1]" ).arg( serial(), 4, 16 ) ); // Frozen if (isFrozen()) charName.append( tr(" [frozen]") ); // Guarded if( guardedby_.size() > 0 ) charName.append( tr(" [guarded]") ); // Guarding if( isTamed() && guarding_ ) charName.append( tr(" [guarding]") ); Q_UINT16 speechColor; // 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red switch( notoriety( socket->player() ) ) { case 0x01: speechColor = 0x59; break; //blue case 0x02: speechColor = 0x3F; break; //green case 0x03: speechColor = 0x3B2; break; //grey case 0x05: speechColor = 0x90; break; //orange case 0x06: speechColor = 0x22; break; //red default: speechColor = 0x3B2; break; // grey } if (isInvulnerable()) { speechColor = 0x35; } // Show it to the socket socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System ); }
/** Overloading setKartAnimation with a kind of listener function in order * to gather statistics about rescues and explosions. */ void KartWithStats::setKartAnimation(AbstractKartAnimation *ka) { bool is_new = !getKartAnimation() && !isInvulnerable() && !isShielded(); Kart::setKartAnimation(ka); // Nothing to count if it's not a new animation if(!is_new) return; // We can't use a dynamic cast here, since this function is called from // constructor of AbstractKartAnimation, which is the base class for all // animations. So at this stage ka is only an AbstractKartAnimation, not // any of the derived classes. if(ka && ka->getName()=="ExplosionAnimation") { m_explosion_count ++; m_explosion_time += ka->getAnimationTimer(); } else if(ka && ka->getName()=="RescueAnimation") { m_rescue_count ++; m_rescue_time += ka->getAnimationTimer(); } } // setKartAnimation
void cPlayer::showName( cUOSocket* socket ) { if ( !socket->player() ) { return; } QString charName = name(); // Prefix QString prefix( " " ); // Tag for Prefix if ( !isPolymorphed() ) { if ( hasTag( "name.prefix" ) ) { prefix.append( getTag( "name.prefix" ).toString() ); } else if ( fame_ >= 10000 && !isReputationHidden() ) { prefix.append( gender_ ? tr( "Lady" ) : tr( "Lord" ) ); } } // Suffix QString affix( " " ); // Tag for Suffix if ( !isPolymorphed() ) { if ( hasTag( "name.suffix" ) ) { affix.append( getTag( "name.suffix" ).toString() ); affix.append( " " ); } } if ( !isIncognito() && guild_ && !guild_->abbreviation().isEmpty() ) { cGuild::MemberInfo* info = guild_->getMemberInfo( this ); if ( info && info->showSign() ) { affix.append( QString( "[%1]" ).arg( guild_->abbreviation() ) ); } } // Append serial for GMs if ( socket->account()->isShowSerials() ) affix.append( QString( "[0x%1]" ).arg( serial(), 4, 16 ) ); // Append offline flag if ( !socket_ && !logoutTime_ ) affix.append( tr( " [offline]" ) ); // Guarded if ( guardedby_.size() > 0 ) affix.append( tr( " [guarded]" ) ); // Guarding if ( isTamed() && guarding_ ) affix.append( tr( " [guarding]" ) ); quint16 speechColor; // 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red if (Config::instance()->sendAsciiNames()) { switch ( notoriety( socket->player() ) ) { case 0x01: speechColor = 0x63; break; //blue case 0x02: speechColor = 0x44; break; //green case 0x03: speechColor = 0x3B2; break; //grey case 0x05: speechColor = 0x2b; break; //orange case 0x06: speechColor = 0x0026; break; //red default: speechColor = 0x3B2; break; // grey } if ( isInvulnerable() ) { speechColor = 0x37; } // ASCII Packet cUOTxAsciiSpeech speech; speech.setId(body_); speech.setSerial(serial_); speech.setMessage(prefix + " " + charName + " " + affix); speech.setColor(speechColor); speech.setFont(3); speech.setType(6); // Object Speech speech.setName(name_); socket->send(&speech); // Show it to the socket // socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System ); // Names are presented in ASCII speech, Guild titles are not //socket->clilocMessage( 1050045, " \t" + charName + "\t " + affix, speechColor, 3, this, true ); } else { switch ( notoriety( socket->player() ) ) { case 0x01: speechColor = 0x59; break; //blue case 0x02: speechColor = 0x3F; break; //green case 0x03: speechColor = 0x3B2; break; //grey case 0x05: speechColor = 0x90; break; //orange case 0x06: speechColor = 0x22; break; //red default: speechColor = 0x3B2; break; // grey } if ( isInvulnerable() ) { speechColor = 0x35; } // Show it to the socket // socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System ); // Names are presented in ASCII speech, Guild titles are not socket->clilocMessage( 1050045, prefix + " \t" + charName + "\t " + affix, speechColor, 3, this, true ); } }
UINT8 cNPC::notoriety( P_CHAR pChar ) // Gets the notoriety toward another char { if (isIncognito()) { return 0x03; } /* Hard to tell because the ai-types are now string based 0 = invalid/across server line 1 = innocent (blue) 2 = guilded/ally (green) 3 = attackable but not criminal (gray) 4 = criminal (gray) 5 = enemy (orange) 6 = murderer (red) 7 = invulnerable (yellow) //7 = unknown use (translucent (like 0x4000 hue)) */ UINT8 result; if (isInvulnerable()) { return 7; } // Check for Guild status + Highlight // UINT8 guildStatus = GuildCompare( this, pChar ); // if( npcaitype() == 0x02 ) // return 0x06; // 6 = Red -> Monster if( ai_ && ai_->notorietyOverride() ) return ai_->notorietyOverride(); if( !pChar ) return 3; if( pChar->kills() > SrvParams->maxkills() ) result = 0x06; // 6 = Red -> Murderer // else if( guildStatus == 1 ) // result = 0x02; // 2 = Green -> Same Guild // else if( guildStatus == 2 ) // result = 0x05; // 5 = Orange -> Enemy Guild else { // Monsters are always bad // if( npcaitype_ == 4 ) // return 0x01; if( isHuman() ) { if( karma_ >= 0 ) result = 0x01; else result = 0x06; } // Everything else else { return 3; } } return result; }
void cPlayer::showName( cUOSocket* socket ) { if ( !socket->player() ) { return; } QString charName = name(); // Lord & Lady Title if ( !isIncognito() && fame_ >= 10000 ) charName.prepend( gender_ ? tr( "Lady " ) : tr( "Lord " ) ); QString affix( "" ); if ( !isIncognito() && guild_ && !guild_->abbreviation().isEmpty() ) { cGuild::MemberInfo* info = guild_->getMemberInfo( this ); if ( info && info->showSign() ) { affix.append( QString( "[%1]" ).arg( guild_->abbreviation() ) ); } } // Append serial for GMs if ( socket->player()->showSerials() ) affix.append( QString( "[0x%1]" ).arg( serial(), 4, 16 ) ); // Append offline flag if ( !socket_ && !logoutTime_ ) affix.append( tr( " [offline]" ) ); // Guarded if ( guardedby_.size() > 0 ) affix.append( tr( " [guarded]" ) ); // Guarding if ( isTamed() && guarding_ ) affix.append( tr( " [guarding]" ) ); Q_UINT16 speechColor; // 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red switch ( notoriety( socket->player() ) ) { case 0x01: speechColor = 0x59; break; //blue case 0x02: speechColor = 0x3F; break; //green case 0x03: speechColor = 0x3B2; break; //grey case 0x05: speechColor = 0x90; break; //orange case 0x06: speechColor = 0x22; break; //red default: speechColor = 0x3B2; break; // grey } if ( isInvulnerable() ) { speechColor = 0x35; } // Show it to the socket // socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System ); // Names are presented in ASCII speech, Guild titles are not socket->clilocMessage( 1050045, " \t" + charName + "\t " + affix, speechColor, 3, this, true ); }