2008年4月21日 星期一

[T007] 修正變換髮型造成當機的錯誤

針對[T007] 讓倉庫管理員變成造型師 這篇作修正的!

原本的code裡面不小心寫到不存在的"髮型",所以當你選到那個地方的時候,就會造成錯誤囉!
只要把下面紅色的地方修正即可!


// add by squall 2008-08-04-14
void NPCsScripts::npc_1002005(NPC* npc){
int state = npc->getState();
int skins[] = {0, 1, 2, 3, 4};
int hairs[] = {31000, 31010, 31020, 31030, 31040, 31050, 31060, 31070, 31080, 31090, 31100, 31110, 31120, 31130, 31140, 31150, 31160, 31170, 31180, 31190, 31200, 31210, 31220, 31230, 31240, 31250, 31260, 31270, 31280, 31290, 31300, 31310, 31320, 31330, 31340, 31350, 31400, 31410, 31420, 31430, 31440, 31450, 31460, 31470, 31480, 31490, 31510, 31520, 31530, 31540, 31550, 31560, 31570, 31580, 31590, 31600, 31610, 31620, 31630, 31640, 31650, 31680, 31690, 31700, 31710, 31720, 31730};
int hairscolor[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};

int eyes[] = {21000, 21001, 21002, 21003, 21004, 21005, 21006, 21007, 21008, 21009, 21010, 21011, 21012, 21013, 21014, 21016, 21017, 21018, 21019, 21020, 21022};
if(state == 0){
npc->addText("#L0#變換膚色#l\r\n#L1#變換髮型#l\r\n#L2#變換髮型顏色#l\r\n#L3#變換眼睛#l\r\n#L4#變換眼睛顏色#l");
npc->sendSimple();
}
else if(state == 1){
int type = npc->getSelected();
npc->setVariable("type", type);
if(type == 0){
npc->sendStyle(skins, 5);
}
else if(type == 1){
npc->sendStyle(hairs, 67);
}
else if(type == 2){
int cur = npc->getPlayerHair()/10*10;
int colors[] = {cur, cur+1, cur+2, cur+3, cur+4, cur+5, cur+6, cur+7};
npc->sendStyle(colors, hairscolor[npc->getPlayerHair()%1000/10]);
}
else if(type == 3){
npc->sendStyle(eyes, 21);
}
else if(type == 4){
int cur = npc->getPlayerEyes()%100+20000;
int colors[] = {cur, cur+100, cur+200, cur+300, cur+400, cur+500, cur+600, cur+700};
npc->sendStyle(colors, 8);
}
else{
npc->end();
}
}
else if(state == 2){
npc->end();
int type = npc->getVariable("type");
if(type == 0){
npc->setStyle(skins[npc->getSelected()]);
}
else if(type == 1){
npc->setStyle(hairs[npc->getSelected()]);
}
else if(type == 2){
npc->setStyle(npc->getPlayerHair()/10*10 + npc->getSelected());
}
else if(type == 3){
npc->setStyle(eyes[npc->getSelected()]);
}
else if(type == 4){
npc->setStyle(20000+npc->getPlayerEyes()%100 + npc->getSelected()*100);
}
else
npc->setStyle(eyes[npc->getSelected()]);
}

}

沒有留言: