Facebook
From Perl Bee, 1 Month ago, written in C++.
This paste is a reply to Untitled from Botched Camel - view diff
Embed
Download Paste or View Raw
Hits: 28
  1. //arat;
  2.  
  3. inline int CParty::ComputePartyBonusDefenseGrade()
  4.  
  5. //fonksiyonun altına ekle;
  6.  
  7. #ifdef ENABLE_DICE_SYSTEM
  8. #include "item.h"
  9.  
  10. struct FPartyDropDiceRoll
  11. {
  12.     const LPITEM m_itemDrop;
  13.     LPCHARACTER m_itemOwner;
  14.     int m_lastNumber;
  15.  
  16.     FPartyDropDiceRoll(const LPITEM itemDrop, LPCHARACTER itemOwner) : m_itemDrop(itemDrop), m_itemOwner(itemOwner), m_lastNumber(0)
  17.     {
  18.     };
  19.  
  20.     void Process(const LPCHARACTER mobVictim)
  21.     {
  22.         if ((!mobVictim || (mobVictim->GetMobRank() >= MOB_RANK_BOSS && mobVictim->GetMobRank() <= MOB_RANK_KING)) && m_itemOwner->GetParty() && m_itemOwner->GetParty()->GetNearMemberCount() > 1)
  23.         {
  24.             LPPARTY pParty = m_itemOwner->GetParty();
  25.             pParty->ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, LC_TEXT("*** Rolling for the following item: %16s ***"), m_itemDrop->GetName());
  26.  
  27.             pParty->ForEachNearMember(*this);
  28.             if (m_itemOwner)
  29.             {
  30.                 m_itemDrop->SetOwnership(m_itemOwner);
  31.                 pParty->ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, LC_TEXT("*** Rolling of %s: %16s ***"), m_itemDrop->GetName(), m_itemOwner->GetName());
  32.             }
  33.         }
  34.         else
  35.             m_itemDrop->SetOwnership(m_itemOwner);
  36.     }
  37.     LPCHARACTER GetItemOwner()
  38.     {
  39.         return m_itemOwner;
  40.     }
  41.     const LPITEM GetItemDrop()
  42.     {
  43.         return m_itemDrop;
  44.     }
  45.     void operator () (LPCHARACTER ch)
  46.     {
  47.         if (!ch)
  48.             return;
  49.  
  50.         LPPARTY pParty = ch->GetParty();
  51.         if (!pParty)
  52.             return;
  53.  
  54.         while (true)
  55.         {
  56.             int pickedNumber = number(10000, 99999);
  57.             if (pickedNumber > m_lastNumber)
  58.             {
  59.                 m_lastNumber = pickedNumber;
  60.                 m_itemOwner = ch;
  61.             }
  62.             else if (pickedNumber == m_lastNumber)
  63.             {
  64.                 continue;
  65.             }
  66.             else // if (pickedNumber < m_lastNumber)
  67.             {
  68.             }
  69.             pParty->ChatPacketToAllMember(CHAT_TYPE_DICE_INFO, LC_TEXT("*** -> %16s - Dice score: %05d ***"), ch->GetName(), pickedNumber);
  70.             break;
  71.         }
  72.     }
  73. };
  74. #endif

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Colossal Capybara cpp 1 Month ago.