📄 mshare.pas
字号:
g_WMagicImages.Free;
g_WMagic2Images.Finalize;;
g_WMagic2Images.Free;
{$IF CUSTOMLIBFILE = 1}
g_WEventEffectImages.Finalize;
g_WEventEffectImages.Free;
{$IFEND}
end;
//取地图图库
function GetObjs (nUnit,nIdx:Integer):TDirectDrawSurface;
var
sFileName:String;
begin
Result:=nil;
if not (nUnit in [Low(g_WObjectArr) .. High(g_WObjectArr)]) then nUnit:=0;
if g_WObjectArr[nUnit] = nil then begin
if nUnit = 0 then sFileName:=OBJECTIMAGEFILE
else sFileName:=format(OBJECTIMAGEFILE1,[nUnit+1]);
if not FileExists(sFileName) then exit;
g_WObjectArr[nUnit]:=TWMImages.Create(nil);
g_WObjectArr[nUnit].DxDraw:=g_DxDraw;
g_WObjectArr[nUnit].DDraw:=g_DxDraw.DDraw;
g_WObjectArr[nUnit].FileName:=sFileName;
g_WObjectArr[nUnit].LibType:=ltUseCache;
g_WObjectArr[nUnit].Initialize;
end;
Result:=g_WObjectArr[nUnit].Images[nIdx];
end;
//取地图图库
function GetObjsEx (nUnit,nIdx:Integer; var px, py: integer): TDirectDrawSurface;
var
sFileName:String;
begin
Result:=nil;
if not (nUnit in [Low(g_WObjectArr) .. High(g_WObjectArr)]) then nUnit:=0;
if g_WObjectArr[nUnit] = nil then begin
if nUnit = 0 then sFileName:=OBJECTIMAGEFILE
else sFileName:=format(OBJECTIMAGEFILE1,[nUnit+1]);
if not FileExists(sFileName) then exit;
g_WObjectArr[nUnit]:=TWMImages.Create(nil);
g_WObjectArr[nUnit].DxDraw:=g_DxDraw;
g_WObjectArr[nUnit].DDraw:=g_DxDraw.DDraw;
g_WObjectArr[nUnit].FileName:=sFileName;
g_WObjectArr[nUnit].LibType:=ltUseCache;
g_WObjectArr[nUnit].Initialize;
end;
Result:=g_WObjectArr[nUnit].GetCachedImage(nIdx,px,py);
end;
function GetMonImg (nAppr:Integer):TWMImages;
var
sFileName:String;
nUnit:Integer;
begin
Result:=nil;
if nAppr < 1000 then nUnit:=nAppr div 10
else nUnit:=nAppr;
if (nUnit < Low(g_WMonImagesArr)) or (nUnit > High(g_WMonImagesArr)) then nUnit:=0;
if g_WMonImagesArr[nUnit] = nil then begin
sFileName:=format(MONIMAGEFILE,[nUnit+1]);
if nUnit = 80 then sFileName:=DRAGONIMAGEFILE;
if nUnit = 90 then sFileName:=EFFECTIMAGEFILE;
if nUnit >= 1000 then sFileName:=format(MONIMAGEFILEEX,[nUnit]); //超过1000序号的怪物取新的怪物文件
g_WMonImagesArr[nUnit]:=TWMImages.Create(nil);
g_WMonImagesArr[nUnit].DxDraw:=g_DxDraw;
g_WMonImagesArr[nUnit].DDraw:=g_DxDraw.DDraw;
g_WMonImagesArr[nUnit].FileName:=sFileName;
g_WMonImagesArr[nUnit].LibType:=ltUseCache;
g_WMonImagesArr[nUnit].Initialize;
end;
Result:=g_WMonImagesArr[nUnit];
end;
function GetMonAction (nAppr:Integer):pTMonsterAction;
var
FileStream:TFileStream;
sFileName:String;
MonsterAction:TMonsterAction;
begin
Result:=nil;
sFileName:=format(MONPMFILE,[nAppr]);
if FileExists (sFileName) then begin
FileStream:=TFileStream.Create(sFileName,fmOpenRead or fmShareDenyNone);
FileStream.Read (MonsterAction, SizeOf(MonsterAction));
New(Result);
Result^:=MonsterAction;
FileStream.Free;
end;
end;
//取得职业名称
//0 武士
//1 魔法师
//2 道士
function GetJobName (nJob:Integer):String;
begin
Result:= '';
case nJob of
0:Result:=g_sWarriorName;
1:Result:=g_sWizardName;
2:Result:=g_sTaoistName;
else begin
Result:=g_sUnKnowName;
end;
end;
end;
function GetAttatckMode (m_btAttatckMode:Integer):String;
begin
Result:= '';
case m_btAttatckMode of
HAM_ALL:Result:=g_AttackModeOfAll;
HAM_PEACE:Result:=g_AttackModeOfPeaceful;
HAM_DEAR:Result:=g_AttackModeOfDear;
HAM_MASTER:Result:=g_AttackModeOfMaster;
HAM_GROUP:Result:=g_AttackModeOfGroup;
HAM_GUILD:Result:=g_AttackModeOfGuild;
HAM_PKATTACK:Result:=g_AttackModeOfRedWhite;
end;
end;
function GetItemType(ItemType:TItemType):String;
begin
case ItemType of
i_HPDurg :Result:='金创药';
i_MPDurg :Result:='魔法药';
i_HPMPDurg :Result:='高级药';
i_OtherDurg :Result:='其它药品';
i_Weapon :Result:='武器';
i_Dress :Result:='衣服';
i_Helmet :Result:='头盔';
i_Necklace:Result:='项链';
i_Armring :Result:='手镯';
i_Ring :Result:='戒指';
i_Belt :Result:='腰带';
i_Boots :Result:='鞋子';
i_Charm :Result:='宝石';
i_Book :Result:='技能书';
i_PosionDurg :Result:='毒药';
i_UseItem :Result:='消耗品';
i_Scroll :Result:='卷类';
i_Stone :Result:='矿石';
i_Gold :Result:='金币';
i_Other :Result:='其它';
end;
end;
function GetShowItem(sItemName:String):pTShowItem;
var
I:Integer;
begin
Result:=nil;
g_ShowItemList.Lock;
try
for I := 0 to g_ShowItemList.Count - 1 do begin
if CompareText(pTShowItem(g_ShowItemList.Items[I]).sItemName,sItemName) = 0 then begin
Result:=g_ShowItemList.Items[I];
break;
end;
end;
finally
g_ShowItemList.UnLock;
end;
end;
procedure ClearShowItemList();
var
ShowItem:pTShowItem;
I:Integer;
begin
g_ShowItemList.Lock;
try
for I := 0 to g_ShowItemList.Count - 1 do begin
ShowItem:=g_ShowItemList.Items[I];
Dispose(ShowItem);
end;
g_ShowItemList.Clear;
finally
g_ShowItemList.UnLock;
end;
end;
procedure SaveUserConfig(sUserName:String);
var
ShowItem:pTShowItem;
Ini:TIniFile;
sFileName:String;
I:Integer;
sItemName,sLineText:String;
sType,sPickup,sShow,sFColor,sBColor:String;
begin
if sUserName <> '' then sFileName := format(CONFIGFILE,[sUserName])
else sFileName:=format(CONFIGFILE,['Config']);
Ini:=TIniFile.Create(sFileName);
g_ShowItemList.Lock;
try
for I := 0 to g_ShowItemList.Count - 1 do begin
ShowItem:=g_ShowItemList.Items[I];
sType:=IntToStr(Integer(ShowItem.ItemType));
if ShowItem.boAutoPickup then sPickup:='1'
else sPickup:='0';
if ShowItem.boShowName then sShow:='1'
else sShow:='0';
Ini.WriteString('Items',ShowItem.sItemName,format('%s,%s,%s,%d,%d',[sType,sPickup,sShow,ShowItem.nFColor,ShowItem.nBColor]));
end;
finally
g_ShowItemList.UnLock;
end;
Ini.Free;
end;
procedure LoadUserConfig(sUserName:String);
var
ShowItem:pTShowItem;
Ini:TIniFile;
sFileName:String;
Strings: TStringList;
I:Integer;
sItemName,sLineText:String;
sType,sPickup,sShow,sFColor,sBColor:String;
begin
sFileName:=format(CONFIGFILE,[sUserName]);
if not FileExists(sFileName) then begin
sFileName:=format(CONFIGFILE,['Config']);
end;
if FileExists(sFileName) then begin
Ini:=TIniFile.Create(sFileName);
Strings:=TStringList.Create;
g_ShowItemList.Lock;
try
Ini.ReadSection('Items',Strings);
for I := 0 to Strings.Count - 1 do begin
sItemName:=Strings.Strings[I];
if sItemName = '' then Continue;
sLineText:=Ini.ReadString('Items',sItemName,'');
sLineText:=GetValidStr3(sLineText,sType,[',']);
sLineText:=GetValidStr3(sLineText,sPickup,[',']);
sLineText:=GetValidStr3(sLineText,sShow,[',']);
sLineText:=GetValidStr3(sLineText,sFColor,[',']);
sLineText:=GetValidStr3(sLineText,sBColor,[',']);
if (sType <> '') and (sPickup <> '') and (sShow <> '') and (sFColor <> '') and (sBColor <> '') then begin
New(ShowItem);
ShowItem.sItemName:=sItemName;
ShowItem.ItemType:=TItemType(Str_ToInt(sType,0));
ShowItem.boAutoPickup:= sPickup = '1';
ShowItem.boShowName:= sShow = '1';
ShowItem.nFColor:=Str_ToInt(sFColor,0);
ShowItem.nBColor:=Str_ToInt(sBColor,0);
g_ShowItemList.Add(ShowItem);
end;
end;
finally
g_ShowItemList.UnLock;
end;
Strings.Free;
Ini.Free;
exit;
end;
end;
procedure InitObj();
begin
DlgConf.DScrollTop.Obj :=FrmDlg.DScrollTop;
DlgConf.DScrollUp.Obj :=FrmDlg.DScrollUp;
DlgConf.DScrollDown.Obj :=FrmDlg.DScrollDown;
DlgConf.DScrollBottom.Obj :=FrmDlg.DScrollBottom;
DlgConf.DBotItemShop.Obj :=FrmDlg.DBotItemShop;
DlgConf.DItemShopJobAll.Obj :=FrmDlg.DItemShopJobAll;
DlgConf.DItemShopJobWarrior.Obj :=FrmDlg.DItemShopJobWarrior;
DlgConf.DItemShopJobWizard.Obj :=FrmDlg.DItemShopJobWizard;
DlgConf.DItemShopJobMonk.Obj :=FrmDlg.DItemShopJobMonk;
DlgConf.DItemShopJobCommon.Obj :=FrmDlg.DItemShopJobCommon;
DlgConf.DGrpPgUp.Obj :=FrmDlg.DGrpPgUp;
DlgConf.DGrpPgDn.Obj :=FrmDlg.DGrpPgDn;
DlgConf.DItemShopFind.Obj :=FrmDlg.DItemShopFind;
DlgConf.DItemShopCaNew.Obj :=FrmDlg.DItemShopCaNew;
DlgConf.DItemShopCaAll.Obj :=FrmDlg.DItemShopCaAll;
DlgConf.DItemShopCaWeapon.Obj :=FrmDlg.DItemShopCaWeapon;
DlgConf.DItemShopCaArmor.Obj :=FrmDlg.DItemShopCaArmor;
DlgConf.DItemShopCaAcc.Obj :=FrmDlg.DItemShopCaAcc;
DlgConf.DItemShopCasSubitem.Obj :=FrmDlg.DItemShopCasSubitem;
DlgConf.DItemShopCaOther.Obj :=FrmDlg.DItemShopCaOther;
DlgConf.DItemShopCaPackage.Obj :=FrmDlg.DItemShopCaPackage;
DlgConf.DItemShopCaSub1.Obj :=FrmDlg.DItemShopCaSub1;
DlgConf.DItemShopCaSub2.Obj :=FrmDlg.DItemShopCaSub2;
DlgConf.DItemShopCaSub3.Obj :=FrmDlg.DItemShopCaSub3;
DlgConf.DItemShopCaSub4.Obj :=FrmDlg.DItemShopCaSub4;
DlgConf.DItemShopCaSub5.Obj :=FrmDlg.DItemShopCaSub5;
DlgConf.DItemShopCaSub6.Obj :=FrmDlg.DItemShopCaSub6;
DlgConf.DItemShopCaSub7.Obj :=FrmDlg.DItemShopCaSub7;
DlgConf.DItemShopGetGift.Obj :=FrmDlg.DItemShopGetGift;
DlgConf.DItemShopAddFav.Obj :=FrmDlg.DItemShopAddFav;
DlgConf.DItemShopBye.Obj :=FrmDlg.DItemShopBye;
DlgConf.DItemShopGift.Obj :=FrmDlg.DItemShopGift;
DlgConf.DItemShopPayMoney.Obj :=FrmDlg.DItemShopPayMoney;
DlgConf.DItemShopWear.Obj :=FrmDlg.DItemShopWear;
DlgConf.DItemShopWearLturn.Obj :=FrmDlg.DItemShopWearLturn;
DlgConf.DItemShopWearChange.Obj :=FrmDlg.DItemShopWearChange;
DlgConf.DItemShopWearRturn.Obj :=FrmDlg.DItemShopWearRturn;
DlgConf.DItemShopListPrev.Obj :=FrmDlg.DItemShopListPrev;
DlgConf.DItemShopListNext.Obj :=FrmDlg.DItemShopListNext;
DlgConf.DShopScrollBarUp.Obj :=FrmDlg.DShopScrollBarUp;
DlgConf.DShopScrollBarDown.Obj :=FrmDlg.DShopScrollBarDown;
DlgConf.DShopScrollBar.Obj :=FrmDlg.DShopScrollBar;
DlgConf.DItemShopCaFav.Obj :=FrmDlg.DItemShopCaFav;
DlgConf.DItemShopInPackBack.Obj :=FrmDlg.DItemShopInPackBack;
DlgConf.DItemShopCashRefresh.Obj :=FrmDlg.DItemShopCashRefresh;
DlgConf.DItemShopPackSub1.Obj :=FrmDlg.DItemShopPackSub1;
DlgConf.DItemShopPackSub2.Obj :=FrmDlg.DItemShopPackSub2;
DlgConf.DItemShopPackSub3.Obj :=FrmDlg.DItemShopPackSub3;
DlgConf.DItemShopPackSub4.Obj :=FrmDlg.DItemShopPackSub4;
DlgConf.DItemShopPackSub5.Obj :=FrmDlg.DItemShopPackSub5;
DlgConf.DItemShopPackSub6.Obj :=FrmDlg.DItemShopPackSub6;
DlgConf.DItemShopPackSub7.Obj :=FrmDlg.DItemShopPackSub7;
DlgConf.DItemShopPackSub8.Obj :=FrmDlg.DItemShopPackSub8;
DlgConf.DItemShopFavDel1.Obj :=FrmDlg.DItemShopFavDel1;
DlgConf.DItemShopFavDel2.Obj :=FrmDlg.DItemShopFavDel2;
DlgConf.DItemShopFavDel3.Obj :=FrmDlg.DItemShopFavDel3;
DlgConf.DItemShopFavDel4.Obj :=FrmDlg.DItemShopFavDel4;
DlgConf.DItemShopFavDel5.Obj :=FrmDlg.DItemShopFavDel5;
DlgConf.DItemShopFavDel6.Obj :=FrmDlg.DItemShopFavDel6;
DlgConf.DItemShopFavDel7.Obj :=FrmDlg.DItemShopFavDel7;
DlgConf.DItemShopFavDel8.Obj :=FrmDlg.DItemShopFavDel8;
DlgConf.DItemShopPriceUp.Obj :=FrmDlg.DItemShopPriceUp;
DlgConf.DItemShopPriceDn.Obj :=FrmDlg.DItemShopPriceDn;
DlgConf.DItemShopCheckSort.Obj :=FrmDlg.DItemShopCheckSort;
end;
initialization
{---- Adjust global SVN revision ----}
SVNRevision('$Id: MShare.pas 596 2007-04-11 00:14:13Z sean $');
begin
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -