EPawnActionAbortState::Type UPawnAction::Abort(EAIForceParam::Type ShouldForce) { // if already aborting, and this request is not Forced, just skip it if (AbortState != EPawnActionAbortState::NotBeingAborted && ShouldForce != EAIForceParam::Force) { if (AbortState == EPawnActionAbortState::NeverStarted) { UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Discarding Abort request since the action has never been started yet"), *GetName()); } else { UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> Discarding Abort request due to action being already in abort state"), *GetName()); } return AbortState; } const bool bForce = ShouldForce == EAIForceParam::Force; EPawnActionAbortState::Type Result = EPawnActionAbortState::NotBeingAborted; EPawnActionAbortState::Type ChildResult = EPawnActionAbortState::AbortDone; if (ChildAction != NULL) { ChildResult = ChildAction->Abort(ShouldForce); if (ChildResult == EPawnActionAbortState::NotBeingAborted) { UE_VLOG(GetPawn(), LogPawnAction, Error, TEXT("%s> ChildAction %s failed to carry out proper abortion! Things might get ugly..") , *GetName(), *ChildAction->GetName()); // fake proper result and hope for the best! ChildResult = EPawnActionAbortState::AbortDone; } } if (bForce) { Result = PerformAbort(ShouldForce); if (Result != EPawnActionAbortState::AbortDone) { UE_VLOG(GetPawn(), LogPawnAction, Error, TEXT("%s> failed to force-abort! Things might get ugly..") , *GetName()); // fake proper result and hope for the best! Result = EPawnActionAbortState::AbortDone; } } else { switch (ChildResult) { case EPawnActionAbortState::MarkPendingAbort: // this means child is awaiting its abort, so should parent case EPawnActionAbortState::LatentAbortInProgress: // this means child is performing time-consuming abort. Parent should wait Result = EPawnActionAbortState::MarkPendingAbort; break; case EPawnActionAbortState::AbortDone: Result = IsPaused() ? EPawnActionAbortState::MarkPendingAbort : PerformAbort(ShouldForce); break; default: UE_VLOG(GetPawn(), LogPawnAction, Error, TEXT("%s> Unhandled Abort State!") , *GetName()); Result = EPawnActionAbortState::AbortDone; break; } } SetAbortState(Result); return Result; }
int32 Client::CalcBaseMana() { int WisInt = 0; int MindLesserFactor, MindFactor; int32 max_m = 0; int wisint_mana = 0; int base_mana = 0; int ConvertedWisInt = 0; switch(GetCasterClass()) { case 'I': WisInt = GetINT(); if (GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if (WisInt > 100) { ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100); if (WisInt > 201) { ConvertedWisInt -= ((WisInt - 201) * 5 / 4); } } else { ConvertedWisInt = WisInt; } if (GetLevel() < 41) { wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000); base_mana = (GetLevel() * 15); } else if (GetLevel() < 81) { wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100)); base_mana = (600 + ((GetLevel() - 40) * 30)); } else { wisint_mana = (9 * ConvertedWisInt); base_mana = (1800 + ((GetLevel() - 80) * 18)); } max_m = base_mana + wisint_mana + (GetHeroicINT() * 10); } else { if((( WisInt - 199 ) / 2) > 0) MindLesserFactor = ( WisInt - 199 ) / 2; else MindLesserFactor = 0; MindFactor = WisInt - MindLesserFactor; if(WisInt > 100) max_m = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40); else max_m = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100); } break; case 'W': WisInt = GetWIS(); if (GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) { if (WisInt > 100) { ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100); if (WisInt > 201) { ConvertedWisInt -= ((WisInt - 201) * 5 / 4); } } else { ConvertedWisInt = WisInt; } if (GetLevel() < 41) { wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000); base_mana = (GetLevel() * 15); } else if (GetLevel() < 81) { wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100)); base_mana = (600 + ((GetLevel() - 40) * 30)); } else { wisint_mana = (9 * ConvertedWisInt); base_mana = (1800 + ((GetLevel() - 80) * 18)); } max_m = base_mana + wisint_mana + (GetHeroicWIS() * 10); } else { if((( WisInt - 199 ) / 2) > 0) MindLesserFactor = ( WisInt - 199 ) / 2; else MindLesserFactor = 0; MindFactor = WisInt - MindLesserFactor; if(WisInt > 100) max_m = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40); else max_m = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100); } break; case 'N': { max_m = 0; break; } default: { LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_m = 0; break; } } #if EQDEBUG >= 11 LogFile->write(EQEMuLog::Debug, "Client::CalcBaseMana() called for %s - returning %d", GetName(), max_m); #endif return max_m; }
wxObject *wxChoicebookXmlHandler::DoCreateResource() { if (m_class == wxT("choicebookpage")) { wxXmlNode *n = GetParamNode(wxT("object")); if ( !n ) n = GetParamNode(wxT("object_ref")); if (n) { bool old_ins = m_isInside; m_isInside = false; wxObject *item = CreateResFromNode(n, m_choicebook, NULL); m_isInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); if (wnd) { m_choicebook->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected"))); if ( HasParam(wxT("bitmap")) ) { wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER); wxImageList *imgList = m_choicebook->GetImageList(); if ( imgList == NULL ) { imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() ); m_choicebook->AssignImageList( imgList ); } int imgIndex = imgList->Add(bmp); m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, imgIndex ); } else if ( HasParam(wxT("image")) ) { if ( m_choicebook->GetImageList() ) { m_choicebook->SetPageImage(m_choicebook->GetPageCount()-1, GetLong(wxT("image")) ); } else // image without image list? { ReportError(n, "image can only be used in conjunction " "with imagelist"); } } } else { ReportError(n, "choicebookpage child must be a window"); } return wnd; } else { ReportError("choicebookpage must have a window child"); return NULL; } } else { XRC_MAKE_INSTANCE(nb, wxChoicebook) nb->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style")), GetName()); wxImageList *imagelist = GetImageList(); if ( imagelist ) nb->AssignImageList(imagelist); wxChoicebook *old_par = m_choicebook; m_choicebook = nb; bool old_ins = m_isInside; m_isInside = true; CreateChildren(m_choicebook, true/*only this handler*/); m_isInside = old_ins; m_choicebook = old_par; return nb; } }
bool Font::SaveXML(Serializer& dest, int pointSize, bool usedGlyphs) { const FontFace* fontFace = GetFace(pointSize); if (!fontFace) return false; PROFILE(FontSaveXML); SharedPtr<FontFace> packedFontFace; if (usedGlyphs) { // Save used glyphs only, try to pack them first packedFontFace = Pack(fontFace); if (packedFontFace) fontFace = packedFontFace; else return false; } SharedPtr<XMLFile> xml(new XMLFile(context_)); XMLElement rootElem = xml->CreateRoot("font"); // Information XMLElement childElem = rootElem.CreateChild("info"); String fileName = GetFileName(GetName()); childElem.SetAttribute("face", fileName); childElem.SetAttribute("size", String(pointSize)); // Common childElem = rootElem.CreateChild("common"); childElem.SetInt("lineHeight", fontFace->rowHeight_); unsigned pages = fontFace->textures_.Size(); childElem.SetInt("pages", pages); // Construct the path to store the texture String pathName; File* file = dynamic_cast<File*>(&dest); if (file) // If serialize to file, use the file's path pathName = GetPath(file->GetName()); else // Otherwise, use the font resource's path pathName = "Data/" + GetPath(GetName()); // Pages childElem = rootElem.CreateChild("pages"); for (unsigned i = 0; i < pages; ++i) { XMLElement pageElem = childElem.CreateChild("page"); pageElem.SetInt("id", i); String texFileName = fileName + "_" + String(i) + ".png"; pageElem.SetAttribute("file", texFileName); // Save the font face texture to image file SaveFaceTexture(fontFace->textures_[i], pathName + texFileName); } // Chars and kernings XMLElement charsElem = rootElem.CreateChild("chars"); unsigned numGlyphs = fontFace->glyphs_.Size(); charsElem.SetInt("count", numGlyphs); XMLElement kerningsElem; bool hasKerning = fontFace->hasKerning_; if (hasKerning) kerningsElem = rootElem.CreateChild("kernings"); for (HashMap<unsigned, unsigned>::ConstIterator i = fontFace->glyphMapping_.Begin(); i != fontFace->glyphMapping_.End(); ++i) { // Char XMLElement charElem = charsElem.CreateChild("char"); charElem.SetInt("id", i->first_); FontGlyph glyph = fontFace->glyphs_[i->second_]; charElem.SetInt("x", glyph.x_); charElem.SetInt("y", glyph.y_); charElem.SetInt("width", glyph.width_); charElem.SetInt("height", glyph.height_); charElem.SetInt("xoffset", glyph.offsetX_); charElem.SetInt("yoffset", glyph.offsetY_); charElem.SetInt("xadvance", glyph.advanceX_); charElem.SetInt("page", glyph.page_); // Kerning if (hasKerning) { for (HashMap<unsigned, unsigned>::ConstIterator j = glyph.kerning_.Begin(); j != glyph.kerning_.End(); ++j) { // To conserve space, only write when amount is non zero if (j->second_ == 0) continue; XMLElement kerningElem = kerningsElem.CreateChild("kerning"); kerningElem.SetInt("first", i->first_); kerningElem.SetInt("second", j->first_); kerningElem.SetInt("amount", j->second_); } } } return xml->Save(dest); }
uint16 Mob::GetInstrumentMod(uint16 spell_id) const { if(GetClass() != BARD) return(10); uint16 effectmod = 10; //this should never use spell modifiers... //if a spell grants better modifers, they are copied into the item mods //because the spells are supposed to act just like having the intrument. //item mods are in 10ths of percent increases switch(spells[spell_id].skill) { case PERCUSSION_INSTRUMENTS: if(itembonuses.percussionMod == 0 && spellbonuses.percussionMod == 0) effectmod = 10; else if(GetSkill(PERCUSSION_INSTRUMENTS) == 0) effectmod = 10; else if(itembonuses.percussionMod > spellbonuses.percussionMod) effectmod = itembonuses.percussionMod; else effectmod = spellbonuses.percussionMod; break; case STRINGED_INSTRUMENTS: if(itembonuses.stringedMod == 0 && spellbonuses.stringedMod == 0) effectmod = 10; else if(GetSkill(STRINGED_INSTRUMENTS) == 0) effectmod = 10; else if(itembonuses.stringedMod > spellbonuses.stringedMod) effectmod = itembonuses.stringedMod; else effectmod = spellbonuses.stringedMod; break; case WIND_INSTRUMENTS: if(itembonuses.windMod == 0 && spellbonuses.windMod == 0) effectmod = 10; else if(GetSkill(WIND_INSTRUMENTS) == 0) effectmod = 10; else if(itembonuses.windMod > spellbonuses.windMod) effectmod = itembonuses.windMod; else effectmod = spellbonuses.windMod; break; case BRASS_INSTRUMENTS: if(itembonuses.brassMod == 0 && spellbonuses.brassMod == 0) effectmod = 10; else if(GetSkill(BRASS_INSTRUMENTS) == 0) effectmod = 10; else if(itembonuses.brassMod > spellbonuses.brassMod) effectmod = itembonuses.brassMod; else effectmod = spellbonuses.brassMod; break; case SINGING: if(itembonuses.singingMod == 0 && spellbonuses.singingMod == 0) effectmod = 10; else if(itembonuses.singingMod > spellbonuses.singingMod) effectmod = itembonuses.singingMod; else effectmod = spellbonuses.singingMod; break; default: effectmod = 10; break; } if(spells[spell_id].skill == SINGING) { effectmod += 2*GetAA(aaSingingMastery); effectmod += 2*GetAA(aaImprovedSingingMastery); } else { effectmod += 2*GetAA(aaInstrumentMastery); effectmod += 2*GetAA(aaImprovedInstrumentMastery); } effectmod += 2*GetAA(aaAyonaesTutelage); //singing & instruments effectmod += 2*GetAA(aaEchoofTaelosia); //singing & instruments if(effectmod < 10) effectmod = 10; _log(SPELLS__BARDS, "%s::GetInstrumentMod() spell=%d mod=%d\n", GetName(), spell_id, effectmod); return(effectmod); }
void UGameplayTask::OnGameplayTaskDeactivated(UGameplayTask& Task) { // cleanup after deactivation if (&Task == ChildTask) { UE_VLOG(GetGameplayTasksComponent(), LogGameplayTasks, Verbose, TEXT("%s> Child task deactivated: %s (state: %s)"), *GetName(), *Task.GetName(), *Task.GetTaskStateName()); if (Task.IsFinished()) { ChildTask = nullptr; } } }
void CFSPlayer::SetSide(CFSMission * pfsMission, IsideIGC * pside) { CFSMission * pfsmOld = GetMission(); IsideIGC* psideOld = GetSide(); CFSShip::SetSide(pfsMission, pside); // Their persist score now becomes their current score, and other stuff is reset if (pside) { PlayerScoreObject* ppso = GetPlayerScoreObject(); ppso->SetPersist(GetPersistPlayerScore(pside->GetCivilization()->GetObjectID())); memset(m_ptDesiredLoadout, 0, sizeof(m_ptDesiredLoadout)); } // can't guarantee success on group changes--dplay player may be already blown away if (pside != psideOld) { if (pfsmOld) g.fm.DeleteConnectionFromGroup(CFSSide::FromIGC(psideOld)->GetGroup(), GetConnection()); if (pfsMission) { bool fLobbySide = SIDE_TEAMLOBBY == pside->GetObjectID(); CFMGroup * pgrp = CFSSide::FromIGC(pside)->GetGroup(); g.fm.AddConnectionToGroup(pgrp, GetConnection()); if (fLobbySide) g.fm.DeleteConnectionFromGroup(pfsMission->GetGroupRealSides(), GetConnection()); else g.fm.AddConnectionToGroup(pfsMission->GetGroupRealSides(), GetConnection()); } } else assert (pfsmOld == pfsMission); if (!pside && m_pgrp) { g.fm.DeleteConnectionFromGroup(m_pgrp, GetConnection()); m_pgrp = NULL; } // // If the user just joined or left the game, consider firing an AGC event // if (pfsmOld != pfsMission) { if (pfsmOld) // if leaving a game { const char * szName = pfsmOld->GetIGCMission() && pfsmOld->GetIGCMission()->GetMissionParams() ? pfsmOld->GetIGCMission()->GetMissionParams()->strGameName : "?" ; int id = pfsmOld->GetIGCMission() ? pfsmOld->GetIGCMission()->GetMissionID() : -1; long idShip = (AGC_AdminUser << 16) | CAdminUser::DetermineID(this->GetPlayer()); LPCSTR pszContext = pfsmOld->GetIGCMission() ? pfsmOld->GetIGCMission()->GetContextName() : NULL; _AGCModule.TriggerContextEvent(NULL, EventID_LogoutGame, pszContext, GetName(), idShip, -1, -1, 2, "GameID", VT_I4, id, "GameName", VT_LPSTR, szName); } if (pfsMission) // if joining a game { const char * szName = pfsMission->GetIGCMission() && pfsMission->GetIGCMission()->GetMissionParams() ? pfsMission->GetIGCMission()->GetMissionParams()->strGameName : "?" ; int id = pfsMission->GetIGCMission() ? pfsMission->GetIGCMission()->GetMissionID() : -1; long idShip = (AGC_AdminUser << 16) | CAdminUser::DetermineID(this->GetPlayer()); LPCSTR pszContext = pfsMission->GetIGCMission() ? pfsMission->GetIGCMission()->GetContextName() : NULL; _AGCModule.TriggerContextEvent(NULL, EventID_LoginGame, pszContext, GetName(), idShip, -1, -1, 2, "GameID", VT_I4, id, "GameName", VT_LPSTR, szName); } } // // If the user just joined or left the team, consider firing an AGC event // if (psideOld != pside) { //Imago #169 if ( (psideOld && psideOld->GetObjectID() == SIDE_TEAMLOBBY) || (pside && pside->GetObjectID() == SIDE_TEAMLOBBY)) if (pfsMission) pfsMission->SetLobbyIsDirty(); long idShip = (AGC_AdminUser << 16) | CAdminUser::DetermineID(this->GetPlayer()); if (psideOld ) // if leaving a side { LPCSTR pszContext = GetIGCShip()->GetMission() ? GetIGCShip()->GetMission()->GetContextName() : NULL; // TE Modify LeaveTeam AGCEvent to include MissionID, and change UniqueID to ObjectID _AGCModule.TriggerContextEvent(NULL, EventID_LeaveTeam, pszContext, GetName(), idShip, psideOld->GetUniqueID(), -1, 3, // Changed UniqueID to ObjectID. Modified ParamCount to 3 "MissionID", VT_I4 , psideOld->GetMission()->GetMissionID(), // Added line MissionID as param "Team" , VT_I4 , psideOld->GetObjectID(), // Changed UniqueID to ObjectID "TeamName", VT_LPSTR, psideOld->GetName()); // old event //_AGCModule.TriggerContextEvent(NULL, EventID_LeaveTeam, pszContext, // GetName(), idShip, psideOld->GetUniqueID(), -1, 2, // "Team" , VT_I4 , psideOld->GetUniqueID(), // "TeamName", VT_LPSTR, psideOld->GetName()); } if (pside) // if joining a side { // TE Modify JoinTeam AGCEvent to include MissionID, and change UniqueID to ObjectID _AGCModule.TriggerEvent(NULL, EventID_JoinTeam, GetName(), idShip, pside->GetUniqueID(), -1, 3, // Changed UniqueID to ObjectID. Modified ParamCount to 3 "MissionID", VT_I4 , pfsMission->GetMissionID(), // Added line MissionID "Team" , VT_I4 , pside->GetObjectID(), // Changed UniqueID to ObjectID. "TeamName", VT_LPSTR, pside->GetName()); // old event //_AGCModule.TriggerEvent(NULL, EventID_JoinTeam, GetName(), idShip, //pside->GetUniqueID(), -1, 2, //"Team" , VT_I4 , pside->GetUniqueID(), //"TeamName", VT_LPSTR, pside->GetName()); } } }
void AActor::EditorApplyRotation(const FRotator& DeltaRotation, bool bAltDown, bool bShiftDown, bool bCtrlDown) { if( RootComponent != NULL ) { const FRotator Rot = RootComponent->GetAttachParent() != NULL ? GetActorRotation() : RootComponent->RelativeRotation; FRotator ActorRotWind, ActorRotRem; Rot.GetWindingAndRemainder(ActorRotWind, ActorRotRem); const FQuat ActorQ = ActorRotRem.Quaternion(); const FQuat DeltaQ = DeltaRotation.Quaternion(); const FQuat ResultQ = DeltaQ * ActorQ; const FRotator NewActorRotRem = FRotator( ResultQ ); FRotator DeltaRot = NewActorRotRem - ActorRotRem; DeltaRot.Normalize(); if( RootComponent->GetAttachParent() != NULL ) { RootComponent->SetWorldRotation( Rot + DeltaRot ); } else { // No attachment. Directly set relative rotation (to support winding) RootComponent->SetRelativeRotation( Rot + DeltaRot ); } } else { UE_LOG(LogActor, Warning, TEXT("WARNING: EditorApplyRotation %s has no root component"), *GetName() ); } }
void AActor::EditorApplyScale( const FVector& DeltaScale, const FVector* PivotLocation, bool bAltDown, bool bShiftDown, bool bCtrlDown ) { if( RootComponent != NULL ) { const FVector CurrentScale = GetRootComponent()->RelativeScale3D; // @todo: Remove this hack once we have decided on the scaling method to use. FVector ScaleToApply; if( AActor::bUsePercentageBasedScaling ) { ScaleToApply = CurrentScale * (FVector(1.0f) + DeltaScale); } else { ScaleToApply = CurrentScale + DeltaScale; } GetRootComponent()->SetRelativeScale3D(ScaleToApply); if (PivotLocation) { const FVector CurrentScaleSafe(CurrentScale.X ? CurrentScale.X : 1.0f, CurrentScale.Y ? CurrentScale.Y : 1.0f, CurrentScale.Z ? CurrentScale.Z : 1.0f); FVector Loc = GetActorLocation(); Loc -= *PivotLocation; Loc *= (ScaleToApply / CurrentScaleSafe); Loc += *PivotLocation; GetRootComponent()->SetWorldLocation(Loc); } } else { UE_LOG(LogActor, Warning, TEXT("WARNING: EditorApplyTranslation %s has no root component"), *GetName() ); } FEditorSupportDelegates::UpdateUI.Broadcast(); }
void ExportLinkageParameter (individual *indlist) { individual *ind; FreqList *fl; int i, j, k; // Check that data exists if (listlen(indlist)==0) { printf("WARNING: No data avaliable for creating linkage data file\n"); return; } ind = indlist; cfopen ("linkage.par", "w"); fprintf(F, "%d 0 0 3\n", listlen(ind->marker) + numberoftraits()); fprintf(F, "0 0.0 0.0 0\n"); // Now prints the marker order for (i=1; i<= numberofmarkers(); i++) { fprintf(F, "%d ",order[i]); } fprintf(F, "\n"); for (i = 1; i<= numberofmarkers(); i++) { // This is a genetic marker with so many alleles (requires reducing) j = maxallelenumber(i); fprintf(F, "3 %d # %s\n", j, GetName(markernames, i)); fl = FrequencyNumber(i); for (k=1; k<= fl->num_alleles; k++) fprintf(F, "%-6.4f ",fl->frequency[k]); fprintf(F, "\n"); } for (i=1; i<=numberoftraits(); i++) { fprintf(F, "4 0 # %s \n", GetName(traitnames, i)); } fprintf(F, "0 0\n"); // Printing recombination fractions if (numberofmarkers()>1) { for (i = 1; i< numberofmarkers(); i++) fprintf(F, "%-5.3f ",distance[i]); fprintf(F, "\n"); } else fprintf(F, "0\n "); fprintf(F, "0\n1\n"); fflush(F); fclose(F); puts("Made LINKAGE parameter file"); }
void AActor::EditorApplyTranslation(const FVector& DeltaTranslation, bool bAltDown, bool bShiftDown, bool bCtrlDown) { if( RootComponent != NULL ) { GetRootComponent()->SetWorldLocation( GetRootComponent()->GetComponentLocation() + DeltaTranslation ); } else { UE_LOG(LogActor, Warning, TEXT("WARNING: EditorApplyTranslation %s has no root component"), *GetName() ); } }
int ExportCRIMAPGen(individual *indlist, int xlinked) { individual *ind; namelist *pedigree, *ped; markerlist *mkr; char mkrname[NAMESIZE], tempstr[NAMESIZE]; int nFamilies, nLoci, i, nInternalID, nMembers, al1, al2, pseudoal; nLoci = listlen(indlist->marker); pedigree = MakePedigreeList(indlist); nFamilies = listlen(pedigree); cfopen ("crimap.gen", "w"); fprintf(F, "%d %d", nFamilies, nLoci); // The first line // Prints the markers in the correct order for (i = 1; i<= nLoci; i++) { // Remove white spaces in marker name RemoveWhiteSpace(tempstr, GetName(markernames, order[i])); strncpy(mkrname, tempstr, 15); fprintf(F, " %s", mkrname); } fprintf(F, "\n"); // Fixes internal id's for use below for (ped = pedigree; ped; ped = ped->next) { nInternalID = 1; for (ind = indlist; ind; ind = ind->next) { // From the right pedigree if (!strcmpl(ind->pedigree, ped->name)) { ind->localid = nInternalID; nInternalID++; } } } // Writes each family for (ped = pedigree; ped; ped = ped->next) { // Family name fprintf(F, "%s\n", ped->name); nMembers = 0; // Count the number of family members for (ind = indlist; ind; ind = ind->next) { // From the right pedigree if (!strcmpl(ind->pedigree, ped->name)) nMembers++; } fprintf(F, "%d\n", nMembers); for (ind = indlist; ind; ind = ind->next) { // From the right pedigree if (!strcmpl(ind->pedigree, ped->name)) { if (founder(ind)) fprintf(F, "%d 0 0 ", ind->localid); else fprintf(F, "%d %d %d ", ind->localid, ind->father->localid, ind->mother->localid); switch (ind->sex) { case S_MALE: fprintf(F, "1"); break; case S_FEMALE: fprintf(F, "0"); break; default: fprintf(F, "3"); break; } // Should now print the alleles for each locus // If xlinked, then create a pseudo allele for each marker // to make the males heterozygous for (i = 1; i<= nLoci; i++) { mkr = markernumber(ind, order[i]); al1 = mkr->allele1; al2 = mkr->allele2; if (xlinked && ind->sex == S_MALE && al1>0 && al2>0) { pseudoal = NumberOfAlleles(order[i])+1; al2 = pseudoal; } fprintf(F, " %d %d", al1, al2); } fprintf(F, "\n"); } } } fclose(F); printf("Created crimap gen file\n"); if (xlinked) { printf("Pseudo-allele generated for all males\n"); } return 0; }
void MakeGHdatafile (void) { individual *ind; FreqList *fl; int i, j, k; // Check that data exists if (!individuals) { printf("WARNING: No data avaliable for creating linkage data file\n"); return; } ind = individuals; cfopen ("gh.data", "w"); fprintf(F, "%d 0 0 5\n", listlen(ind->marker)+1+numberoftraits()); fprintf(F, "0 0.0 0.0 0\n"); // Now prints the marker order fprintf(F, "1 "); for (i=1; i<= numberofmarkers(); i++) { fprintf(F, "%d ",order[i]+1); } fprintf(F, "\n"); fprintf(F, "1 2 << AFFECTION, NO OF ALLELES\n"); fprintf(F, "0.99 0.01 << GENE FREQ\n"); fprintf(F, "1\n"); fprintf(F, "0.001 0.999 0.999 << GENE FREQ\n"); // if (options->Index[O_XLINKED]) { // fprintf(F, "0.001 0.999 << GENE FREQ\n"); // } for (i = 1; i<= numberofmarkers(); i++) { // This is a genetic marker with so many alleles (requires reducing) j = NumberOfAlleles(i); #ifdef XGH if (options->Index[O_XLINKED]) { fprintf(F, "3 %d\n", j+1); } else { fprintf(F, "3 %d\n", j); } #else fprintf(F, "3 %d\n", j); #endif fl = FrequencyNumber(i); for (k=1; k<= fl->num_alleles; k++) fprintf(F, "%-6.4f ",fl->frequency[k]); #ifdef XGH if (options->Index[O_XLINKED]) { fprintf(F, "0.001 "); } #endif fprintf(F, "\n"); } for (i=1; i<=numberoftraits(); i++) { fprintf(F, "4 0 # %s \n", GetName(traitnames, i)); } fprintf(F, "0 0\n"); // Printing recombination fractions if (numberofmarkers()>1) { fprintf(F, ".1 "); for (i = 1; i< numberofmarkers(); i++) fprintf(F, "%-7.5f ",distance[i]); fprintf(F, "\n"); } else fprintf(F, "0\n "); fprintf(F, "0\n1\n"); fflush(F); fclose(F); puts("Made GeneHunter 2 parameter file"); }
/* ================ rvEffect::Spawn ================ */ void rvEffect::Spawn( void ) { const char* fx; if ( !spawnArgs.GetString ( "fx", "", &fx ) || !*fx ) { if ( !( gameLocal.editors & EDITOR_FX ) ) { gameLocal.Warning ( "no effect file specified on effect entity '%s'", name.c_str() ); PostEventMS ( &EV_Remove, 0 ); return; } } else { effect = ( const idDecl * )declManager->FindEffect( spawnArgs.GetString ( "fx" ) ); if( effect->IsImplicit() ) { common->Warning( "Unknown effect \'%s\' on entity \'%s\'", spawnArgs.GetString ( "fx" ), GetName() ); } } spawnArgs.GetVector ( "endOrigin", "0 0 0", endOrigin ); spawnArgs.GetBool ( "loop", "0", loop ); // If look at target is set the effect will continually update itself to look at its target spawnArgs.GetBool( "lookAtTarget", "0", lookAtTarget ); renderEntity.shaderParms[SHADERPARM_ALPHA] = spawnArgs.GetFloat ( "_alpha", "1" ); renderEntity.shaderParms[SHADERPARM_BRIGHTNESS] = spawnArgs.GetFloat ( "_brightness", "1" ); if( spawnArgs.GetBool( "start_on", loop ? "1" : "0" ) ) { ProcessEvent( &EV_Activate, this ); } #if 0 // If anyone ever gets around to a flood fill from the origin rather than the over generous PushVolumeIntoTree bounds, // this warning will become useful. Until then, it's a bogus warning. if( gameRenderWorld->PointInArea( GetPhysics()->GetOrigin() ) < 0 ) { common->Warning( "Effect \'%s\' out of world", name.c_str() ); } #endif }
FString UGameplayTask::GetDebugString() const { return FString::Printf(TEXT("%s (%s)"), *GetName(), *InstanceName.ToString()); }
void AActor::EditorApplyMirror(const FVector& MirrorScale, const FVector& PivotLocation) { const FRotationMatrix TempRot( GetActorRotation() ); const FVector New0( TempRot.GetScaledAxis( EAxis::X ) * MirrorScale ); const FVector New1( TempRot.GetScaledAxis( EAxis::Y ) * MirrorScale ); const FVector New2( TempRot.GetScaledAxis( EAxis::Z ) * MirrorScale ); // Revert the handedness of the rotation, but make up for it in the scaling. // Arbitrarily choose the X axis to remain fixed. const FMatrix NewRot( -New0, New1, New2, FVector::ZeroVector ); if( RootComponent != NULL ) { GetRootComponent()->SetRelativeRotation( NewRot.Rotator() ); FVector Loc = GetActorLocation(); Loc -= PivotLocation; Loc *= MirrorScale; Loc += PivotLocation; GetRootComponent()->SetRelativeLocation( Loc ); FVector Scale3D = GetRootComponent()->RelativeScale3D; Scale3D.X = -Scale3D.X; GetRootComponent()->SetRelativeScale3D(Scale3D); } else { UE_LOG(LogActor, Warning, TEXT("WARNING: EditorApplyMirror %s has no root component"), *GetName() ); } }
void UGameplayTask::Activate() { UE_VLOG(GetGameplayTasksComponent(), LogGameplayTasks, Verbose , TEXT("%s Activate called, current State: %s") , *GetName(), *GetTaskStateName()); }
JSBool XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface, JSObject *parent, jsval *vp) { if (IsConstant()) { const nsXPTConstant* constant; if (NS_FAILED(iface->GetInterfaceInfo()->GetConstant(mIndex, &constant))) return JS_FALSE; const nsXPTCMiniVariant& mv = *constant->GetValue(); // XXX Big Hack! nsXPTCVariant v; v.flags = 0; v.type = constant->GetType(); memcpy(&v.val, &mv.val, sizeof(mv.val)); jsval resultVal; if (!XPCConvert::NativeData2JS(ccx, &resultVal, &v.val, v.type, nsnull, nsnull)) return JS_FALSE; *vp = resultVal; return JS_TRUE; } // else... // This is a method or attribute - we'll be needing a function object intN argc; JSNative callback; if (IsMethod()) { const nsXPTMethodInfo* info; if (NS_FAILED(iface->GetInterfaceInfo()->GetMethodInfo(mIndex, &info))) return JS_FALSE; // Note: ASSUMES that retval is last arg. argc = (intN) info->GetParamCount(); if (argc && info->GetParam((uint8)(argc-1)).IsRetval()) argc-- ; callback = XPC_WN_CallMethod; } else { argc = 0; callback = XPC_WN_GetterSetter; } JSFunction *fun = JS_NewFunctionById(ccx, callback, argc, 0, parent, GetName()); if (!fun) return JS_FALSE; JSObject* funobj = JS_GetFunctionObject(fun); if (!funobj) return JS_FALSE; if (!JS_SetReservedSlot(ccx, funobj, 0, PRIVATE_TO_JSVAL(iface))|| !JS_SetReservedSlot(ccx, funobj, 1, PRIVATE_TO_JSVAL(this))) return JS_FALSE; *vp = OBJECT_TO_JSVAL(funobj); return JS_TRUE; }
void UGameplayTask::OnGameplayTaskInitialized(UGameplayTask& Task) { UE_VLOG(GetGameplayTasksComponent(), LogGameplayTasks, Verbose, TEXT("%s> Child task initialized: %s"), *GetName(), *Task.GetName()); // only one child task is allowed if (ChildTask) { UE_VLOG(GetGameplayTasksComponent(), LogGameplayTasks, Verbose, TEXT(">> terminating previous child task: %s"), *ChildTask->GetName()); ChildTask->EndTask(); } ChildTask = &Task; }
/* =============== idDeclFX::List =============== */ void idDeclFX::List( void ) const { common->Printf("%s, %d stages\n", GetName(), events.Num() ); }
/*------------------------------------------------------------------------- * CaptureStation *------------------------------------------------------------------------- * Purpose: * Handle a station being captured by a ship */ void CFSShip::CaptureStation(IstationIGC * pstation) { { //Fudge the hitpoints of the station //All those guns inside damage the hull pstation->SetFraction(pstation->GetFraction() * 0.5f); //But the heroic engineer's get the shields up. pstation->SetShieldFraction(0.8f); //pstation->GetShieldFraction() + 0.5f); } { GetPlayerScoreObject()->CaptureBase(true); for (ShipLinkIGC* psl = GetIGCShip()->GetChildShips()->first(); (psl != NULL); psl = psl->next()) { CFSShip* ps = (CFSShip*)(psl->data()->GetPrivateData()); ps->GetPlayerScoreObject()->CaptureBase(false); } } IsideIGC * pside = GetSide(); pside->AddBaseCapture(); SideID iSide = pside->GetObjectID(); IsideIGC* psideOld = pstation->GetSide(); StationID stationID = pstation->GetObjectID(); BEGIN_PFM_CREATE(g.fm, pfmStationCapture, S, STATION_CAPTURE) END_PFM_CREATE pfmStationCapture->stationID = stationID; pfmStationCapture->sidOld = psideOld->GetObjectID(); pfmStationCapture->sidNew = iSide; pfmStationCapture->shipIDCredit = GetIGCShip()->GetObjectID(); g.fm.SendMessages(GetMission()->GetGroupRealSides(), FM_GUARANTEED, FM_FLUSH); pstation->SetSide(pside); // TE: Fire AGCEvent when base is captured CFSMission * pfsMission = this->GetMission(); LPCSTR pszContext = pfsMission->GetIGCMission() ? pfsMission->GetIGCMission()->GetContextName() : NULL; _AGCModule.TriggerContextEvent(NULL, EventID_StationChangesSides, pszContext, GetName(), GetShipID(), pside->GetUniqueID(), -1, 4, "GameID" , VT_I4 , pfsMission->GetMissionID(), "OldTeam" , VT_I4 , psideOld->GetUniqueID(), "OldTeamName", VT_LPSTR, psideOld->GetName(), "StationName", VT_LPSTR, pstation->GetName()); // TE end // yp: Add event for players who were involved in the capture of an enemy base. // mmf commented this out for now pending additional testing #if 0 ZString pszPlayerList = ""; // this creates a new ZString object and set its value to "", it's not a pointer to "" if(m_pfsMission->GetIGCMission() && m_pfsMission->GetIGCMission()->GetShips()) { ShipLinkIGC * pShiplink = m_pfsMission->GetIGCMission()->GetShips()->first(); while (pShiplink) { CFSShip * pfsShip = (CFSShip *) pShiplink->data()->GetPrivateData(); if (pfsShip && pfsShip->IsPlayer()) { // this logic might need to be tweeked to include the ship that did the capture if its if(pfsShip->GetSide() && pfsShip->GetSide()->GetObjectID() == iSide && // if they are on the side that did the Capture. and.. pfsShip->GetPlayer()->GetIGCShip()->GetObjectID() == GetIGCShip()->GetObjectID() || // they are the ship that did the caputure. or pfsShip->GetCluster() && pstation->GetCluster() && pfsShip->GetCluster()->GetObjectID() == pstation->GetCluster()->GetObjectID()) // they are in this sector { pszPlayerList = pszPlayerList + ";" + ZString(pfsShip->GetPlayer()->GetName()); // players name // The distance the player is from the station that was destroyed. if(pfsShip->GetPlayer()->GetIGCShip() ) { pszPlayerList = pszPlayerList + ":" + ZString( (pstation->GetPosition() - pfsShip->GetPlayer()->GetIGCShip()->GetPosition()).Length()); // the distance } } } pShiplink = pShiplink->next(); } } // Fire AGCEvent listing players in the sector // TODO: Might want to add into the event weither or not this was a VICTORY capture.. should we track that as well? _AGCModule.TriggerContextEvent(NULL, EventID_StationChangesSides, pszContext, GetName(), GetShipID(), pside->GetUniqueID(), -1, 4, "GameID" , VT_I4 , pfsMission->GetMissionID(), "OldTeam" , VT_I4 , psideOld->GetUniqueID(), "OldTeamName", VT_LPSTR, psideOld->GetName(), "zPlayerList", VT_LPSTR, pszPlayerList); // pszPlayerList should look like ";player@squad:1500;player2@squad:500" // yp:end #endif //Possibly the built themselves to a victory IsideIGC* psideWin = m_pfsMission->CheckForVictoryByStationCapture(pside, psideOld); if (psideWin) { static char szReason[100]; //Make this static so we only need to keep a pointer to it around sprintf(szReason, "%s won because %s captured %s", psideWin->GetName(), GetIGCShip()->GetName(), pstation->GetName()); m_pfsMission->GameOver(psideWin, szReason); } else if (psideOld->GetActiveF()) //RESET OUR EYE HERE? IMAGO CAPTURE EYE BUG FIX? REVIEW 7/23/09 m_pfsMission->VacateStation(pstation); }
AActor* UBTNode::GetGameplayTaskAvatar(const UGameplayTask* Task) const { if (Task == nullptr) { if (IsInstanced()) { const UBehaviorTreeComponent* BTComponent = Cast<const UBehaviorTreeComponent>(GetOuter()); //not having BT component for an instanced BT node is invalid! check(BTComponent); return BTComponent->GetAIOwner(); } else { UE_LOG(LogBehaviorTree, Warning, TEXT("%s: Unable to determine default GameplayTaskAvatar!"), *GetName()); return nullptr; } } const UAITask* AITask = Cast<const UAITask>(Task); if (AITask) { return AITask->GetAIController() ? AITask->GetAIController()->GetPawn() : nullptr; } const UGameplayTasksComponent* TasksComponent = Task->GetGameplayTasksComponent(); return TasksComponent ? TasksComponent->GetGameplayTaskAvatar(Task) : nullptr; }
void GetClassName(TSTR& s) { s = GetName(); }
void ArenaTeam::Disband(WorldSession* session) { // Remove all members from arena team while (!Members.empty()) DelMember(Members.front().Guid, false); // Broadcast update if (session) { BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName().c_str(), GetName(), ""); if (Player* player = session->GetPlayer()) sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId()); } // Update database SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM); stmt->setUInt32(0, TeamId); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBERS); stmt->setUInt32(0, TeamId); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); // Remove arena team from ObjectMgr sArenaTeamMgr->RemoveArenaTeam(TeamId); }
int32 Client::CalcMaxMana() { switch(GetCasterClass()) { case 'I': case 'W': { max_mana = (CalcBaseMana() + itembonuses.Mana + spellbonuses.Mana + GroupLeadershipAAManaEnhancement()); break; } case 'N': { max_mana = 0; break; } default: { LogFile->write(EQEMuLog::Debug, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } } if (max_mana < 0) { max_mana = 0; } if (cur_mana > max_mana) { cur_mana = max_mana; } int mana_perc_cap = spellbonuses.ManaPercCap; if(mana_perc_cap) { int curMana_cap = (max_mana * mana_perc_cap) / 100; if (cur_mana > curMana_cap) cur_mana = curMana_cap; } #if EQDEBUG >= 11 LogFile->write(EQEMuLog::Debug, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); #endif return max_mana; }
void hhCenturion::Event_CenturionLaunch( const idList<idStr>* parmList ) { const idDict* projDef = NULL; const idSoundShader* soundShader = NULL; // parms: joint, projectileDef, sound, fx if( !parmList || parmList->Num() != 5 ) { gameLocal.Warning( "Incorrect paramater number" ); return; } //Rbarrel_A projectile_centurion_autocannon snd_fire fx_muzzleFlash const char* jointName = (*parmList)[ 0 ].c_str(); const char* projectileDefName = (*parmList)[ 1 ].c_str(); const char* soundName = (*parmList)[ 2 ].c_str(); const char* fxName = (*parmList)[ 3 ].c_str(); int autoAim = atoi( (*parmList)[ 4 ].c_str() ); if( AI_CENTURION_ARM_MISSING ) { //skip firing if joint is on the severed arm if( !idStr::Icmp(jointName, spawnArgs.GetString("severed_jointA", "")) || !idStr::Icmp(jointName, spawnArgs.GetString("severed_jointB", "")) ) { return; } } projDef = gameLocal.FindEntityDefDict( projectileDefName, false ); HH_ASSERT( !shootTarget.IsValid() ); // If autoAim is true and we're not blending, and we're facing the enemy, auto-aim if ( ( autoAim == 1 || ( autoAim == 2 && gameLocal.random.RandomInt(100) < 50 ) ) && torsoAnim.animBlendFrames == 0 && FacingEnemy( 5.0f ) ) { AimedAttackMissile( jointName, projDef ); } else { // Otherwise do a normal missile attack Event_AttackMissile( jointName, projDef, 1 ); } if(idStr::Cmpn( soundName, "snd_", 4)) { soundShader = declManager->FindSound( soundName ); if( soundShader->GetState() == DS_DEFAULTED ) { gameLocal.Warning( "Sound '%s' not found", soundName ); } StartSoundShader( soundShader, SND_CHANNEL_WEAPON, 0, false, NULL ); } else { if( !StartSound(soundName, SND_CHANNEL_WEAPON, 0, false, NULL) ) { gameLocal.Warning( "Framecommand 'centurionFire' on entity '%s' could not find sound '%s'", GetName(), soundName ); } } BroadcastFxInfoAlongBone( spawnArgs.GetString(fxName), jointName ); }
CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, FX_BOOL bStartTag) { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { return NULL; } CFX_ByteString tag_name, tag_space; FX_BOOL bEndTag; GetTagName(tag_space, tag_name, bEndTag, bStartTag); if (tag_name.IsEmpty() || bEndTag) { return NULL; } CXML_Element* pElement; pElement = FX_NEW CXML_Element; if (pElement) { pElement->m_pParent = pParent; pElement->SetTag(tag_space, tag_name); } if (!pElement) { return NULL; } do { CFX_ByteString attr_space, attr_name; while (m_dwIndex < m_dwBufferSize) { SkipWhiteSpaces(); if (IsEOF()) { break; } if (!g_FXCRT_XML_IsNameIntro(m_pBuffer[m_dwIndex])) { break; } GetName(attr_space, attr_name); SkipWhiteSpaces(); if (IsEOF()) { break; } if (m_pBuffer[m_dwIndex] != '=') { break; } m_dwIndex ++; SkipWhiteSpaces(); if (IsEOF()) { break; } CFX_WideString attr_value; GetAttrValue(attr_value); pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value); } m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (m_dwIndex < m_dwBufferSize || IsEOF()) { break; } } while (ReadNextBlock()); SkipWhiteSpaces(); if (IsEOF()) { return pElement; } FX_BYTE ch = m_pBuffer[m_dwIndex ++]; if (ch == '/') { m_dwIndex ++; m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; return pElement; } if (ch != '>') { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; delete pElement; return NULL; } SkipWhiteSpaces(); if (IsEOF()) { return pElement; } CFX_UTF8Decoder decoder; CFX_WideTextBuf content; FX_BOOL bCDATA = FALSE; FX_INT32 iState = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex ++]; switch (iState) { case 0: if (ch == '<') { iState = 1; } else if (ch == '&') { decoder.ClearStatus(); decoder.AppendChar(GetCharRef()); } else { decoder.Input(ch); } break; case 1: if (ch == '!') { iState = 2; } else if (ch == '?') { SkipLiterals(FX_BSTRC("?>")); SkipWhiteSpaces(); iState = 0; } else if (ch == '/') { CFX_ByteString space, name; GetName(space, name); SkipWhiteSpaces(); m_dwIndex ++; iState = 10; } else { content << decoder.GetResult(); CFX_WideString dataStr = content.GetWideString(); if (!bCDATA && !m_bSaveSpaceChars) { dataStr.TrimRight((FX_LPCWSTR)L" \t\r\n"); } InsertContentSegment(bCDATA, dataStr, pElement); content.Clear(); decoder.Clear(); bCDATA = FALSE; iState = 0; m_dwIndex --; CXML_Element* pSubElement = ParseElement(pElement, TRUE); if (pSubElement == NULL) { break; } pSubElement->m_pParent = pElement; pElement->m_Children.Add((FX_LPVOID)CXML_Element::Element); pElement->m_Children.Add(pSubElement); SkipWhiteSpaces(); } break; case 2: if (ch == '[') { SkipLiterals(FX_BSTRC("]]>")); } else if (ch == '-') { m_dwIndex ++; SkipLiterals(FX_BSTRC("-->")); } else { SkipLiterals(FX_BSTRC(">")); } decoder.Clear(); SkipWhiteSpaces(); iState = 0; break; } if (iState == 10) { break; } } m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) { break; } } while (ReadNextBlock()); content << decoder.GetResult(); CFX_WideString dataStr = content.GetWideString(); if (!m_bSaveSpaceChars) { dataStr.TrimRight((FX_LPCWSTR)L" \t\r\n"); } InsertContentSegment(bCDATA, dataStr, pElement); content.Clear(); decoder.Clear(); bCDATA = FALSE; return pElement; }
bool TaskStore::Item::operator<(const Item &other) const { return _tcscmp(GetName(), other.GetName()) < 0; }
void Client::SetLevel(uint8 set_level, bool command) { if (GetEXPForLevel(set_level) == 0xFFFFFFFF) { Log.Out(Logs::General, Logs::Error, "Client::SetLevel() GetEXPForLevel(%i) = 0xFFFFFFFF", set_level); return; } EQApplicationPacket* outapp = new EQApplicationPacket(OP_LevelUpdate, sizeof(LevelUpdate_Struct)); LevelUpdate_Struct* lu = (LevelUpdate_Struct*)outapp->pBuffer; lu->level = set_level; if(m_pp.level2 != 0) lu->level_old = m_pp.level2; else lu->level_old = level; level = set_level; if(IsRaidGrouped()) { Raid *r = this->GetRaid(); if(r){ r->UpdateLevel(GetName(), set_level); } } if(set_level > m_pp.level2) { if(m_pp.level2 == 0) m_pp.points += 5; else m_pp.points += (5 * (set_level - m_pp.level2)); m_pp.level2 = set_level; } if(set_level > m_pp.level) { parse->EventPlayer(EVENT_LEVEL_UP, this, "", 0); /* QS: PlayerLogLevels */ if (RuleB(QueryServ, PlayerLogLevels)){ std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID()); QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); } } else if (set_level < m_pp.level){ /* QS: PlayerLogLevels */ if (RuleB(QueryServ, PlayerLogLevels)){ std::string event_desc = StringFormat("Leveled DOWN :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID()); QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); } } m_pp.level = set_level; if (command){ m_pp.exp = GetEXPForLevel(set_level); Message(15, "Welcome to level %i!", set_level); lu->exp = 0; } else { float tmpxp = (float) ( (float) m_pp.exp - GetEXPForLevel( GetLevel() )) / ( (float) GetEXPForLevel(GetLevel()+1) - GetEXPForLevel(GetLevel())); lu->exp = (uint32)(330.0f * tmpxp); } QueuePacket(outapp); safe_delete(outapp); this->SendAppearancePacket(AT_WhoLevel, set_level); // who level change Log.Out(Logs::General, Logs::Normal, "Setting Level for %s to %i", GetName(), set_level); CalcBonuses(); if(!RuleB(Character, HealOnLevel)) { int mhp = CalcMaxHP(); if(GetHP() > mhp) SetHP(mhp); } else { SetHP(CalcMaxHP()); // Why not, lets give them a free heal } DoTributeUpdate(); SendHPUpdate(); SetMana(CalcMaxMana()); UpdateWho(); UpdateMercLevel(); Save(); }
void UPawnAction::SetOwnerComponent(class UPawnActionsComponent* Component) { if (OwnerComponent != NULL && OwnerComponent != Component) { UE_VLOG(GetPawn(), LogPawnAction, Warning, TEXT("%s> UPawnAction::SetOwnerComponent called to change already set valid owner component"), *GetName()); } OwnerComponent = Component; if (Component != NULL) { AAIController* AIController = Cast<AAIController>(Component->GetController()); if (AIController != NULL) { BrainComp = AIController->FindComponentByClass<UBrainComponent>(); } } }