int GetCreateMobTrade(int mob, MSG_CreateMobTrade *sm) { sm->Type = _MSG_CreateMobTrade; strncpy(sm->MobName, pMob[mob].MOB.MobName, NAME_LENGTH); if(mob >= MAX_USER) { Log("err,getcreatemob request by non player %d", pMob[mob].MOB.MobName, 0); return 0; } if (mob < MAX_USER) { int ck = GetCurKill(mob); int tk = GetTotKill(mob); unsigned char cv = ck; unsigned char cv1 = tk%256; unsigned char cv2 = tk/256; sm->MobName[13] = cv; sm->MobName[14] = cv1; sm->MobName[15] = cv2; int chaos = GetPKPoint(mob); cv = chaos; sm->MobName[12] = cv; } sm->PosX = pMob[mob].TargetX; sm->PosY = pMob[mob].TargetY; sm->Size = sizeof(MSG_CreateMobTrade); sm->ID = ESCENE_FIELD; sm->MobID = mob; sm->ClientTick = CurrentTime; memcpy(&sm->Score, &pMob[mob].MOB.CurrentScore, sizeof(STRUCT_SCORE)); sm->Guild = pMob[mob].MOB.Guild; if (pMob[mob].GuildDisable == 1) sm->Guild = 0; if (mob >= MAX_USER) sm->Score.Ac = pMob[mob].MOB.Clan != 4; sm->CreateType = 0; if (pMob[mob].MOB.GuildLevel == 9) sm->CreateType = sm->CreateType | 0x80; if (pMob[mob].MOB.GuildLevel != 0) sm->CreateType = sm->CreateType | 0x40; int selfdead=0; for (int i = 0; i < MAX_EQUIP; i++) { STRUCT_ITEM *item = &pMob[mob].MOB.Equip[i]; sm->Equip[i] = BASE_VisualItemCode(item, i); sm->AnctCode[i] = BASE_VisualAnctCode(item); if (i == 14 && sm->Equip[i] >= 2360 && sm->Equip[i] < 2390 && pMob[mob].MOB.Equip[i].stEffect[0].sValue <= 0) { sm->Equip[i] = 0; selfdead = 1; continue; } if (i == 14 && sm->Equip[i] >= 2360 && sm->Equip[i] < 2390) { int sanc = pMob[mob].MOB.Equip[i].stEffect[1].cEffect; sanc = sanc / 10; if (sanc > 13) sanc = 13; if (sanc < 0) sanc = 0; sanc = sanc << 12; sm->Equip[i] = sm->Equip[i] + sanc; continue; } } strncpy(sm->Tab, pMob[mob].Tab, 26); strncpy(sm->Desc, pUser[mob].AutoTrade.Title, MAX_AUTOTRADETITLE-1); GetAffect(sm->Affect,pMob[mob].Affect); return selfdead; }
int GetCreateMob(int mob, MSG_CreateMob *sm) { memset(sm, 0, sizeof(MSG_CreateMob)); sm->Type = _MSG_CreateMob; strncpy(sm->MobName, pMob[mob].MOB.MobName, NAME_LENGTH); if (mob < MAX_USER) { int ck = GetCurKill(mob); int tk = GetTotKill(mob); unsigned char cv = ck; unsigned char cv1 = tk % 256; unsigned char cv2 = tk / 256; sm->MobName[13] = cv; sm->MobName[14] = cv1; sm->MobName[15] = cv2; int chaos = GetPKPoint(mob); int gv = GetGuilty(mob); if (gv > 0) chaos = 0; cv = chaos; sm->MobName[12] = chaos; } sm->PosX = pMob[mob].TargetX; sm->PosY = pMob[mob].TargetY; sm->Size = sizeof(MSG_CreateMob); sm->ID = ESCENE_FIELD; sm->MobID = mob; sm->ClientTick = CurrentTime; sm->Score = pMob[mob].MOB.CurrentScore; sm->Guild = pMob[mob].MOB.Guild; sm->GuildMemberType = pMob[mob].MOB.GuildLevel; if (pMob[mob].GuildDisable == 1) { sm->Guild = 0; sm->GuildMemberType = 0; } if (mob >= MAX_USER) { if (pMob[mob].MOB.Clan == 4) sm->Score.Ac = 0; else sm->Score.Ac = 1; } sm->CreateType = 0; if (pMob[mob].MOB.GuildLevel == 9) sm->CreateType = sm->CreateType | 0x80; else if (pMob[mob].MOB.GuildLevel >= 6) sm->CreateType = sm->CreateType | 0x40; sm->Hold = pMob[mob].extra.Hold; strncpy(sm->Tab, pMob[mob].Tab, 26); int selfdead = 0; int xx = pMob[mob].TargetX; int yy = pMob[mob].TargetY; for (int i = 0; i < MAX_EQUIP; i++) { STRUCT_ITEM *item = &pMob[mob].MOB.Equip[i]; sm->Equip[i] = BASE_VisualItemCode(item, i); sm->AnctCode[i] = BASE_VisualAnctCode(item); if (i == 14 && sm->Equip[i] >= 2360 && sm->Equip[i] < 2390 && pMob[mob].MOB.Equip[i].stEffect[0].sValue <= 0) { sm->Equip[i] = 0; selfdead = 1; continue; } if (i == 14 && sm->Equip[i] >= 2360 && sm->Equip[i] < 2390) { int sanc = pMob[mob].MOB.Equip[i].stEffect[1].cEffect; sanc = sanc / 10; if (sanc > 13) sanc = 13; if (sanc < 0) sanc = 0; sanc = sanc << 12; sm->Equip[i] = sm->Equip[i] + sanc; continue; } } GetAffect(sm->Affect, pMob[mob].Affect); if (BrState != 0 && xx >= 2604 && yy >= 1708 && xx <= 2648 && yy <= 1744) { memset(sm->MobName, 0, NAME_LENGTH); // MOBNAME_LEGNTH = 16 strncpy(sm->MobName, "??????", 6); sm->Equip[15] = 0; sm->Guild = 0; } return selfdead; }
void GridMulticast(int tx, int ty, MSG_STANDARD *msg, int skip) { int SizeY = VIEWGRIDY; int SizeX = VIEWGRIDX; int StartX = tx - HALFGRIDX; int StartY = ty - HALFGRIDY; if (StartX + SizeX >= MAX_GRIDX) SizeX = SizeX - (StartX + SizeX - MAX_GRIDX); if (SizeY + StartY >= MAX_GRIDY) SizeY = SizeY - (StartY + SizeY - MAX_GRIDY); if (StartX < 0) { StartX = 0; SizeX = SizeX + StartX; } if (StartY < 0) { StartY = 0; SizeY = SizeY + StartY; } int sx1 = StartX; int sy1 = StartY; int sx2 = StartX + SizeX; int sy2 = StartY + SizeY; for (int y = sy1; y < sy2; y++) { for (int x = sx1; x < sx2; x++) { int tmob = pMobGrid[y][x]; if (tmob <= 0 || tmob == skip) continue; if (pMob[tmob].Mode == MOB_EMPTY) { int Unk = 0; continue; } if (msg != NULL && tmob < MAX_USER) { if (msg->Type == _MSG_CreateMob) { int xx = ((MSG_CreateMob*)msg)->PosX; int yy = ((MSG_CreateMob*)msg)->PosY; if(xx >= 896 && yy >= 1405 && xx <= 1150 && yy <= 1538) { STRUCT_ITEM hcitem; memset(&hcitem, 0, sizeof(STRUCT_ITEM)); hcitem.sIndex = 3505; ((MSG_CreateMob*)msg)->Equip[1] = BASE_VisualItemCode(&hcitem, 1); ((MSG_CreateMob*)msg)->AnctCode[1] = BASE_VisualAnctCode(&hcitem); hcitem.sIndex = 3999; ((MSG_CreateMob*)msg)->Equip[15] = BASE_VisualItemCode(&hcitem, 15); ((MSG_CreateMob*)msg)->AnctCode[15] = BASE_VisualAnctCode(&hcitem); } } if (msg->Type == _MSG_CNFMobKill) { ((MSG_CNFMobKill*)msg)->Exp = pMob[tmob].MOB.Exp; ((MSG_CNFMobKill*)msg)->Hold = pMob[tmob].extra.Hold; int Segment = pMob[tmob].CheckGetLevel(); if (Segment >= 1 && Segment <= 4) { if (Segment == 4) { SetCircletSubGod(tmob); SendClientMessage(tmob, g_pMessageStringTable[_NN_Level_Up]); if(pMob[tmob].extra.ClassMaster == MORTAL) DoItemLevel(tmob); } if (Segment == 3) SendClientMessage(tmob, g_pMessageStringTable[_NN_3_Quarters_Bonus]); if (Segment == 2) SendClientMessage(tmob, g_pMessageStringTable[_NN_2_Quarters_Bonus]); if (Segment == 1) SendClientMessage(tmob, g_pMessageStringTable[_NN_1_Quarters_Bonus]); SendScore(tmob); SendEmotion(tmob, 14, 3); if (Segment == 4) { SendEtc(tmob); int PKPoint = GetPKPoint(tmob) + 5; SetPKPoint(tmob, PKPoint); MSG_CreateMob sm_lupc; memset(&sm_lupc, 0, sizeof(MSG_CreateMob)); GetCreateMob(tmob, &sm_lupc); GridMulticast(pMob[tmob].TargetX, pMob[tmob].TargetY, (MSG_STANDARD*)&sm_lupc, 0); sprintf(temp, "lvl %s level up to %d", pMob[tmob].MOB.MobName, pMob[tmob].MOB.BaseScore.Level); Log(temp, pUser[tmob].AccountName, pUser[tmob].IP); } } } pUser[tmob].cSock.AddMessage((char*)msg, msg->Size); } } } }