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

📄 objnpc.~pas

📁 继续更新AFT源代码 现在解决了无法登陆游戏的问题 用0504的dbserver就可以登陆了 去掉了绿字广告 降低内存占用HOO 去掉了大量的验证问题
💻 ~PAS
📖 第 1 页 / 共 5 页
字号:
      nDura:=nDura + Integer(DuraList.Items[I]);
      Inc(nItemCount);
      if nItemCount >= 5 then break;
    end;
    btDura:=ROUND(_MIN(5,nItemCount) + _MIN(5,nItemCount) * ((nDura /nItemCount) / 5.0));
    btDc:=nDcMin div 5 + nDcMax div 3;
    btSc:=nScMin div 5 + nScMax div 3;
    btMc:=nMcMin div 5 + nMcMax div 3;
    if DelItemList <> nil then
      User.SendMsg(Self,RM_SENDDELITEMLIST,0,Integer(DelItemList),0,0,'');

    if DuraList <> nil then DuraList.Free;

  end;
var
  I: Integer;
  bo0D:Boolean;
  UpgradeInfo:pTUpgradeInfo;
  StdItem:pTStdItem;
begin
  bo0D:=False;
  for I := 0 to m_UpgradeWeaponList.Count - 1 do begin
    UpgradeInfo:=m_UpgradeWeaponList.Items[I];
    if UpgradeInfo.sUserName = User.m_sCharName then begin
      GotoLable(User,sUPGRADEING,False);
      exit;
    end;
  end;
  if (User.m_UseItems[U_WEAPON].wIndex <> 0) and (User.m_nGold >= g_Config.nUpgradeWeaponPrice) and
     (User.CheckItems(g_Config.sBlackStone) <> nil) then begin
    User.DecGold(g_Config.nUpgradeWeaponPrice);
//    if m_boCastle or g_Config.boGetAllNpcTax then UserCastle.IncRateGold(g_Config.nUpgradeWeaponPrice);
    if m_boCastle or g_Config.boGetAllNpcTax then begin
      if m_Castle <> nil then begin
        TUserCastle(m_Castle).IncRateGold(g_Config.nUpgradeWeaponPrice);
      end else
      if g_Config.boGetAllNpcTax then begin
        g_CastleManager.IncRateGold(g_Config.nUpgradeWeaponPrice);
      end;
    end;
    User.GoldChanged();
    New(UpgradeInfo);
    UpgradeInfo.sUserName:=User.m_sCharName;
    UpgradeInfo.UserItem:=User.m_UseItems[U_WEAPON];
    StdItem:=UserEngine.GetStdItem(User.m_UseItems[U_WEAPON].wIndex);

    //004A0B2F
    if StdItem.NeedIdentify = 1 then
      AddGameDataLog('25' +  #9 +
                   User.m_sMapName + #9 +
                   IntToStr(User.m_nCurrX) + #9 +
                   IntToStr(User.m_nCurrY) + #9 +
                   User.m_sCharName + #9 +
                   //UserEngine.GetStdItemName(User.m_UseItems[U_WEAPON].wIndex) + #9 +
                   StdItem.Name + #9 +
                   IntToStr(User.m_UseItems[U_WEAPON].MakeIndex) + #9 +
                   '1' + #9 +
                   '0');
    User.SendDelItems(@User.m_UseItems[U_WEAPON]);
    User.m_UseItems[U_WEAPON].wIndex:=0;
    User.RecalcAbilitys();
    User.FeatureChanged();
    User.SendMsg(User,RM_ABILITY,0,0,0,0,'');
    sub_4A0218(User.m_ItemList,UpgradeInfo.btDc,UpgradeInfo.btSc,UpgradeInfo.btMc,UpgradeInfo.btDura);
    UpgradeInfo.dtTime:=Now();
    UpgradeInfo.dwGetBackTick:=GetTickCount();
    m_UpgradeWeaponList.Add(UpgradeInfo);
    SaveUpgradingList();
    bo0D:=True;
  end;
  if bo0D then GotoLable(User,sUPGRADEOK,False)
  else GotoLable(User,sUPGRADEFAIL,False);
end;
procedure TMerchant.GetBackupgWeapon(User:TPlayObject); //004A0CB8
var
  I: Integer;
  UpgradeInfo:pTUpgradeInfo;
  n10,n14,n18,n1C,n90:Integer;
  UserItem:pTUserItem;
  StdItem:pTStdItem;
begin
  n18:=0;
  UpgradeInfo:=nil;
  if not User.IsEnoughBag then begin
//    User.SysMsg('你的背包已经满了,无法再携带任何物品了!!!',0);
    GotoLable(User,sGETBACKUPGFULL,False);
    exit;
  end;
  for I := 0 to m_UpgradeWeaponList.Count - 1 do begin
    if pTUpgradeInfo(m_UpgradeWeaponList.Items[I]).sUserName = User.m_sCharName then begin
      n18:=1;
      if ((GetTickCount - pTUpgradeInfo(m_UpgradeWeaponList.Items[I]).dwGetBackTick) > g_Config.dwUPgradeWeaponGetBackTime) or (User.m_btPermission >= 4) then begin
        UpgradeInfo:=m_UpgradeWeaponList.Items[I];
        m_UpgradeWeaponList.Delete(I);
        SaveUpgradingList();
        n18:=2;
        break;
      end;
    end;
  end;
  //004A0DC2
  if UpgradeInfo <> nil then begin
    case UpgradeInfo.btDura of    //
      0..8: begin //004A0DE5
//       n14:=_MAX(3000,UpgradeInfo.UserItem.DuraMax shr 1);
       if UpgradeInfo.UserItem.DuraMax > 3000 then begin
         Dec(UpgradeInfo.UserItem.DuraMax,3000);
       end else begin
         UpgradeInfo.UserItem.DuraMax:=UpgradeInfo.UserItem.DuraMax shr 1;
       end;
       if UpgradeInfo.UserItem.Dura > UpgradeInfo.UserItem.DuraMax then
         UpgradeInfo.UserItem.Dura:=UpgradeInfo.UserItem.DuraMax;
      end;
      9..15: begin //004A0E41
       if Random(UpgradeInfo.btDura) < 6 then begin
         if UpgradeInfo.UserItem.DuraMax > 1000 then
           Dec(UpgradeInfo.UserItem.DuraMax,1000);
         if UpgradeInfo.UserItem.Dura > UpgradeInfo.UserItem.DuraMax then
           UpgradeInfo.UserItem.Dura:=UpgradeInfo.UserItem.DuraMax;
       end;
         
      end;
      18..255: begin
        case Random(UpgradeInfo.btDura - 18) of
          1..4: Inc(UpgradeInfo.UserItem.DuraMax,1000);
          5..7: Inc(UpgradeInfo.UserItem.DuraMax,2000);
          8..255: Inc(UpgradeInfo.UserItem.DuraMax,4000)
        end;
      end;
    end;    // case
    if (UpgradeInfo.btDc = UpgradeInfo.btMc) and (UpgradeInfo.btMc = UpgradeInfo.btSc) then begin
      n1C:=Random(3);
    end else begin
      n1C:= -1;
    end;
    if ((UpgradeInfo.btDc >= UpgradeInfo.btMc) and (UpgradeInfo.btDc >= UpgradeInfo.btSc)) or
      (n1C = 0) then begin
      n90:=_MIN(11,UpgradeInfo.btDc);
      n10:=_MIN(85,n90 shl 3 - n90 + 10 + UpgradeInfo.UserItem.btValue[3] - UpgradeInfo.UserItem.btValue[4] + User.m_nBodyLuckLevel);
//      n10:=_MIN(85,n90 * 8 - n90 + 10 + UpgradeInfo.UserItem.btValue[3] - UpgradeInfo.UserItem.btValue[4] + User.m_nBodyLuckLevel);

      if Random(g_Config.nUpgradeWeaponDCRate) < n10 then begin//if Random(100) < n10 then begin
        UpgradeInfo.UserItem.btValue[10]:=10;

        if (n10 > 63) and (Random(g_Config.nUpgradeWeaponDCTwoPointRate) = 0) then//if (n10 > 63) and (Random(30) = 0) then
          UpgradeInfo.UserItem.btValue[10]:= 11;

        if (n10 > 79) and (Random(g_Config.nUpgradeWeaponDCThreePointRate) = 0) then//if (n10 > 79) and (Random(200) = 0) then
          UpgradeInfo.UserItem.btValue[10]:= 12;
      end else UpgradeInfo.UserItem.btValue[10]:=1; //004A0F89
    end;

    if ((UpgradeInfo.btMc >= UpgradeInfo.btDc) and (UpgradeInfo.btMc >= UpgradeInfo.btSc)) or
       (n1C = 1) then begin
      n90:=_MIN(11,UpgradeInfo.btMc);
      n10:=_MIN(85,n90 shl 3 - n90 + 10 + UpgradeInfo.UserItem.btValue[3] - UpgradeInfo.UserItem.btValue[4] + User.m_nBodyLuckLevel);

      if Random(g_Config.nUpgradeWeaponMCRate) < n10 then begin//if Random(100) < n10 then begin
        UpgradeInfo.UserItem.btValue[10]:=20;

        if (n10 > 63) and (Random(g_Config.nUpgradeWeaponMCTwoPointRate) = 0) then//if (n10 > 63) and (Random(30) = 0) then
          UpgradeInfo.UserItem.btValue[10]:= 21;

        if (n10 > 79) and (Random(g_Config.nUpgradeWeaponMCThreePointRate) = 0) then//if (n10 > 79) and (Random(200) = 0) then
          UpgradeInfo.UserItem.btValue[10]:= 22;
      end else UpgradeInfo.UserItem.btValue[10]:=1;
    end;

    if ((UpgradeInfo.btSc >= UpgradeInfo.btMc) and (UpgradeInfo.btSc >= UpgradeInfo.btDc)) or
       (n1C = 2) then begin
      n90:=_MIN(11,UpgradeInfo.btMc);
      n10:=_MIN(85,n90 shl 3 - n90 + 10 + UpgradeInfo.UserItem.btValue[3] - UpgradeInfo.UserItem.btValue[4] + User.m_nBodyLuckLevel);

      if Random(g_Config.nUpgradeWeaponSCRate) < n10 then begin//if Random(100) < n10 then begin
        UpgradeInfo.UserItem.btValue[10]:=30;

        if (n10 > 63) and (Random(g_Config.nUpgradeWeaponSCTwoPointRate) = 0) then//if (n10 > 63) and (Random(30) = 0) then
          UpgradeInfo.UserItem.btValue[10]:= 31;

        if (n10 > 79) and (Random(g_Config.nUpgradeWeaponSCThreePointRate) = 0) then//if (n10 > 79) and (Random(200) = 0) then
          UpgradeInfo.UserItem.btValue[10]:= 32;
      end else UpgradeInfo.UserItem.btValue[10]:=1;
    end;
    New(UserItem);
    UserItem^:=UpgradeInfo.UserItem;
    DisPose(UpgradeInfo);
    StdItem:=UserEngine.GetStdItem(UserItem.wIndex);
    //004A120E
    if StdItem.NeedIdentify = 1 then
    AddGameDataLog('24' +  #9 +
                   User.m_sMapName + #9 +
                   IntToStr(User.m_nCurrX) + #9 +
                   IntToStr(User.m_nCurrY) + #9 +
                   User.m_sCharName + #9 +
                   //UserEngine.GetStdItemName(UserItem.wIndex) + #9 +
                   StdItem.Name + #9 +
                   IntToStr(UserItem.MakeIndex) + #9 +
                   '1' + #9 +
                   '0');
    User.AddItemToBag(UserItem);
    User.SendAddItem(UserItem);
  end;
  case n18 of    //
    0: GotoLable(User,sGETBACKUPGFAIL,False);
    1: GotoLable(User,sGETBACKUPGING,False);
    2: GotoLable(User,sGETBACKUPGOK,False);
  end;    // case
  
