大家看下这段代码,解释一下 //武器升级设置 procedure CheckWeaponUpgradeStatus(UserItem:pTUserItem); //004C27C0 begin //if (UserItem.btValue[0] + UserItem.btValue[1] + UserItem.btValue[2]) < 20 then begin if (UserItem.btValue[0] + UserItem.btValue[1] + UserItem.btValue[2]) < g_Config.nUpgradeWeaponMaxPoint then begin case UserItem.btValue[10] of 1: UserItem.wIndex:=0; 10..13: UserItem.btValue[0]:=UserItem.btValue[0] + UserItem.btValue[10] - 9; 20..23: UserItem.btValue[1]:=UserItem.btValue[1] + UserItem.btValue[10] - 19; 30..33: UserItem.btValue[2]:=UserItem.btValue[2] + UserItem.btValue[10] - 29; end; end else UserItem.wIndex:=0; UserItem.btValue[10]:=0; end; procedure CheckWeaponUpgrade(); //004C2854 var UseItems:TUserItem; PlayObject:TPlayObject; StdItem:TItem; begin if m_UseItems[U_WEAPON].btValue[10] > 0 then begin UseItems:=m_UseItems[U_WEAPON]; CheckWeaponUpgradeStatus(@m_UseItems[U_WEAPON]); if m_UseItems[U_WEAPON].wIndex = 0 then begin SysMsg(g_sTheWeaponBroke,c_Red,t_Hint); PlayObject:=TPlayObject(Self); PlayObject.SendDelItems(@UseItems); //PlayObject.StatusChanged; SendRefMsg(RM_BREAKWEAPON,0,0,0,0,''); StdItem:=UserEngine.GetStdItem(UseItems.wIndex); //004C29E0 if StdItem.NeedIdentify = 1 then AddGameDataLog('21' + #9 + m_sMapName + #9 + IntToStr(m_nCurrX) + #9 + IntToStr(m_nCurrY) + #9 + m_sCharName + #9 + //UserEngine.GetStdItemName(UseItems.wIndex) + #9 + StdItem.Name + #9 + IntToStr(UseItems.MakeIndex) + #9 + '1' + #9 + '0'); FeatureChanged(); end else begin SysMsg(sTheWeaponRefineSuccessfull,c_Red,t_Hint); PlayObject:=TPlayObject(Self); PlayObject.SendUpdateItem(@m_UseItems[U_WEAPON]); StdItem:=UserEngine.GetStdItem(UseItems.wIndex); //004C2B14 if StdItem.NeedIdentify = 1 then AddGameDataLog('20' + #9 + m_sMapName + #9 + IntToStr(m_nCurrX) + #9 + IntToStr(m_nCurrY) + #9 + m_sCharName + #9 + //UserEngine.GetStdItemName(UseItems.wIndex) + #9 + StdItem.Name + #9 + IntToStr(UseItems.MakeIndex) + #9 + '1' + #9 + '0'); RecalcAbilitys(); SendMsg(Self,RM_ABILITY,0,0,0,0,''); SendMsg(Self,RM_SUBABILITY,0,0,0,0,''); end; end; end; var AttackTarget :TBaseObject; boPowerHit :Boolean; boFireHit :Boolean; boCrsHit :Boolean; bo41 :Boolean; boTwinHit :Boolean; bo43 :Boolean; wIdent :Word; nCheckCode :Integer; ResourceString sExceptionMsg = '[Exception] TBaseObject::AttackDir Code: %d'; begin //004C2C50 nCheckCode:=0; try if (wHitMode = 5) and (m_MagicBanwolSkill <> nil) then begin //半月 if m_WAbil.MP > 0 then begin DamageSpell(m_MagicBanwolSkill.MagicInfo.btDefSpell + GetMagicSpell(m_MagicBanwolSkill)); HealthSpellChanged(); end else wHitMode:=RM_HIT; end; if (wHitMode = 12) and (m_MagicRedBanwolSkill <> nil) then begin if m_WAbil.MP > 0 then begin DamageSpell(m_MagicRedBanwolSkill.MagicInfo.btDefSpell + GetMagicSpell(m_MagicRedBanwolSkill)); HealthSpellChanged(); end else wHitMode:=RM_HIT; end; if (wHitMode = 8) and (m_MagicCrsSkill <> nil) then begin if m_WAbil.MP > 0 then begin DamageSpell(m_MagicCrsSkill.MagicInfo.btDefSpell + GetMagicSpell(m_MagicCrsSkill)); HealthSpellChanged(); end else wHitMode:=RM_HIT; end;
nCheckCode:=4; m_btDirection:=nDir; if TargeTBaseObject = nil then begin nCheckCode:=41; AttackTarget:=GetPoseCreate(); end else AttackTarget:=TargeTBaseObject; if (AttackTarget <> nil) and (m_UseItems[U_WEAPON].wIndex > 0) then begin nCheckCode:=42; CheckWeaponUpgrade(); end; nCheckCode:=5; boPowerHit:=m_boPowerHit; boFireHit:=m_boFireHitSkill; boCrsHit:=m_boCrsHitkill; bo41:=m_bo41kill; boTwinHit:=m_boTwinHitSkill; bo43:=m_bo43kill; if _Attack(wHitMode,AttackTarget) then begin nCheckCode:=6; SetTargetCreat(AttackTarget); //$FFF2 nCheckCode:=7; end; wIdent:=RM_HIT; if m_btRaceServer = RC_PLAYOBJECT then begin case wHitMode of 0: wIdent:=RM_HIT; 1: wIdent:=RM_HEAVYHIT; 2: wIdent:=RM_BIGHIT; 3: if boPowerHit then wIdent:=RM_SPELL2; 4: if m_MagicErgumSkill <> nil then wIdent:=RM_LONGHIT; 5: if m_MagicBanwolSkill <> nil then wIdent:=RM_WIDEHIT; 7: if boFireHit then wIdent:=RM_FIREHIT; 8: if m_MagicCrsSkill <> nil then wIdent:=RM_CRSHIT; 9: if boTwinHit then wIdent:=RM_TWINHIT; {10: if boTwinHit then wIdent:=RM_TWINHIT; 11: if bo43 then wIdent:=RM_43;} 12: if m_MagicRedBanwolSkill <> nil then wIdent:=RM_WIDEHIT; end; end; nCheckCode:=8; SendAttackMsg(wIdent,m_btDirection,m_nCurrX,m_nCurrY); nCheckCode:=9; except on e: Exception do begin MainOutMessage(format(sExceptionMsg,[nCheckCode])); MainOutMessage(E.Message); end; end; end;