代码
//大七 2016年6月23日23:17:23 unit Q_MRQD; interface uses Classes, SysUtils, DateUtils; procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); implementation procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); begin Main2(Npc,Player,Args); end; procedure Main2(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); const S = [[ %s %s %s %s %s %s %s <{I=$01;F=DaysSigned.Data}/@QD($01)> <{I=$11;F=DaysSigned.Data}/@QD($11)> <{I=$21;F=DaysSigned.Data}/@QD($21)> <{I=$31;F=DaysSigned.Data}/@QD($31)> <{I=$41;F=DaysSigned.Data}/@QD($41)> <{I=$51;F=DaysSigned.Data}/@QD($51)> <{I=$61;F=DaysSigned.Data}/@QD($61)> <{I=$02;F=DaysSigned.Data}/@QD($02)> <{I=$12;F=DaysSigned.Data}/@QD($12)> <{I=$22;F=DaysSigned.Data}/@QD($22)> <{I=$32;F=DaysSigned.Data}/@QD($32)> <{I=$42;F=DaysSigned.Data}/@QD($42)> <{I=$52;F=DaysSigned.Data}/@QD($52)> <{I=$62;F=DaysSigned.Data}/@QD($62)> <{I=$03;F=DaysSigned.Data}/@QD($03)> <{I=$13;F=DaysSigned.Data}/@QD($13)> <{I=$23;F=DaysSigned.Data}/@QD($23)> <{I=$33;F=DaysSigned.Data}/@QD($33)> <{I=$43;F=DaysSigned.Data}/@QD($43)> <{I=$53;F=DaysSigned.Data}/@QD($53)> <{I=$63;F=DaysSigned.Data}/@QD($63)> <{I=$04;F=DaysSigned.Data}/@QD($04)> <{I=$14;F=DaysSigned.Data}/@QD($14)> <{I=$24;F=DaysSigned.Data}/@QD($24)> <{I=$34;F=DaysSigned.Data}/@QD($34)> <{I=$44;F=DaysSigned.Data}/@QD($44)> <{I=$54;F=DaysSigned.Data}/@QD($54)> <{I=$64;F=DaysSigned.Data}/@QD($64)> <{I=$05;F=DaysSigned.Data}/@QD($05)> <{I=$15;F=DaysSigned.Data}/@QD($15)> <{I=$25;F=DaysSigned.Data}/@QD($25)> <{I=$35;F=DaysSigned.Data}/@QD($35)> <{I=$45;F=DaysSigned.Data}/@QD($45)> <{I=$55;F=DaysSigned.Data}/@QD($55)> <{I=$65;F=DaysSigned.Data}/@QD($65)>\ 你已经签到:{S=$d;C=249}天,距离下一次领奖还差{S=300;C=249}天 ]]; var days: array[1..7] of string; s1,s2: string; Year, Month, Day, Hour:Word; nField,nLine,n,m,Daynum{月天数},nWeek{星期几}: integer; MyArray:Array [1..7,1..5]of string; begin DecodeDate(Now, Year, Month, Day); nWeek := DayOfWeek(StartOfTheMonth(Now)); Daynum := DaysInAMonth(Year, Month); s1 := Format(S,[‘星期日‘,‘星期一‘,‘星期二‘,‘星期三‘,‘星期四‘,‘星期五‘,‘星期六‘]); n := 1; m := 1; for nLine := 1 to 5 do begin for nField := 1 to 7 do begin if(n < nWeek)then begin MyArray[nField,nLine] := ‘‘; end else if (nWeek + Daynum > n)then begin MyArray[nField,nLine] := inttostr(m); m := m+1; end else begin MyArray[nField,nLine] := ‘‘; end; n := n+1; end; end; s2 := s1; for nLine := 1 to 5 do begin for nField := 1 to 7 do begin IF(MyArray[nField,nLine]=‘‘)THEN begin s2 := ReplaceStr(S2, Format(‘$%d%d‘,[nField-1,nLine]),‘0‘) ; //填充作用 end else begin s2 := ReplaceStr(S2, Format(‘$%d%d‘,[nField-1,nLine]),MyArray[nField,nLine]); end; end; end; Npc.Say(Player, S2 ); end; procedure QD(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); begin Debug(Args.Str[0]); end; end.
最终运行效果
根据当前月份动态生成日历
时间: 2024-10-13 20:15:43