コード例 #1
0
ファイル: ThreatMap.cpp プロジェクト: dogg-jr/GR-Core
CreatureObject* ThreatMap::getHighestDamagePlayer() {
	Locker locker(&lockMutex);

	uint32 maxDamage = 0;
	VectorMap<uint64,uint32> damageMap;
	CreatureObject* player = NULL;

	for (int i = 0; i < size(); ++i) {
		ThreatMapEntry* entry = &elementAt(i).getValue();

		uint32 totalDamage = 0;

		for (int j = 0; j < entry->size(); ++j) {
			uint32 damage = entry->elementAt(j).getValue();

			totalDamage += damage;
		}

		CreatureObject* creature = elementAt(i).getKey();

		if (creature->isPlayerCreature()) {
			if(!damageMap.contains(creature->getObjectID())){
				damageMap.put(creature->getObjectID(),totalDamage);
			} else {
				damageMap.get(creature->getObjectID()) += totalDamage;
			}

			if (damageMap.get(creature->getObjectID()) > maxDamage) {
				maxDamage = damageMap.get(creature->getObjectID());
				player = cast<CreatureObject*>(creature);
			}
		} else if (creature->isPet()) {
			CreatureObject* owner = creature->getLinkedCreature().get();

			if (owner != NULL && owner->isPlayerCreature()) {
				if(!damageMap.contains(owner->getObjectID())){
					damageMap.put(owner->getObjectID(),totalDamage);
				} else {
					damageMap.get(owner->getObjectID()) += totalDamage;
				}

				if (damageMap.get(owner->getObjectID()) > maxDamage) {
					maxDamage = damageMap.get(owner->getObjectID());
					player = cast<CreatureObject*>(owner);
				}
			}
		}
	}

	return player;
}
コード例 #2
0
void SVDependTable::createHideEdit()
{
    int nRow = numRows();
    m_pHideEdit = new WLineEdit("", elementAt(nRow, 0));
    if(m_pHideEdit)
        m_pHideEdit->hide();

    m_pHideButton = new WPushButton("hide button", elementAt(nRow, 0));
    if(m_pHideButton)
    {
        m_pHideButton->hide();
        WObject::connect(m_pHideButton, SIGNAL(clicked()), this, SLOT(changePath()));
    }
}
コード例 #3
0
ファイル: StringVector.cpp プロジェクト: partouf/Crosscables
Groundfloor::StringVectorRange *Groundfloor::StringVector::translatePosToChunkedIndex( unsigned long iPos ) {
   Groundfloor::StringVectorRange *range = new Groundfloor::StringVectorRange();

   unsigned int cChunkLen = 0;
   unsigned int iCurChunk = 0;
   unsigned long iLenTodo = iPos;

   while ( iLenTodo != 0 ) {
      Groundfloor::String *sChunk = static_cast<Groundfloor::String *>( elementAt(iCurChunk) );
      if ( sChunk != NULL ) {
         cChunkLen = sChunk->getLength();

         if ( cChunkLen > iLenTodo ) {
            range->start_ind = iCurChunk;
            range->start_pos = iLenTodo;

            break;
         }

         iLenTodo -= cChunkLen;
         iCurChunk++;
      } else {
         break;
      }
   }

   return range;
}
コード例 #4
0
CSVWholeview::CSVWholeview(WContainerWidget *parent, string szIDCUser, string szIDCPwd):
WTable(parent)
{
    m_szIDCUser = szIDCUser;
    m_szIDCPwd  = szIDCPwd;

    m_szUserID  = "";
    m_bFirstLoad   = true;

    m_pTime     = NULL;
    m_pContent  = NULL;
    m_pSVUser   = NULL;


	//new WText("<div id='view_panel' class='panel_view'>",elementAt(0, 0));

    new WText("\n<SCRIPT language='JavaScript' src='/basic.js'></SCRIPT>", elementAt(0, 0));


    loadStrings();
    //initForm();
	NewInitForm();


	//new WText("</div>", elementAt(0, 0));

	//AddJsParam("uistyle", "viewpan");
	//AddJsParam("fullstyle", "true");
	//AddJsParam("bGeneral", "false");
	//new WText("<SCRIPT language='JavaScript' src='/Script.js'></SCRIPT>", elementAt(0, 0));

}
コード例 #5
0
 virtual int getIndex(const XMLCh* const qName ) const
 {
     for(XMLSize_t i=0;i<size();i++)
         if(XMLString::equals(elementAt(i)->qName,qName))
             return (int)i;
     return -1;
 }