end;
function TMerchant.GetUserPrice(PlayObject:TPlayObject;nPrice:Integer):Integer; //0049F6E0
var
  n14:Integer;
begin
  {
  if m_boCastle then begin
    if UserCastle.IsMasterGuild(TGuild(PlayObject.m_MyGuild)) then begin
      n14:=_MAX(60,ROUND(m_nPriceRate * 8.0000000000000000001e-1));//80%
      Result:=ROUND(nPrice / 1.0e2 * n14); //100
    end else begin
      Result:=ROUND(nPrice / 1.0e2 * m_nPriceRate);
    end;
  end else begin
    Result:=ROUND(nPrice / 1.0e2 * m_nPriceRate);
  end;
  }
  if m_boCastle then begin
//    if UserCastle.IsMasterGuild(TGuild(PlayObject.m_MyGuild)) then begin
    if (m_Castle <> nil) and TUserCastle(m_Castle).IsMasterGuild(TGuild(PlayObject.m_MyGuild)) then begin
      n14:=_MAX(60,ROUND(m_nPriceRate * (g_Config.nCastleMemberPriceRate / 100)));//80%
      Result:=ROUND(nPrice / 100 * n14); //100
    end else begin
      Result:=ROUND(nPrice / 100 * m_nPriceRate);
    end;
  end else begin
    Result:=ROUND(nPrice / 100 * m_nPriceRate);
  end;
end;
procedure TMerchant.UserSelect(PlayObject:TPlayObject;sData:String);//004A1820
  procedure SuperRepairItem(User:TPlayObject); //004A159C
  begin
    User.SendMsg(Self,RM_SENDUSERSREPAIR,0,Integer(Self),0,0,'');
  end;
  procedure BuyItem(User:TPlayObject;nInt:integer); //004A1378
  var
    I,n10,nStock,nPrice: Integer;
    nSubMenu:ShortInt;
    sSendMsg,sName:String;
    UserItem:pTUserItem;
    StdItem:pTStdItem;
    List14:TList;
    sUserItemName:String;
  begin
    sSendMsg:='';
    n10:=0;
    for I := 0 to m_GoodsList.Count - 1 do begin
      List14:=TList(m_GoodsList.Items[i]);

      if List14.count<=0 then  continue;  //
      UserItem:=List14.Items[0];
      if UserItem=nil then begin   //==2006,8,3  B7抱错
        List14.Delete(0);          //
        continue;                  //
      end;                         //
      StdItem:=UserEngine.GetStdItem(UserItem.wIndex);
      if StdItem <> nil then begin
        //取自定义物品名称
        sName:='';
        if UserItem.btValue[13] = 1 then
          sName:=ItemUnit.GetCustomItemName(UserItem.MakeIndex,UserItem.wIndex);
        if sName = '' then
          sName:=StdItem.Name;

        nPrice:=GetUserPrice(User,GetItemPrice(UserItem.wIndex));
        nStock:=List14.Count;
        if (StdItem.StdMode <= 4) or
           (StdItem.StdMode = 42) or
           (StdItem.StdMode = 31) then nSubMenu:=0
    

⌨️ 快捷键说明

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