Jump to content

[IDEA][HELP NEEDED] Single player RP mod


Guest steveb

Recommended Posts

Hello everybody! I am back around mangos forums after quite some time. It is so great to see the changes that took place here and the way Mangos turns out to be... very well done i must add

now on topic...

A while ago i did some little edits to the core that would enable players from both factions to do all the quests, changed the xp rewards for gray quests and a player could basically play all the quests in all cities, horde and alliance. but now that is all gone. from what i can see, code has changed quite alot since last year.

I myself am not a coder, i can remove checks here and there and tweak things for my own needs so i am kindly asking for some help from someone with better understanding of the core

What i want to do first is to remove the scaling of xp reward for quests (red, yellow, green and gray) so that it always returns the base xp of the quest.

the current code looks like this. how do i remove the formula and just put a statement where QuestLevel == playerLevel in all cases?

uint32 Quest::XPValue(Player *pPlayer) const
{
   if (pPlayer)
   {
       uint32 realXP = 0;
       uint32 xpMultiplier = 0;
       int32 baseLevel = 0;
       int32 playerLevel = pPlayer->getLevel();

       // formula can possibly be organized better, using less if's and simplify some.

       if (QuestLevel != -1)
           baseLevel = QuestLevel;

       if (((baseLevel - playerLevel) + 10)*2 > 10)
       {
           baseLevel = playerLevel;

           if (QuestLevel != -1)
               baseLevel = QuestLevel;

           if (((baseLevel - playerLevel) + 10)*2 <= 10)
           {
               if (QuestLevel == -1)
                   baseLevel = playerLevel;

               xpMultiplier = 2 * (baseLevel - playerLevel) + 20;
           }
           else
           {
               xpMultiplier = 10;
           }
       }
       else
       {
           baseLevel = playerLevel;

           if (QuestLevel != -1)
               baseLevel = QuestLevel;

           if (((baseLevel - playerLevel) + 10)*2 >= 1)
           {
               baseLevel = playerLevel;

               if (QuestLevel != -1)
                   baseLevel = QuestLevel;

               if (((baseLevel - playerLevel) + 10)*2 <= 10)
               {
                   if (QuestLevel == -1)
                       baseLevel = playerLevel;

                   xpMultiplier = 2 * (baseLevel - playerLevel) + 20;
               }
               else
               {
                   xpMultiplier = 10;
               }
           }
           else
           {
               xpMultiplier = 1;
           }
       }

now the second part is about the reputation system. i want to remove the checks if a faction is hidden and/or at war with another. Horde is hidden for alliance (also at war) and viceversa. the rest i can do via the database. any help would be greatly appreciated

from my searching the code is like this:

void ReputationMgr::SetAtWar( RepListID repListID, bool on )
{
   FactionStateList::iterator itr = m_factions.find(repListID);
   if (itr == m_factions.end())
       return;

   // always invisible or hidden faction can't change war state
   if(itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) )
       return;

   SetAtWar(&itr->second,on);
}

void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
{
   // not allow declare war to faction unless already hated or less
   if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) && ReputationToRank(faction->Standing) > REP_HATED)
       return;

   // already set
   if(((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
       return;

   if( atWar )
       faction->Flags |= FACTION_FLAG_AT_WAR;
   else
       faction->Flags &= ~FACTION_FLAG_AT_WAR;

   faction->Changed = true;
}

any suggestions or comments and very welcomed ;) thanks,

Steveb

Link to comment
Share on other sites

The first part is pretty easy:

uint32 Quest::XPValue(Player *pPlayer) const
{
   if (pPlayer)
   {
       uint32 uiRealXP = 0;

       if (const QuestXPLevel* pXPData = sQuestXPLevelStore.LookupEntry(QuestLevel))
       {
           uint32 uiRawXP = pXPData->xpIndex[RewXPId] / 10;

           // Round values
           if (uiRawXP > 1000)
               uiRealXP = ((uiRawXP + 25) / 50 * 50);
           else if (uiRawXP > 500)
               uiRealXP = ((uiRawXP + 12) / 25 * 25);
           else if (uiRawXP > 100)
               uiRealXP = ((uiRawXP + 5) / 10 * 10);
           else
               uiRealXP = ((uiRawXP + 2) / 5 * 5);
       }

       return uiRealXP;
   }
   return 0;
}

Now, I haven't tested that, so I have no idea if it works, but it should.

For the second part, I just want to clarify, you want it so that no factions whatsoever are at war? Or just Horde/Alliance?

Link to comment
Share on other sites

i want Horde and Alliance not to be at war and consequently the other factions on both sides ... for example Honor Hold and Thrallmar. if i remember correctly it was/should be possible to have the option of selecting/deselecting to be at war with a specific faction, even for Horde/Alliance. to have the factions visible and be able to select atWar state for all characters. hope it makes sense.

now about the quest xp part i will test that and see the results but is that all there needs to be put for Quest::XPValue? will it apply in all cases? cheers,

Steveb

Link to comment
Share on other sites

have just tested that code and it has 2 sides: one good and one bad but i guess it is worthwhile

Bad Side: reward xp is only a a fraction of the real value of the quest xp, only 10% to be precise

Good side is and actually the one that matters is that reward xp is given the same no matter what level the player is. can it be adjusted even more? thanks,

Steveb

LE: after some trials and error with that formula all seems to be great, multiplying instead of dividing gives much better results :D hehe

Link to comment
Share on other sites

Just change:

uint32 uiRawXP = pXPData->xpIndex[RewXPId] / 10;

to

uint32 uiRawXP = pXPData->xpIndex[RewXPId];

Wasn't sure if I needed to include that or not, guess I didn't.

And looking into the being able to set "At War" for Horde/Alliance and seems to be toggled in the DBC files, although I am not sure, as I can't find and documentation supporting this, but I can't find it in the code, and it is a client feature.

Link to comment
Share on other sites

Yeah that works great as i said in my earlier post with the xp being divided.

about the atWar part just look at code that i posted and there are more checks in ReputationMgr. i know it is dbc related but it is doable because i did a while ago. first by removing the check for factions that are forced invisible/hidden and then the check for forced hidden because by default they are atWar. I will do some search

Edit: i have found it :

void ReputationMgr::SetVisible(FactionState* faction)
{
   // always invisible or hidden faction can't be make visible
[b]//[/b]    if(faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN))
[b]//[/b]        return;

   // already set
   if(faction->Flags & FACTION_FLAG_VISIBLE)
       return;

   faction->Flags |= FACTION_FLAG_VISIBLE;
   faction->Changed = true;

   ++m_visibleFactionCount;

   SendVisible(faction);
}

by commenting that out the check is no longer done to see if a faction is forced invisible/hidden

Also in void ReputationMgr::LoadFromDB(QueryResult *result) i have set some values to FALSE

and tested ingame and it works... opposing factions are forced atWar while you have rep hated or lower but as soon as you are on Neutral or higher... then atWar becomes selectable and voila all is done. change the DB quests restrictions and you can do opposing quests.

Now all i need is a OnCharacterCreate script to add reputation for the opposing factions so that a new character starts with Neutral standing with those factions.

I have tried in CharacterHandler on login but cannot seem to get it right as it is converting an int to const

    if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
{
       pCurrChar->GetReputationMgr().SetReputation(76,0);
       pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
}

Any ideas? Thanks,

Steveb

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use