コード例 #6
0
void SVSEView::createSEList()
{
    int nRow  = numRows();
    SVShowTable * pTable = new SVShowTable((WContainerWidget*)elementAt(nRow, 0));
    if(pTable)
    {
        pTable->setTitle(SVResString::getResString("IDS_SE_List_Title").c_str());
        WTable * pSub = pTable->createSubTable();
        if(pSub)
        {
            int nRow = pSub->numRows();
            m_pSEList = new WTable((WContainerWidget*)pSub->elementAt(nRow, 0));
            if(m_pSEList)
            {
                m_pSEList->setStyleClass("t3");
                //new WText("", (WContainerWidget *)m_pSEList->elementAt(0, 0));
                new WText(SVResString::getResString("IDS_State_Description"), (WContainerWidget *)m_pSEList->elementAt(0, 0));
                new WText(SVResString::getResString("IDS_Name"), (WContainerWidget *)m_pSEList->elementAt(0, 1));
                new WText(SVResString::getResString("IDS_Edit"), (WContainerWidget *)m_pSEList->elementAt(0, 2));
                m_pSEList->setCellPadding(0);
                m_pSEList->setCellSpaceing(0);
                m_pSEList->GetRow(0)->setStyleClass("t3title");

                connect(&m_wNameMapper, SIGNAL(mapped(const std::string)), this, SLOT(enterSVSE(const std::string)));
                connect(&m_wEditMapper, SIGNAL(mapped(const std::string)), this, SLOT(EditSE(const std::string)));
            }
            //createOperate(pSub);
        }
    }
}
コード例 #7
0
ファイル: ThreatMap.cpp プロジェクト: JigglyPoofSWG/BSS
void ThreatMap::addDamage(CreatureObject* target, uint32 damage, String xp) {
	Locker locker(&lockMutex);

	ManagedReference<TangibleObject*> strongSelf = self.get();
	if (strongSelf == NULL || strongSelf.get() == target)
		return;

	int idx = find(target);
	String xpToAward = "";

	if (xp == "") {
		WeaponObject* weapon = target->getWeapon();
		xpToAward = weapon->getXpType();
	} else
		xpToAward = xp;

	if (idx == -1) {
		ThreatMapEntry entry;
		entry.addDamage(xpToAward, damage);
		entry.addAggro(1);

		put(target, entry);
		registerObserver(target);

	} else {
		ThreatMapEntry* entry = &elementAt(idx).getValue();
		entry->addDamage(xpToAward, damage);
		entry->addAggro(1);
	}
}
コード例 #8
0
ファイル: ThreatMap.cpp プロジェクト: dogg-jr/GR-Core
void ThreatMap::addDamage(CreatureObject* target, uint32 damage, String xp) {
	Locker locker(&lockMutex);

	int idx = find(target);
	String xpToAward = "";

	if (xp == "") {
		WeaponObject* weapon = target->getWeapon();
		xpToAward = weapon->getXpType();
	} else
		xpToAward = xp;

	if (idx == -1) {
		ThreatMapEntry entry;
		entry.addDamage(xpToAward, damage);
		entry.addAggro(1);

		put(target, entry);
		registerObserver(target);

	} else {
		ThreatMapEntry* entry = &elementAt(idx).getValue();
		entry->addDamage(xpToAward, damage);
		entry->addAggro(1);
	}

	// randomly change target everytime threatmap is added to, TODO: keep this in mind and perhaps make it slightly more complicated
	if (System::random(5) == 0)
		currentThreat = target;
}
コード例 #9
0
ファイル: ThreatMap.cpp プロジェクト: JigglyPoofSWG/BSS
void ThreatMap::removeAll(bool forceRemoveAll) {
	Locker locker(&lockMutex);

	removeObservers();

	for (int i = size() - 1; i >= 0; i--) {
		VectorMapEntry<ManagedReference<CreatureObject*> , ThreatMapEntry> *entry = &elementAt(i);

		ManagedReference<CreatureObject*> key = entry->getKey();
		ThreatMapEntry *value = &entry->getValue();

		ManagedReference<TangibleObject*> selfStrong = self.get();

		// these checks will determine if we should store the damage from the dropped aggressor
		Zone* keyZone = (key != NULL ? key->getZone() : NULL);
		Zone* selfZone = (selfStrong != NULL ? selfStrong->getZone() : NULL);

		uint32 keyPlanetCRC = (keyZone != NULL ? keyZone->getPlanetCRC() : 0);
		uint32 selfPlanetCRC = (selfZone != NULL ? selfZone->getPlanetCRC() : 0);

		if (key == NULL || selfStrong == NULL || key->isDead() || !key->isOnline() || keyPlanetCRC != selfPlanetCRC || forceRemoveAll) {
			remove(i);

			if (threatMapObserver != NULL)
				key->dropObserver(ObserverEventType::HEALINGPERFORMED, threatMapObserver);
		} else {
			value->setNonAggroDamage(value->getTotalDamage());
			value->addHeal(-value->getHeal()); // don't need to store healing
			value->clearAggro();
		}
	}

	currentThreat = NULL;
	threatMatrix.clear();
}
コード例 #10
0
ファイル: ThreatMap.cpp プロジェクト: JigglyPoofSWG/BSS
void ThreatMap::addAggro(CreatureObject* target, int value, uint64 duration) {
	Locker locker(&lockMutex);

	ManagedReference<TangibleObject*> strongSelf = self.get();
	if (strongSelf == NULL || strongSelf.get() == target)
		return;

	int idx = find(target);

	if (idx == -1) {
		ThreatMapEntry entry;
		entry.addAggro(value);
		put(target, entry);
		registerObserver(target);

	} else {
		ThreatMapEntry* entry = &elementAt(idx).getValue();
		entry->addAggro(value);
	}

	if(duration > 0) {
		Reference<RemoveAggroTask*> removeAggroTask = new RemoveAggroTask(self.get(), target, value);
		removeAggroTask->schedule(duration);
	}
}
コード例 #11
0
 virtual bool getIndex(const XMLCh* const qName, XMLSize_t& i) const
 {
     for(i=0;i<size();i++)
         if(XMLString::equals(elementAt(i)->qName,qName))
             return true;
     return false;
 }
