⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 script.pas

📁 RO模拟器!!适合玩仙境传说的玩家们呦~
💻 PAS
📖 第 1 页 / 共 5 页
字号:
						3:  l := $20;  //Left Hand
						4:  l := $2;   //Right Hand
						5:  l := $4;   //Robe
						6:  l := $40;  //Foot
						7:  l := $8;   //Acc1
						8:  l := $80;  //Acc2
						9:  l := $200; //Head2
						10: l := $1;   //Head
						else l := 0;
					end;
{NPC僀儀儞僩捛壛}
					j := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[2]);
{NPC僀儀儞僩捛壛僐僐傑偱}
					if (j < 0) or (j > 10) then j := 0;
					if l <> 0 then begin
						for i := 1 to 100 do begin
							if (tc.Item[i].ID <> 0) and (tc.Item[i].Amount <> 0) and tc.Item[i].Data.IEquip and
								 ((tc.Item[i].Equip and l) = l) and (tc.Item[i].Refine < 10) then begin
								//憰旛夝彍
                                reset_skill_effects(tc);
								WFIFOW(0, $00ac);
								WFIFOW(2, i);
								WFIFOW(4, tc.Item[i].Equip);
								WFIFOB(6, 1);
           			tc.Socket.SendBuf(buf, 7);
                                remove_equipcard_skills(tc, i);
								//Refine sucess
								if k = 0 then begin
									tc.Item[i].Refine := j;
									//僄僼僃僋僩
									WFIFOW(0, $0188);
									WFIFOW(2, 0);
									WFIFOW(4, i);
									WFIFOW(6, tc.Item[i].Refine);
									tc.Socket.SendBuf(buf, 8);
									//嵞憰旛
									WFIFOW(0, $00aa);
									WFIFOW(2, i);
									WFIFOW(4, tc.Item[i].Equip);
									WFIFOB(6, 1);
									tc.Socket.SendBuf(buf, 7);
								//Refine failure, kiss weapon goodbye
								end else begin
									tc.Item[i].Refine := 0;
									tc.Item[i].Equip := 0;
									//僄僼僃僋僩
									WFIFOW(0, $0188);
									WFIFOW(2, 1);
									WFIFOW(4, i);
									WFIFOW(6, word(tc.Item[i].Refine));
									tc.Socket.SendBuf(buf, 8);
									if k = 1 then begin
										//傾僀僥儉尭彮
										Dec(tc.Item[i].Amount, 1);
										if tc.Item[i].Amount = 0 then tc.Item[i].ID := 0;
										WFIFOW( 0, $00af);
										WFIFOW( 2, i);
										WFIFOW( 4, 1);
										tc.Socket.SendBuf(buf, 6);
										//廳検曄峏
										tc.Weight := tc.Weight - tc.Item[i].Data.Weight * cardinal(1);
										SendCStat1(tc, 0, $0018, tc.Weight);
									end;
					  		end;
						  end;
						end;
 						CalcStat(tc);
						WFIFOW(0, $019b);
						WFIFOL(2, tc.CID);
            if k = 0 then WFIFOL(6, 3) else WFIFOL(6, 2);
						//僷働憲怣
						SendBCmd(tc.MData, tc.Point, 10, tc);
						SendCStat(tc);
					end;
					Inc(tc.ScriptStep);
				end;
      30: //equipmenu  --->Thanks goes to Melz -- for fixing the translation!! <---
				begin
					if value = 0 then begin
						tn.Script[tc.ScriptStep].Data2[0] := '[Head - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[1] := '[Body - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[2] := '[Left Hand - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[3] := '[Right Hand - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[4] := '[Robe - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[5] := '[Foot - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[6] := '[Accessory1 - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[7] := '[Accessory2 - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[8] := '[Head2 - Not Equipped]';
						tn.Script[tc.ScriptStep].Data2[9] := '[Head3 - Not Equipped]';
            for i := 1 to 100 do begin
	  					if (tc.Item[i].ID <> 0) and (tc.Item[i].Amount <> 0) and (tc.Item[i].Equip <> 0) then begin
                if tc.Item[i].Refine > 0 then str := '(+' + IntToStr(tc.Item[i].Refine) + ')'
                  else str := '';
                str := tc.Item[i].Data.JName + str;
                case tc.Item[i].Equip of
									$1: //摢壓抜
										tn.Script[tc.ScriptStep].Data2[9] := str;
									$2: //塃庤
										tn.Script[tc.ScriptStep].Data2[3] := str;
									$4: //尐
										tn.Script[tc.ScriptStep].Data2[4] := str;
									$8: //傾僋僙1
										tn.Script[tc.ScriptStep].Data2[6] := str;
									$10: //奪
										tn.Script[tc.ScriptStep].Data2[1] := str;
                  $20: //嵍庤
										tn.Script[tc.ScriptStep].Data2[2] := str;
									$22: //椉庤晲婍
										begin
											tn.Script[tc.ScriptStep].Data2[2] := str;
											tn.Script[tc.ScriptStep].Data2[3] := str;
										end;
									$40: //孋
										tn.Script[tc.ScriptStep].Data2[5] := str;
									$80: //傾僋僙2
										tn.Script[tc.ScriptStep].Data2[7] := str;
									$100: //摢忋抜
										tn.Script[tc.ScriptStep].Data2[0] := str;
									$200: //摢拞抜
										tn.Script[tc.ScriptStep].Data2[8] := str;
									$201: //摢拞壓抜
										begin
											tn.Script[tc.ScriptStep].Data2[8] := str;
											tn.Script[tc.ScriptStep].Data2[9] := str;
										end;
									$300: //摢忋拞抜
										begin
											tn.Script[tc.ScriptStep].Data2[0] := str;
											tn.Script[tc.ScriptStep].Data2[8] := str;
										end;
									$301: //摢忋拞壓抜
										begin
											tn.Script[tc.ScriptStep].Data2[0] := str;
											tn.Script[tc.ScriptStep].Data2[8] := str;
											tn.Script[tc.ScriptStep].Data2[9] := str;
										end;
								end;
							end;
						end;
						for i := 0 to 9 do begin
							if i = 0 then
								str := tn.Script[tc.ScriptStep].Data2[i]
							else
								str := str + ':' + tn.Script[tc.ScriptStep].Data2[i];
						end;
						i := Length(str);
						WFIFOW(0, $00b7);
						WFIFOW(2, i + 8);
						WFIFOL(4, tn.ID);
						WFIFOS(8, str, i);
						tc.Socket.SendBuf(buf[0], i + 8);
						break;
					end else begin
						if value = $FF then begin
              //EqLock夝彍
              if tc.EqLock = true then tc.EqLock := false;
							tc.ScriptStep := $FFFF;
							break;
						end;
{NPC僀儀儞僩捛壛}
						if (Copy(tn.Script[tc.ScriptStep].Data1[0], 1, 1) <> '\') then begin
							tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(value);
						end else begin
							ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[0]] := IntToStr(value);
						end;
{NPC僀儀儞僩捛壛僐僐傑偱}
						case value of
							1:  l := $100; //摢忋抜
							2:  l := $10;  //奪
							3:  l := $20;  //嵍庤
							4:  l := $2;   //塃庤
							5:  l := $4;   //尐
							6:  l := $40;  //孋
							7:  l := $8;   //傾僋僙1
							8:  l := $80;  //傾僋僙2
							9:  l := $200; //摢忋抜
							10: l := $1;   //摢壓抜
							else l := 0;
						end;
						if l <> 0 then begin
							k := 0;
							j := 99;
							for i := 1 to 100 do begin
	    					if (tc.Item[i].ID <> 0) and (tc.Item[i].Amount <> 0) and tc.Item[i].Data.IEquip and
  		  					 ((tc.Item[i].Equip and l) = l) then begin
                  if tc.Item[i].Data.IType = 4 then begin
                    j := tc.Item[i].Data.wLV;
                  end else begin
                    j := 0;
                  end;
                  k := i;
                  break;
                end;
              end;
{NPC僀儀儞僩捛壛}
							if (Copy(tn.Script[tc.ScriptStep].Data1[1], 1, 1) <> '\') then begin
								tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(j);
							end else begin
								ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[1]] := IntToStr(j);
							end;
							if (Copy(tn.Script[tc.ScriptStep].Data1[2], 1, 1) <> '\') then begin
								if k <> 0 then
									tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[2]] := IntToStr(tc.Item[i].Refine)
								else
									tc.Flag.Values[tn.Script[tc.ScriptStep].Data1[2]] := '0';
							end else begin
								if k <> 0 then
									ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[2]] := IntToStr(tc.Item[i].Refine)
								else
									ServerFlag.Values[tn.Script[tc.ScriptStep].Data1[2]] := '0';
							end;
{NPC僀儀儞僩捛壛僐僐傑偱}
						end;
  					value := 0;
					end;
					Inc(tc.ScriptStep);
				end;
			31: //lockitem
				begin
				    i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);
					if i = 0 then tc.EqLock := false
					else if i = 1 then tc.EqLock := true;
					Inc(tc.ScriptStep);
				end;
			32: //hcolor
				begin
{NPC僀儀儞僩捛壛}
					i := ConvFlagValue(tc, tn.Script[tc.ScriptStep].Data1[0], true);
{NPC僀儀儞僩捛壛僐僐傑偱}
					if (i >= 0) then begin
						tc.HairColor := i;
            UpdateLook(tc.MData, tc, 6, i, 0, true);
					end;
					Inc(tc.ScriptStep);
				end;
{敮怓曄峏捛壛僐僐傑偱}
{NPC僀儀儞僩捛壛}
			33: //callmob
				begin
					ts := TMob.Create;
					with ts do begin
						Map := tn.Script[tc.ScriptStep].Data1[0];
						Point.X := tn.Script[tc.ScriptStep].Data3[0];
						Point.Y := tn.Script[tc.ScriptStep].Data3[1];
						if (Point.X = 0) and (Point.Y = 0) then begin
							j := 0;
							repeat
								Point.X := Random(tm.Size.X - 2) + 1;
								Point.Y := Random(tm.Size.Y - 2) + 1;
								Inc(j);
							until (tm.gat[Point.X, Point.Y] and 1 <> 0) or (j = 100);
						end;
						if (j = 100) then continue;

						Name := tn.Script[tc.ScriptStep].Data1[1];
						JID := tn.Script[tc.ScriptStep].Data3[2];
						Data := MobDB.IndexOfObject(ts.JID) as TMobDB;
						ID := NowMobID;
						Inc(NowMobID);
						//僀儀儞僩愝掕
						if (tn.Script[tc.ScriptStep].Data2[0] = '') then Event := 0
						else Event := StrToInt(tn.Script[tc.ScriptStep].Data2[0]);

						Dir := Random(8);
						HP := Data.HP;
						Speed := Data.Speed;
						SpawnDelay1 := $7FFFFFFF;
						SpawnDelay2 := 0;
						SpawnType := 0;
						SpawnTick := 0;

						isLooting := False;
						for j:= 1 to 10 do begin
							Item[j].ID := 0;
							Item[j].Amount := 0;
							Item[j].Equip := 0;
							Item[j].Identify := 0;
							Item[j].Refine := 0;
							Item[j].Attr := 0;
							Item[j].Card[0] := 0;
							Item[j].Card[1] := 0;
							Item[j].Card[2] := 0;
							Item[j].Card[3] := 0;
						end;

						if (tn.Script[tc.ScriptStep].Data3[3] = 0) then begin
							if Data.isDontMove then
								MoveWait := 4294967295
							else
								MoveWait := Tick + 5000 + Cardinal(Random(10000));
							isActive := ts.Data.isActive;
						end else begin
							MoveWait := timeGetTime();
							isActive := true;
						end;
						ATarget := 0;
						ATKPer := 100;
						DEFPer := 100;
						DmgTick := 0;
						Element := Data.Element;

						for j := 0 to 31 do begin
							EXPDist[j].CData := nil;
							EXPDist[j].Dmg := 0;
						end;
						if Data.MEXP <> 0 then begin
							for j := 0 to 31 do begin
								MVPDist[j].CData := nil;
								MVPDist[j].Dmg := 0;
							end;
							MVPDist[0].Dmg := Data.HP * 30 div 100; //FA偵30%壛嶼
						end;
						isSummon := True;

						tm.Mob.AddObject(ID, ts);
						tm.Block[Point.X div 8][Point.Y div 8].Mob.AddObject(ID, ts);

						//廃埻偵憲怣
						ZeroMemory(@buf[0], 41);
						WFIFOW( 0, $007c);
						WFIFOL( 2, ID);
						WFIFOW( 6, Speed);
						WFIFOW( 8, Stat1);
						WFIFOW(10, Stat2);
						WFIFOW(20, JID);
						WFIFOM1(36, Point, Dir);
						SendBCmd(tm,Point,41,nil,true);
						Inc(tc.ScriptStep);
					end;
				end;
			34: //broadcast
				begin
					l := tn.Script[tc.ScriptStep].Data3[0];
					str := tn.Script[tc.ScriptStep].Data1[0] + chr(0);
					i := AnsiPos('$[', str);
					while i <> 0 do begin
						j := AnsiPos(']', Copy(str, i + 2, 256));
						if j <= 1 then break;
						if (Copy(str, i + 2, 1) = '$') then begin
							str := Copy(str, 1, i - 1) + tc.Flag.Values[Copy(str, i + 2, j - 1)]  + Copy(str, i + j + 2, 256);
						end else if (Copy(str, i + 2, 2) = '\$') then begin
							str := Copy(str, 1, i - 1) + ServerFlag.Values[Copy(str, i + 2, j - 1)]  + Copy(str, i + j + 2, 256);
						end else begin
							k := ConvFlagValue(tc, Copy(str, i + 2, j - 1), true);
							if k <> -1 then begin
								str := Copy(str, 1, i - 1) + IntToStr(k) + Copy(str, i + j + 2, 256);
							end else begin
								str := Copy(str, 1, i - 1) + Copy(str, i + j + 2, 256);
							end;
						end;
						i := AnsiPos('$[', str);
					end;
					str := StringReplace(str, '$codeversion', CodeVersion, [rfReplaceAll]);
					str := StringReplace(str, '$charaname', tc.Name, [rfReplaceAll]);
          str := StringReplace(str, '$guildname', GetGuildName(tn), [rfReplaceAll]);
          str := StringReplace(str, '$guildmaster', GetGuildMName(tn), [rfReplaceAll]);
          str := StringReplace(str, '$edegree', IntToStr(GetGuildEDegree(tn)), [rfReplaceAll]);
          str := StringReplace(str, '$etrigger', IntToStr(GetGuildETrigger(tn)), [rfReplaceAll]);
          str := StringReplace(str, '$ddegree', IntToStr(GetGuildDDegree(tn)), [rfReplaceAll]);
          str := StringReplace(str, '$dtrigger', IntToStr(GetGuildDTrigger(tn)), [rfReplaceAll]);
					str := StringReplace(str, '$$', '$', [rfReplaceAll]);
					str := StringReplace(str, '\\', '\', [rfReplaceAll]);
					if ((l mod 100) div 10 = 0) then str := tn.Name + ' : ' + str;
					if (l div 100 = 1) then str := 'blue' + str;
					w := Length(str) + 4;
					WFIFOW(0, $009a);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -