so I tested my buff code and it works... partly. The buff icons appear and the buff animations also appear on my character.
What doesn't happen is actually getting any change to my move speed or dodge rate. they both stay the same.
So this means I'm on the right track with the code that I added last week but it's just not completely doing what it should.
tested by adding a little player command to gmcmds.cpp
- if (strcmp(command, "buffme")==0)
- {
- CSkills* ThisSkill = GetSkillByID( 3205 );
- thisclient->UseBuffSkillQSD(thisclient, ThisSkill);
- }
This is set to just apply skill 3205 to the player. It's a GM skill that buffs move speed and dodge rate.
If you would like to add this code put it directly after the broadcast command like this
- if (strcmp(command, "b")==0)
- {
- if(Config.Command_Broadcast > thisclient->Session->accesslevel)
- return true;
- time_t seconds;
- seconds = time (NULL);
- if((thisclient->CharInfo->LastGlobal+Config.Command_GlobalTime) <= seconds || thisclient->Session->accesslevel > 100)
- {
- thisclient->CharInfo->LastGlobal = time (NULL);
- char outputmsg[200];
- sprintf( outputmsg, "%s %s", Config.Command_GlobalPrefix, &P->Buffer[3] );
- Log( MSG_INFO, "%s> %s %s", thisclient->CharInfo->charname, Config.Command_GlobalPrefix, &P->Buffer[3]);
- SendGlobalMSG(thisclient, outputmsg);
- }
- else
- {
- long int remaining = (Config.Command_GlobalTime-(seconds-thisclient->CharInfo->LastGlobal));
- char buffer2[200];
- sprintf ( buffer2, "Please wait %i seconds before sending another global message.", remaining );
- SendPM(thisclient, buffer2);
- }
- return true;
- }
- if (strcmp(command, "buffme")==0)
- {
- CSkills* ThisSkill = GetSkillByID( 3205 );
- thisclient->UseBuffSkillQSD(thisclient, ThisSkill);
- }
Additionally it will be really easy to just do it this way and use an area check to make sure it only works when standing near the specified NPC. Then we don't need to worry about CON, LTB or QSD editing
I will be back with the other half of the puzzle later
OK so it IS applying the correct buff in the server. It's just not getting to the client to display it.
Also I've discovered that it's probably not such a hot idea to call the AddBuff() function with an INT of 1 like we were doing
- // use buff skill from QSD
- void CCharacter::UseBuffSkillQSD( CCharacter* Target, CSkills* skill, bool deBuff )
- {
- bool bflag = false;
- bflag = GServer->AddBuffs( skill, Target, 1 );
- //Log(MSG_INFO,"In UseBuffSkillsQSD, skill %i, nbuffs %i, bflag %i to %u",skill->id,skill->nbuffs,bflag,Target->clientid);
- if(skill->nbuffs > 0 && bflag == true)
- {
- BEGINPACKET( pak, 0x7b5 );
- ADDWORD ( pak, Target->clientid );
- ADDWORD ( pak, Target->clientid );
- ADDWORD ( pak, skill->id );
- ADDWORD ( pak, 1 );
- ADDBYTE ( pak, skill->nbuffs );
- GServer->SendToVisible( &pak, Target );
- //Log(MSG_DEBUG,"Buff Skill. buffs applied 1");
- }
- if (deBuff) return;
- BEGINPACKET( pak, 0x7b9);
- ADDWORD ( pak, Target->clientid);
- ADDWORD ( pak, skill->id);
- ADDWORD ( pak, 1);
- GServer->SendToVisible( &pak, this );
- //Log(MSG_DEBUG,"Buff Skill. buffs applied 2 nbuffs = %i",skill->nbuffs);
- //Log(MSG_INFO,"UseBuffSkillQSD: Target HP = %i",Target->Stats->HP);
- }
try this instead
- bflag = GServer->AddBuffs( skill, Target, 5000 );
So that gets a nice big buff applied (in the server) now we need to let the client know that it has happened. More in a bit as soon as I track the code through