コード例 #12
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 初始化
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEccGenTitle::initForm()
{
    m_pTitle = new WTable(elementAt(0, 0));
    if(m_pTitle)
    {
        m_pTitle->setStyleClass("padding_2");
        m_pTime = new WText("refresh time", m_pTitle->elementAt(0, 1));
        if(m_pTime)
        {
             TTime ttime =  TTime::GetCurrentTimeEx();
            m_pTime->setText(SVResString::getResString("IDS_Refresh_Time") + ttime.Format());
        }
        m_pTitle->elementAt(0, 1)->setStyleClass("width40p");
        m_pTitle->elementAt(0, 1)->setContentAlignment(AlignRight | AlignTop);
    }

    elementAt(0, 0)->setStyleClass("padding_top");
}
コード例 #13
0
void SVConditionParam::createShowButton(int nRow)
{
    WImage * pSet = new WImage("../icons/set.gif", (WContainerWidget*)elementAt(nRow,1));
    if(pSet)
    {
        pSet->setStyleClass("imgbutton");
        WObject::connect(pSet, SIGNAL(clicked()), this, SLOT(showAddCondition()));
    }
}
コード例 #14
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建帮助
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SVConditionParam::createHelp(int nRow)
{
    if(!m_pHelpText)
        m_pHelpText = new WText(m_szHelp, elementAt(nRow + 1, 1));
    if(m_pHelpText)
    {
        elementAt(nRow  + 1, 1)->setStyleClass("table_data_input_des");
        m_pHelpText->hide();
    }

    if(!m_pErrText)
        m_pErrText = new WText(m_szTip, elementAt(nRow + 2, 1));
    if(m_pErrText)
    {
        elementAt(nRow + 2, 1)->setStyleClass("table_data_input_error");
        m_pErrText->hide();
    }
}
コード例 #15
0
ファイル: ustack.cpp プロジェクト: 00zhengfu00/third_party
void* UStack::pop(void) {
    int32_t n = size() - 1;
    void* result = 0;
    if (n >= 0) {
        result = elementAt(n);
        removeElementAt(n);
    }
    return result;
}
コード例 #16
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建显示追加条件
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SVConditionParam::createShowButton(int nRow)
{
    WImage * pSet = new WImage("../Images/more.gif", elementAt(nRow,1));
    if(pSet)
    {
        pSet->setStyleClass("hand");
        WObject::connect(pSet, SIGNAL(clicked()), this, SLOT(showAddCondition()));
    }
}
コード例 #17
0
//添加客户端脚本变量
void CSVWholeview::AddJsParam(const std::string name, const std::string value)
{  
	std::string strTmp("");
	strTmp += "<SCRIPT language='JavaScript' > var ";
	strTmp += name;
	strTmp += "='";
	strTmp += value;
	strTmp += "';</SCRIPT>";
	new WText(strTmp, elementAt(0, 0));
}
コード例 #18
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建内容表
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEccBaseTable::createContent()
{
    m_nContentRow = numRows();
    WTable *pSub = new WTable(elementAt(m_nContentRow, 0));

    if(pSub)
    {
        pSub->setStyleClass("panel");
        WScrollArea *pScroll = new WScrollArea(elementAt(m_nContentRow, 0));
        if(pScroll)
        {
            pScroll->setWidget(pSub);
            pScroll->setStyleClass("panel");
        }

        m_pContent = new WTable(pSub->elementAt(0, 0));
        pSub->elementAt(0, 0)->setContentAlignment(AlignTop);
    }
}
コード例 #19
0
ファイル: ThreatMap.cpp プロジェクト: JigglyPoofSWG/BSS
void ThreatMap::removeAggro(CreatureObject* target, int value) {
	Locker locker(&lockMutex);

	int idx = find(target);

	if (idx != -1) {
		ThreatMapEntry* entry = &elementAt(idx).getValue();
		entry->removeAggro(value);
	}
}
コード例 #20
0
void DamageOverTimeList::clear(CreatureObject* creature) {
	Locker locker(&guard);

	dot = false;

	for (int i = 0; i < size(); ++i) {
		uint64 type = elementAt(i).getKey();

		Vector<DamageOverTime>* vector = &elementAt(i).getValue();

		for (int j = 0; j < vector->size(); ++j) {
			DamageOverTime* dot = &vector->elementAt(j);

			creature->clearState(dot->getType());
		}
	}

	removeAll();
}
コード例 #21
0
ファイル: StringVector.cpp プロジェクト: partouf/Crosscables
void Groundfloor::StringVector::endMinusOne( Groundfloor::StringVectorRange *range ) {
   if ( range->end_pos == 0 ) {
      range->end_ind--;

      Groundfloor::String *sChunk = static_cast<Groundfloor::String *>( elementAt(range->end_ind) );
      range->end_pos = sChunk->getLength() - 1;
   } else {
      range->end_pos--;
   }
}
コード例 #22
0
ファイル: StringVector.cpp プロジェクト: partouf/Crosscables
Groundfloor::String *Groundfloor::StringVector::copy( Groundfloor::StringVectorRange *aRange ) {
   Groundfloor::String *sCopy = new Groundfloor::String();

   unsigned int iCurChunk  = aRange->start_ind;
   unsigned long iCurPos   = aRange->start_pos;
   unsigned int cChunkLen  = 0;

   unsigned int iMaxEndChunk = aRange->end_ind;
   unsigned long iMaxEndPos  = aRange->end_pos;
   unsigned int c = this->size();

   while ( iCurChunk < c ) {
      Groundfloor::String *sChunk = static_cast<Groundfloor::String *>( elementAt(iCurChunk) );
      if ( sChunk != NULL ) {
         cChunkLen = sChunk->getLength();

         if ( iCurPos >= cChunkLen ) {
            iCurPos -= cChunkLen;

            if ( iCurChunk == iMaxEndChunk ) {
               iMaxEndChunk++;

               if ( iMaxEndPos >= cChunkLen ) {
                  iMaxEndPos -= cChunkLen;
               }
            }

            iCurChunk++;
         } else {
            if ( iCurChunk == iMaxEndChunk ) {
               if ( iMaxEndPos >= cChunkLen ) {
                  sCopy->append( sChunk->getPointer(iCurPos), cChunkLen - iCurPos );

                  iMaxEndPos -= cChunkLen;
                  iCurChunk++;
                  iMaxEndChunk++;
               } else {
                  sCopy->append( sChunk->getPointer(iCurPos), iMaxEndPos - iCurPos + 1 );
                  break;
               }
            } else {
               sCopy->append( sChunk->getPointer(iCurPos), cChunkLen - iCurPos );

               iCurChunk++;
            }

            iCurPos = 0;
         }
      } else {
         break;
      }
   }

   return sCopy;
}
コード例 #23
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 初始化
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEccAddMonitor1st::initForm(bool bHasHelp)
{
    // 创建标题
    CEccBaseTable::createTitle(bHasHelp);

    // 设置标题文本
    if(m_pTitle)
        m_pTitle->setText(SVResString::getResString("IDS_Add_Monitor"));

    // 得当当前行数
    int nRow = numRows();
    
    // 创建子组并设置TD的样式表
    WTable *pSub = new WTable(elementAt(nRow, 0));
    elementAt(nRow, 0)->setStyleClass("height95p");
    if(pSub)
    {
        //设置样式表
        pSub->setStyleClass("panel");
        // 创建新的滚动区
        WScrollArea *pScroll = new WScrollArea(elementAt(nRow, 0));
        if(pScroll)
        {
            pScroll->setWidget(pSub);
            pScroll->setStyleClass("panel");
        }

        // 创建 表
        CEccListTable *pSubList = new CEccListTable(pSub->elementAt(0, 0), false, false, false, false);
        if(pSubList)
        {
            // 设置标题
            pSubList->setTitle(SVResString::getResString("IDS_Add_Monitor_Title"));
            // 得到内容表
            m_pContent = pSubList->getListTable();
        }

        pSub->elementAt(0, 0)->setContentAlignment(AlignTop);
    }
    
    createOperate();
}
コード例 #24
0
bool DamageOverTimeList::hasDot(uint64 dotType) {
	Locker locker(&guard);

	bool hasDot = false;

	for (int i = 0; i < size(); ++i) {
		uint64 type = elementAt(i).getKey();

		Vector<DamageOverTime>* vector = &elementAt(i).getValue();

		for (int j = 0; j < vector->size(); ++j) {
			DamageOverTime* dot = &vector->elementAt(j);

			if (dot->getType() == dotType)
				hasDot = true;
		}
	}

	return hasDot;
}
コード例 #25
0
ファイル: ThreatMap.cpp プロジェクト: JigglyPoofSWG/BSS
bool ThreatMap::hasState(uint64 state) {
	Locker locker(&lockMutex);

	for (int i = 0; i < size(); ++i) {
		ThreatMapEntry* entry = &elementAt(i).getValue();
		if(entry->hasState(state))
			return true;
	}

	return false;
}
コード例 #26
0
void CSVSortList::createOperate()
{
    int nRow = numRows();
    WPushButton *pSave = new WPushButton(SVResString::getResString("IDS_OK"), elementAt(nRow, 0));
    if(pSave)
    {
        WObject::connect(pSave, SIGNAL(clicked()) , "showbar();", this, SLOT(saveList()), WObject::ConnectionType::JAVASCRIPTDYNAMIC);
        pSave->setToolTip(SVResString::getResString("IDS_Save_Sort_Tip"));
    }

    new WText("&nbsp;", elementAt(nRow, 0));

    WPushButton *pCancel = new WPushButton(SVResString::getResString("IDS_Cancel"), elementAt(nRow,0));
    if(pCancel)
    {
        pCancel->setToolTip(SVResString::getResString("IDS_Cancel_Sort_Tip"));
        WObject::connect(pCancel, SIGNAL(clicked()), "showbar();", this, SLOT(cancelEdit()), WObject::ConnectionType::JAVASCRIPTDYNAMIC);
    }

    elementAt(nRow, 0)->setContentAlignment(AlignCenter);
}
コード例 #27
0
ファイル: xml.cpp プロジェクト: falbrechtskirchinger/yadu
bool Xml::valueAt(QDomElement parent, QString path, QString &value) {
    value.clear();

    QDomElement element;

    if(elementAt(parent, path, element)) {
        value = element.text().trimmed();
        return true;
    }

    return false;
}
コード例 #28
0
void SVDependTable::createTitle()
{
    int nRow = numRows();
    m_pHide = new WImage("../icons/open.gif", (WContainerWidget *)elementAt( nRow, 0));
    if ( m_pHide )
    {
        m_pHide->decorationStyle().setCursor(WCssDecorationStyle::Pointer);
        WObject::connect(m_pHide, SIGNAL(clicked()), this, SLOT(showSubTable()));
        m_pHide->hide();
    }

    m_pShow = new WImage("../icons/close.gif", (WContainerWidget *)elementAt(nRow, 0));
    if ( m_pShow )
    {
        m_pShow->decorationStyle().setCursor(WCssDecorationStyle::Pointer);
        WObject::connect(m_pShow, SIGNAL(clicked()), this, SLOT(hideSubTable()));
    }

    new WText(SVResString::getResString("IDS_Advance_Option"), (WContainerWidget *)elementAt(nRow, 0));
    elementAt(0,0)->setStyleClass("t2title");
}
コード例 #29
0
ファイル: ThreatMap.cpp プロジェクト: JigglyPoofSWG/BSS
void ThreatMapEntry::addDamage(String xp, uint32 damage) {
	int idx = find(xp);

	if (idx == -1) {
		put(xp, damage);

	} else {
		uint32* dmg = &elementAt(idx).getValue();

		*dmg = *dmg + damage;
	}
}
コード例 #30
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 创建条件
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SVConditionParam::createCondition()
{
    int nRow = numRows();
    m_pLabel = new WText(m_szLabel, elementAt(nRow, 0));

    elementAt(nRow, 0)->setContentAlignment(AlignTop | AlignLeft);
    elementAt(nRow, 0)->setStyleClass("table_list_data_input_text");
    GetRow(nRow)->setStyleClass("padding_top");

    string szValue ("");
    if(!m_szDefaultValue.empty())
        szValue = chLeftBracket + m_szDefaultValue + chRightBracket;

    m_pConditionArea = new WTextArea(szValue, elementAt(nRow, 1));

    if(m_pConditionArea)
        m_pConditionArea->setStyleClass(m_szStyle);

    elementAt(nRow, 1)->setStyleClass("table_data_text");

    createShowButton(nRow);
    createHelp(nRow);
    m_pOperate = new WTable(elementAt(nRow,1));
    if(m_pOperate)
    {
        m_pOperate->setStyleClass("conditionset");
        createHideButton();
        createAddConidtion();
        createButtonGroup();
        m_pOperate->hide();
    }
}