本文整理汇总了C++中RuleI函数的典型用法代码示例。如果您正苦于以下问题:C++ RuleI函数的具体用法?C++ RuleI怎么用?C++ RuleI使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RuleI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
int32 Client::GetMaxStat() const {
if((RuleI(Character, StatCap)) > 0)
return (RuleI(Character, StatCap));
return 255;
}
示例2: GetHPRatio
//this is called whenever we are damaged to process possible fleeing
void Mob::CheckFlee() {
//if were allready fleeing, dont need to check more...
if(flee_mode && curfp)
return;
//dont bother if we are immune to fleeing
if(SpecAttacks[IMMUNE_FLEEING] || spellbonuses.ImmuneToFlee)
return;
if(!flee_timer.Check())
return; //only do all this stuff every little while, since
//its not essential that we start running RIGHT away
//see if were possibly hurt enough
float ratio = GetHPRatio();
if(ratio >= RuleI(Combat, FleeHPRatio))
return;
//we might be hurt enough, check con now..
Mob *hate_top = GetHateTop();
if(!hate_top) {
//this should never happen...
StartFleeing();
return;
}
float other_ratio = hate_top->GetHPRatio();
if(other_ratio < 20) {
//our hate top is almost dead too... stay and fight
return;
}
//base our flee ratio on our con. this is how the
//attacker sees the mob, since this is all we can observe
uint32 con = GetLevelCon(hate_top->GetLevel(), GetLevel());
float run_ratio;
switch(con) {
//these values are not 100% researched
case CON_GREEN:
run_ratio = RuleI(Combat, FleeHPRatio);
break;
case CON_LIGHTBLUE:
run_ratio = RuleI(Combat, FleeHPRatio) * 8 / 10;
break;
case CON_BLUE:
run_ratio = RuleI(Combat, FleeHPRatio) * 6 / 10;
break;
default:
run_ratio = RuleI(Combat, FleeHPRatio) * 4 / 10;
break;
}
if(ratio < run_ratio)
{
if( RuleB(Combat, FleeIfNotAlone)
|| ( !RuleB(Combat, FleeIfNotAlone)
&& (entity_list.GetHatedCount(hate_top, this) == 0)))
StartFleeing();
}
}
示例3: autobootup_timeout
Client::Client(EQStreamInterface* ieqs)
: autobootup_timeout(RuleI(World, ZoneAutobootTimeoutMS)),
CLE_keepalive_timer(RuleI(World, ClientKeepaliveTimeoutMS)),
connect(1000),
eqs(ieqs)
{
// Live does not send datarate as of 3/11/2005
//eqs->SetDataRate(7);
ip = eqs->GetRemoteIP();
port = ntohs(eqs->GetRemotePort());
autobootup_timeout.Disable();
connect.Disable();
seencharsel = false;
cle = 0;
zoneID = 0;
char_name[0] = 0;
charid = 0;
pwaitingforbootup = 0;
StartInTutorial = false;
ClientVersionBit = 0;
numclients++;
ClientVersionBit = 1 << (eqs->ClientVersion() - 1);
}
示例4: heal
//healing and buffing aggro
int32 Mob::CheckHealAggroAmount(uint16 spell_id, Mob *target, uint32 heal_possible)
{
int32 AggroAmount = 0;
auto target_level = target ? target->GetLevel() : 1;
bool ignore_default_buff = false; // rune/hot don't use the default 9, HP buffs that heal (virtue) do use the default
for (int o = 0; o < EFFECT_COUNT; o++) {
switch (spells[spell_id].effectid[o]) {
case SE_CurrentHP: {
if (heal_possible == 0) {
AggroAmount += 1;
break;
}
// hate based on base healing power of the spell
int val = CalcSpellEffectValue_formula(spells[spell_id].formula[o],
spells[spell_id].base[o], spells[spell_id].max[o], GetLevel(), spell_id);
if (val > 0) {
if (heal_possible < val)
val = heal_possible; // capped to amount healed
val = 2 * val / 3; // 3:2 ratio
if (target_level > 50 && val > 1500)
val = 1500; // target 51+ seems ~1500
else if (target_level <= 50 && val > 800)
val = 800; // per live patch notes, capped to 800
}
AggroAmount += std::max(val, 1);
break;
}
case SE_Rune:
AggroAmount += CalcSpellEffectValue_formula(spells[spell_id].formula[o],
spells[spell_id].base[o], spells[spell_id].max[o], GetLevel(), spell_id) * 2;
ignore_default_buff = true;
break;
case SE_HealOverTime:
AggroAmount += 10;
ignore_default_buff = true;
break;
default:
break;
}
}
if (GetOwner() && IsPet())
AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;
if (!ignore_default_buff && IsBuffSpell(spell_id) && IsBeneficialSpell(spell_id))
AggroAmount = IsBardSong(spell_id) ? 2 : 9;
if (AggroAmount > 0) {
int HateMod = RuleI(Aggro, SpellAggroMod);
HateMod += GetFocusEffect(focusSpellHateMod, spell_id);
//Live AA - Spell casting subtlety
HateMod += aabonuses.hatemod + spellbonuses.hatemod + itembonuses.hatemod;
AggroAmount = (AggroAmount * HateMod) / 100;
}
return std::max(0, AggroAmount);
}
示例5: Mob
Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime)
// vesuvias - appearence fix
: Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid,//bodytype added
in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
in_npc->GetPosition(), in_npc->GetInnateLightValue(), in_npc->GetTexture(),in_npc->GetHelmTexture(),
0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0xff,0,0,0,0,0,0,0,0,0),
corpse_decay_timer(in_decaytime),
corpse_rez_timer(0),
corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
corpse_graveyard_timer(0),
loot_cooldown_timer(10)
{
corpse_graveyard_timer.Disable();
memset(item_tint, 0, sizeof(item_tint));
is_corpse_changed = false;
is_player_corpse = false;
is_locked = false;
being_looted_by = 0xFFFFFFFF;
if (in_itemlist) {
itemlist = *in_itemlist;
in_itemlist->clear();
}
SetCash(in_npc->GetCopper(), in_npc->GetSilver(), in_npc->GetGold(), in_npc->GetPlatinum());
npctype_id = in_npctypeid;
SetPlayerKillItemID(0);
char_id = 0;
corpse_db_id = 0;
player_corpse_depop = false;
strcpy(corpse_name, in_npc->GetName());
strcpy(name, in_npc->GetName());
for(int count = 0; count < 100; count++) {
if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) {
corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000);
break;
}
}
if(IsEmpty()) {
corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000);
}
if(in_npc->HasPrivateCorpse()) {
corpse_delay_timer.SetTimer(corpse_decay_timer.GetRemainingTime() + 1000);
}
for (int i = 0; i < MAX_LOOTERS; i++){
allowed_looters[i] = 0;
}
this->rez_experience = 0;
UpdateEquipLightValue();
spell_light = NOT_USED;
UpdateActiveLightValue();
}
示例6: RuleI
int32 Client::CalcHPRegenCap()
{
int cap = RuleI(Character, ItemHealthRegenCap) + itembonuses.HeroicSTA/25;
cap += aabonuses.ItemHPRegenCap + spellbonuses.ItemHPRegenCap + itembonuses.ItemHPRegenCap;
return (cap * RuleI(Character, HPRegenMultiplier) / 100);
}
示例7: switch
//healing and buffing aggro
int32 Mob::CheckHealAggroAmount(uint16 spellid, uint32 heal_possible) {
uint16 spell_id = spellid;
int32 AggroAmount = 0;
for (int o = 0; o < EFFECT_COUNT; o++) {
switch(spells[spell_id].effectid[o]) {
case SE_CurrentHP: {
AggroAmount += spells[spell_id].mana;
break;
}
case SE_Rune: {
AggroAmount += CalcSpellEffectValue_formula(spells[spell_id].formula[0], spells[spell_id].base[0], spells[spell_id].max[o], this->GetLevel(), spellid) * 2;
break;
}
case SE_HealOverTime:{
AggroAmount += CalcSpellEffectValue_formula(spells[spell_id].formula[o], spells[spell_id].base[o], spells[spell_id].max[o], this->GetLevel(), spell_id);
break;
}
default:{
break;
}
}
}
if (IsBardSong(spell_id))
AggroAmount = AggroAmount * RuleI(Aggro, SongAggroMod) / 100;
if (GetOwner() && IsPet())
AggroAmount = AggroAmount * RuleI(Aggro, PetSpellAggroMod) / 100;
if(AggroAmount > 0)
{
int HateMod = RuleI(Aggro, SpellAggroMod);
if(IsClient())
{
HateMod += CastToClient()->GetFocusEffect(focusSpellHateMod, spell_id);
}
//Live AA - Spell casting subtlety
HateMod += aabonuses.hatemod + spellbonuses.hatemod + itembonuses.hatemod;
AggroAmount = (AggroAmount * HateMod) / 100;
//made up number probably scales a bit differently on live but it seems like it will be close enough
//every time you cast on live you get a certain amount of "this is a spell" aggro
//confirmed by EQ devs to be 100 exactly at level 85. From their wording it doesn't seem like it's affected
//by hate modifiers either.
//AggroAmount += (slevel*slevel/72); // Moved Below
}
if(AggroAmount < 0)
return 0;
else
return AggroAmount;
}
示例8: RuleI
int32 Client::CalcHPRegenCap()
{
int cap = RuleI(Character, ItemHealthRegenCap);
if (GetLevel() > 60)
cap = std::max(cap, GetLevel() - 30); // if the rule is set greater than normal I guess
if (GetLevel() > 65)
cap += GetLevel() - 65;
cap += aabonuses.ItemHPRegenCap + spellbonuses.ItemHPRegenCap + itembonuses.ItemHPRegenCap;
return (cap * RuleI(Character, HPRegenMultiplier) / 100);
}
示例9: RuleI
int32 Client::CalcManaRegenCap()
{
int32 cap = RuleI(Character, ItemManaRegenCap) + aabonuses.ItemManaRegenCap;
switch(GetCasterClass())
{
case 'I':
case 'W':
break;
}
return (cap * RuleI(Character, ManaRegenMultiplier) / 100);
}
示例10: RuleI
void Mob::RemoveFromFeignMemory(Client* attacker) {
feign_memory_list.erase(attacker->CharacterID());
if(feign_memory_list.empty() && AI_feign_remember_timer != nullptr)
AI_feign_remember_timer->Disable();
if(feign_memory_list.empty())
{
minLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMin);
maxLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMax);
if(AI_feign_remember_timer != nullptr)
AI_feign_remember_timer->Disable();
}
}
示例11: while
void Mob::ClearFeignMemory() {
std::set<uint32>::iterator RememberedCharID = feign_memory_list.begin();
while (RememberedCharID != feign_memory_list.end())
{
Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID);
++RememberedCharID;
}
feign_memory_list.clear();
minLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMin);
maxLastFightingDelayMoving = RuleI(NPC, LastFightingDelayMovingMax);
if(AIfeignremember_timer != nullptr)
AIfeignremember_timer->Disable();
}
示例12: _log
bool ChatChannel::RemoveClient(Client *c) {
if(!c) return false;
_log(UCS__TRACE, "RemoveClient %s from channel %s", c->GetName().c_str(), GetName().c_str());
bool HideMe = c->GetHideMe();
int AccountStatus = c->GetAccountStatus();
int PlayersInChannel = 0;
LinkedListIterator<Client*> iterator(ClientsInChannel);
iterator.Reset();
while(iterator.MoreElements()) {
Client *CurrentClient = iterator.GetData();
if(CurrentClient == c) {
iterator.RemoveCurrent(false);
}
else if(CurrentClient) {
PlayersInChannel++;
if(CurrentClient->IsAnnounceOn())
if(!HideMe || (CurrentClient->GetAccountStatus() > AccountStatus))
CurrentClient->AnnounceLeave(this, c);
iterator.Advance();
}
}
if((PlayersInChannel == 0) && !Permanent) {
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
return false;
_log(UCS__TRACE, "Starting delete timer for empty password protected channel %s", Name.c_str());
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
}
return true;
}
示例13: LevelRegen
int32 Client::CalcHPRegen() {
int32 regen = LevelRegen() + itembonuses.HPRegen + spellbonuses.HPRegen;
regen += aabonuses.HPRegen + GroupLeadershipAAHealthRegeneration();
return (regen * RuleI(Character, HPRegenMultiplier) / 100);
}
示例14: GetLevel
int32 Client::CalcManaRegen()
{
uint8 clevel = GetLevel();
int32 regen = 0;
//this should be changed so we dont med while camping, etc...
if (IsSitting() || (GetHorseId() != 0))
{
BuffFadeBySitModifier();
if(HasSkill(SkillMeditate)) {
this->medding = true;
regen = (((GetSkill(SkillMeditate) / 10) + (clevel - (clevel / 4))) / 4) + 4;
regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
CheckIncreaseSkill(SkillMeditate, nullptr, -5);
}
else
regen = 2 + spellbonuses.ManaRegen + itembonuses.ManaRegen;
}
else {
this->medding = false;
regen = 2 + spellbonuses.ManaRegen + itembonuses.ManaRegen;
}
//AAs
regen += aabonuses.ManaRegen;
return (regen * RuleI(Character, ManaRegenMultiplier) / 100);
}
示例15: mysql_num_rows
void Client::TradeskillSearchResults(const char *query, unsigned long qlen,
unsigned long objtype, unsigned long someid) {
char errbuf[MYSQL_ERRMSG_SIZE];
MYSQL_RES *result;
MYSQL_ROW row;
if (!database.RunQuery(query, qlen, errbuf, &result)) {
LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': %s", query, errbuf);
return;
}
uint8 qcount = 0;
qcount = mysql_num_rows(result);
if(qcount < 1) {
//search gave no results... not an error
return;
}
if(mysql_num_fields(result) != 6) {
LogFile->write(EQEMuLog::Error, "Error in TradeskillSearchResults query '%s': Invalid column count in result", query);
return;
}
uint8 r;
for(r = 0; r < qcount; r++) {
row = mysql_fetch_row(result);
if(row == NULL || row[0] == NULL || row[1] == NULL || row[2] == NULL || row[3] == NULL || row[5] == NULL)
continue;
uint32 recipe = (uint32)atoi(row[0]);
const char *name = row[1];
uint32 trivial = (uint32) atoi(row[2]);
uint32 comp_count = (uint32) atoi(row[3]);
uint32 tradeskill = (uint16) atoi(row[5]);
// Skip the recipes that exceed the threshold in skill difference
// Recipes that have either been made before or were
// explicitly learned are excempt from that limit
if (RuleB(Skills, UseLimitTradeskillSearchSkillDiff)) {
if (((int32)trivial - (int32)GetSkill((SkillType)tradeskill)) > RuleI(Skills, MaxTradeskillSearchSkillDiff)
&& row[4] == NULL)
{
continue;
}
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_RecipeReply, sizeof(RecipeReply_Struct));
RecipeReply_Struct *reply = (RecipeReply_Struct *) outapp->pBuffer;
reply->object_type = objtype;
reply->some_id = someid;
reply->component_count = comp_count;
reply->recipe_id = recipe;
reply->trivial = trivial;
strn0cpy(reply->recipe_name, name, sizeof(reply->recipe_name));
FastQueuePacket(&outapp);
}
mysql_free_result(result);
}