コード例 #1
0
EQStatList::EQStatList(EQPlayer* player,
                       QWidget* parent, 
                       const char* name)
  : SEQListView("StatList", parent, name),
    m_pPlayer(player)
{
   int i;

   m_guessMaxMana = 0;

   for (i = 0; i < LIST_MAXLIST; i++)
     m_statList[i] = NULL;

   // add columns
   addColumn("Stat");
   addColumn("Val", "Value");
   addColumn("Max");
   addColumn("%", "Percent");

   restoreColumns();

   QString statPrefName;
   for (int nloop = 0; nloop < LIST_MAXLIST; nloop++)
   {
     statPrefName.sprintf("show%s", statNames[nloop]);
     m_showStat[nloop] = pSEQPrefs->getPrefBool(statPrefName, 
						preferenceName(), false);
     updateStat(nloop);
   }

   connect (m_pPlayer, SIGNAL(statChanged(int,int,int)), 
	    this, SLOT(statChanged (int,int,int)));
   connect (m_pPlayer, SIGNAL(expChangedInt(int,int,int)),
	    this, SLOT(expChanged(int,int,int)));
   connect (m_pPlayer, SIGNAL(expAltChangedInt(int,int,int)),
	    this, SLOT(expAltChanged(int,int,int)));
   connect (m_pPlayer, SIGNAL(stamChanged(int,int,int,int,int,int)),
	    this, SLOT(stamChanged(int,int,int,int,int,int)));
   connect (m_pPlayer, SIGNAL(manaChanged(uint32_t,uint32_t)),
	    this, SLOT(manaChanged(uint32_t,uint32_t)));
   connect (m_pPlayer, SIGNAL(hpChanged(uint16_t, uint16_t)), 
	    this, SLOT(hpChanged(uint16_t, uint16_t)));

   // restore the columns
   restoreColumns();
}
コード例 #2
0
ファイル: Player.cpp プロジェクト: io-2016/SimpleMOBA
void PlayerObject::setMana(uint m) {
  if (m < 0) {
    m_mana = 0;
  } else if (m > maxMana()) {
    m_mana = maxMana();
  } else {
    m_mana = m;
  }
  emit manaChanged();
}
コード例 #3
0
ファイル: player.cpp プロジェクト: xbackupx/showeqx
void EQPlayer::manaChange(const manaDecrementStruct *mana)
{
  // update the players mana
  m_thePlayer.MANA = mana->newMana;

  m_validMana = true;

  // notify others of this change
  emit manaChanged(m_thePlayer.MANA, m_maxMana);  // Needs max mana
}
コード例 #4
0
ファイル: player.cpp プロジェクト: xbackupx/showeqx
void EQPlayer::backfill(const playerProfileStruct* player)
{
  QString messag;
  
  printf("EQPlayer::backfill():\n");
  
  messag.sprintf("Zone: Name='%s' Last='%s'\n", 
		 player->name, player->lastName);
  emit msgReceived(messag);
  
  messag.sprintf("Zone: Level: %d\n", player->level);
  emit msgReceived(messag);
  
  messag.sprintf("Zone: PlayerMoney: P=%d G=%d S=%d C=%d\n",
		 player->platinum, player->gold, 
		 player->silver, player->copper);
  emit msgReceived(messag);
  
  messag.sprintf("Zone: BankMoney: P=%d G=%d S=%d C=%d\n",
		 player->platinumBank, player->goldBank, 
		 player->silverBank, player->copperBank);
  emit msgReceived(messag);
  
  memcpy(&m_thePlayer, player, sizeof(playerProfileStruct));
  
  m_playerLevel = player->level;
  m_playerRace = player->race;
  m_playerClass = player->class_;
  
  setUseDefaults(false);
  setPlayerName(player->name);
  setPlayerLastName(player->lastName);
  setPlayerLevel(player->level);
  setPlayerRace(player->race);
  setPlayerClass(player->class_);
  
  messag = "Exp: " + Commanate(player->exp);
  
  // Due to the delayed decode, we must reset
  // maxplayer on zone and accumulate all totals.
  m_maxSTR += player->STR;
  m_maxSTA += player->STA;
  m_maxCHA += player->CHA;
  m_maxDEX += player->DEX;
  m_maxINT += player->INT;
  m_maxAGI += player->AGI;
  m_maxWIS += player->WIS;
  
  emit statChanged (LIST_STR, m_maxSTR, m_maxSTR);
  emit statChanged (LIST_STA, m_maxSTA, m_maxSTA);
  emit statChanged (LIST_CHA, m_maxCHA, m_maxCHA);
  emit statChanged (LIST_DEX, m_maxDEX, m_maxDEX);
  emit statChanged (LIST_INT, m_maxINT, m_maxINT);
  emit statChanged (LIST_AGI, m_maxAGI, m_maxAGI);
  emit statChanged (LIST_WIS, m_maxWIS, m_maxWIS);
  
  m_maxMana = calcMaxMana( m_maxINT,
			   m_maxWIS,
			   m_playerClass,
			   m_playerLevel
			   ) + m_plusMana;
  
  emit manaChanged(m_thePlayer.MANA, m_maxMana);  // need max mana

  uint32_t playerExp = player->exp;

  if (playerExp > m_currentExp)
    m_currentExp = playerExp;
  else
    playerExp = m_currentExp;
  
  m_maxExp = calc_exp(m_playerLevel,m_playerRace,m_playerClass);

  emit expChangedStr (messag);
  emit expChangedInt ( playerExp,
                       calc_exp(m_playerLevel-1, m_playerRace, m_playerClass),
                       calc_exp(m_playerLevel,   m_playerRace, m_playerClass)
		       );
  
  // Merge in our new skills...
  for (int a = 0; a < MAX_KNOWN_SKILLS; a++)
  {
    if ((m_playerSkills[a] == 255) || // not valid
	(player->skills[a] > m_playerSkills[a])) // or a higher value
      m_playerSkills[a] = player->skills[a];

    emit addSkill (a, m_playerSkills[a]);
  }

  // Merge in our new languages...
  for (int a = 0; a < MAX_KNOWN_LANGS; a++)
  {
    if ((m_playerLanguages[a] == 255) ||
	(player->languages[a] > m_playerLanguages[a]))
      m_playerLanguages[a] = player->languages[a];
    
    emit addLanguage (a, m_playerLanguages[a]);
  }

  m_validAttributes = true;
  m_validMana = true;
  m_validExp = true;

  // update the con table
  fillConTable();
}
コード例 #5
0
ファイル: player.cpp プロジェクト: xbackupx/showeqx
void EQPlayer::removeItem(const itemStruct* item)
{
  if ((item->equipSlot < 22) && !isItemBook(*item))
  {
    bool manaAdjust = false;

    if (item->common.STR != 0)
    {
      m_maxSTR -= item->common.STR;
      emit statChanged (LIST_STR, m_maxSTR, m_maxSTR);
    }
    
    if (item->common.STA != 0)
    {
      m_maxSTA -= item->common.STA;
      emit statChanged (LIST_STA, m_maxSTA, m_maxSTA);
    }

    if (item->common.CHA != 0)
    {
      m_maxCHA -= item->common.CHA;
      emit statChanged (LIST_CHA, m_maxCHA, m_maxCHA);
    }

    if (item->common.DEX != 0)
    {
      m_maxDEX -= item->common.DEX;
      emit statChanged (LIST_DEX, m_maxDEX, m_maxDEX);
    }

    if (item->common.INT != 0)
    {
      m_maxINT -= item->common.INT;
      emit statChanged (LIST_INT, m_maxINT, m_maxINT);
      manaAdjust = true;
    }

    if (item->common.AGI != 0)
    {
      m_maxAGI -= item->common.AGI;
      emit statChanged (LIST_AGI, m_maxAGI, m_maxAGI);
    }

    if (item->common.WIS != 0)
    {
      m_maxWIS -= item->common.WIS;
      emit statChanged (LIST_WIS, m_maxWIS, m_maxWIS);
      manaAdjust = true;
    }

    m_plusHP -= item->common.HP;

    if (item->common.MANA != 0)
    {
      m_plusMana -= item->common.MANA;
      manaAdjust = true;
    }

    if (manaAdjust)
    {
      m_maxMana = calcMaxMana( m_maxINT,
			     m_maxWIS,
			     getPlayerClass(),
			     getPlayerLevel()
			     )  +  m_plusMana;
    
      emit manaChanged(m_thePlayer.MANA, m_maxMana);  /* Needs max mana */

      m_validMana = true;
    }
  }
}