void pawsActiveMagicWindow::HandleMessage(MsgEntry* me) { if(!configPopup) configPopup = (pawsConfigPopup*)PawsManager::GetSingleton().FindWidget("ConfigPopup"); psGUIActiveMagicMessage incoming(me); if( !incoming.valid ) return; // Use signed comparison to handle sequence number wrap around. if( (int)incoming.index - (int)lastIndex < 0 ) { return; } csList<csString> rowEntry; show = showWindow->GetState() ? false : true; if(!IsVisible() && psengine->loadstate == psEngine::LS_DONE && show) ShowBehind(); size_t numSpells=incoming.name.GetSize(); buffList->Clear(); for( size_t i=0; i<numSpells; i++ ) { pawsDnDButton* newButton = NULL; if(incoming.duration[i]==0 && showEffects==false) { //if showEffects is false, don't show anything with a constant effect. continue; } rowEntry.PushBack(incoming.name[i]); if( incoming.image[i] == "none" ) { //do not show any icon or text in activemagic window - this suppresses display of things like potions or etc. continue; } if(useImages) { csRef<iPawsImage> image; if(incoming.image[i].Length() >0) { image = PawsManager::GetSingleton().GetTextureManager()->GetPawsImage(incoming.image[i]); } if(image) { newButton = buffList->LoadSingle(incoming.name[i], incoming.image[i], incoming.name[i], csString(""), 0, this, false); } else { if( incoming.type[i]==BUFF ) { newButton = buffList->LoadSingle(incoming.name[i], csString("/planeshift/materials/crystal_ball_icon.dds"), incoming.name[i], csString(""), 0, this, false); } else { newButton = buffList->LoadSingle(incoming.name[i], csString("danger_01"), incoming.name[i], csString(""), -1, this, false); } } } else { newButton = buffList->LoadSingle(incoming.name[i], csString(""), incoming.name[i], csString(""), 0, this, false); } if( newButton && useTimers ) { //received 3 times from the server: // registeredTime = when the server thinks the spell was cast. // serverTime = when the server sent the active magic update // duration = how many ticks the spell will last. // //plus we get the current client time. if( warnMode==0 ) newButton->SetWarnLevel(warnLevel/100, warnLow ); else { float ratio = warnLevel*100; if( ratio > incoming.duration[i]) { ratio = 1.0; } else { ratio = 1-(ratio/(float)incoming.duration[i]); } newButton->SetWarnLevel( ratio, warnLow ); } if( dangerMode==0 ) newButton->SetDangerLevel(dangerLevel/100, dangerLow ); else { float ratio = dangerLevel*100; if( ratio > incoming.duration[i]) { ratio = 1.0; } else { ratio = 1-(ratio/(float)incoming.duration[i]); } newButton->SetDangerLevel( ratio, dangerLow ); } if( flashMode==0 ) newButton->SetFlashLevel(flashLevel/100, flashLow ); else { float ratio = flashLevel*100; if( ratio > incoming.duration[i]) { ratio = 1.0; } else { ratio = 1-(ratio/(float)incoming.duration[i]); } newButton->SetFlashLevel( ratio, flashLow ); } newButton->Start( incoming.registrationTime[i], incoming.serverTime, incoming.duration[i] ); } else { } } if(autoResize) { AutoResize(); } else { buffList->Resize(); } }
void pawsActiveMagicWindow::HandleMessage(MsgEntry* me) { if(!configPopup) configPopup = (pawsConfigPopup*)PawsManager::GetSingleton().FindWidget("ConfigPopup"); psGUIActiveMagicMessage incoming(me); if( !incoming.valid ) return; // Use signed comparison to handle sequence number wrap around. if( (int)incoming.index - (int)lastIndex < 0 ) { return; } csList<csString> rowEntry; show = showWindow->GetState() ? false : true; if(!IsVisible() && psengine->loadstate == psEngine::LS_DONE && show) ShowBehind(); size_t numSpells=incoming.name.GetSize(); buffList->Clear(); for( size_t i=0; i<numSpells; i++ ) { if(incoming.duration[i]==0 && showEffects==false) { continue; } rowEntry.PushBack(incoming.name[i]); if( incoming.image[i] == "none" ) { //do not show any icon or text in activemagic window - this suppresses display of things like potions or etc. continue; } if(useImages) { csRef<iPawsImage> image; if(incoming.image[i].Length() >0) { image = PawsManager::GetSingleton().GetTextureManager()->GetPawsImage(incoming.image[i]); } if(image) { buffList->LoadSingle(incoming.name[i], incoming.image[i], incoming.name[i], csString(""), 0, this, false); } else { if( incoming.type[i]==BUFF ) { buffList->LoadSingle(incoming.name[i], csString("/planeshift/materials/crystal_ball_icon.dds"), incoming.name[i], csString(""), 0, this, false); } else { buffList->LoadSingle(incoming.name[i], csString("danger_01"), incoming.name[i], csString(""), -1, this, false); } } } else { buffList->LoadSingle(incoming.name[i], csString(""), incoming.name[i], csString(""), 0, this, false); } } if(autoResize) { AutoResize(); } else { buffList->Resize(); } }