2008年4月17日 星期四

[T007] 修正使用四轉技能無法登入的問題

方法1 跟 方法2 的結果是一樣的! 所以請選擇其中一種方法就可以囉!! ^^

方法 1. 請開啟你的PlayerPacket.cpp,並將下面程式碼全部取代
#include "PlayerPacket.h"
#include "PacketCreator.h"
#include "Player.h"
#include "Inventory.h"
#include "Skills.h"
#include "SkillsPacket.h" //for 4th job skills error 38 fix

void PlayerPacket::connectData(Player* player){
Packet packet = Packet();
packet.addHeader(0x4D);
packet.addInt(0); // Channel
packet.addBytes("0101853D4B11F4836B3DBA9A4FA1");
packet.addShort(-1);
packet.addInt(player->getPlayerid());
packet.addString(player->getName(), 12);
packet.addByte(0);
packet.addByte(player->getGender());
packet.addByte(player->getSkin());
packet.addInt(player->getEyes());
packet.addInt(player->getHair());
packet.addInt(0);
packet.addInt(0);
packet.addByte(player->getLevel());
packet.addShort(player->getJob());
packet.addShort(player->getStr());
packet.addShort(player->getDex());
packet.addShort(player->getInt());
packet.addShort(player->getLuk());
packet.addShort(player->getHP());
packet.addShort(player->getMHP());
packet.addShort(player->getMP());
packet.addShort(player->getMMP());
packet.addShort(player->getAp());
packet.addShort(player->getSp());
packet.addInt(player->getExp());
packet.addShort(player->getFame());
packet.addInt(player->getMap());
packet.addByte(player->getMappos());
packet.addByte(0x14);
packet.addInt(player->inv->getMesos());
packet.addByte(100);
packet.addByte(100);
packet.addByte(100);
packet.addByte(100);
packet.addByte(100);
for(int i=0; iinv->getEquipNum(); i++){
Equip* equip = player->inv->getEquip(i);
if(equip->pos<0){>type);
packet.addByte(1);
packet.addInt(equip->id);
packet.addShort(0);
packet.addBytes("8005BB46E61702");
packet.addShort(equip->slots); // slots
packet.addShort(equip->istr); // STR
packet.addShort(equip->idex); // DEX
packet.addShort(equip->iint); // INT
packet.addShort(equip->iluk); // LUK
packet.addShort(equip->ihp); // HP
packet.addShort(equip->imp); // MP
packet.addShort(equip->iwatk); // W.Atk
packet.addShort(equip->imatk); // M.Atk
packet.addShort(equip->iwdef); // W.def
packet.addShort(equip->imdef); // M.Def
packet.addShort(equip->iacc); // Acc
packet.addShort(equip->iavo); // Avo
packet.addShort(equip->ihand); // Hands
packet.addShort(equip->ispeed); // Speed
packet.addShort(equip->ijump); // Jump
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
}
}
packet.addShort(0);
for(int i=0; iinv->getEquipNum(); i++){
Equip* equip = player->inv->getEquip(i);
if(equip->pos>0){
packet.addByte((char)equip->pos);
packet.addByte(1);
packet.addInt(equip->id);
packet.addShort(0);
packet.addBytes("8005BB46E61702");
packet.addShort(equip->slots); // slots
packet.addShort(equip->istr); // STR
packet.addShort(equip->idex); // DEX
packet.addShort(equip->iint); // INT
packet.addShort(equip->iluk); // LUK
packet.addShort(equip->ihp); // HP
packet.addShort(equip->imp); // MP
packet.addShort(equip->iwatk); // W.Atk
packet.addShort(equip->imatk); // M.Atk
packet.addShort(equip->iwdef); // W.def
packet.addShort(equip->imdef); // M.Def
packet.addShort(equip->iacc); // Acc
packet.addShort(equip->iavo); // Avo
packet.addShort(equip->ihand); // Hands
packet.addShort(equip->ispeed); // Speed
packet.addShort(equip->ijump); // Jump
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
packet.addShort(0);
}
}
packet.addByte(0);
for(int j=2; j<=5; j++){ for(int i=0; iinv->getItemNum(); i++){
Item* item = player->inv->getItem(i);
if(item->inv == j){
packet.addByte((char)item->pos);
packet.addByte(2);
packet.addInt(item->id);
packet.addShort(0);
packet.addBytes("8005BB46E61702");
packet.addShort(item->amount); // slots
packet.addInt(0);
if(ISSTAR(item->id)){
packet.addInt(2);
packet.addShort(0x54);
packet.addByte(0);
packet.addByte(0x34);
}
}
}
packet.addByte(0);

}
packet.addShort(0); //Skills
packet.addInt(0);
packet.addInt(0);
packet.addInt(0);
packet.addShort(0);
for(int i=0; i<15; i="0;">skills->getSkillsNum(); i++){
SkillsPacket::addSkill(player, player->skills->getSkillID(i), player->skills->getSkillLevel(player->skills->getSkillID(i)));
}
}

