I'll be devoting (some) of my time to fixing the stat calculations found in osIrose, since most of them are way off. I'll be adding fixes to this list as soon as I tested them on my local server.
How does it work:
- I'll provide you with the full function code, and the adjustments I made to them.
NOTE: I'm using the unmodified version of HRose.exe(131), so I'm fixing the calculations to work with that client. If you have any suggestions or you find any bugs, post them down here.
Currently working on:
- Dodge (already fixed main calculation, fixing the bug were shields do not add dodge)
Known bugs:
- HP Generation(???)
I've got a question about this one, it seems like the server regenerates WAY faster then the client does, but the client only adds 1HP/sec or something like that, isn't this more of a clientside problem?
---------
Movement Speed:
Adjustments:
- Replaced the whole function with PY's one from osprose (22/06/'09 - 8PM)
- Added dexterity calculations to it. (22/06/'09 - 8PM)
- Fixed shoe calculations (22/06/'09 - 8PM)
(note: You'll have to add "unsigned int Mspd_base" in the STAT struct found in chartype.h)
- unsigned int CPlayer::GetMoveSpeed()
- {
- UINT mspeed = 425;
- if(!Status->CanRun)
- {
- Status->Stance = WALKING;
- }
- mspeed += UINT((Attr->Dex) * 0.85);
- switch(Status->Stance)
- {
- case WALKING: //walking
- mspeed = 200;
- break;
- case 1:
- case RUNNING: // running 476 - 489
- {
- if(items[6].count != 0)//Foot
- {
- UINT tspeed = GServer->EquipList[SHOE].Index[items[6].itemnum]->movespeed;
- UINT valspeed = tspeed - 65;
- mspeed += ((valspeed * 5) + (valspeed / 5));
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed with shoes on %i", mspeed);
- }
- }
- for(UINT i=0;i<12;i++)//cloth stats [from tomiz]
- {
- if(items[i].count != 0)
- {
- if(items[i].itemtype > 9)
- {
- Log(MSG_WARNING, "Char %s have equip invalid item: %i,%i", CharInfo->charname, items[i].itemtype, items[i].itemnum);
- continue;
- }
- if(GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[0] == MOVE_SPEED)
- {
- mspeed += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat1[1];
- }
- if(GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[0] == MOVE_SPEED)
- {
- mspeed += GServer->EquipList[items[i].itemtype].Index[items[i].itemnum]->stat2[1];
- }
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed %i after equipment stats for item in slot %i",mspeed,i);
- }
- }
- if(items[i].stats > 0 && items[i].stats < 500)
- {
- if(GServer->StatsList[items[i].stats].stat[0] == A_DASH)
- {
- mspeed += GServer->StatsList[items[i].stats].value[0];
- }
- if(GServer->StatsList[items[i].stats].stat[1] == A_DASH)
- {
- mspeed += GServer->StatsList[items[i].stats].value[1];
- }
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed %i after adding extra/gem stats for item in slot %i",mspeed,i);
- }
- }
- }
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed %i after adding all equipped items",mspeed);
- }
- UINT Extra = 0;
- for(UINT i=0;i<30;i++)
- {
- if(pskill[i] == 0)
- {
- continue;
- }
- CSkills* skill = GServer->GetSkillByID((pskill[i])+(pskilllvl[i]));
- if(skill == NULL)
- continue;
- for(UINT j = 0; j < 2; j++)
- {
- if(skill->buff[j] == sMoveSpeed || skill->buff[j] == sMoveSpeed2)
- {
- if(skill->value2[j] > 0)
- Extra += mspeed * skill->value2[j] / 100;
- if(skill->value1[j] > 0)
- Extra += skill->value1[j];
- }
- }
- }
- mspeed += Extra;
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed %i after adding passive skills", mspeed);
- }
- Stats->Mspd_base = mspeed;
- if(Status->Dash_up != 0xff)
- {
- mspeed += MagicStatus[Status->Dash_up].Value;
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Speed buff detected. amount: %i new move speed: %i",MagicStatus[Status->Dash_up].Value, mspeed);
- }
- }
- if(Status->Dash_down != 0xff)
- {
- mspeed -= MagicStatus[Status->Dash_down].Value;
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Speed DE-buff detected. amount: %i new move speed: %i", MagicStatus[Status->Dash_down].Value, mspeed);
- }
- }
- }
- break;
- case DRIVING: //cart or gear
- {
- //Log(MSG_INFO, "player is driving");
- float m_speed = 0;
- int patType = GServer->PatList.Index[items[135].itemnum]->type;
- //if(this->items[135].itemnum > 30 && this->items[135].itemnum < 40) //Castle gear body
- if(patType == 512)
- {
- m_speed = 1000;
- float mod1 =(float)GServer->PatList.Index[items[136].itemnum]->speed;
- mod1 /= 100; //engine
- float mod2 =(float)GServer->PatList.Index[items[137].itemnum]->speed;
- mod2 /= 100; // legs
- m_speed *= mod1;
- m_speed *= mod2;
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed %i riding a Castle Gear",m_speed);
- }
- }
- else if(patType == 511) //Cart body
- {
- m_speed = 1000;
- float mod1 =(float)GServer->PatList.Index[items[136].itemnum]->speed;
- mod1 /= 100; //engine
- float mod2 =(float)GServer->PatList.Index[items[137].itemnum]->speed;
- mod2 /= 100; //wheels
- m_speed *= mod1;
- m_speed *= mod2;
- if(GServer->PatList.Index[items[138].itemnum]->condition[1] == 23) // accessory
- m_speed +=(float)GServer->PatList.Index[items[138].itemnum]->modifier[1];
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Move speed %f riding a Cart",m_speed);
- }
- }
- else
- {
- Log(MSG_ERROR,"What the heck is this character driving? it is type %i", patType);
- }
- mspeed =(int)floor(m_speed);
- if(Session->codedebug) //Debug code
- {
- GServer->SendPM(this, "Final Speed: %i", mspeed);
- }
- Stats->Mspd_base = mspeed;
- }
- break;
- }
- return mspeed;
- }