void PlayerPacket::newHP(Player* player, short hp){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addByte(0);
packet.addShort(0);
packet.addShort(4);
packet.addByte(0);
packet.addShort(hp);
packet.packetSend(player);
}

void PlayerPacket::newMP(Player* player, short mp, bool is){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addByte(is);
packet.addShort(0);
packet.addShort(0x10);
packet.addByte(0);
packet.addShort(mp);
packet.packetSend(player);
}

void PlayerPacket::newEXP(Player* player, int exp){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addShort(0);
packet.addShort(0);
packet.addShort(1);
packet.addInt(exp);
packet.packetSend(player);
}


void PlayerPacket::showKeys(Player* player, int keys[90]){
Packet packet = Packet();
packet.addHeader(0xf6);
packet.addByte(0);
for(int i=0; i<90; packet =" Packet();">getSp());
packet.packetSend(player);
}

void PlayerPacket::setJob(Player* player){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addShort(0);
packet.addInt(0x20);
packet.addShort(player->getJob());
packet.packetSend(player);
}

void PlayerPacket::newHair(Player* player){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addShort(0);
packet.addInt(0x4);
packet.addInt(player->getHair());
packet.packetSend(player);
}

void PlayerPacket::newEyes(Player* player){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addShort(0);
packet.addInt(0x2);
packet.addInt(player->getEyes());
packet.packetSend(player);
}

void PlayerPacket::newSkin(Player* player){
Packet packet = Packet();
packet.addHeader(0x23);
packet.addShort(0);
packet.addInt(0x1);
packet.addByte(player->getSkin());
packet.packetSend(player);
}


方法 2:

自己動手修改囉!
Step 1.首先在最放上方新增一個,原作者建議放在 #include "Skills.h" 後面 (基本上沒差)
#include "SkillsPacket.h"

Step 2.將下面這五行程式碼刪除
packet.addShort(player->skills->getSkillsNum());
for(int i=0; iskills->getSkillsNum(); i++){
packet.addInt(player->skills->getSkillID(i));
packet.addInt(player->skills->getSkillLevel(player->skills->getSkillID(i)));
}
並取代成packet.addShort(0);Step 3. 在 packet.addBytes("90633A0DC55DC801");
packet.packetSend(player);
的後面新增 for(int i=0; iskills->getSkillsNum(); i++){
SkillsPacket::addSkill(player, player->skills->getSkillID(i), player->skills->getSkillLevel(player->skills->getSkillID(i)));
}


基本上就修改這幾個地方囉! :)

所以最後看起來應該會像下面這樣
//Skills
/*
packet.addShort(player->skills->getSkillsNum());
for(int i=0; iskills->getSkillsNum(); i++){
packet.addInt(player->skills->getSkillID(i));
packet.addInt(player->skills->getSkillLevel(player->skills->getSkillID(i)));
}

*/
//End 以上皆刪除

packet.addShort(0); // 我們新增的code
packet.addInt(0);
packet.addInt(0);
packet.addInt(0);
packet.addShort(0);
for(int i=0; i<15; color="blue">for(int i=0; iskills->getSkillsNum(); i++){
SkillsPacket::addSkill(player, player->skills->getSkillID(i), player->skills->getSkillLevel(player->skills->getSkillID(i)));
}
這個版本的好處就是,下次登入時四轉技能還在喔~^^ 比起我上個版本要好得多了!

原文網址:http://forum.ragezone.com/f427/release-fix-logging-characters-have-4th-job-skills-386505/
附註:如果有使用我之前解決無法登入的方法,請至Player.cpp中將 MySQL::delete4thSkills(getPlayerid()); 這段程式碼刪掉即可!

沒有留言: